diff --git a/deps/sources.json b/deps/sources.json index 85ff7fd..d0a3644 100644 --- a/deps/sources.json +++ b/deps/sources.json @@ -62,6 +62,18 @@ "url": "https://api.github.com/repos/nix-community/disko/tarball/v1.5.0", "hash": "1d03a0wb710by1m2c3rx758vy67f8r71gnv2h3qn4jj1bx10sdg4" }, + "git-hooks": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "cachix", + "repo": "git-hooks.nix" + }, + "branch": "master", + "revision": "e35aed5fda3cc79f88ed7f1795021e559582093a", + "url": "https://github.com/cachix/git-hooks.nix/archive/e35aed5fda3cc79f88ed7f1795021e559582093a.tar.gz", + "hash": "1bq0yrjmkddj964s2q6393nwp4mqrlmc2i5wsy992r034awyywp1" + }, "home-manager": { "type": "Git", "repository": { @@ -98,6 +110,18 @@ "url": "https://github.com/JulienMalka/homepage/archive/29e779d8600b1c1e6235570a3614a54f8ec8126e.tar.gz", "hash": "0prma1rg6glf3xy1dkd6gbzb26z1sxkgzd8wr623pbqvf44hgv32" }, + "impermanence": { + "type": "Git", + "repository": { + "type": "GitHub", + "owner": "nix-community", + "repo": "impermanence" + }, + "branch": "master", + "revision": "a33ef102a02ce77d3e39c25197664b7a636f9c30", + "url": "https://github.com/nix-community/impermanence/archive/a33ef102a02ce77d3e39c25197664b7a636f9c30.tar.gz", + "hash": "1mig6ns8l5iynsm6pfbnx2b9hmr592s1kqbw6gq1n25czdlcniam" + }, "lanzaboote": { "type": "Git", "repository": { @@ -209,4 +233,4 @@ } }, "version": 3 -} \ No newline at end of file +} diff --git a/shell.nix b/shell.nix index 2641e6d..1bdc855 100644 --- a/shell.nix +++ b/shell.nix @@ -1,12 +1,35 @@ let inputs = import ./deps; - pkgs = import inputs.nixpkgs { }; + pkgs = import inputs.unstable { }; nixos-anywhere = pkgs.callPackage "${inputs.nixos-anywhere}/src/default.nix" { }; agenix = pkgs.callPackage "${inputs.agenix}/pkgs/agenix.nix" { }; bootstrap = import scripts/bootstrap-machine.nix; + pre-commit-hook = (import inputs.git-hooks).run { + src = ./.; + + hooks = { + statix.enable = true; + deadnix.enable = true; + rfc101 = { + enable = true; + name = "RFC-101 formatting"; + entry = "${pkgs.lib.getExe pkgs.nixfmt-rfc-style}"; + files = "\\.nix$"; + }; + commitizen.enable = true; + }; + }; in pkgs.mkShell { - nativeBuildInputs = with pkgs; [ colmena npins nixos-anywhere agenix bootstrap ]; + nativeBuildInputs = with pkgs; [ + colmena + npins + nixos-anywhere + agenix + bootstrap + statix + ]; + shellHook = '' + ${pre-commit-hook.shellHook} + ''; } - - diff --git a/statix.toml b/statix.toml new file mode 100644 index 0000000..cabe0c4 --- /dev/null +++ b/statix.toml @@ -0,0 +1,4 @@ +disabled = [ + "repeated_keys" +] +