I have a nixos system that uses flakes. The flake I have is spread across multiple files, but if combined the relevant structure would be something like:
flake.nix
{
outputs = inputs: {
nixosConfigurations = {
hostX = nixpkgs.lib.nixosSystem {
environment.systemPackages = {
(let
my-python-packages = python-packages: with python-packages;
let
some-python-package = python-packages.callPackage (
{buildPythonPackage, ...}: buildPythonPackage { ... }
);
in [some-python-package];
python-with-my-packages = python3.withPackages my-python-packages;
in python-with-my-packages;
)
}
}
}
}
}
I hope I did not make any typos, but you should get the gist.
My question is - right now I’m testing this by doing:
# nixos-rebuild switch --flake .#hostX
which basically rebuilds the whole system. That has two drawbacks:
- It adds entries into the list of nixos generations
- It’s building much more than it should
for situations where I just want to add and tweak a single package’s build process.
Is there a way for me to build only this particular part of the flake (without necessarily deploying it where it should normally go)?