Hello, I got some problem while trying out ags. I use home manager as an nixos configuration module. Specifically, my home.nix is located in /etc/nixos with the following content:
warning: creating lock file '/etc/nixos/flake.lock'
error: flake 'path:/etc/nixos' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."Windows11".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."Windows11".config.system.build.nixos-rebuild' or 'nixosConfigurations."Windows11".config.system.build.nixos-rebuild'
How would you suggest i change the content of flake so that it work with my current config? I don’t know anything about flake or how it works at all
I love home manager and I dont want it to be seperate so that i can do rebuild easier and don’t have to worry about having to do extra steps
This is what i came up with, still error tho, no idea what went wrong
error:
… while calling the 'seq' builtin
at /nix/store/dw3dzpv6yqrw2gikw9qgnda0sy8xvlwi-source/lib/modules.nix:322:18:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
… while evaluating a branch condition
at /nix/store/dw3dzpv6yqrw2gikw9qgnda0sy8xvlwi-source/lib/modules.nix:261:9:
260| checkUnmatched =
261| if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
| ^
262| let
(stack trace truncated; use '--show-trace' to show the full trace)
error: in pure evaluation mode, 'fetchTarball' requires a 'sha256' argument
Flakes run in pure evaluation mode. That means fetchTarball as you do in your home.nix is not allowed:
It is not allowed because Nix has no way to knowing whether the file will be the same on future downloads (it might actually change) so your flake would not be guaranteed to be reproducible.
Not sure why the error trace does not point to the fetchTarball location (maybe it requires --show-trace)
But you do not really need to fetch the home-manager manually, when you already have it present through flakes. You can pass the home-manager from flake.nix through extraSpecialArgs and then use it in home.nix.
Additionally, you are importing a home-manager NixOS module into home.nix (a home-manager module) which is not allowed – home-manager would have no idea what to do with the NixOS options defined by the home-manager NixOS module.
home.nix is a home-manager module because you pass it to modules argument of homeManagerConfiguration.