Automatically set machine hostname

This commit is contained in:
Zuckerberg 2023-04-24 20:52:17 -06:00
parent 832894edfc
commit b5dd983ba3
6 changed files with 11 additions and 16 deletions

View File

@ -55,7 +55,7 @@
{
nixosConfigurations =
let
modules = system: with inputs; [
modules = system: hostname: with inputs; [
./common
simple-nixos-mailserver.nixosModule
agenix.nixosModules.default
@ -63,19 +63,23 @@
archivebox.nixosModule
nix-index-database.nixosModules.nix-index
({ lib, ... }: {
config.environment.systemPackages = [
config = {
environment.systemPackages = [
agenix.packages.${system}.agenix
];
networking.hostName = hostname;
};
# because nixos specialArgs doesn't work for containers... need to pass in inputs a different way
options.inputs = lib.mkOption { default = inputs; };
options.currentSystem = lib.mkOption { default = system; };
})
];
mkSystem = system: nixpkgs: path:
mkSystem = system: nixpkgs: path: hostname:
let
allModules = modules system;
allModules = modules system hostname;
# allow patching nixpkgs, remove this hack once this is solved: https://github.com/NixOS/nix/issues/3920
patchedNixpkgsSrc = nixpkgs.legacyPackages.${system}.applyPatches {
@ -99,7 +103,7 @@
in
nixpkgs.lib.mapAttrs
(hostname: cfg:
mkSystem cfg.arch nixpkgs cfg.configurationPath)
mkSystem cfg.arch nixpkgs cfg.configurationPath hostname)
machines;
packages =

View File

@ -5,7 +5,6 @@
./hardware-configuration.nix
];
networking.hostName = "phil";
services.gitea-runner = {
enable = true;
instanceUrl = "https://git.neet.dev";

View File

@ -5,8 +5,6 @@
./hardware-configuration.nix
];
networking.hostName = "ponyo";
system.autoUpgrade.enable = true;
# p2p mesh network

View File

@ -5,8 +5,6 @@
./hardware-configuration.nix
];
networking.hostName = "ray";
# for luks onlock over tor
services.tor.enable = true;
services.tor.client.enable = true;

View File

@ -11,8 +11,6 @@
# https://github.com/skogsbrus/os/blob/master/sys/router.nix
# http://trac.gateworks.com/wiki/wireless/wifi
networking.hostName = "router";
system.autoUpgrade.enable = true;
services.tailscale.exitNode = true;

View File

@ -5,8 +5,6 @@
./hardware-configuration.nix
];
networking.hostName = "s0";
system.autoUpgrade.enable = true;
services.iperf3.enable = true;