Hi!
I’m kind of new to nixos and don’t really understand how flakes work. I took the configuration from nixos-with-flakes and modified it to suit my needs.
Now I want to install HyprPanel and according to its guide I need to add
but I don’t know where to even add this code and any information about using overlays in flakes is not suitable because it uses a completely different general flakes.nix schema (it looks completely different and contains let ... in ... instead of nixos = nixpkgs.lib.nixosSystem ...).
Please help me to rewrite the config (maybe change the schema) and add this overlay.
You’re doing it right, that guide arguably advises you to commit an antipattern. There’s no need to explicitly eval nixpkgs unless you’re doing something specific, and doing so means not using the evaluation cache, and is therefore a little slower/more memory intensive.
So, don’t do what the guide says. Your current code achieves the same end goal and is arguably better practice. Where are you stuck?
Thanks for the reply!
I want to install the HyprPanel package. If I can do it without using overlays, ok. But I don’t know if I can do that. If I try to run this configuration, I get
error:
… while calling the 'head' builtin
at /nix/store/z71lmgd0ydfnax1b13zbrls5idf1y7ak-source/lib/attrsets.nix:1575:11:
1574| || pred here (elemAt values 1) (head values) then
1575| head values
| ^
1576| else
… while evaluating the attribute 'value'
at /nix/store/z71lmgd0ydfnax1b13zbrls5idf1y7ak-source/lib/modules.nix:809:9:
808| in warnDeprecation opt //
809| { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
810| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: evaluation aborted with the following error message: 'lib.customisation.callPackageWith: Function called without required argument "gnome-bluetooth" at /nix/store/s88mqkxsp5fl7wldp1n99vm21rai2agh-source/nix/default.nix:24'
And all I did was try to add this overlay and added pkgs.hyprpanel to my home.nix.
You’re even using home-manager.useGlobalPkgs, which means that the NixOS module pkgs (which you have applied the hyprpanel overlay to) is passed into home-manager as well. If it wasn’t working it’d tell you the package itself is missing, rather than a dependency.
What’s happening here is that hyprpanel’s overlay is built for nixpkgs unstable, looks like gnome-bluetooth was renamed from gnome.gnome-bluetooth. You’ll need to switch to unstable or do something more messy if you want to use this.
You need to run nix flake update in the directory with your flake. nixos-rebuild switch doesn’t update anything, and with flakes even adding the --update flag won’t do anything, because flakes manage their updates with the flake.lock file instead of channels.
When you run nixos-rebuild, nix will go to your flake to check what it should build, and your flake inputs are then used to actually do stuff - whatever flake.lock says nixpkgs is will be used to build your system. If flake.lock doesn’t change, your system does not change, and flake.lock is only ever updated with a call to nix flake update in the directory of you flake (or any of its child directories).
After updating everything I got building with no errors, but the package is just not installed. As I found in HyprPanel issues, it’s better to install this kind of common way through using something like inputs.hyprpanel.homeManagerModules.default rather than through overlays. I’ve tried all the common attributes, but always get errors. Could you please check this and find which path should be used, if possible.
I indeed agree that this is better practice, since it allows you to avoid overlays, which means this is much less error prone. It also means the nixpkgs version your system uses is irrelevant as this defers to your dependency flake’s recursive nixpkgs, so an attribute rename won’t break stuff in the future (but you pay a disk space cost since stuff will need to be duplicated, unless you use the same thing you do for home-manager to override the nixpkgs hyprpanel uses, at which point you’re basically back to the former state).
The upsides and downsides of this approach aside, though, this won’t change anything about how the package works, so if you can’t spot it as “installed” now it also won’t be there after the change.
How are you determining whether it is installed? Where exactly did you add it to your config? How do you go through the nested imports to get to the place where you add hyprpaper? This sounds more like part of your configuration isn’t evaluated, or like you don’t fully understand how your configuration works and therefore don’t know what scope hyprpaper is actually “installed” in.
Ignore this text, I accidentally clicked another post before hitting reply, and now discourse marks this as spam if I don’t edit it.
Discourse is really really bad with firefox mobile.
I check if the package is installed by trying to run it (according to the guide, it can be run with the ags command). I think this is the right way, because it is a user-side application and it should be run by command.
Thanks. I guess it’s kind of near to the soultion. But if I add inputs.hyprpanel.packages.${pkgs.system}.default to my home.nix package list, I get
this error
error:
… while calling the 'head' builtin
at /nix/store/60sn02zhawl3kwn0r515zff3h6hg6ydz-source/lib/attrsets.nix:1575:11:
1574| || pred here (elemAt values 1) (head values) then
1575| head values
| ^
1576| else
… while evaluating the attribute 'value'
at /nix/store/60sn02zhawl3kwn0r515zff3h6hg6ydz-source/lib/modules.nix:816:9:
815| in warnDeprecation opt //
816| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
817| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `home-manager.users.tim.programs.hyprpanel' does not exist. Definition values:
- In `/nix/store/60sn02zhawl3kwn0r515zff3h6hg6ydz-source/flake.nix':
{
enable = true;
}
I think this is just a NixOS-specific mistake in their docs, where if you follow the sections as listed on the website things go wrong. The NixOS docs do point out the binary name as part of the sample config.