diff options
| author | seth <[email protected]> | 2023-11-15 03:39:03 -0500 |
|---|---|---|
| committer | seth <[email protected]> | 2023-11-16 00:15:23 +0000 |
| commit | d7ec074a8a1c8c665d2837ae29c5f71214d9ecef (patch) | |
| tree | 45292ce8bf971412731a1aa82c40b873d316191f | |
| parent | ea3b523a37d22e67eaf5019bb8a661a60e82cc31 (diff) | |
flake: add more checks & ci release gate
| -rw-r--r-- | .prettierignore | 1 | ||||
| -rw-r--r-- | parts/dev.nix | 59 |
2 files changed, 49 insertions, 11 deletions
diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..301d47e --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +flake.lock 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]; }; }; |
