Closed brsvh closed 1 year ago
I have noticed that the darwin generator has a
system
parameter, and I think it might be possible to add a similar parameter tomkLinuxSystem
and set a default value tox86_64-linux
to keep compatibility with existed configurations.
Sounds good to me, PR welcome!
Alternatively, or in addition, we can expose the specialArgsFor
set from lib
.
I am not certain about the specific implementation details. To implement the goal of passing system
, mod
(imports), and specialArgs
to mkLinuxSystem
, it would be necessary to pass an attribute set when calling the function. This might introduce some potential break changes that I initially wanted to avoid.
And it doesn't look different from using nixpkgs.lib.nixosSystem
directly.
In fact, I just discovered a few hours ago that setting default values for function parameters is only possible within an attribute set (Maybe it can be set via the let scope, but it doesn't matter).
nixos-flake
's API is not stablized, so it is fine to introduce breaking changes.
And it doesn't look different from using
nixpkgs.lib.nixosSystem
directly.
Hence, exposing the specialArgsFor
set from lib
should be sufficient. Then you can just use
inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = inputs.nixpkgs.nixos-flake.lib.specialArgsFor.nixos;
modules = [ ({
# My configuration ...
}) ];
};
Hence, exposing the
specialArgsFor
set fromlib
should be sufficient. Then you can just useinputs.nixpkgs.lib.nixosSystem { system = "aarch64-linux"; specialArgs = inputs.nixpkgs.nixos-flake.lib.specialArgsFor.nixos; modules = [ ({ # My configuration ... }) ]; };
I've implemented this in fed6487
df6fe273ff64dc29de2c93805045b5348d70bc26
Presently, when using
mkLinuxSystem
, the system parameter is look like hardcoded tox86_64-linux
.https://github.com/srid/nixos-flake/blob/d54b31a542f9d34e051f434806b607e70835adb1/flake-module.nix#L124-L129
What should I do if I desire to create host configurations for other architectures like
aarch64-linux
?I am try to use
nixpkgs.lib.makeOverridable
and then updatesystem
attribute, but I don't know if that's right because I am Nix noob.I have noticed that the darwin generator has a
system
parameter, and I think it might be possible to add a similar parameter tomkLinuxSystem
and set a default value tox86_64-linux
to keep compatibility with existed configurations.