diff options
Diffstat (limited to 'parts')
| -rw-r--r-- | parts/dev.nix | 59 |
1 files changed, 48 insertions, 11 deletions
diff --git a/parts/dev.nix b/parts/dev.nix index 556e3b6..440fa7c 100644 --- a/parts/dev.nix +++ b/parts/dev.nix @@ -1,35 +1,72 @@ { perSystem = { - config, + lib, pkgs, + system, + config, ... }: { - pre-commit = { - settings.hooks = { + pre-commit.settings = { + hooks = { actionlint.enable = true; - alejandra.enable = true; + ${config.formatter.pname}.enable = true; deadnix.enable = true; nil.enable = true; + prettier.enable = true; rustfmt.enable = true; statix.enable = true; }; }; + # a linkFarm of expected outputs for ci + checks = { + ciGate = let + /* + require self.checks for all systems + require self.packages for x86_64-linux + */ + required = builtins.concatMap builtins.attrValues ( + [(builtins.removeAttrs config.checks ["ciGate"])] + ++ lib.optionals (system == "x86_64-linux") [(builtins.removeAttrs config.packages ["default"])] + ); + + paths = + builtins.foldl' + ( + acc: deriv: let + name = deriv.pname or deriv.name; + pathName = + # if im not sure why `acc?name` doesn't work here + if (builtins.elem name (builtins.attrNames acc)) + then "${name}-1" + else name; + in + acc // {"${pathName}" = deriv.path or deriv.outPath;} + ) + {} + required; + in + pkgs.linkFarm "ci-gate" paths; + }; + devShells = { default = pkgs.mkShell { - shellHook = config.pre-commit.installationScript; packages = with pkgs; [ actionlint - alejandra + nodePackages_latest.prettier + + # rust + clippy + rustfmt + + # nix + config.formatter deadnix nil statix - - rustc - cargo - rustfmt - clippy ]; + + inputsFrom = [config.packages.default]; }; }; |
