index — nix @ 97205946f9b8afb441759d728239cd6519fa1d3a

My first nix server; runs a minecraft server

structure: create separate modules
crispy-caesus crispy@crispy-caesus.eu
Sun, 12 Apr 2026 20:59:36 +0200
commit

97205946f9b8afb441759d728239cd6519fa1d3a

parent

7bb5e17f9e1ecb48271aa1e67ecddbe535bba305

5 files changed, 70 insertions(+), 56 deletions(-)

jump to
M configuration.nixconfiguration.nix

@@ -4,6 +4,10 @@ {

imports = [ ./hardware-configuration.nix + ./modules/wireguard.nix + ./modules/server.nix + ./modules/git.nix + ./modules/gpg.nix ]; boot.loader.systemd-boot.enable = true;

@@ -22,28 +26,6 @@ enable = true;

pulse.enable = true; }; - services.logind.settings.Login = { - HandleLidSwitch = "ignore"; - HandleLidSwitchDocked = "ignore"; - HandleLidSwitchExternalPower = "ignore"; - - HandlePowerKey = "ignore"; - HandleRebootKey = "ignore"; - HandleSuspendKey = "ignore"; - HandleHibernateKey = "ignore"; - }; - - systemd.services.foo = { - enable = true; - script = '' - echo "0" > /sys/class/backlight/nv_backlight/brightness - ''; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - Restart = "on-failure"; - RestartSec = "3"; - }; - }; # Enable touchpad support (enabled default in most desktopManager). services.libinput.enable = true;

@@ -66,40 +48,6 @@ microfetch

gdu age ]; - - programs.gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - - age.secrets.wg0-key = { - file = ./secrets/wg0-key.age; - }; - - networking.wg-quick.interfaces = { - wg0 = { - address = ["10.0.0.18/32"]; - privateKeyFile = config.age.secrets.wg0-key.path; - peers = [ - { - endpoint = "202.61.203.128:51820"; - publicKey = "dGeLAqZD81XYcZQBJ5SELiUGh7hD//G+o1rahSpxY0s="; - allowedIPs = [ "10.0.0.1/32" "10.0.0.6/32" ]; - persistentKeepalive = 25; - } - ]; - }; - }; - - programs.git = { - enable = true; - config = { - user = { - email = "crispy@crispy-caesus.eu"; - name = "crispy-caesus"; - }; - }; - }; services.openssh.enable = true;
A modules/git.nix

@@ -0,0 +1,12 @@

+{config, pkgs, ...}: +{ + programs.git = { + enable = true; + config = { + user = { + email = "crispy@crispy-caesus.eu"; + name = "crispy-caesus"; + }; + }; + }; +}
A modules/gpg.nix

@@ -0,0 +1,7 @@

+{config, pkgs, ...}: +{ + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; +}
A modules/server.nix

@@ -0,0 +1,25 @@

+{config, pkgs, ...}: +{ + services.logind.settings.Login = { + HandleLidSwitch = "ignore"; + HandleLidSwitchDocked = "ignore"; + HandleLidSwitchExternalPower = "ignore"; + + HandlePowerKey = "ignore"; + HandleRebootKey = "ignore"; + HandleSuspendKey = "ignore"; + HandleHibernateKey = "ignore"; + }; + + systemd.services.foo = { + enable = true; + script = '' + echo "0" > /sys/class/backlight/nv_backlight/brightness + ''; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Restart = "on-failure"; + RestartSec = "3"; + }; + }; +}
A modules/wireguard.nix

@@ -0,0 +1,22 @@

+{ config, pkgs, ...}: +{ + + age.secrets.wg0-key = { + file = ../secrets/wg0-key.age; + }; + + networking.wg-quick.interfaces = { + wg0 = { + address = ["10.0.0.18/32"]; + privateKeyFile = config.age.secrets.wg0-key.path; + peers = [ + { + endpoint = "202.61.203.128:51820"; + publicKey = "dGeLAqZD81XYcZQBJ5SELiUGh7hD//G+o1rahSpxY0s="; + allowedIPs = [ "10.0.0.1/32" "10.0.0.6/32" "10.0.0.19/32"]; + persistentKeepalive = 25; + } + ]; + }; + }; +}