Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions modules/top-level/nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 3 additions & 3 deletions wrappers/_shared.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};

Expand Down