-
Notifications
You must be signed in to change notification settings - Fork 0
/
nixos.nix
29 lines (26 loc) · 1.04 KB
/
nixos.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ hostname ? builtins.head (builtins.match "[[:space:]]*([^[:space:]]*)[[:space:]]*" (builtins.readFile "/etc/hostname")), configuration ? builtins.getEnv "NIXOS_CONFIG", system ? builtins.currentSystem }:
let
self = (import (
let
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
in fetchTarball {
url = "https://git.lix.systems/lix-project/flake-compat/archive/${lock.nodes.${lock.nodes.${lock.root}.inputs.flake-compat}.locked.rev}.tar.gz";
sha256 = lock.nodes.${lock.nodes.${lock.root}.inputs.flake-compat}.locked.narHash;
}
)
{
# hack to skip fetchGit when evaluating impurely and get original paths
src = {
outPath = ./.;
};
}
).defaultNix;
nixosConfig = if configuration == "" then
self.nixosConfigurations.${hostname} // {
system = nixosConfig.config.system.build.toplevel;
inherit (nixosConfig.config.system.build) vm vmWithBootLoader;
}
else
import "${self.inputs.nixpkgs}/nixos" { inherit configuration system; };
in
nixosConfig