2024-11-22 23:15:13 -05:00
|
|
|
self: {
|
|
|
|
config,
|
|
|
|
lib,
|
2024-12-10 23:06:29 -05:00
|
|
|
pkgs,
|
2024-11-22 23:15:13 -05:00
|
|
|
...
|
|
|
|
}: let
|
2024-12-11 05:23:04 -05:00
|
|
|
inherit (lib) attrValues filter findFirst hasAttr isAttrs mkIf optionalString;
|
2024-12-10 23:06:29 -05:00
|
|
|
|
2024-12-11 05:23:04 -05:00
|
|
|
inherit (self.inputs) nixd nixpkgs;
|
2024-11-22 23:15:13 -05:00
|
|
|
inherit (config.sops.secrets) access-token;
|
|
|
|
|
|
|
|
cfg = config.roles.base;
|
|
|
|
in {
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
nix = {
|
2024-12-10 23:06:29 -05:00
|
|
|
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;
|
|
|
|
|
2024-12-11 05:23:04 -05:00
|
|
|
# Minimize dowloads of indirect nixpkgs flakes
|
2024-11-22 23:15:13 -05:00
|
|
|
registry.nixpkgs.flake = nixpkgs;
|
|
|
|
nixPath = ["nixpkgs=${nixpkgs}"];
|
|
|
|
|
|
|
|
extraOptions =
|
|
|
|
optionalString (hasAttr "sops" config)
|
|
|
|
"!include ${access-token.path}";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Global hm settings
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# For accurate stack trace
|
|
|
|
_file = ./default.nix;
|
|
|
|
}
|