gytis-ivaskevicius / flake-utils-plus

Use Nix flakes without any fluff.
MIT License
459 stars 52 forks source link

Unable to explicitly specify networking.hostName #102

Closed willruggiano closed 2 years ago

willruggiano commented 2 years ago

If I have;

mkFlake {
  hosts.foo = {
    modules = [ ./hosts/foo.nix ];
  };
}

and then in foo.nix I have;

{
  networking.hostName = "bar";
}

I get an error;

error: The option `networking.hostName` has conflicting definition values:
          - In `/nix/store/path/to/foo.nix`: "bar"
          - In `<unknown-file>`: "foo"

There is (seemingly?) an attempt to support explicit hostName specification; https://github.com/gytis-ivaskevicius/flake-utils-plus/blob/4db80b033eaa02d8aae46844364b24e0375214f8/lib/mkFlake.nix#L138 However either I am not specifying networking.hostName correctly (e.g. it needs to be an argument to mkFlake in some way), or this logic is broken, or I am just misinterpreting the code :)

gytis-ivaskevicius commented 2 years ago

It is expected for hostname to be specified as hosts.<hostname> = {...} for consistency reasons. This is not a bug. If you really wish overwrite it - you can do it via networking.hostName = lib.mkForce "bar";