mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
modules/nixpkgs: add hostPlatform
& buildPlatform
options
This commit is contained in:
parent
5bd04ce09a
commit
8dc8fa38b0
2 changed files with 58 additions and 3 deletions
|
@ -172,6 +172,52 @@ in
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hostPlatform = lib.mkOption {
|
||||||
|
type = with lib.types; either str attrs;
|
||||||
|
example = {
|
||||||
|
system = "aarch64-linux";
|
||||||
|
};
|
||||||
|
apply = lib.systems.elaborate;
|
||||||
|
defaultText = lib.literalMD ''
|
||||||
|
- Inherited from the "host" configuration's `pkgs`
|
||||||
|
- Must be specified manually when building a standalone nixvim
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Specifies the platform where the Nixvim configuration will run.
|
||||||
|
|
||||||
|
To cross-compile, also set `nixpkgs.buildPlatform`.
|
||||||
|
|
||||||
|
Ignored when `nixpkgs.pkgs` is set.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
buildPlatform = lib.mkOption {
|
||||||
|
type = with lib.types; either str attrs;
|
||||||
|
default = cfg.hostPlatform;
|
||||||
|
example = {
|
||||||
|
system = "x86_64-linux";
|
||||||
|
};
|
||||||
|
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.
|
||||||
|
'';
|
||||||
|
description = ''
|
||||||
|
Specifies the platform on which Nixvim should be built.
|
||||||
|
By default, Nixvim is built on the system where it runs, but you can change where it's built.
|
||||||
|
Setting this option will cause Nixvim to be cross-compiled.
|
||||||
|
|
||||||
|
Ignored when `nixpkgs.pkgs` is set.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
# NOTE: This is a nixvim-specific option; there's no equivalent in nixos
|
# NOTE: This is a nixvim-specific option; there's no equivalent in nixos
|
||||||
source = lib.mkOption {
|
source = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
|
|
|
@ -32,11 +32,20 @@ let
|
||||||
evalArgs
|
evalArgs
|
||||||
// {
|
// {
|
||||||
modules = evalArgs.modules or [ ] ++ [
|
modules = evalArgs.modules or [ ] ++ [
|
||||||
# Use global packages by default in nixvim's submodule
|
|
||||||
# TODO: `useGlobalPackages` option and/or deprecate using host packages?
|
|
||||||
{
|
{
|
||||||
_file = ./_shared.nix;
|
_file = ./_shared.nix;
|
||||||
nixpkgs.pkgs = lib.mkDefault pkgs;
|
|
||||||
|
nixpkgs = {
|
||||||
|
# Use global packages by default in nixvim's submodule
|
||||||
|
# TODO: `useGlobalPackages` option and/or deprecate using host packages?
|
||||||
|
pkgs = lib.mkDefault pkgs;
|
||||||
|
|
||||||
|
# Inherit platform spec
|
||||||
|
# FIXME: buildPlatform can't use option-default because it already has a default
|
||||||
|
# (it defaults to hostPlatform)...
|
||||||
|
hostPlatform = lib.mkOptionDefault pkgs.stdenv.hostPlatform;
|
||||||
|
buildPlatform = lib.mkDefault pkgs.stdenv.buildPlatform;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue