add devshell cli

This commit is contained in:
Tim Schubert 2022-10-28 17:00:34 +02:00
parent c781508dee
commit 771e718335
Signed by: dadada
GPG key ID: EEB8D1CE62C4DFEA
4 changed files with 66 additions and 15 deletions

50
devshell.nix Normal file
View file

@ -0,0 +1,50 @@
{ pkgs, ... }:
(pkgs.devshell.mkShell {
name = "dadada/nix-config";
packages = with pkgs; [
agenix
nixpkgs-fmt
nixos-rebuild
];
commands = [
{
name = "switch";
help = "Switch the configuration on the current system.";
command = ''
flake=$(nix flake metadata --json ${./.} | jq -r .url)
${pkgs.nixos-rebuild}/bin/nixos-rebuild switch --flake ".#" --use-remote-sudo
'';
category = "deploy";
}
{
name = "format";
help = "Format the project";
command = ''
nixpkgs-fmt .
'';
category = "dev";
}
{
name = "update";
help = "Update the project";
command = ''
nix flake update --commit-lock-file
'';
category = "dev";
}
{
name = "deploy";
help = "Deploy this flake";
package = "deploy-rs";
category = "deploy";
}
{
name = "check";
help = "Run checks";
category = "dev";
command = "nix flake check";
}
];
})