diff --git a/devices/servivi/modules/binary-cache.nix b/devices/servivi/modules/binary-cache.nix index 8d5a8a0b..1e744369 100644 --- a/devices/servivi/modules/binary-cache.nix +++ b/devices/servivi/modules/binary-cache.nix @@ -1,35 +1,24 @@ { config, mainUser, - nix-eval-jobs, - nix-fast-build, pkgs, ... }: let - # FIXME: move nix-fast-build-pkg to overlays, make #nixFastChecks an attrset of all, packages, devices and aptDevices. add binary cache at apartment + # FIXME: make #nixFastChecks an attrset of all, packages, devices and aptDevices + # add binary cache at apartment + inherit (builtins) attrValues; inherit (config.sops) secrets; - nix-fast-build-pkg = nix-fast-build.packages.${pkgs.system}.nix-fast-build.override { - nix-eval-jobs = - nix-eval-jobs.packages.${pkgs.system}.default.override { - nix = config.nix.package; - } - // { - nix = config.nix.package; - }; - }; - nixFastBuild = pkgs.writeShellApplication { name = "nixFastBuild"; - runtimeInputs = builtins.attrValues { + runtimeInputs = attrValues { inherit (pkgs) gnugrep + nix-fast-build nix-output-monitor ; - - inherit nix-fast-build-pkg; }; text = '' @@ -45,11 +34,10 @@ in { services.nix-serve = { enable = true; - package = pkgs.nix-serve-ng; secretKeyFile = secrets.binary-cache-key.path; }; - environment.systemPackages = [nix-fast-build-pkg nixFastBuild]; + environment.systemPackages = [pkgs.nix-fast-build nixFastBuild]; # Populate cache systemd = { @@ -60,17 +48,16 @@ in { Group = config.users.users.${mainUser}.group; }; - path = builtins.attrValues { + path = attrValues { inherit (pkgs) bash git + nix-fast-build openssh ; inherit (config.nix) package; - - inherit nix-fast-build-pkg; }; script = '' diff --git a/outputs.nix b/outputs.nix index 879555ab..de40520e 100644 --- a/outputs.nix +++ b/outputs.nix @@ -134,7 +134,7 @@ perSystem (pkgs: import ./packages {inherit inputs mkVersion pkgs;}); - overlays = import ./overlays {}; + overlays = import ./overlays {inherit self;}; apps = perSystem (pkgs: diff --git a/overlays/default.nix b/overlays/default.nix index 11060335..e78db738 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,5 +1,5 @@ -{...}: { +{self, ...}: { build-failures = import ./build-failures; - nix-version = import ./nix-version; + nix-version = import ./nix-version self; xdg-desktop-portal-kde = import ./xdg-desktop-portal-kde; } diff --git a/overlays/nix-version/default.nix b/overlays/nix-version/default.nix index 762bfe9f..148200b8 100644 --- a/overlays/nix-version/default.nix +++ b/overlays/nix-version/default.nix @@ -1,15 +1,26 @@ -{nix ? null}: ( - final: prev: - builtins.mapAttrs - (n: v: - if nix == null - then prev.${n} - else v) - { - inherit nix; +self: {nix ? null}: final: prev: let + inherit (builtins) mapAttrs; + inherit (self.inputs) nix-eval-jobs nix-fast-build; - nix-serve-ng = prev.nix-serve-ng.override { - inherit nix; - }; - } -) + nullCheck = n: v: + if nix == null + then prev.${n} + else v; +in + mapAttrs nullCheck { + inherit nix; + + nix-serve = prev.nix-serve-ng.override { + inherit nix; + }; + + nix-fast-build = nix-fast-build.packages.${final.system}.nix-fast-build.override { + nix-eval-jobs = + nix-eval-jobs.packages.${final.system}.default.override { + inherit nix; + } + // { + inherit nix; + }; + }; + }