From f3415cbdf73008d2be6a0eecb9976f1f873b4ee3 Mon Sep 17 00:00:00 2001 From: Leonhard Kost Date: Fri, 13 Nov 2026 13:27:33 +0100 Subject: [PATCH] fix: fix the 10 billion mistakes made in refactoring --- home/default.nix | 12 ++++ hosts/default.nix | 8 ++- hosts/server/default.nix | 104 ++++++++++++++++--------------- hosts/server/secrets/default.nix | 8 +-- standalone/base.nix | 3 - standalone/default.nix | 1 - system/default.nix | 2 + 7 files changed, 74 insertions(+), 64 deletions(-) diff --git a/home/default.nix b/home/default.nix index 78f355a..6c020ec 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,5 +1,12 @@ +{ + lib, + osConfig ? null, + ... +}: { imports = [ + ../options.nix + ./git.nix ./firefox.nix ./fish.nix @@ -15,4 +22,9 @@ }; xdg.enable = true; + + nix-leonhard = lib.mkIf (osConfig != null) (lib.mkDefault osConfig.nix-leonhard); + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + home.stateVersion = "25.11"; } diff --git a/hosts/default.nix b/hosts/default.nix index 6469c54..b8c7ba0 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -14,17 +14,19 @@ let inherit specialArgs; modules = modules ++ [ ../system - ../options.nix inputs.home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; - home-manager.users.leonhard = ../home/default.nix; + home-manager.users.leonhard = ../home; } ]; }; in { desktop = mkNixosSystem [ ./desktop ]; - server = mkNixosSystem [ ./server ]; + server = mkNixosSystem [ + ./server + inputs.sops-nix.nixosModules.sops + ]; } diff --git a/hosts/server/default.nix b/hosts/server/default.nix index 7ebfa78..98cf43c 100644 --- a/hosts/server/default.nix +++ b/hosts/server/default.nix @@ -26,67 +26,69 @@ }; }; - nix-leonhard.graphical = false; + config = { + nix-leonhard.graphical = false; - # Intentional antipattern for information that is not - # critical but should still not be in the config - nix-leonhard.domain = builtins.readFile config.sops.secrets.domain.path; - nix-leonhard.publicKeys = builtins.readFile config.sops.secrets.domain.publicKeys; + # Intentional antipattern for information that is not + # critical but should still not be in the config + nix-leonhard.domain = builtins.readFile config.sops.secrets.domain.path; + nix-leonhard.publicKeys = builtins.readFile config.sops.secrets.domain.publicKeys.path; - users.users.leonhard = { - initialPassword = "leonhard"; - isNormalUser = true; - extraGroups = [ "wheel" ]; - openssh.authorizedKeys.keys = config.nix-leonhard.publicKeys; - }; + users.users.leonhard = { + initialPassword = "leonhard"; + isNormalUser = true; + extraGroups = [ "wheel" ]; + openssh.authorizedKeys.keys = config.nix-leonhard.publicKeys; + }; - networking = { - hostName = "server"; - firewall.enable = false; - interfaces.eno1 = { - ipv4.addresses = [ - { - address = "192.168.178.210"; - prefixLength = 24; - } + networking = { + hostName = "server"; + firewall.enable = false; + interfaces.eno1 = { + ipv4.addresses = [ + { + address = "192.168.178.210"; + prefixLength = 24; + } + ]; + }; + defaultGateway = { + address = "192.168.178.1"; + interface = "eno1"; + }; + nameservers = [ + "1.1.1.1" + "8.8.8.8" ]; }; - defaultGateway = { - address = "192.168.178.1"; - interface = "eno1"; + + services.openssh = { + enable = true; + ports = [ 5432 ]; + settings = { + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + PermitRootLogin = "no"; + }; }; - nameservers = [ - "1.1.1.1" - "8.8.8.8" - ]; - }; - services.openssh = { - enable = true; - ports = [ 5432 ]; - settings = { - PasswordAuthentication = false; - KbdInteractiveAuthentication = false; - PermitRootLogin = "no"; + security.acme = { + acceptTerms = true; + defaults.email = "admin@${config.nix-leonhard.domain}"; + defaults.webroot = "/var/lib/acme/acme-challenge/"; + certs.${config.nix-leonhard.domain} = { + group = config.services.nginx.group; + }; }; - }; - security.acme = { - acceptTerms = true; - defaults.email = "admin@${config.nix-leonhard.domain}"; - defaults.webroot = "/var/lib/acme/acme-challenge/"; - certs.${config.nix-leonhard.domain} = { - group = config.services.nginx.group; - }; - }; + services.nginx = { + enable = true; - services.nginx = { - enable = true; - - virtualHosts.${config.nix-leonhard.domain} = { - forceSSL = true; - useACMEHost = config.nix-leonhard.domain; - locations."/.well-known/".root = config.security.acme.defaults.webroot; + virtualHosts.${config.nix-leonhard.domain} = { + forceSSL = true; + useACMEHost = config.nix-leonhard.domain; + locations."/.well-known/".root = config.security.acme.defaults.webroot; + }; }; }; } diff --git a/hosts/server/secrets/default.nix b/hosts/server/secrets/default.nix index ddc7ad9..45372f0 100644 --- a/hosts/server/secrets/default.nix +++ b/hosts/server/secrets/default.nix @@ -3,10 +3,6 @@ ... }: { - imports = [ - ./secret-config.nix - ]; - sops.secrets.dyndns = { format = "dotenv"; sopsFile = ./dyndns.env; @@ -20,11 +16,11 @@ sops.secrets.domain = { format = "json"; sopsFile = ./secret-config.json; - mode = 0444; + mode = "0444"; }; sops.secrets.publicKeys = { format = "json"; sopsFile = ./secret-config.json; - mode = 0444; + mode = "0444"; }; } diff --git a/standalone/base.nix b/standalone/base.nix index 25fbe40..69f70f7 100644 --- a/standalone/base.nix +++ b/standalone/base.nix @@ -23,7 +23,4 @@ }; programs.home-manager.enable = true; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion - home.stateVersion = "25.11"; } diff --git a/standalone/default.nix b/standalone/default.nix index 14595e4..79062e3 100644 --- a/standalone/default.nix +++ b/standalone/default.nix @@ -14,7 +14,6 @@ homeManagerConfiguration { modules = [ ./base.nix ../home - ../options.nix { nix-leonhard.graphical = false; nix-leonhard.neovim.enable = true; diff --git a/system/default.nix b/system/default.nix index 4f518ab..9eca54f 100644 --- a/system/default.nix +++ b/system/default.nix @@ -4,6 +4,8 @@ }: { imports = [ + ../options.nix + ./fish.nix ./hyprland.nix ./ly.nix