I’m looking for advice on:
- Is trying to use the same nixpkgs version for nested Flakes silly?
- How best to allow nested Flakes to all follow my version of nixpkgs. I have a solution I stumbled into at the end.
I have managed to migrate my dotfiles setup to home-manager on PopOS/Mac. After I had things working well I changed my setup to use Flakes and setup home-manager to follow my version of nixpkgs. The inputs looked like the following:
{
inputs = {
home-manager = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/home-manager";
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
}
Then I wanted to integrate a few rust utilities to have Flake support and ended up with the following:
# top-level flake
{
inputs = {
git-remote-open.url = "github:CoffeeAndCode/git-remote-open";
home-manager = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/home-manager";
};
mdquote.url = "github:CoffeeAndCode/mdquote";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
}
# example rust project flake
{
inputs = {
naersk.url = "github:nmattia/naersk";
utils.url = "github:numtide/flake-utils";
};
}
which creates something like the following inputs tree:
Inputs:
├───git-remote-open: github:CoffeeAndCode/git-remote-open/142ab1c4a0b34f23a232308d50359e79530b698f
│ ├───naersk: github:nmattia/naersk/32e3ba39d9d83098b13720a4384bdda191dd0445
│ │ └───nixpkgs: github:NixOS/nixpkgs/c3870f2bb5d1f631d7f6b31d744f25272c9a4dd7
│ ├───nixpkgs: github:NixOS/nixpkgs/c3870f2bb5d1f631d7f6b31d744f25272c9a4dd7
│ └───utils: github:numtide/flake-utils/eed214942bcfb3a8cc09eb3b28ca7d7221e44a94
├───home-manager: github:nix-community/home-manager/db00b39a9abec04245486a01b236b8d9734c9ad0
│ └───nixpkgs follows input 'nixpkgs'
├───mdquote: github:CoffeeAndCode/mdquote/9c93dfe71dfd3f5efc85f87d50fb1c65b8aaa14d
│ ├───naersk: github:nmattia/naersk/32e3ba39d9d83098b13720a4384bdda191dd0445
│ │ └───nixpkgs: github:NixOS/nixpkgs/c3870f2bb5d1f631d7f6b31d744f25272c9a4dd7
│ ├───nixpkgs: github:NixOS/nixpkgs/c3870f2bb5d1f631d7f6b31d744f25272c9a4dd7
│ └───utils: github:numtide/flake-utils/eed214942bcfb3a8cc09eb3b28ca7d7221e44a94
└───nixpkgs: github:nixos/nixpkgs/cd0ffd3f5fad719586a9b2d06b1faa603da6ba8d
I took a pass at trying to ‘follow’ in my Rust utility flake, but I don’t think it did much:
{
inputs = {
naersk = {
url = "github:nmattia/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
utils.url = "github:numtide/flake-utils";
};
}
I was able to get all nixpkgs to follow my top-level with the following, but I’m unsure if there’s a better way to handle it (or if it’s silly to even pursue).
{
inputs = {
git-remote-open = {
inputs.nixpkgs.follows = "nixpkgs";
inputs.naersk.follows = "naersk";
url = "github:CoffeeAndCode/git-remote-open";
};
home-manager = {
inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/home-manager";
};
mdquote = {
inputs.nixpkgs.follows = "nixpkgs";
inputs.naersk.follows = "naersk";
url = "github:CoffeeAndCode/mdquote";
};
naersk = {
inputs.nixpkgs.follow = "nixpkgs";
url = "github:nmattie/naersk";
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
};
}
Thanks for any advice.