From 0e092d427bb8bfb5d5eeae89477e67323fcbdc72 Mon Sep 17 00:00:00 2001
From: Manuel Thalmann <m@nuth.ch>
Date: Sat, 11 May 2024 19:53:58 +0200
Subject: [PATCH] Replace `hostname` variable with `machineInfo`

---
 flake.nix             | 3 ---
 lib/configuration.nix | 5 +++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/flake.nix b/flake.nix
index 0b84f13..207195c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -88,8 +88,6 @@
                   (
                     { pkgs, ... }: {
                       config._module.args = {
-                        inherit hostname;
-
                         machineInfo = machine // {
                           name = hostname;
                           config = (pkgs.callPackage config { });
@@ -139,7 +137,6 @@
 
                                   inherit
                                     machineConfig
-                                    hostname
                                     username
                                   ;
 
diff --git a/lib/configuration.nix b/lib/configuration.nix
index 02327b7..2fa3690 100644
--- a/lib/configuration.nix
+++ b/lib/configuration.nix
@@ -1,4 +1,4 @@
-{ hostname, lib, machineConfig, ... }: {
+{ lib, machineConfig, machineInfo, ... }: {
   imports = [
     ./modules/custom-build-vm.nix
     ./modules/custom-sops-nix.nix
@@ -37,6 +37,7 @@
       users =
         lib.attrsets.concatMapAttrs (username: user:
           let
+            hostname = machineInfo.name;
             getUserConfig = import ./utils/user-config.nix { inherit lib; };
             configPath = getUserConfig { inherit hostname username; };
           in
@@ -53,7 +54,7 @@
     };
 
     # Networking
-    networking.hostName = hostname;
+    networking.hostName = machineInfo.name;
 
     # Set time zone
     time.timeZone = machineConfig.timeZone;