1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

treewide: remove shims for Nixpkgs ≤ 23.05

These deprecated versions were already made unsupported by #932.
This commit is contained in:
Emily 2024-06-13 13:48:07 +01:00
parent cbde36ce62
commit 5399270903
2 changed files with 5 additions and 81 deletions

View file

@ -21,7 +21,7 @@ let
It isn't perfect, but it seems to cover a vast majority of use cases. It isn't perfect, but it seems to cover a vast majority of use cases.
Caveat: even if the package is reached by a different means, Caveat: even if the package is reached by a different means,
the path above will be shown and not e.g. `${config.services.foo.package}`. */ the path above will be shown and not e.g. `${config.services.foo.package}`. */
realManual = import ../../doc/manual { manual = import ../../doc/manual {
inherit pkgs config; inherit pkgs config;
version = config.system.darwinVersion; version = config.system.darwinVersion;
revision = config.system.darwinRevision; revision = config.system.darwinRevision;
@ -44,38 +44,6 @@ let
in scrubbedEval.options; in scrubbedEval.options;
}; };
# TODO: Remove this when dropping 22.11 support.
manual = realManual //
lib.optionalAttrs (!pkgs.buildPackages ? nixos-render-docs) rec {
optionsJSON = pkgs.writeTextFile {
name = "options.json-stub";
destination = "/share/doc/darwin/options.json";
text = "{}";
};
manpages = pkgs.writeTextFile {
name = "darwin-manpages-stub";
destination = "/share/man/man5/configuration.nix.5";
text = ''
.TH "CONFIGURATION\&.NIX" "5" "01/01/1980" "Darwin" "Darwin Reference Pages"
.SH "NAME"
\fIconfiguration\&.nix\fP \- Darwin system configuration specification
.SH "DESCRIPTION"
.PP
The nix\-darwin documentation now requires nixpkgs 23.05 to build.
'';
};
manualHTML = pkgs.writeTextFile {
name = "darwin-manual-html-stub";
destination = "/share/doc/darwin/index.html";
text = ''
<!DOCTYPE html>
<title>Darwin Configuration Options</title>
The nix-darwin documentation now requires nixpkgs 23.05 to build.
'';
};
manualHTMLIndex = "${manualHTML}/share/doc/darwin/index.html";
};
helpScript = pkgs.writeScriptBin "darwin-help" helpScript = pkgs.writeScriptBin "darwin-help"
'' ''
#! ${pkgs.stdenv.shell} -e #! ${pkgs.stdenv.shell} -e

View file

@ -3,48 +3,6 @@
with lib; with lib;
let 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; cfg = config.nixpkgs;
opt = options.nixpkgs; opt = options.nixpkgs;
@ -91,9 +49,7 @@ let
merge = lib.mergeOneOption; merge = lib.mergeOneOption;
}; };
# TODO: Remove backwards compatibility hack when dropping pkgsType = types.pkgs // {
# 22.11 support.
pkgsType = types.pkgs or (types.uniq types.attrs) // {
# This type is only used by itself, so let's elaborate the description a bit # This type is only used by itself, so let's elaborate the description a bit
# for the purpose of documentation. # for the purpose of documentation.
description = "An evaluation of Nixpkgs; the top level attribute set of packages"; description = "An evaluation of Nixpkgs; the top level attribute set of packages";
@ -310,15 +266,15 @@ in
# which is somewhat costly for Nixpkgs. With an explicit priority, we only # 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 # evaluate the wrapper to find out that the priority is lower, and then we
# don't need to evaluate `finalPkgs`. # don't need to evaluate `finalPkgs`.
lib.mkOverride defaultOverridePriority lib.mkOverride lib.modules.defaultOverridePriority
finalPkgs.__splicedPackages; finalPkgs.__splicedPackages;
}; };
nixpkgs.constructedByUs = nixpkgs.constructedByUs =
# We set it with default priority and it can not be merged, so if the # 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. # pkgs module argument has that priority, it's from us.
(mergeAttrDefinitionsWithPrio options._module.args).pkgs.highestPrio (lib.modules.mergeAttrDefinitionsWithPrio options._module.args).pkgs.highestPrio
== defaultOverridePriority == lib.modules.defaultOverridePriority
# Although, if nixpkgs.pkgs is set, we did forward it, but we did not construct it. # Although, if nixpkgs.pkgs is set, we did forward it, but we did not construct it.
&& !opt.pkgs.isDefined; && !opt.pkgs.isDefined;