Whenever I enable yazi in home manager with the following:
programs.yazi = {
enable = true;
};
It causes the version to go to Yazi 0.3.3 (Nixpkgs 2024-09-04) but when I comment that out it picks up the version from my configuration.nix environment.systemPackages (version 25.3.2).
I tried adding the following to configuration.nix but that doesn’t help:
home-manager.useGlobalPkgs = true;
Also don’t see anything in the example given in the installation instructions that sets the version in home manager:
That’s good to double check, but all looks right there. Thank you for the suggestion. Ideally the solution would be something along those lines. Like if there was a way to set home-manager to use the same global packages that nixos uses. Honestly, not sure why that isn’t the default. I’d really like to stay away from having to use an overlay, or something along those lines, for every package that I use in home-manager to declare its user config file.
Anyway, thanks again. I’ll grab some coffee and keep digging.
I used librephoenix’s technique to use both stable and unstable channels, and added yazi to the unstable package list in nixos.
How do I point to that package in home manager using programs.yazi.package? They don’t provide any examples in the documentation aside from the default being pkgs.yazi. So I tried:
Skimming the video, that would imply you’re using flakes. Could you share the rest of your configuration, including how you set up your packages? Explaining what you mean by “angry” helps too - without an exact error message or the context that shows what you’ve done we’d need to be fortune tellers to help.
Instead of linking videos you’ll probably get more helpful replies actually showing what you have in general; reading a post is way quicker and more accurate than trying to figure out which parts of a 20+ minute video you followed.
And from what I can gather from the error message, it thinks the attribute is missing when I tried setting programs.yazi.package equal to ‘nixpkgs-unstable’ and ‘pkgs-unstable’ which I don’t really get since I have inherit nixpkgs-unstable; as an extraSpecialArgs in the homeConfigurations section of the flake.nix (shown above).
Yeah, so that explains a fair bit. You’ve gotten the standalone and NixOS module home-manager setups confused, and you don’t really understand modules
I’d start with removing all of homeConfigurations - assuming this is your only system, you’re not using that anyway. If you wanted to, you’d need to use the home-manager binary instead of nixos-rebuild.
Next up, you’d want to actually configure your home-manager. Add to your in-line module (not a function argument, put it on its own set of lines so it’s clearer to you):
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
# Anything added to this attrset will be available from
# module args.
extraSpecialArgs = {
# Note that you're adding the input here, so you'll need
# to use `nixpkgs-unstable.legacyPackages.${pkgs.system}.yazi
# instead of `pkgs-unstable.yazi`
inherit nixpkgs-unstable;
};
users."guttermonk" = import ./home/home.nix; # CHANGE ME
};
}
Furthermore, this almost certainly means you’ve previously installed yazi with nix-env, as you weren’t using unstable for anything else. I’d urge you to remove all packages you have installed with nix-env, alongside any channels you have on your system. You’re using flakes, not channels.
Finally, if I may be so bold as to give some NixOS config structure advice; instead of packing the modules list in your flake.nix full of gunk, add those modules as part of your config - especially any in-line modules.
By that I mean, replace all of this:
… with just ./nixos/configuration.nix, and then innixos/configuration.nix you would do this:
{ inputs, ... }: {
imports = [
# This part I could be convinced comes down to preference,
# but if you have more than one system writing these for
# each system gets old fast, especially if you add more in
# the future.
inputs.nix-flatpak.nixosModules.nix-flatpak
inputs.home-manager.nixosModules.home-manager
];
environment.systemPackages = [
inputs.hyprswitch.packages.${pkgs.system}.default
# inputs.wpaperd.packages.${pkgs.system}.default
# inputs.yazi.packages.${pkgs.system}.default
];
nixpkgs.overlays = [
inputs.hyprpanel.overlay
];
# This has always been superfluous, you add `inputs` to
# `specialArgs` already.
# _module.args = { inherit inputs; };
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
# Note that you're adding *all* inputs here, so now you need
# `inputs.nixpkgs-unstable`. I would recommend this, but
# you could use `inherit (inputs) nixpkgs-unstable` if you
# want to be more specific.
inherit inputs;
};
users."guttermonk" = import ./home/home.nix; # CHANGE ME
};
# ... Any other config already in here
}
I hope breaking apart that list makes it a bit clearer what “modules” are, and helps you keep your config a bit more organized.
After that, you could refactor your nixosSystem call to just this:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
# inherit system; - You could just use `pkgs.system`
# inherit pkgs-unstable; - You could just use `inputs.nixpkgs-unstable.legacyPackages.${system}`
};
modules = [
./nixos/configuration.nix
];
}