Personal-use NixOS configuration

Create local subdomain

+34 -10
+2
hosts/index/config/groupware/cells.nix
··· 10 10 { 11 11 name = "drive.encrypted.group"; 12 12 ssl = "cloudflare"; 13 + 14 + useLocal = true; 13 15 } 14 16 ]; 15 17 };
+2
hosts/index/config/language/omnipoly.nix
··· 10 10 { 11 11 name = "language.encrypted.group"; 12 12 ssl = "cloudflare"; 13 + 14 + useLocal = true; 13 15 } 14 16 ]; 15 17 };
+2
hosts/index/config/media/navidrome.nix
··· 10 10 { 11 11 name = "listen.encrypted.group"; 12 12 ssl = "cloudflare"; 13 + 14 + useLocal = true; 13 15 } 14 16 ]; 15 17 };
+2
hosts/index/config/web/forgejo.nix
··· 12 12 { 13 13 name = host; 14 14 ssl = "cloudflare"; 15 + 16 + useLocal = true; 15 17 } 16 18 ]; 17 19 };
+2
hosts/index/config/web/immich.nix
··· 12 12 { 13 13 name = host; 14 14 ssl = "cloudflare"; 15 + 16 + useLocal = true; 15 17 } 16 18 ]; 17 19 };
+2
hosts/index/config/web/miniflux.nix
··· 10 10 { 11 11 name = "feed.encrypted.group"; 12 12 ssl = "cloudflare"; 13 + 14 + useLocal = true; 13 15 } 14 16 ]; 15 17 };
-4
hosts/index/config/web/searx.nix
··· 6 6 searxModule = import (flakeRoot + /packages/server/web/searx.nix) { 7 7 hosts = [ 8 8 { 9 - name = "searx.lan"; 10 - ssl = "internal"; 11 - } 12 - { 13 9 name = host; 14 10 ssl = "cloudflare"; 15 11 }
+2
hosts/index/config/web/vaultwarden.nix
··· 12 12 { 13 13 name = host; 14 14 ssl = "cloudflare"; 15 + 16 + useLocal = true; 15 17 } 16 18 ]; 17 19 };
+2 -2
lib/default.nix
··· 1 - { nix-jetbrains-plugins, pkgs }: 1 + { nix-jetbrains-plugins, pkgs, lib }: 2 2 3 3 { 4 4 customJetbrainsPackage = import ./customJetbrainsPackage.nix { 5 5 inherit nix-jetbrains-plugins pkgs; 6 6 }; 7 7 8 - mkProxies = import ./mkProxies.nix; 8 + mkProxies = import ./mkProxies.nix { inherit lib; }; 9 9 mkUserIcon = import ./mkUserIcon.nix; 10 10 }
+13 -1
lib/mkProxies.nix
··· 1 + { lib }: 2 + 1 3 hosts: proxy: 2 4 3 5 let ··· 5 7 6 8 compressionModules = import (caddyModulesPath + /compression.nix); 7 9 sslModules = import (caddyModulesPath + /ssl.nix); 10 + 11 + insertLocalSubdomain = host: 12 + let 13 + domainLevels = lib.splitString "." host; 14 + totalLevels = (lib.length domainLevels - 2); 15 + in 16 + lib.concatStringsSep "." (lib.take totalLevels domainLevels ++ [ "local" ] ++ lib.drop totalLevels domainLevels); 8 17 in 9 18 builtins.listToAttrs ( 10 19 map (host: { 11 20 name = host.name; 21 + 12 22 value = { 23 + serverAliases = lib.optional (host.useLocal or false) (insertLocalSubdomain host.name); 24 + 13 25 extraConfig = '' 14 26 ${compressionModules.basic} 15 27 ${sslModules.${host.ssl}} ··· 18 30 ''; 19 31 }; 20 32 }) hosts 21 - ) 33 + )
+5 -3
lib/mkSystem.nix
··· 33 33 inherit system; 34 34 }; 35 35 36 + lib = inputs.nixpkgs.lib; 37 + 36 38 flakeLib = import ./default.nix { 37 - inherit pkgs; 39 + inherit pkgs lib; 38 40 39 41 nix-jetbrains-plugins = inputs.nix-jetbrains-plugins; 40 42 }; 41 43 in 42 - inputs.nixpkgs.lib.nixosSystem { 44 + lib.nixosSystem { 43 45 inherit system; 44 46 45 47 modules = [ ··· 55 57 } 56 58 ] 57 59 ++ builtins.attrValues inputs.encode42-packages.nixosModules 58 - ++ inputs.nixpkgs.lib.optional isLaptop ../hardware/laptop.nix 60 + ++ lib.optional isLaptop ../hardware/laptop.nix 59 61 ++ extraModules; 60 62 61 63 specialArgs = {