gytis-ivaskevicius/flake-utils-plus

Unable to explicitly specify networking.hostName

willruggiano opened this issue · 1 comments

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;

(optionalAttrs (options ? networking.hostName) {

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 :)

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";