entrypoint.nix (1073B)
1 { 2 config, 3 pkgs, 4 lib, 5 ... 6 }: let 7 fullname = "Peter"; 8 username = lib.strings.toLower fullname; 9 domain = "minskio.co.uk"; 10 email = "${username}@${domain}"; 11 sshkey = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCXdHG4d/CoCbS1mp7cg+/3qS8nI4bvp7nvU5BZdkzseOt1NerZ4rgdQLBiFGiEi4LPMOQxBGXe7uuskn3TCc2C/DkZH/+AdYQ5MDXRbRqta/0oS8XVTzWcBtluaHc6qsuF6MkSU853ZWVgzlYimfSkjkwvrMT38WkkauC9U4VoqODVLQe5sivR/2INHctNfj0dYuyvPRUhAiuTrha0cKrS7xkOIf4a9gQgunU4+cmyb1HPt6KmNMzuZ/nhsqVWf6h/v0oBTg8p+aestfpg2fTAlY8Za8t/ZOqpF1TeWqUB+1AXEoQHNw2bezzKwCyX39cvjTeE5EWKl7oXalq91J39 ssh-key-2022-02-16"; 12 hostname = 13 if builtins.pathExists "/etc/hostname" 14 then lib.strings.removeSuffix "\n" (builtins.readFile "/etc/hostname") 15 else throw "Error: /etc/hostname not found. Please ensure the hostname is set before rebuild."; 16 machine = lib.strings.removeSuffix "\n" hostname; 17 osConfigPath = ./machines + "/${machine}.nix"; 18 in { 19 imports = [ 20 (import osConfigPath {inherit config pkgs lib fullname machine username domain email sshkey;}) 21 ]; 22 23 networking.hostName = machine; 24 }