From be18b76f8df1b173ef1646be5ae060d44a37f1d1 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 13 Jun 2024 14:31:24 +0100 Subject: [PATCH 1/4] flake.lock: update With 23.05 support dropped, this was pinned to an unsupported version. --- flake.lock | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 719cfe6..3ce8eac 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,12 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1687274257, - "narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=", - "path": "/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source", - "rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5", - "type": "path" + "lastModified": 1718149104, + "narHash": "sha256-Ds1QpobBX2yoUDx9ZruqVGJ/uQPgcXoYuobBguyKEh8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e913ae340076bbb73d9f4d3d065c2bca7caafb16", + "type": "github" }, "original": { "id": "nixpkgs", From cbde36ce624cfc7009b6f8a5970bf7a57580ef07 Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 13 Jun 2024 13:50:16 +0100 Subject: [PATCH 2/4] readme: update stable Nixpkgs to 24.05 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e1f0609..8ba58f1 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ Add the following to `flake.nix` in the same folder as `configuration.nix`: description = "John's darwin system"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-23.11-darwin"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin"; nix-darwin.url = "github:LnL7/nix-darwin"; nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; }; From 5399270903f6e95e5a5b083391e910dfed226f3a Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 13 Jun 2024 13:48:07 +0100 Subject: [PATCH 3/4] =?UTF-8?q?treewide:=20remove=20shims=20for=20Nixpkgs?= =?UTF-8?q?=20=E2=89=A4=2023.05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These deprecated versions were already made unsupported by #932. --- modules/documentation/default.nix | 34 +------------------- modules/nix/nixpkgs.nix | 52 +++---------------------------- 2 files changed, 5 insertions(+), 81 deletions(-) diff --git a/modules/documentation/default.nix b/modules/documentation/default.nix index 10bcbd3..3259cfd 100644 --- a/modules/documentation/default.nix +++ b/modules/documentation/default.nix @@ -21,7 +21,7 @@ let 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, 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; version = config.system.darwinVersion; revision = config.system.darwinRevision; @@ -44,38 +44,6 @@ let 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 = '' - - Darwin Configuration Options - The nix-darwin documentation now requires nixpkgs 23.05 to build. - ''; - }; - manualHTMLIndex = "${manualHTML}/share/doc/darwin/index.html"; - }; - helpScript = pkgs.writeScriptBin "darwin-help" '' #! ${pkgs.stdenv.shell} -e diff --git a/modules/nix/nixpkgs.nix b/modules/nix/nixpkgs.nix index 8b3e428..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"; @@ -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; From 2406909d7a2aa50f907a82e553d6e923814e978a Mon Sep 17 00:00:00 2001 From: Emily Date: Thu, 13 Jun 2024 13:52:29 +0100 Subject: [PATCH 4/4] Reapply "eval-config: set `class`" All supported Nixpkgs versions now support this. This reverts commit a5b09580e2d0bbc52b338afe4f1f1d46178e6bbf. --- eval-config.nix | 1 + modules/documentation/default.nix | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/eval-config.nix b/eval-config.nix index d2567a4..cd14493 100644 --- a/eval-config.nix +++ b/eval-config.nix @@ -16,6 +16,7 @@ let }; eval = lib.evalModules (builtins.removeAttrs args [ "lib" ] // { + class = "darwin"; modules = modules ++ [ argsModule ] ++ baseModules; specialArgs = { modulesPath = builtins.toString ./modules; } // specialArgs; }); diff --git a/modules/documentation/default.nix b/modules/documentation/default.nix index 3259cfd..395e6e6 100644 --- a/modules/documentation/default.nix +++ b/modules/documentation/default.nix @@ -11,9 +11,9 @@ let regularConfig = config; argsModule = { - config._module.args = regularConfig._module.args // { + config._module.args = lib.mkForce (regularConfig._module.args // { modules = [ ]; - }; + }); }; /* For the purpose of generating docs, evaluate options with each derivation @@ -28,8 +28,9 @@ let inherit (config.system) nixpkgsRevision; options = let - scrubbedEval = evalModules { - modules = baseModules ++ [ argsModule ]; + scrubbedEval = import ../../eval-config.nix { + inherit lib; + modules = [ argsModule ]; specialArgs = { pkgs = scrubDerivations "pkgs" pkgs; }; }; scrubDerivations = namePrefix: pkgSet: mapAttrs