I know how to use an overlay to build a different revision of a package, via Overlays - Official NixOS Wiki . However, the build process for the package takes a long time and a lot of storage space, and it seems to rebuild the package whenever I run sudo nixos-rebuild switch --upgrade.
I would like to build the program with the override once, locally, then replace the overlay with my local version of the package, but I cannot find any documentation on how to do that. Please help! TIA
I’m not super familiar with the whole process. I’m going to make some inferences and please correct me where I’m wrong:
The reason the package is getting rebuilt despite keeping the same revision is because of dependencies updating in nixpkgs-unstable? Most compiled languages don’t package in the dependencies in the finished binary, so if I were able to compile the program locally, I would maybe still need to pin the dependencies so the binary keeps working anyway?
Annoyingly, I can’t get over the final hurdle of using the package, since I’m getting attribute 'nushell' missing on my inputs.nixpkgs-stable.nushell.overrideAttrs.
Ahh thanks. So the package builds fine, but when I add the override to the GitHub revision I want, I get the following error:
nushell> error: rustc 1.95.0 is not supported by the following packages:
nushell> nu@0.115.2 requires rustc 1.96.1
...
I think this means that the version of rustc in nixos-26.05-small is too old for the version of the package I’m overriding to. It seems like what I need is a snapshot of nixos-unstable but frozen in time around now. Is there a way to do that?
As a complete aside, I’m curious about the need to include extraSpecialArgs = { inherit inputs; }; in my home-manager config in order to recognise the inputs.nixpkgs-stable attribute. I’ve had lines like the following two in my home manager config previously without needing extraSpecialArgs: package = inputs.xdp-termfilepickers.packages.${pkgs.stdenv.hostPlatform.system}.default; imports = [ inputs.noctalia.homeModules.default ];
What other means are there? I’d quite like to keep the lines of code which put it in scope consistent across my uses of it, and in the same places as I use it.
Maybe you have been in the flake.nix where the inputs are usually in scope, or had a HM module nested in system, where you had the inputs in scope through system. We can’t really know without seeing any code or context.
Pretty much every other file is included via a chain of flake parts module imports, so the files with external module imports and the file with an external package are the same structurally as the one I’m trying to get the alternate nixpkgs from. Only the lattermost needs the extraSpecialArgs. I’m not familiar enough with any of the moving parts to have a good grasp of how the system works. A friend helped me set it up.
Those 2 are nearly the only files in modules/ which aren’t flake part modules. The others which aren’t are just an imports = [ inputs.flake-parts.flakeModules.modules ];, a systems = ["x86_64-linux"];, and my generated hardware configuration.
I’m not sure of the best forum to seek general understanding of my system, since this is now far from the original question, but here’s it is in case I haven’t described whats going on right.