nix-config/devshell.nix
Tim Schubert 16666b8adf
Fix cs (#25)
* fix format

* make pre-push hook into pre-commit-hook
2022-11-01 19:38:55 +01:00

56 lines
1.1 KiB
Nix

{ pkgs, extraModules, ... }:
(pkgs.devshell.mkShell {
imports = extraModules;
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";
}
];
git.hooks = {
pre-commit.text = "nix flake check";
};
})