diff options
Diffstat (limited to 'modules/nix/nixpkgs.nix')
| -rw-r--r-- | modules/nix/nixpkgs.nix | 66 |
1 files changed, 11 insertions, 55 deletions
diff --git a/modules/nix/nixpkgs.nix b/modules/nix/nixpkgs.nix index 52aec9a..ee99997 100644 --- a/modules/nix/nixpkgs.nix +++ b/modules/nix/nixpkgs.nix @@ -3,48 +3,6 @@ with lib; let - - # Backport from Nixpkgs 23.05 - defaultOverridePriority = - lib.modules.defaultOverridePriority or lib.modules.defaultPriority; - - # Backport from Nixpkgs 23.11 - mergeAttrDefinitionsWithPrio = lib.mergeAttrDefinitionsWithPrio or (opt: - let - # Inlined to avoid warning about using internal APIs 🥴 - pushDownProperties = cfg: - if cfg._type or "" == "merge" then - concatMap pushDownProperties cfg.contents - else if cfg._type or "" == "if" then - map (mapAttrs (n: v: mkIf cfg.condition v)) (pushDownProperties cfg.content) - else if cfg._type or "" == "override" then - map (mapAttrs (n: v: mkOverride cfg.priority v)) (pushDownProperties cfg.content) - else # FIXME: handle mkOrder? - [ cfg ]; - - defsByAttr = - lib.zipAttrs ( - lib.concatLists ( - lib.concatMap - ({ value, ... }@def: - map - (lib.mapAttrsToList (k: value: { ${k} = def // { inherit value; }; })) - (pushDownProperties value) - ) - opt.definitionsWithLocations - ) - ); - in - assert opt.type.name == "attrsOf" || opt.type.name == "lazyAttrsOf"; - lib.mapAttrs - (k: v: - let merging = lib.mergeDefinitions (opt.loc ++ [k]) opt.type.nestedTypes.elemType v; - in { - value = merging.mergedValue; - inherit (merging.defsFinal') highestPrio; - }) - defsByAttr); - cfg = config.nixpkgs; opt = options.nixpkgs; @@ -91,9 +49,7 @@ let merge = lib.mergeOneOption; }; - # TODO: Remove backwards compatibility hack when dropping - # 22.11 support. - pkgsType = types.pkgs or (types.uniq types.attrs) // { + pkgsType = types.pkgs // { # This type is only used by itself, so let's elaborate the description a bit # for the purpose of documentation. description = "An evaluation of Nixpkgs; the top level attribute set of packages"; @@ -143,7 +99,7 @@ in pkgs = mkOption { type = pkgsType; example = literalExpression "import <nixpkgs> {}"; - description = lib.mdDoc '' + description = '' If set, the pkgs argument to all nix-darwin modules is the value of this option, extended with `nixpkgs.overlays`, if that is also set. The nix-darwin and Nixpkgs architectures must @@ -171,7 +127,7 @@ in { allowBroken = true; allowUnfree = true; } ''; type = configType; - description = lib.mdDoc '' + description = '' The configuration of the Nix Packages collection. (For details, see the Nixpkgs documentation.) It allows you to set package configuration options. @@ -194,7 +150,7 @@ in ] ''; type = types.listOf overlayType; - description = lib.mdDoc '' + description = '' List of overlays to use with the Nix Packages collection. (For details, see the Nixpkgs documentation.) It allows you to override packages globally. Each function in the list @@ -214,7 +170,7 @@ in # Make sure that the final value has all fields for sake of other modules # referring to this. TODO make `lib.systems` itself use the module system. apply = lib.systems.elaborate; - description = lib.mdDoc '' + description = '' Specifies the platform where the nix-darwin configuration will run. To cross-compile, set also `nixpkgs.buildPlatform`. @@ -232,7 +188,7 @@ in apply = lib.systems.elaborate; defaultText = literalExpression ''config.nixpkgs.hostPlatform''; - description = lib.mdDoc '' + description = '' Specifies the platform on which nix-darwin should be built. By default, nix-darwin is built on the system where it runs, but you can change where it's built. Setting this option will cause nix-darwin to be @@ -266,7 +222,7 @@ in defaultText = lib.literalMD '' Traditionally `builtins.currentSystem`, but unset when invoking nix-darwin through `lib.darwinSystem`. ''; - description = lib.mdDoc '' + description = '' Specifies the Nix platform type on which nix-darwin should be built. It is better to specify `nixpkgs.hostPlatform` instead. @@ -281,7 +237,7 @@ in defaultText = literalMD '' `<nixpkgs>` or nix-darwin's `nixpkgs` flake input ''; - description = lib.mdDoc '' + description = '' The path to import Nixpkgs from. If you're setting a custom [](#opt-nixpkgs.pkgs) or `_module.args.pkgs`, setting this to something with `rev` and `shortRev` attributes (such as a @@ -310,15 +266,15 @@ in # which is somewhat costly for Nixpkgs. With an explicit priority, we only # evaluate the wrapper to find out that the priority is lower, and then we # don't need to evaluate `finalPkgs`. - lib.mkOverride defaultOverridePriority + lib.mkOverride lib.modules.defaultOverridePriority finalPkgs.__splicedPackages; }; nixpkgs.constructedByUs = # We set it with default priority and it can not be merged, so if the # pkgs module argument has that priority, it's from us. - (mergeAttrDefinitionsWithPrio options._module.args).pkgs.highestPrio - == defaultOverridePriority + (lib.modules.mergeAttrDefinitionsWithPrio options._module.args).pkgs.highestPrio + == lib.modules.defaultOverridePriority # Although, if nixpkgs.pkgs is set, we did forward it, but we did not construct it. && !opt.pkgs.isDefined; |
