entrypoint.nix (799B)
1 { 2 config, 3 pkgs, 4 lib, 5 ... 6 }: let 7 vars = import ./variables.nix { inherit lib; }; 8 inherit (vars) fullname username domain email sshkey sshport timezone htpasswd vpnusername vpnpassword todosecret privatekey matrixuser matrixserver; 9 10 hostname = 11 if builtins.pathExists "/etc/hostname" 12 then lib.strings.removeSuffix "\n" (builtins.readFile "/etc/hostname") 13 else throw "Error: /etc/hostname not found. Please ensure the hostname is set before rebuild."; 14 15 machine = lib.strings.removeSuffix "\n" hostname; 16 osConfigPath = ./machines + "/${machine}.nix"; 17 in { 18 imports = [ 19 (import osConfigPath { inherit config pkgs lib fullname username domain email sshkey sshport timezone htpasswd vpnusername vpnpassword todosecret privatekey machine matrixuser matrixserver ; }) 20 ]; 21 }