Explorar el Código

Start transition of home lab to nixos

Johan Rong hace 1 mes
padre
commit
2dd2c562cb
Se han modificado 4 ficheros con 42 adiciones y 1 borrados
  1. 1 1
      config/hosts.nix
  2. 1 0
      config/users.nix
  3. 25 0
      hosts/moholt/nixos/default.nix
  4. 15 0
      nixos/profiles/server/default.nix

+ 1 - 1
config/hosts.nix

@@ -18,6 +18,6 @@ in
     hostname = "moholt";
     dir = "moholt";
     arch = "x86_64-linux";
-    user = users.default; 
+    user = users.vaktmester; 
   };
 }

+ 1 - 0
config/users.nix

@@ -1,3 +1,4 @@
 {
   default = "johron";
+  server = "vaktmester";
 }

+ 25 - 0
hosts/moholt/nixos/default.nix

@@ -0,0 +1,25 @@
+{ config, pkgs, lib, ... }:
+
+let 
+  hosts = import ../../../config/hosts.nix;
+in
+{
+  imports = [
+    ./hardware.nix
+
+    ../../../nixos/modules/system/nixos-base.nix
+    ../../../nixos/profiles/server
+
+    ../../../nixos/modules/hardware/networking/server.nix
+
+    ../../../nixos/modules/server/docker
+    ../../../nixos/modules/server/docker/containers/navidrome.nix
+    ../../../nixos/modules/server/docker/containers/gogs.nix
+  ];
+
+  interfaces.eth0.ipv4.addresses = [{
+    address = "192.168.1.150";
+  }];
+
+  networking.hostName = hosts.moholt.hostname;
+}

+ 15 - 0
nixos/profiles/server/default.nix

@@ -0,0 +1,15 @@
+{ config, pkgs, lib, inputs, ... }:
+
+{
+  services.logind.extraConfig = ''
+    LidSwitchIgnoreInhibit=no
+    HandleLidSwitch=ignore
+    HandleLidSwitchExternalPower=ignore
+    HandleLidSwitchDocked=ignore
+  '';
+
+  systemd.targets.sleep.enable = false;
+  systemd.targets.suspend.enable = false;
+  systemd.targets.hibernate.enable = false;
+  systemd.targets.hybrid-sleep.enable = false;
+}