diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 89693ab..1f13e6d 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -8,4 +8,5 @@ jobs: runs-on: native steps: - uses: actions/checkout@v4 - - run: nix flake check --all-systems + - run: nix-build -A ci.check + - run: ./result diff --git a/.gitignore b/.gitignore index 92b2793..2bbdbfe 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .direnv +result diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..bb13b3b --- /dev/null +++ b/default.nix @@ -0,0 +1,8 @@ +let + nilla = import ./nilla.nix { }; + getPackage = name: nilla.packages.${name}.result.${builtins.currentSystem}; +in +{ + ci.check = getPackage "ci-check"; + formatter = getPackage "formatter"; +} diff --git a/nilla.nix b/nilla.nix index f7ecedd..5562e23 100644 --- a/nilla.nix +++ b/nilla.nix @@ -75,6 +75,43 @@ in eval.config.build.wrapper; }; + __allPackages = + let + all-packages = builtins.attrValues ( + builtins.removeAttrs config.packages [ + "ci-check" + "__allPackages" + ] + ); + all-packages' = lib.lists.flatten (map (pkg: builtins.attrValues pkg.result) all-packages); + + nixos-systems = builtins.attrValues config.systems.nixos; + nixos-systems' = map (system: system.result.config.system.build.toplevel) nixos-systems; + + darwin-systems = builtins.attrValues config.systems.darwin; + darwin-systems' = map (system: system.result.config.system.build.toplevel) darwin-systems; + + all-drvs = all-packages' ++ nixos-systems' ++ darwin-systems'; + all-drvs' = lib.strings.concatMapSep "\n" builtins.unsafeDiscardStringContext all-drvs; + in + mkPackage ( + { runCommand }: + runCommand "eval-check" { + allDerivations = all-drvs'; + passAsFile = [ "allDerivations" ]; + } "touch $out" + ); + ci-check = mkPackage ( + { + writeShellScript, + lib, + system, + }: + writeShellScript "ci-check" '' + nix-instantiate --eval -E 'import ./nilla.nix {}' -A packages.__allPackages.result.${system}.outPath + "${lib.getExe config.packages.formatter.result.${system}}" --ci + '' + ); }; config.shells.default = {