From 07e1ce9b731119e9a25b969db62612a6348d9579 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sat, 8 Feb 2025 18:50:58 +0000 Subject: [PATCH 1/2] flake.lock: override nixpkgs input to use NixOS/nixpkgs#380342 --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index bdb2fbdc62..0f346a382b 100644 --- a/flake.lock +++ b/flake.lock @@ -185,11 +185,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1738797219, - "narHash": "sha256-KRwX9Z1XavpgeSDVM/THdFd6uH8rNm/6R+7kIbGa+2s=", - "owner": "NixOS", + "lastModified": 1739040350, + "narHash": "sha256-K4K50MZHe6BhTAjMTU/YfJQ4fC6DiQtVJ75IheCQj+s=", + "owner": "MattSturgeon", "repo": "nixpkgs", - "rev": "1da52dd49a127ad74486b135898da2cef8c62665", + "rev": "ffd6dc6380eba7ef28c4c12315f65cc54cfbd0cb", "type": "github" }, "original": { From b692d1670d871d5cdbd2fccf58a5a76b8b06e9c8 Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Sat, 8 Feb 2025 18:49:23 +0000 Subject: [PATCH 2/2] Revert "modules/nixpkgs: don't assign elaborated platforms" This reverts commit f99264c1fb8e98e0712cdad2744afa8b40661dcc. --- modules/top-level/nixpkgs.nix | 21 ++++++++++----------- wrappers/_shared.nix | 6 +++--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/top-level/nixpkgs.nix b/modules/top-level/nixpkgs.nix index f3de2899d6..24e9380bdd 100644 --- a/modules/top-level/nixpkgs.nix +++ b/modules/top-level/nixpkgs.nix @@ -146,9 +146,7 @@ in example = { system = "aarch64-linux"; }; - # FIXME: An elaborated platform is not supported, - # but an `apply` function is probably still needed. - # See https://github.com/NixOS/nixpkgs/pull/376988 + apply = lib.systems.elaborate; defaultText = lib.literalMD '' - Inherited from the "host" configuration's `pkgs` - Or `evalNixvim`'s `system` argument @@ -169,9 +167,14 @@ in example = { system = "x86_64-linux"; }; - # FIXME: An elaborated platform is not supported, - # but an `apply` function is probably still needed. - # See https://github.com/NixOS/nixpkgs/pull/376988 + apply = + value: + let + elaborated = lib.systems.elaborate value; + in + # If equivalent to `hostPlatform`, make it actually identical so that `==` can be used + # See https://github.com/NixOS/nixpkgs/issues/278001 + if lib.systems.equals elaborated cfg.hostPlatform then cfg.hostPlatform else elaborated; defaultText = lib.literalMD '' Inherited from the "host" configuration's `pkgs`. Or `config.nixpkgs.hostPlatform` when building a standalone nixvim. @@ -212,13 +215,9 @@ in inherit (cfg) config overlays; }; - elaborated = builtins.mapAttrs (_: lib.systems.elaborate) { - inherit (cfg) buildPlatform hostPlatform; - }; - # Configure `localSystem` and `crossSystem` as required systemArgs = - if lib.systems.equals elaborated.buildPlatform elaborated.hostPlatform then + if cfg.buildPlatform == cfg.hostPlatform then { localSystem = cfg.hostPlatform; } diff --git a/wrappers/_shared.nix b/wrappers/_shared.nix index 77874b5204..858434186e 100644 --- a/wrappers/_shared.nix +++ b/wrappers/_shared.nix @@ -39,9 +39,9 @@ let # Use global packages in nixvim's submodule pkgs = lib.mkIf config.nixpkgs.useGlobalPackages (lib.mkDefault pkgs); - # Inherit platforms - hostPlatform = lib.mkOptionDefault pkgs.stdenv.hostPlatform.system; - buildPlatform = lib.mkOverride buildPlatformPrio pkgs.stdenv.buildPlatform.system; + # Inherit platform spec + hostPlatform = lib.mkOptionDefault pkgs.stdenv.hostPlatform; + buildPlatform = lib.mkOverride buildPlatformPrio pkgs.stdenv.buildPlatform; }; };