diff --git a/nixosModules/base/common-nix/default.nix b/nixosModules/base/common-nix/default.nix index 4c7d17ad..63fb015b 100644 --- a/nixosModules/base/common-nix/default.nix +++ b/nixosModules/base/common-nix/default.nix @@ -1,9 +1,14 @@ +# FIXME: remove unneeded params and reformat self: { config, lib, + pkgs, ... }: let - inherit (lib) hasAttr mkIf optionalString; + inherit (lib) optionalString; + inherit (lib) attrValues filter findFirst isAttrs hasAttr mkDefault mkIf mkOption types; + inherit (self.inputs) home-manager nh nixd; + inherit (self.inputs) nixpkgs; inherit (config.sops.secrets) access-token; @@ -13,6 +18,19 @@ in { config = mkIf cfg.enable { # Minimize dowloads of indirect nixpkgs flakes nix = { + package = let + nixdInput = + findFirst + (x: x.pname == "nix") {} + nixd.packages.x86_64-linux.nixd.buildInputs; + + throws = x: !(builtins.tryEval x).success; + hasVersion = x: isAttrs x && hasAttr "version" x; + + nixVersions = filter (x: ! throws x && hasVersion x) (attrValues pkgs.nixVersions); + in + findFirst (x: x.version == nixdInput.version) {} nixVersions; + registry.nixpkgs.flake = nixpkgs; nixPath = ["nixpkgs=${nixpkgs}"]; diff --git a/nixosModules/base/default.nix b/nixosModules/base/default.nix index 1b5d2e31..c8bfd604 100644 --- a/nixosModules/base/default.nix +++ b/nixosModules/base/default.nix @@ -1,3 +1,4 @@ +# FIXME: remove unneeded params and format self: { config, lib, @@ -48,19 +49,6 @@ in { }; nix = { - package = let - nixdInput = - findFirst - (x: x.pname == "nix") {} - nixd.packages.${pkgs.system}.nixd.buildInputs; - - throws = x: !(builtins.tryEval x).success; - hasVersion = x: isAttrs x && hasAttr "version" x; - - nixVersions = filter (x: ! throws x && hasVersion x) (attrValues pkgs.nixVersions); - in - findFirst (x: x.version == nixdInput.version) {} nixVersions; - # Edit nix.conf settings = { # Store