Open ratson opened 1 month ago
Sorry for delay; have been busy.
The inputs'
arg is provided by flakelight, so is not available in second flake. The args to modules come from the nixosSystem
as well, so inputs'
in a module refers to the inputs of the flake defining the system, not the one that defined the module.
If you want to use packages from another flake, I'd recommend having the module use the package from the pkgs arg, and having the second flake's system use the first's overlay.
@accelbread Should the inputs'
be provided to flake1.nixosModules.default
with flake1
's inputs
?
Or is there a way to refer to flake1
's inputs
in flale1.nixosModules
, so that it can used by another flake?
To better illustrate the problem, I updated flake1
to include vm2
,
https://github.com/ratson/bug-report/blob/flakelight-nixos-module/flake1/flake.nix#L13-L19
nixosConfigurations.vm2 = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
self.nixosModules.default
];
};
It is strange that nix build ./flake1#nixosConfigurations.vm1.config.system.build.vm
works, while nix build ./flake1#nixosConfigurations.vm2.config.system.build.vm
fails.
Here is the vm1
code,
https://github.com/ratson/bug-report/blob/flakelight-nixos-module/flake1/nix/nixos/vm1.nix
{ inputs, ... }:
{
system = "x86_64-linux";
modules = [
inputs.self.nixosModules.default
];
}
if you change vm2 to not call nixosSystem explicitly, it will work:
nixosConfigurations.vm2 = {
inherit system;
modules = [
self.nixosModules.default
];
};
If you don't call it, flakelight can propagate inputs and etc. to the nixos invocation since it calls it. If you call it yourself, flakelight can't add its stuff. You can call it yourself and add the flakelight stuff by adding config.propogationModule
to your modules. Can see here: https://github.com/nix-community/flakelight/blob/2a96b83bf6ffad4b8a15afe19e883ca1a1720d88/API_GUIDE.md?plain=1#L965-L977
self.nixosModules.default
should propagate inputs
and moduleArgs
for outputs
, so non-flakelight users could use it.
I don't know if it can be generically implemented or not, here is a working example,
gives
While the following is working,
Source code in https://github.com/ratson/bug-report/tree/flakelight-nixos-module
@accelbread Would you check if usage in
flake2/flake.nix
is correct?FYR, here is a copy of it,
There is
test.sh
script in the repo to run locally to verify the bug.