nixos-installer/flake.nix

28 lines
1.6 KiB
Nix
Raw Normal View History

2022-05-09 13:20:43 +02:00
{ description = (
"Fully automated NixOS CLI installer"
2022-05-09 13:20:43 +02:00
); inputs = {
nixpkgs = { url = "github:NixOS/nixpkgs/nixos-23.05"; };
functions = { url = "github:NiklasGollenstede/nix-functions"; inputs.nixpkgs.follows = "nixpkgs"; };
config.url = "path:./example/defaultConfig";
2022-05-09 13:20:43 +02:00
}; outputs = inputs@{ self, ... }: inputs.functions.lib.importRepo inputs ./. (repo@{ overlays, ... }: let
lib = repo.lib.__internal__;
in [ # Run »nix flake show --allow-import-from-derivation« to see what this merges to:
2022-05-09 13:20:43 +02:00
## Exports (things to reuse in other flakes):
repo # lib.* nixosModules.* overlays.*
{ patches = (lib.fun.importWrapped inputs "${self}/patches").result; } # patches.*
2022-05-09 13:20:43 +02:00
## Examples:
# The example host definitions from ./hosts/, plus their installers (apps):
(lib.self.mkSystemsFlake { inherit inputs; }) # nixosConfigurations.* apps.*-linux.* devShells.*-linux.* packages.*-linux.all-systems
# The same cross-compiled from aarch64 (just to show how that works):
(lib.self.mkSystemsFlake { inherit inputs; buildPlatform = "aarch64-linux"; renameOutputs = name: "arm:${name}"; }) # nixosConfigurations.arm:* apps.*-linux.arm:* devShells.*-linux.arm:* packages.*-linux.arm:all-systems
# Any packages touched by the ./overlays/:
(lib.fun.forEachSystem [ "aarch64-linux" "x86_64-linux" ] (localSystem: let # packages.*-linux.*
packages = lib.fun.getModifiedPackages (lib.fun.importPkgs inputs { system = localSystem; }) overlays;
in { packages = packages // { default = self.packages.${localSystem}.all-systems; }; }))
2022-05-09 13:20:43 +02:00
]); }