- flake-parts
- flake-aspects
- flake-file
- import-tree
- nixpkgs-multiverse
- disko
- dual boot
- lanzaboote
- preservation (nixos)
- impermanence (home-manager)
- microvm
- sops-nix
- nixvim
- hosts kept private
- raspberry-pi
nixos
├─ host-1.nix
├─ host-2/
├─── main.nix
├─ host-3/
├─── darwin.nix
├─── home-manager.nix
└─ flake.nix
flake.nix (minimal)
{
inputs.nixos.url = "github:lunics/nixos";
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.nixos.flakeModules.default
((inputs.import-tree.matchNot ".*flake\\.nix") ./.)
];
};
}Only the entry point is provided here. nixos modules resolve inputs.<name> against this
flake, so declaring the inputs they use is left to the consumer.
flake.nix (fully following lunics/nixos)
Declaring them as follows keeps nixos as the single source of truth: its own flake.lock
drives every version and no url is ever duplicated.
{
inputs = {
nixos.url = "github:lunics/nixos";
nixpkgs.follows = "nixos/nixpkgs";
flake-parts.follows = "nixos/flake-parts";
import-tree.follows = "nixos/import-tree";
};
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.nixos.flakeModules.default
((inputs.import-tree.matchNot ".*flake\\.nix") ./.)
];
};
}host-A/main.nix
{ config, ... }:{
flake.nixosConfigurations = config.flake.lib.make_nixos "x86_64-linux" "host-A";
flake.aspects = { aspects, ... }:{
host-A = {
includes = with aspects; [ # aspects provided by nixos
options
disk
boot
nix
...
];
nixos = {
_ = { # parent root option
hostname = "host-A";
flake_dir = "/path/to/this/repo";
};
};
};
};
}Caveats:
selfandinputsinside nixos modules resolve against the consumer flake, so its input set must cover everyinputs.<name>used by nixos.- the consumer flake is written by hand:
write-flakewould regenerate it with every url duplicated, so overrideflake-file.outputswithlib.mkForceonly if that is wanted.