sigboe / nixos-config

1 stars 0 forks source link

overlays for pkgs.unstable #1

Open EmergentMind opened 1 month ago

EmergentMind commented 1 month ago

Had a brief look at your config to see if I could figure out your issue with not being able to install packages using pkgs.unstable via the overlay.

The only thing that stands out to me is that where you are importing ./overlays to overlays in your flake.nix, you are only inheriting inputs where as I inherit both inputs and outputs.

Relevant line in yours: https://github.com/sigboe/nixos-config/blob/2dc8b4bddbb01c261fe504551c78982eee0c4954/flake.nix#L103

Relevant line in mine: https://github.com/EmergentMind/nix-config/blob/c5a4626cc74ee2b8c4a43553ac104bfbd06f1f92/flake.nix#L110

I'm not totally certain that is the problem but it's worth testing out.

Also, I couldn't find anything in your config where you may have been trying to use pkgs.unstable so not sure how you tried it but will throw the following out there just as an example in case the it helps. Keep in mind that I updated my flake a while ago to use unstable, and that my overlay sets up both pkgs.stable and pkgs.unstable, so I can pin something to either of them, regardless of what I do with pkgs itself.

I recently to pin the Calibre package to stable because of a build issue with one of its dependencies on unstable. https://github.com/EmergentMind/nix-config/blob/5ab6b860054847d04ff00229f00cad7af85edb71/home/ta/common/optional/media/default.nix#L12

Btw, haven't got to looking at the impermanence stuff you mentioned yet but will do when I get to that stage. Cheers.

sigboe commented 1 month ago

Thank you for having a look! That was unexpectedly nice of you! I do believe I had that line exactly like yours before, but was trying to copy your reference Misterio77 just to see if it changed that. I did just now try to add inherit outputs there as well now, but it didn't seam to fix the issue. Also I don't see where outputs are used, but it might be a nested thing?

Yes I don't have anywhere I am trying to use pkgs.unstable in my build, because, then it wouldn't allow me to sudo nixos-rebuild switch.

But the place I am trying to install an unstable package is here https://github.com/sigboe/nixos-config/blob/ef4da7d22b38cd55fcc2b6f8000b523572db61bb/home/sigurdb/common/core/nixvim/default.nix#L23

I am very glad you came back to me and followed up and said you had it working, because, then I know it is possible to fix in my config by changing something, and not making huge changes :) Thank you for that!

EmergentMind commented 4 weeks ago

So if you change that line to package = pkgs.unstable.neovim-unwrapped; it fails? Or were you also adding in legacyPackages.<arch>? Curious because I've never tested the latter so not sure if it would work.... although I suspect it should

sigboe commented 2 weeks ago

Sorry, life has been hectic, didn't notice you asked a follow up question!

So if you change that line to package = pkgs.unstable.neovim-unwrapped; it fails?

Yes, or example pkgs.bose-connect-app-linux which is installed trough programs.sway.extrapackages Then the configuration simply wont build.

Instead I use inputs.nixpkgs-unstable.legacyPackages.x86_64-linux.neovim-unwrapped and outputs.packages.x86_64-linux.bose-connect-app-linux

EmergentMind commented 1 week ago

I had a minute to look at your code his afternoon and I suspect the issue is that programs.sway.extrapackages doesn't know what pkgs.unstable is because with pkgs is only adding pkgs to scope here: https://github.com/sigboe/nixos-config/blob/3311639f98653153661e98d857f0bbf727c73fd9/hosts/common/optional/sway.nix#L9C1-L35C9 I.e. pkgs and pkgs.unstable are two separate scopes and pkgs itself doesn't include pkgs.unstable, which is somewhat confusing given how most other things work.

For reference on how I do it for both scopes, you can check my file home/ta/common/optional/tools/default.nix. https://github.com/EmergentMind/nix-config/blob/18d236a9c462638669d2e3bf0ce1b04ce935d197/home/ta/common/optional/tools/default.nix#L5

Notice that home.packages uses inherit pkgs for most of the packages but also changes scope using inherit pkgs.stable for blender and drawio (because I was running into build errors for them on unstable).

Granted, I'm not using with pkgs for scoping so I could be mistaken. As a quick tangent, the reason I don't use with pkgs is explained here: https://nix.dev/guides/best-practices#with-scopes

Maybe refactor a bit and see if that works out.