snowfallorg / lib

Unified configuration for systems, packages, modules, shells, templates, and more with Nix Flakes.
https://snowfall.org
Other
424 stars 37 forks source link

Target Wide Home-Manager not working as expected #124

Open replicapra opened 3 months ago

replicapra commented 3 months ago

the v3 migration docs state that _For example, if you created a home homes/x86_64-linux/jake/default.nix, the home will be included for every x86_64-linux machine and will be exported on your Flake as homeConfigurations."jake@x8664-linux".

but the generated homeConfiguration will actually be named only "jake"

that becomes a problem as soon as you try to create a target wide home config for more than one target as only the first one ( or only one, can't really tell if it's the first one ) seems to be build

in my exact case I defined a target wide home config for both x86_64-linux and aarch64-linux and while the x86_64-linux config kept building just fine the aarch64-linux one failed, not being able to find the defined home-manager user my homeConfigurations included only one config with the plain name, no @<target>

bLuka commented 2 months ago

I have a few struggles on my side too and I confirm the behavior: my homes/aarch64-darwin/luka and homes/x86_64-linux/luka targets are merged and prevent rebuilds.

$ nix repl
nix-repl> :lf .
nix-repl> homeConfigurations
{
  luka = { ... };
  root = { ... };
}

File tree:

homes/aarch64-darwin/luka/default.nix
homes/x86_64-linux/luka/default.nix
homes/x86_64-linux/root/default.nix

Moreover, if I try to rename to include the host (mv homes/aarch64-darwin/luka{,@foo}), I get an error:

error: path 'fm7i5n6iwkxpsdj2cbzxxrnk25rykwr7-luka@foo' is not a valid store path: name 'luka@foo' 
contains illegal character '@'

I believe it misses a call to lib.strings.sanitizeDerivationName