forked from Drift/pvv-nixos-config
		
	Compare commits
	
		
			92 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 74b770545e | |||
| 71479d5ca0 | |||
| cf01792269 | |||
| afae0da0b6 | |||
| 35d745b156 | |||
| 218ee776c7 | |||
| 3a972f03f7 | |||
| 96024efa28 | |||
| af54cc2df4 | |||
| 6f6721ce07 | |||
| 1c35da0295 | |||
| 5fb1b805a8 | |||
| a38a12c429 | |||
| 898e362a9f | |||
| c267820426 | |||
| a57b5f07f9 | |||
| bcf2ceed32 | |||
| 0a3d1e3696 | |||
| 45eea1a791 | |||
| 200224d2c1 | |||
| dcf29b76b8 | |||
| 55e8f01d1d | |||
| b7b1c73bfa | |||
| 19d5ddc688 | |||
| 6851879a03 | |||
| 70603145cf | |||
| 1e4195ea9d | |||
| ee335e3712 | |||
| ffbf855f24 | |||
| 28e7a63d33 | |||
| 01f0e63a49 | |||
| ae4ace9fa2 | |||
| 8c72088d9c | |||
| 0056029da7 | |||
| 9b4fbd847f | |||
| 5bed292a01 | |||
| 36b7087a3f | |||
| 1919da7a1c | |||
| 0950fedf98 | |||
| 614c2d624c | |||
| 3352e48f47 | |||
| db211c2304 | |||
| 4f322ec0b1 | |||
| 79bf307ef2 | |||
| 4d50efc6db | |||
| 145a840a2c | |||
| 2bbc851e0e | |||
| 9577477460 | |||
| fc19a8f1e1 | |||
| 8657e77514 | |||
| 03c9638098 | |||
| 065992620e | |||
| e22c7d5b4d | |||
| 4fcc1fd5e9 | |||
| 05a1f049dc | |||
| fbbc54328b | |||
| d8e13ff67c | |||
| 42fd371c3b | |||
| f25a4e5c02 | |||
| 6e1b06731f | |||
| 161ef284be | |||
| 2cb7e06369 | |||
| a55c908fe7 | |||
| 06bd93e5d1 | |||
| d531419f35 | |||
| 806b18ede8 | |||
| c612975b60 | |||
| 9495682f57 | |||
| d39047b8cb | |||
| 266ce9ed08 | |||
| 07c480d004 | |||
| 64c7e3e365 | |||
| fe4dd21acb | |||
| 0336744124 | |||
| b4d6e00622 | |||
| 7c6d4d31c7 | |||
| 9f46be1ca1 | |||
| 545583cf04 | |||
| 62b269637a | |||
| 7fd9a1e646 | |||
| 4ea90380ad | |||
| bcd5292f78 | |||
| 1ab1b3a84e | |||
| 80ef1ce4fa | |||
| 2b834eee14 | |||
| 9ed2ca8883 | |||
| fe12e5441a | |||
| 2b305678df | |||
| dd8b677a79 | |||
| eabd8df3d8 | |||
| 8a0ebe761e | |||
| 0b5e03471f | 
| @@ -3,10 +3,11 @@ keys: | ||||
|   - &user_danio age17tagmpwqjk3mdy45rfesrfey6h863x8wfq38wh33tkrlrywxducs0k6tpq | ||||
|   - &user_felixalb age1mrnldl334l2nszuta6ywvewng0fswv2dz9l5g4qcwe3nj4yxf92qjskdx6 | ||||
|   - &user_oysteikt F7D37890228A907440E1FD4846B9228E814A2AAC | ||||
|   - &user_eirikwit age1ju7rd26llahz3g8tz7cy5ld52swj8gsmg0flrmrxngc0nj0avq3ssh0sn5 | ||||
|  | ||||
|   # Hosts | ||||
|   - &host_jokum age1gp8ye4g2mmw3may5xg0zsy7mm04glfz3788mmdx9cvcsdxs9hg0s0cc9kt | ||||
|   - &host_ildkule age1hn45n46ypyrvypv0mwfnpt9ddrlmw34dwlpf33n8v67jexr3lucq6ahc9x | ||||
|   - &host_ildkule age1x28hmzvuv6f2n66c0jtqcca3h9rput8d7j5uek6jcpx8n9egd52sqpejq0 | ||||
|   - &host_bekkalokk age12nj59tguy9wg882updc2vjdusx5srnxmjyfaqve4zx6jnnsaw3qsyjq6zd | ||||
|   - &host_bicep age1sl43gc9cw939z5tgha2lpwf0xxxgcnlw7w4xem4sqgmt2pt264vq0dmwx2 | ||||
|  | ||||
| @@ -18,6 +19,7 @@ creation_rules: | ||||
|       - *host_jokum | ||||
|       - *user_danio | ||||
|       - *user_felixalb | ||||
|       - *user_eirikwit | ||||
|       pgp: | ||||
|       - *user_oysteikt | ||||
|  | ||||
|   | ||||
							
								
								
									
										48
									
								
								base.nix
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								base.nix
									
									
									
									
									
								
							| @@ -3,6 +3,7 @@ | ||||
| { | ||||
|   imports = [ | ||||
|     ./users | ||||
|     ./modules/snakeoil-certs.nix | ||||
|   ]; | ||||
|  | ||||
|   networking.domain = "pvv.ntnu.no"; | ||||
| @@ -58,6 +59,7 @@ | ||||
|     gnupg | ||||
|     htop | ||||
|     nano | ||||
|     ripgrep | ||||
|     rsync | ||||
|     screen | ||||
|     tmux | ||||
| @@ -65,6 +67,7 @@ | ||||
|     wget | ||||
|  | ||||
|     kitty.terminfo | ||||
|     foot.terminfo | ||||
|   ]; | ||||
|  | ||||
|   programs.zsh.enable = true; | ||||
| @@ -82,5 +85,50 @@ | ||||
|     settings.PermitRootLogin = "yes"; | ||||
|   }; | ||||
|  | ||||
|   # nginx return 444 for all nonexistent virtualhosts | ||||
|  | ||||
|   systemd.services.nginx.after = [ "generate-snakeoil-certs.service" ]; | ||||
|  | ||||
|   environment.snakeoil-certs = lib.mkIf config.services.nginx.enable { | ||||
|     "/etc/certs/nginx" = { | ||||
|       owner = "nginx"; | ||||
|       group = "nginx"; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   services.nginx = { | ||||
|     recommendedTlsSettings = true; | ||||
|     recommendedProxySettings = true; | ||||
|     recommendedOptimisation = true; | ||||
|     recommendedGzipSettings = true; | ||||
|  | ||||
|     appendConfig = '' | ||||
|       pcre_jit on; | ||||
|       worker_processes auto; | ||||
|       worker_rlimit_nofile 100000; | ||||
|     ''; | ||||
|     eventsConfig = '' | ||||
|       worker_connections 2048; | ||||
|       use epoll; | ||||
|       multi_accept on; | ||||
|     ''; | ||||
|   }; | ||||
|  | ||||
|   systemd.services.nginx.serviceConfig = lib.mkIf config.services.nginx.enable { | ||||
|     LimitNOFILE = 65536; | ||||
|   }; | ||||
|  | ||||
|   services.nginx.virtualHosts."_" = lib.mkIf config.services.nginx.enable { | ||||
|     sslCertificate = "/etc/certs/nginx.crt"; | ||||
|     sslCertificateKey = "/etc/certs/nginx.key"; | ||||
|     addSSL = true; | ||||
|     extraConfig = "return 444;"; | ||||
|   }; | ||||
|  | ||||
|   networking.firewall.allowedTCPPorts = lib.mkIf config.services.nginx.enable [ 80 443 ]; | ||||
|  | ||||
|   security.acme = { | ||||
|     acceptTerms = true; | ||||
|     defaults.email = "drift@pvv.ntnu.no"; | ||||
|   }; | ||||
| } | ||||
|   | ||||
							
								
								
									
										169
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										169
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							| @@ -7,11 +7,11 @@ | ||||
|         ] | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1700927249, | ||||
|         "narHash": "sha256-iqmIWiEng890/ru7ZBf4nUezFPyRm2fjRTvuwwxqk2o=", | ||||
|         "lastModified": 1715445235, | ||||
|         "narHash": "sha256-SUu+oIWn+xqQIOlwfwNfS9Sek4i1HKsrLJchsDReXwA=", | ||||
|         "owner": "nix-community", | ||||
|         "repo": "disko", | ||||
|         "rev": "3cb78c93e6a02f494aaf6aeb37481c27a2e2ee22", | ||||
|         "rev": "159d87ea5b95bbdea46f0288a33c5e1570272725", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
| @@ -20,18 +20,58 @@ | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "fix-python": { | ||||
|       "inputs": { | ||||
|         "flake-utils": "flake-utils", | ||||
|         "nixpkgs": [ | ||||
|           "grzegorz", | ||||
|           "nixpkgs" | ||||
|         ] | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1713887124, | ||||
|         "narHash": "sha256-hGTSm0p9xXUYDgsAAr/ORZICo6T6u33vLfX3tILikaQ=", | ||||
|         "owner": "GuillaumeDesforges", | ||||
|         "repo": "fix-python", | ||||
|         "rev": "f7f4b33e22414071fc1f9cbf68072c413c3a7fdf", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "GuillaumeDesforges", | ||||
|         "repo": "fix-python", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "flake-utils": { | ||||
|       "inputs": { | ||||
|         "systems": "systems" | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1689068808, | ||||
|         "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", | ||||
|         "owner": "numtide", | ||||
|         "repo": "flake-utils", | ||||
|         "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "id": "flake-utils", | ||||
|         "type": "indirect" | ||||
|       } | ||||
|     }, | ||||
|     "grzegorz": { | ||||
|       "inputs": { | ||||
|         "fix-python": "fix-python", | ||||
|         "nixpkgs": [ | ||||
|           "nixpkgs-unstable" | ||||
|         ] | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1696346665, | ||||
|         "narHash": "sha256-J6Tf6a/zhFZ8SereluHLrvgPsIVm2CGHHA8wrbhZB3Y=", | ||||
|         "lastModified": 1715364232, | ||||
|         "narHash": "sha256-ZJC3SkanEgbV7p+LFhP+85CviRWOXJNHzZwR/Stb7hE=", | ||||
|         "owner": "Programvareverkstedet", | ||||
|         "repo": "grzegorz", | ||||
|         "rev": "9b9c3ac7d408ac7c6d67544b201e6b169afacb03", | ||||
|         "rev": "3841cda1cdcac470440b06838d56a2eb2256378c", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
| @@ -47,11 +87,11 @@ | ||||
|         ] | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1693864994, | ||||
|         "narHash": "sha256-oLDiWdCKDtEfeGzfAuDTq+n9VWp6JCo67PEESEZ3y8E=", | ||||
|         "lastModified": 1715384651, | ||||
|         "narHash": "sha256-7RhckgUTjqeCjWkhiCc1iB+5CBx9fl80d/3O4Jh+5kM=", | ||||
|         "owner": "Programvareverkstedet", | ||||
|         "repo": "grzegorz-clients", | ||||
|         "rev": "a38a0b0fb31ad0ad78a91458cb2c7f77f686468f", | ||||
|         "rev": "738a4f3dd887f7c3612e4e772b83cbfa3cde5693", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
| @@ -62,76 +102,82 @@ | ||||
|     }, | ||||
|     "matrix-next": { | ||||
|       "inputs": { | ||||
|         "nixpkgs-lib": "nixpkgs-lib" | ||||
|         "nixpkgs": [ | ||||
|           "nixpkgs" | ||||
|         ] | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1697936579, | ||||
|         "narHash": "sha256-nMyepKnwoHMzu2OpXvG2ZhU081TV9ENmWCo0vWxs6AI=", | ||||
|         "lastModified": 1710311999, | ||||
|         "narHash": "sha256-s0pT1NyrMgeolUojXXcnXQDymN7m80GTF7itCv0ZH20=", | ||||
|         "owner": "dali99", | ||||
|         "repo": "nixos-matrix-modules", | ||||
|         "rev": "e09814657187c8ed1a5fe1646df6d8da1eb2dee9", | ||||
|         "rev": "6c9b67974b839740e2a738958512c7a704481157", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "dali99", | ||||
|         "repo": "nixos-matrix-modules", | ||||
|         "rev": "e09814657187c8ed1a5fe1646df6d8da1eb2dee9", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "nix-gitea-themes": { | ||||
|       "inputs": { | ||||
|         "nixpkgs": [ | ||||
|           "nixpkgs" | ||||
|         ] | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1714416973, | ||||
|         "narHash": "sha256-aZUcvXjdETUC6wVQpWDVjLUzwpDAEca8yR0ITDeK39o=", | ||||
|         "ref": "refs/heads/main", | ||||
|         "rev": "2b23c0ba8aae68d3cb6789f0f6e4891cef26cc6d", | ||||
|         "revCount": 6, | ||||
|         "type": "git", | ||||
|         "url": "https://git.pvv.ntnu.no/oysteikt/nix-gitea-themes.git" | ||||
|       }, | ||||
|       "original": { | ||||
|         "type": "git", | ||||
|         "url": "https://git.pvv.ntnu.no/oysteikt/nix-gitea-themes.git" | ||||
|       } | ||||
|     }, | ||||
|     "nixpkgs": { | ||||
|       "locked": { | ||||
|         "lastModified": 1701362232, | ||||
|         "narHash": "sha256-GVdzxL0lhEadqs3hfRLuj+L1OJFGiL/L7gCcelgBlsw=", | ||||
|         "lastModified": 1715410392, | ||||
|         "narHash": "sha256-ltp1jQps9tym0uWNl/lTniHSQngCtNIyzlymu+ZSyts=", | ||||
|         "owner": "NixOS", | ||||
|         "repo": "nixpkgs", | ||||
|         "rev": "d2332963662edffacfddfad59ff4f709dde80ffe", | ||||
|         "rev": "9f8bf7503bd85d5208575f4bd81c8b1fc999a468", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "id": "nixpkgs", | ||||
|         "ref": "nixos-23.05-small", | ||||
|         "ref": "nixos-23.11-small", | ||||
|         "type": "indirect" | ||||
|       } | ||||
|     }, | ||||
|     "nixpkgs-lib": { | ||||
|       "locked": { | ||||
|         "lastModified": 1673743903, | ||||
|         "narHash": "sha256-sloY6KYyVOozJ1CkbgJPpZ99TKIjIvM+04V48C04sMQ=", | ||||
|         "owner": "nix-community", | ||||
|         "repo": "nixpkgs.lib", | ||||
|         "rev": "7555e2dfcbac1533f047021f1744ac8871150f9f", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "nix-community", | ||||
|         "repo": "nixpkgs.lib", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "nixpkgs-stable": { | ||||
|       "locked": { | ||||
|         "lastModified": 1700905716, | ||||
|         "narHash": "sha256-w1vHn2MbGfdC+CrP3xLZ3scsI06N0iQLU7eTHIVEFGw=", | ||||
|         "lastModified": 1714858427, | ||||
|         "narHash": "sha256-tCxeDP4C1pWe2rYY3IIhdA40Ujz32Ufd4tcrHPSKx2M=", | ||||
|         "owner": "NixOS", | ||||
|         "repo": "nixpkgs", | ||||
|         "rev": "dfb95385d21475da10b63da74ae96d89ab352431", | ||||
|         "rev": "b980b91038fc4b09067ef97bbe5ad07eecca1e76", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "NixOS", | ||||
|         "ref": "release-23.05", | ||||
|         "ref": "release-23.11", | ||||
|         "repo": "nixpkgs", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "nixpkgs-unstable": { | ||||
|       "locked": { | ||||
|         "lastModified": 1701368325, | ||||
|         "narHash": "sha256-3OqZyi2EdopJxpxwrySPyCTuCvfBY4oXTLVgQ4B6qDg=", | ||||
|         "lastModified": 1715435713, | ||||
|         "narHash": "sha256-lb2HqDQGfTdnCCpc1pgF6fkdgIOuBQ0nP8jjVSfLFqg=", | ||||
|         "owner": "NixOS", | ||||
|         "repo": "nixpkgs", | ||||
|         "rev": "3934dbde4f4a0e266825348bc4ad1bdd00a8d6a3", | ||||
|         "rev": "52b40f6c4be12742b1504ca2eb4527e597bf2526", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
| @@ -160,15 +206,37 @@ | ||||
|         "url": "https://git.pvv.ntnu.no/Projects/calendar-bot.git" | ||||
|       } | ||||
|     }, | ||||
|     "pvv-nettsiden": { | ||||
|       "inputs": { | ||||
|         "nixpkgs": [ | ||||
|           "nixpkgs" | ||||
|         ] | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1716150352, | ||||
|         "narHash": "sha256-c13lzYbLmbrcbEdPTYZYtlX2Qsz1W+2sLsIMGShPgwo=", | ||||
|         "ref": "refs/heads/master", | ||||
|         "rev": "2cab4df4b119e08a1f90ea1c944652cd78b4d478", | ||||
|         "revCount": 459, | ||||
|         "type": "git", | ||||
|         "url": "https://git.pvv.ntnu.no/Projects/nettsiden.git" | ||||
|       }, | ||||
|       "original": { | ||||
|         "type": "git", | ||||
|         "url": "https://git.pvv.ntnu.no/Projects/nettsiden.git" | ||||
|       } | ||||
|     }, | ||||
|     "root": { | ||||
|       "inputs": { | ||||
|         "disko": "disko", | ||||
|         "grzegorz": "grzegorz", | ||||
|         "grzegorz-clients": "grzegorz-clients", | ||||
|         "matrix-next": "matrix-next", | ||||
|         "nix-gitea-themes": "nix-gitea-themes", | ||||
|         "nixpkgs": "nixpkgs", | ||||
|         "nixpkgs-unstable": "nixpkgs-unstable", | ||||
|         "pvv-calendar-bot": "pvv-calendar-bot", | ||||
|         "pvv-nettsiden": "pvv-nettsiden", | ||||
|         "sops-nix": "sops-nix" | ||||
|       } | ||||
|     }, | ||||
| @@ -180,11 +248,11 @@ | ||||
|         "nixpkgs-stable": "nixpkgs-stable" | ||||
|       }, | ||||
|       "locked": { | ||||
|         "lastModified": 1701127353, | ||||
|         "narHash": "sha256-qVNX0wOl0b7+I35aRu78xUphOyELh+mtUp1KBx89K1Q=", | ||||
|         "lastModified": 1715244550, | ||||
|         "narHash": "sha256-ffOZL3eaZz5Y1nQ9muC36wBCWwS1hSRLhUzlA9hV2oI=", | ||||
|         "owner": "Mic92", | ||||
|         "repo": "sops-nix", | ||||
|         "rev": "b1edbf5c0464b4cced90a3ba6f999e671f0af631", | ||||
|         "rev": "0dc50257c00ee3c65fef3a255f6564cfbfe6eb7f", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
| @@ -192,6 +260,21 @@ | ||||
|         "repo": "sops-nix", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "systems": { | ||||
|       "locked": { | ||||
|         "lastModified": 1681028828, | ||||
|         "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", | ||||
|         "owner": "nix-systems", | ||||
|         "repo": "default", | ||||
|         "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "nix-systems", | ||||
|         "repo": "default", | ||||
|         "type": "github" | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   "root": "root", | ||||
|   | ||||
							
								
								
									
										77
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										77
									
								
								flake.nix
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ | ||||
|   description = "PVV System flake"; | ||||
|  | ||||
|   inputs = { | ||||
|     nixpkgs.url = "nixpkgs/nixos-23.05-small"; | ||||
|     nixpkgs.url = "nixpkgs/nixos-23.11-small"; | ||||
|     nixpkgs-unstable.url = "nixpkgs/nixos-unstable-small"; | ||||
|  | ||||
|     sops-nix.url = "github:Mic92/sops-nix"; | ||||
| @@ -11,11 +11,17 @@ | ||||
|     disko.url = "github:nix-community/disko"; | ||||
|     disko.inputs.nixpkgs.follows = "nixpkgs"; | ||||
|  | ||||
|     pvv-nettsiden.url = "git+https://git.pvv.ntnu.no/Projects/nettsiden.git"; | ||||
|     pvv-nettsiden.inputs.nixpkgs.follows = "nixpkgs"; | ||||
|  | ||||
|     pvv-calendar-bot.url = "git+https://git.pvv.ntnu.no/Projects/calendar-bot.git"; | ||||
|     pvv-calendar-bot.inputs.nixpkgs.follows = "nixpkgs"; | ||||
|  | ||||
|     # Last release compatible with 23.05 | ||||
|     matrix-next.url = "github:dali99/nixos-matrix-modules/e09814657187c8ed1a5fe1646df6d8da1eb2dee9"; | ||||
|     matrix-next.url = "github:dali99/nixos-matrix-modules"; | ||||
|     matrix-next.inputs.nixpkgs.follows = "nixpkgs"; | ||||
|  | ||||
|     nix-gitea-themes.url = "git+https://git.pvv.ntnu.no/oysteikt/nix-gitea-themes.git"; | ||||
|     nix-gitea-themes.inputs.nixpkgs.follows = "nixpkgs"; | ||||
|  | ||||
|     grzegorz.url = "github:Programvareverkstedet/grzegorz"; | ||||
|     grzegorz.inputs.nixpkgs.follows = "nixpkgs-unstable"; | ||||
| @@ -23,7 +29,7 @@ | ||||
|     grzegorz-clients.inputs.nixpkgs.follows = "nixpkgs"; | ||||
|   }; | ||||
|  | ||||
|   outputs = { self, nixpkgs, nixpkgs-unstable, sops-nix, disko, ... }@inputs: | ||||
|   outputs = { self, nixpkgs, nixpkgs-unstable, pvv-nettsiden, sops-nix, disko, ... }@inputs: | ||||
|   let | ||||
|     nixlib = nixpkgs.lib; | ||||
|     systems = [ | ||||
| @@ -42,6 +48,7 @@ | ||||
|     ]; | ||||
|   in { | ||||
|     nixosConfigurations = let | ||||
|       unstablePkgs = nixpkgs-unstable.legacyPackages.x86_64-linux; | ||||
|       nixosConfig = nixpkgs: name: config: nixpkgs.lib.nixosSystem (nixpkgs.lib.recursiveUpdate | ||||
|         rec { | ||||
|           system = "x86_64-linux"; | ||||
| @@ -53,19 +60,16 @@ | ||||
|           modules = [ | ||||
|             ./hosts/${name}/configuration.nix | ||||
|             sops-nix.nixosModules.sops | ||||
|           ]; | ||||
|           ] ++ config.modules or []; | ||||
|  | ||||
|           pkgs = import nixpkgs { | ||||
|             inherit system; | ||||
|             overlays = [ | ||||
|               (final: prev: { | ||||
|                 mx-puppet-discord = prev.mx-puppet-discord.override { nodejs_14 = final.nodejs_18; }; | ||||
|               }) | ||||
|               inputs.pvv-calendar-bot.overlays.${system}.default | ||||
|             ]; | ||||
|               # Global overlays go here | ||||
|             ] ++ config.overlays or [ ]; | ||||
|           }; | ||||
|         } | ||||
|         config | ||||
|         (removeAttrs config [ "modules" "overlays" ]) | ||||
|       ); | ||||
|  | ||||
|       stableNixosConfig = nixosConfig nixpkgs; | ||||
| @@ -73,19 +77,30 @@ | ||||
|     in { | ||||
|       bicep = stableNixosConfig "bicep" { | ||||
|         modules = [ | ||||
|           ./hosts/bicep/configuration.nix | ||||
|           sops-nix.nixosModules.sops | ||||
|  | ||||
|           inputs.matrix-next.nixosModules.default | ||||
|           inputs.pvv-calendar-bot.nixosModules.default | ||||
|         ]; | ||||
|         overlays = [ | ||||
|           inputs.pvv-calendar-bot.overlays.x86_64-linux.default | ||||
|         ]; | ||||
|       }; | ||||
|       bekkalokk = stableNixosConfig "bekkalokk" { | ||||
|         overlays = [ | ||||
|           (final: prev: { | ||||
|             heimdal = unstablePkgs.heimdal; | ||||
|             mediawiki-extensions = final.callPackage ./packages/mediawiki-extensions { }; | ||||
|             simplesamlphp = final.callPackage ./packages/simplesamlphp { }; | ||||
|           }) | ||||
|           inputs.nix-gitea-themes.overlays.default | ||||
|           inputs.pvv-nettsiden.overlays.default | ||||
|         ]; | ||||
|         modules = [ | ||||
|           inputs.nix-gitea-themes.nixosModules.default | ||||
|           inputs.pvv-nettsiden.nixosModules.default | ||||
|         ]; | ||||
|       }; | ||||
|       bekkalokk = stableNixosConfig "bekkalokk" { }; | ||||
|       bob = stableNixosConfig "bob" { | ||||
|         modules = [ | ||||
|           ./hosts/bob/configuration.nix | ||||
|           sops-nix.nixosModules.sops | ||||
|  | ||||
|           disko.nixosModules.disko | ||||
|           { disko.devices.disk.disk1.device = "/dev/vda"; } | ||||
|         ]; | ||||
| @@ -93,31 +108,22 @@ | ||||
|       ildkule = stableNixosConfig "ildkule" { }; | ||||
|       #ildkule-unstable = unstableNixosConfig "ildkule" { }; | ||||
|       shark = stableNixosConfig "shark" { }; | ||||
|        | ||||
|       elysium = stableNixosConfig "elysium" { }; | ||||
|  | ||||
|       brzeczyszczykiewicz = stableNixosConfig "brzeczyszczykiewicz" { | ||||
|         modules = [ | ||||
|           ./hosts/brzeczyszczykiewicz/configuration.nix | ||||
|           sops-nix.nixosModules.sops | ||||
|  | ||||
|           inputs.grzegorz.nixosModules.grzegorz-kiosk | ||||
|           inputs.grzegorz-clients.nixosModules.grzegorz-webui | ||||
|         ]; | ||||
|       }; | ||||
|       georg = stableNixosConfig "georg" { | ||||
|         modules = [ | ||||
|           ./hosts/georg/configuration.nix | ||||
|           sops-nix.nixosModules.sops | ||||
|  | ||||
|           inputs.grzegorz.nixosModules.grzegorz-kiosk | ||||
|           inputs.grzegorz-clients.nixosModules.grzegorz-webui | ||||
|         ]; | ||||
|       }; | ||||
|       buskerud = stableNixosConfig "buskerud" { | ||||
|         modules = [ | ||||
|           ./hosts/buskerud/configuration.nix | ||||
|           sops-nix.nixosModules.sops | ||||
|         ]; | ||||
|       }; | ||||
|       buskerud = stableNixosConfig "buskerud" { }; | ||||
|     }; | ||||
|  | ||||
|     devShells = forAllSystems (system: { | ||||
| @@ -133,7 +139,16 @@ | ||||
|           (nixlib.getAttrs importantMachines self.packages.x86_64-linux); | ||||
|         all-machines = pkgs.linkFarm "all-machines" | ||||
|           (nixlib.getAttrs allMachines self.packages.x86_64-linux); | ||||
|       } // nixlib.genAttrs allMachines | ||||
|  | ||||
|         simplesamlphp = pkgs.callPackage ./packages/simplesamlphp { }; | ||||
|  | ||||
|       } // | ||||
|       (nixlib.pipe null [ | ||||
|         (_: pkgs.callPackage ./packages/mediawiki-extensions { }) | ||||
|         (nixlib.flip builtins.removeAttrs ["override" "overrideDerivation"]) | ||||
|         (nixlib.mapAttrs' (name: nixlib.nameValuePair "mediawiki-${name}")) | ||||
|       ]) | ||||
|       // nixlib.genAttrs allMachines | ||||
|         (machine: self.nixosConfigurations.${machine}.config.system.build.toplevel); | ||||
|     }; | ||||
|   }; | ||||
|   | ||||
| @@ -6,14 +6,14 @@ | ||||
|     ../../base.nix | ||||
|     ../../misc/metrics-exporters.nix | ||||
|  | ||||
|     #./services/keycloak.nix | ||||
|  | ||||
|     # TODO: set up authentication for the following: | ||||
|     # ./services/website.nix | ||||
|     ./services/nginx | ||||
|     ./services/gitea/default.nix | ||||
|     ./services/idp-simplesamlphp | ||||
|     ./services/kerberos | ||||
|     ./services/mediawiki | ||||
|     ./services/nginx.nix | ||||
|     ./services/vaultwarden.nix | ||||
|     ./services/webmail | ||||
|     # ./services/mediawiki.nix | ||||
|     ./services/website | ||||
|   ]; | ||||
|  | ||||
|   sops.defaultSopsFile = ../../secrets/bekkalokk/bekkalokk.yaml; | ||||
| @@ -24,8 +24,6 @@ | ||||
|   boot.loader.systemd-boot.enable = true; | ||||
|   boot.loader.efi.canTouchEfiVariables = true; | ||||
|  | ||||
|   virtualisation.podman.enable = true; | ||||
|  | ||||
|   networking.hostName = "bekkalokk"; | ||||
|  | ||||
|   systemd.network.networks."30-enp2s0" = values.defaultNetworkConfig // { | ||||
|   | ||||
| @@ -27,4 +27,5 @@ lib.mkMerge [ | ||||
|   (mkRunner "alpha") | ||||
|   (mkRunner "beta") | ||||
|   (mkRunner "epsilon") | ||||
|   { virtualisation.podman.enable = true; } | ||||
| ] | ||||
|   | ||||
| @@ -6,6 +6,7 @@ let | ||||
| in { | ||||
|   imports = [ | ||||
|     ./ci.nix | ||||
|     ./import-users.nix | ||||
|   ]; | ||||
|  | ||||
|   sops.secrets = { | ||||
| @@ -13,9 +14,10 @@ in { | ||||
|       owner = "gitea"; | ||||
|       group = "gitea"; | ||||
|     }; | ||||
|     "gitea/passwd-ssh-key" = { }; | ||||
|     "gitea/ssh-known-hosts" = { }; | ||||
|     "gitea/import-user-env" = { }; | ||||
|     "gitea/email-password" = { | ||||
|       owner = "gitea"; | ||||
|       group = "gitea"; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   services.gitea = { | ||||
| @@ -31,13 +33,23 @@ in { | ||||
|       createDatabase = false; | ||||
|     }; | ||||
|  | ||||
|     mailerPasswordFile = config.sops.secrets."gitea/email-password".path; | ||||
|  | ||||
|     settings = { | ||||
|       server = { | ||||
|         DOMAIN   = domain; | ||||
|         ROOT_URL = "https://${domain}/"; | ||||
|         PROTOCOL = "http+unix"; | ||||
|         SSH_PORT = sshPort; | ||||
| 	      START_SSH_SERVER = true; | ||||
|         START_SSH_SERVER = true; | ||||
|       }; | ||||
|       mailer = { | ||||
|         ENABLED = true; | ||||
|         FROM = "gitea@pvv.ntnu.no"; | ||||
|         PROTOCOL = "smtp"; | ||||
|         SMTP_ADDR = "smtp.pvv.ntnu.no"; | ||||
|         SMTP_PORT = 587; | ||||
|         USER = "gitea@pvv.ntnu.no"; | ||||
|       }; | ||||
|       indexer.REPO_INDEXER_ENABLED = true; | ||||
|       service.DISABLE_REGISTRATION = true; | ||||
| @@ -57,9 +69,9 @@ in { | ||||
|   services.nginx.virtualHosts."${domain}" = { | ||||
|     forceSSL = true; | ||||
|     enableACME = true; | ||||
|     kTLS = true; | ||||
|     locations."/" = { | ||||
|       proxyPass = "http://unix:${cfg.settings.server.HTTP_ADDR}"; | ||||
|       recommendedProxySettings = true; | ||||
|       extraConfig = '' | ||||
|         client_max_body_size 512M; | ||||
|       ''; | ||||
| @@ -68,38 +80,28 @@ in { | ||||
|  | ||||
|   networking.firewall.allowedTCPPorts = [ sshPort ]; | ||||
|  | ||||
|   # Automatically import users | ||||
|   systemd.services.gitea-import-users = { | ||||
|     enable = true; | ||||
|     preStart=''${pkgs.rsync}/bin/rsync -e "${pkgs.openssh}/bin/ssh -o UserKnownHostsFile=$CREDENTIALS_DIRECTORY/ssh-known-hosts -i $CREDENTIALS_DIRECTORY/sshkey" -a pvv@smtp.pvv.ntnu.no:/etc/passwd /tmp/passwd-import''; | ||||
|     serviceConfig = { | ||||
|       ExecStart = pkgs.writers.writePython3 "gitea-import-users" { libraries = [ pkgs.python3Packages.requests ]; } (builtins.readFile ./gitea-import-users.py); | ||||
|       LoadCredential=[ | ||||
|         "sshkey:${config.sops.secrets."gitea/passwd-ssh-key".path}" | ||||
|         "ssh-known-hosts:${config.sops.secrets."gitea/ssh-known-hosts".path}" | ||||
|       ]; | ||||
|       DynamicUser="yes"; | ||||
|       EnvironmentFile=config.sops.secrets."gitea/import-user-env".path; | ||||
|     }; | ||||
|   }; | ||||
|   # Extra customization | ||||
|  | ||||
|   systemd.timers.gitea-import-users = { | ||||
|     requires = [ "gitea.service" ]; | ||||
|     after = [ "gitea.service" ]; | ||||
|     wantedBy = [ "timers.target" ]; | ||||
|     timerConfig = { | ||||
|       OnCalendar = "*-*-* 02:00:00"; | ||||
|       Persistent = true; | ||||
|       Unit = "gitea-import-users.service"; | ||||
|     }; | ||||
|   }; | ||||
|   services.gitea-themes.monokai = pkgs.gitea-theme-monokai; | ||||
|  | ||||
|   system.activationScripts.linkGiteaLogo.text = let | ||||
|     logo-svg = ../../../../assets/logo_blue_regular.svg; | ||||
|     logo-png = ../../../../assets/logo_blue_regular.png; | ||||
|   in '' | ||||
|     install -Dm444 ${logo-svg} ${cfg.stateDir}/custom/public/img/logo.svg | ||||
|     install -Dm444 ${logo-png} ${cfg.stateDir}/custom/public/img/logo.png | ||||
|     install -Dm444 ${./loading.apng} ${cfg.stateDir}/custom/public/img/loading.png | ||||
|   ''; | ||||
|   systemd.services.install-gitea-customization = { | ||||
|     description = "Install extra customization in gitea's CUSTOM_DIR"; | ||||
|     wantedBy = [ "gitea.service" ]; | ||||
|     requiredBy = [ "gitea.service" ]; | ||||
|  | ||||
|     serviceConfig =  { | ||||
|       Type = "oneshot"; | ||||
|       User = cfg.user; | ||||
|       Group = cfg.group; | ||||
|     }; | ||||
|  | ||||
|     script = let | ||||
|       logo-svg = ../../../../assets/logo_blue_regular.svg; | ||||
|       logo-png = ../../../../assets/logo_blue_regular.png; | ||||
|     in '' | ||||
|       install -Dm444 ${logo-svg} ${cfg.customDir}/public/img/logo.svg | ||||
|       install -Dm444 ${logo-png} ${cfg.customDir}/public/img/logo.png | ||||
|       install -Dm444 ${./loading.apng} ${cfg.customDir}/public/img/loading.png | ||||
|     ''; | ||||
|   }; | ||||
| } | ||||
|   | ||||
| @@ -32,7 +32,6 @@ def add_user(username, name): | ||||
|             "full_name": name, | ||||
|             "username": username, | ||||
|             "login_name": username, | ||||
|             "visibility": "public", | ||||
|             "source_id": 1,  # 1 = SMTP | ||||
|     } | ||||
|  | ||||
| @@ -52,6 +51,7 @@ def add_user(username, name): | ||||
|         existing_users[username] = user | ||||
|  | ||||
|     else: | ||||
|         user["visibility"] = existing_users[username]["visibility"] | ||||
|         r = requests.patch(GITEA_API_URL + f'/admin/users/{username}', | ||||
|                            json=user, | ||||
|                            headers={'Authorization': 'token ' + API_TOKEN}) | ||||
|   | ||||
							
								
								
									
										38
									
								
								hosts/bekkalokk/services/gitea/import-users.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								hosts/bekkalokk/services/gitea/import-users.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| { config, pkgs, lib, ... }: | ||||
| let | ||||
|   cfg = config.services.gitea; | ||||
| in | ||||
| { | ||||
|   sops.secrets = { | ||||
|     "gitea/passwd-ssh-key" = { }; | ||||
|     "gitea/ssh-known-hosts" = { }; | ||||
|     "gitea/import-user-env" = { }; | ||||
|   }; | ||||
|  | ||||
|   systemd.services.gitea-import-users = lib.mkIf cfg.enable { | ||||
|     enable = true; | ||||
|     preStart=''${pkgs.rsync}/bin/rsync -e "${pkgs.openssh}/bin/ssh -o UserKnownHostsFile=$CREDENTIALS_DIRECTORY/ssh-known-hosts -i $CREDENTIALS_DIRECTORY/sshkey" -a pvv@smtp.pvv.ntnu.no:/etc/passwd /tmp/passwd-import''; | ||||
|     serviceConfig = { | ||||
|       ExecStart = pkgs.writers.writePython3 "gitea-import-users" { | ||||
|         libraries = with pkgs.python3Packages; [ requests ]; | ||||
|       } (builtins.readFile ./gitea-import-users.py); | ||||
|       LoadCredential=[ | ||||
|         "sshkey:${config.sops.secrets."gitea/passwd-ssh-key".path}" | ||||
|         "ssh-known-hosts:${config.sops.secrets."gitea/ssh-known-hosts".path}" | ||||
|       ]; | ||||
|       DynamicUser="yes"; | ||||
|       EnvironmentFile=config.sops.secrets."gitea/import-user-env".path; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   systemd.timers.gitea-import-users = lib.mkIf cfg.enable { | ||||
|     requires = [ "gitea.service" ]; | ||||
|     after = [ "gitea.service" ]; | ||||
|     wantedBy = [ "timers.target" ]; | ||||
|     timerConfig = { | ||||
|       OnCalendar = "*-*-* 02:00:00"; | ||||
|       Persistent = true; | ||||
|       Unit = "gitea-import-users.service"; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										135
									
								
								hosts/bekkalokk/services/idp-simplesamlphp/authpwauth.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										135
									
								
								hosts/bekkalokk/services/idp-simplesamlphp/authpwauth.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,135 @@ | ||||
| <?php | ||||
|  | ||||
| /** | ||||
|  * Authenticate using HTTP login. | ||||
|  * | ||||
|  * @author Yorn de Jong | ||||
|  * @author Oystein Kristoffer Tveit | ||||
|  * @package simpleSAMLphp | ||||
|  */ | ||||
|  | ||||
| namespace SimpleSAML\Module\authpwauth\Auth\Source; | ||||
|  | ||||
| class PwAuth extends \SimpleSAML\Module\core\Auth\UserPassBase | ||||
| { | ||||
|     protected $pwauth_bin_path; | ||||
|     protected $mail_domain; | ||||
|  | ||||
|     public function __construct(array $info, array &$config) { | ||||
|             assert('is_array($info)'); | ||||
|             assert('is_array($config)'); | ||||
|  | ||||
|             /* Call the parent constructor first, as required by the interface. */ | ||||
|             parent::__construct($info, $config); | ||||
|  | ||||
|             $this->pwauth_bin_path = $config['pwauth_bin_path']; | ||||
|             if (array_key_exists('mail_domain', $config)) { | ||||
|                     $this->mail_domain = '@' . ltrim($config['mail_domain'], '@'); | ||||
|             } | ||||
|     } | ||||
|  | ||||
|     public function login(string $username, string $password): array { | ||||
|             $username = strtolower( $username ); | ||||
|  | ||||
| 	    if (!file_exists($this->pwauth_bin_path)) { | ||||
|                     die("Could not find pwauth binary"); | ||||
|                     return false; | ||||
| 	    } | ||||
|  | ||||
| 	    if (!is_executable($this->pwauth_bin_path)) { | ||||
|                     die("pwauth binary is not executable"); | ||||
|                     return false; | ||||
| 	    } | ||||
|  | ||||
|             $handle = popen($this->pwauth_bin_path, 'w'); | ||||
|             if ($handle === FALSE) { | ||||
|                     die("Error opening pipe to pwauth"); | ||||
|                     return false; | ||||
|             } | ||||
|  | ||||
|             $data = "$username\n$password\n"; | ||||
|             if (fwrite($handle, $data) !== strlen($data)) { | ||||
|                     die("Error writing to pwauth pipe"); | ||||
|                     return false; | ||||
|             } | ||||
|  | ||||
|             # Is the password valid? | ||||
|             $result = pclose( $handle ); | ||||
|             if ($result !== 0) { | ||||
|                     if (!in_array($result, [1, 2, 3, 4, 5, 6, 7], true)) { | ||||
|                             die("pwauth returned $result for username $username"); | ||||
|                     } | ||||
|                     throw new \SimpleSAML\Error\Error('WRONGUSERPASS'); | ||||
|             } | ||||
|             /* | ||||
|             $ldap = ldap_connect('129.241.210.159', 389); | ||||
|             ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); | ||||
|             ldap_start_tls($ldap); | ||||
|             ldap_bind($ldap, 'passordendrer@pvv.ntnu.no', 'Oi7aekoh'); | ||||
|             $search = ldap_search($ldap, 'DC=pvv,DC=ntnu,DC=no', '(sAMAccountName='.ldap_escape($username, '', LDAP_ESCAPE_FILTER).')'); | ||||
|             $entry = ldap_first_entry($ldap, $search); | ||||
|             $dn = ldap_get_dn($ldap, $entry); | ||||
|             $newpassword = mb_convert_encoding("\"$password\"", 'UTF-16LE', 'UTF-8'); | ||||
|             ldap_modify_batch($ldap, $dn, [ | ||||
|                     #[ | ||||
|                     #       'modtype' => LDAP_MODIFY_BATCH_REMOVE, | ||||
|                     #       'attrib' => 'unicodePwd', | ||||
|                     #       'values' => [$password], | ||||
|                     #], | ||||
|                     [ | ||||
|                             #'modtype' => LDAP_MODIFY_BATCH_ADD, | ||||
|                             'modtype' => LDAP_MODIFY_BATCH_REPLACE, | ||||
|                             'attrib' => 'unicodePwd', | ||||
|                             'values' => [$newpassword], | ||||
|                     ], | ||||
|             ]); | ||||
|             */ | ||||
|  | ||||
|             #0  -  Login OK. | ||||
|             #1  -  Nonexistant login or (for some configurations) incorrect password. | ||||
|             #2  -  Incorrect password (for some configurations). | ||||
|             #3  -  Uid number is below MIN_UNIX_UID value configured in config.h. | ||||
|             #4  -  Login ID has expired. | ||||
|             #5  -  Login's password has expired. | ||||
|             #6  -  Logins to system have been turned off (usually by /etc/nologin file). | ||||
|             #7  -  Limit on number of bad logins exceeded. | ||||
|             #50 -  pwauth was not run with real uid SERVER_UID.  If you get this | ||||
|             #      this error code, you probably have SERVER_UID set incorrectly | ||||
|             #      in pwauth's config.h file. | ||||
|             #51 -  pwauth was not given a login & password to check.  The means | ||||
|             #      the passing of data from mod_auth_external to pwauth is messed | ||||
|             #      up.  Most likely one is trying to pass data via environment | ||||
|             #      variables, while the other is trying to pass data via a pipe. | ||||
|             #52 -  one of several possible internal errors occured. | ||||
|  | ||||
|  | ||||
|             $uid = $username; | ||||
| 	    # TODO: Reinstate this code once passwd is working... | ||||
| 	    /* | ||||
|             $cn = trim(shell_exec('getent passwd '.escapeshellarg($uid).' | cut -d: -f5 | cut -d, -f1')); | ||||
|  | ||||
|             $groups = preg_split('_\\s_', shell_exec('groups '.escapeshellarg($uid))); | ||||
|             array_shift($groups); | ||||
|             array_shift($groups); | ||||
|             array_pop($groups); | ||||
| 	     | ||||
|             $info = posix_getpwnam($uid); | ||||
|             $group = $info['gid']; | ||||
|             if (!in_array($group, $groups)) { | ||||
|                     $groups[] = $group; | ||||
|             } | ||||
| 	    */ | ||||
| 	    $cn = "Unknown McUnknown"; | ||||
| 	    $groups = array(); | ||||
|  | ||||
|             $result = array( | ||||
|                     'uid' => array($uid), | ||||
|                     'cn' => array($cn), | ||||
|                     'group' => $groups, | ||||
|             ); | ||||
|             if (isset($this->mail_domain)) { | ||||
|                     $result['mail'] = array($uid.$this->mail_domain); | ||||
|             } | ||||
|             return $result; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										1293
									
								
								hosts/bekkalokk/services/idp-simplesamlphp/config.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1293
									
								
								hosts/bekkalokk/services/idp-simplesamlphp/config.php
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										208
									
								
								hosts/bekkalokk/services/idp-simplesamlphp/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										208
									
								
								hosts/bekkalokk/services/idp-simplesamlphp/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,208 @@ | ||||
| { config, pkgs, lib, ... }: | ||||
| let | ||||
|   pwAuthScript = pkgs.writeShellApplication { | ||||
|     name = "pwauth"; | ||||
|     runtimeInputs = with pkgs; [ coreutils heimdal ]; | ||||
|     text = '' | ||||
|       read -r user1 | ||||
|       user2="$(echo -n "$user1" | tr -c -d '0123456789abcdefghijklmnopqrstuvwxyz')" | ||||
|       if test "$user1" != "$user2" | ||||
|       then | ||||
|         read -r _ | ||||
|         exit 2 | ||||
|       fi | ||||
|       kinit --password-file=STDIN "''${user1}@PVV.NTNU.NO" >/dev/null 2>/dev/null | ||||
|       kdestroy >/dev/null 2>/dev/null | ||||
|     ''; | ||||
|   }; | ||||
|  | ||||
|   package = pkgs.simplesamlphp.override { | ||||
|     extra_files = { | ||||
|       # NOTE: Using self signed certificate created 30. march 2024, with command: | ||||
|       # openssl req -newkey rsa:4096 -new -x509 -days 365 -nodes -out idp.crt -keyout idp.pem | ||||
|       "metadata/saml20-idp-hosted.php" = pkgs.writeText "saml20-idp-remote.php" '' | ||||
|         <?php | ||||
| 	  $metadata['https://idp.pvv.ntnu.no/'] = array( | ||||
| 	    'host' => '__DEFAULT__', | ||||
| 	    'privatekey' => '${config.sops.secrets."idp/privatekey".path}', | ||||
| 	    'certificate' => '${./idp.crt}', | ||||
| 	    'auth' => 'pwauth', | ||||
| 	  ); | ||||
| 	?> | ||||
|       ''; | ||||
|  | ||||
|       "metadata/saml20-sp-remote.php" = pkgs.writeText "saml20-sp-remote.php" '' | ||||
|         <?php | ||||
| 	  ${ lib.pipe config.services.idp.sp-remote-metadata [ | ||||
|              (map (url: '' | ||||
|                $metadata['${url}'] = [ | ||||
|                    'SingleLogoutService' => [ | ||||
|                        [ | ||||
|                            'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', | ||||
|                            'Location' => '${url}module.php/saml/sp/saml2-logout.php/default-sp', | ||||
|                        ], | ||||
|                        [ | ||||
|                            'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP', | ||||
|                            'Location' => '${url}module.php/saml/sp/saml2-logout.php/default-sp', | ||||
|                        ], | ||||
|                    ], | ||||
|                    'AssertionConsumerService' => [ | ||||
|                        [ | ||||
|                            'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST', | ||||
|                            'Location' => '${url}module.php/saml/sp/saml2-acs.php/default-sp', | ||||
|                            'index' => 0, | ||||
|                        ], | ||||
|                        [ | ||||
|                            'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact', | ||||
|                            'Location' => '${url}module.php/saml/sp/saml2-acs.php/default-sp', | ||||
|                            'index' => 1, | ||||
|                        ], | ||||
|                    ], | ||||
|                ]; | ||||
| 	     '')) | ||||
| 	     (lib.concatStringsSep "\n") | ||||
| 	  ]} | ||||
| 	?> | ||||
|       ''; | ||||
|  | ||||
|       "config/authsources.php" = pkgs.writeText "idp-authsources.php" '' | ||||
|         <?php | ||||
|           $config = array( | ||||
| 	    'admin' => array( | ||||
| 	      'core:AdminPassword' | ||||
| 	    ), | ||||
|             'pwauth' => array( | ||||
|                'authpwauth:PwAuth', | ||||
|                'pwauth_bin_path' => '${lib.getExe pwAuthScript}', | ||||
|                'mail_domain' => '@pvv.ntnu.no', | ||||
|             ), | ||||
|           ); | ||||
| 	?> | ||||
|       ''; | ||||
|  | ||||
|       "config/config.php" = pkgs.runCommandLocal "simplesamlphp-config.php" { } '' | ||||
|         cp ${./config.php} "$out" | ||||
|  | ||||
|         substituteInPlace "$out" \ | ||||
|           --replace '$SAML_COOKIE_SECURE' 'true' \ | ||||
|           --replace '$SAML_COOKIE_SALT' 'file_get_contents("${config.sops.secrets."idp/cookie_salt".path}")' \ | ||||
|           --replace '$SAML_ADMIN_NAME' '"Drift"' \ | ||||
|           --replace '$SAML_ADMIN_EMAIL' '"drift@pvv.ntnu.no"' \ | ||||
|           --replace '$SAML_ADMIN_PASSWORD' 'file_get_contents("${config.sops.secrets."idp/admin_password".path}")' \ | ||||
|           --replace '$SAML_TRUSTED_DOMAINS' 'array( "idp.pvv.ntnu.no" )' \ | ||||
|           --replace '$SAML_DATABASE_DSN' '"pgsql:host=postgres.pvv.ntnu.no;port=5432;dbname=idp"' \ | ||||
|           --replace '$SAML_DATABASE_USERNAME' '"idp"' \ | ||||
|           --replace '$SAML_DATABASE_PASSWORD' 'file_get_contents("${config.sops.secrets."idp/postgres_password".path}")' \ | ||||
|           --replace '$CACHE_DIRECTORY' '/var/cache/idp' | ||||
|       ''; | ||||
|  | ||||
|       "modules/authpwauth/src/Auth/Source/PwAuth.php" = ./authpwauth.php; | ||||
|     }; | ||||
|   }; | ||||
| in | ||||
| { | ||||
|   options.services.idp.sp-remote-metadata = lib.mkOption { | ||||
|     type = with lib.types; listOf str; | ||||
|     default = [ ]; | ||||
|     description = '' | ||||
|       List of urls point to (simplesamlphp) service profiders, which the idp should trust. | ||||
|  | ||||
|       :::{.note} | ||||
| 	Make sure the url ends with a `/` | ||||
|       ::: | ||||
|     ''; | ||||
|   }; | ||||
|  | ||||
|   config = { | ||||
|     sops.secrets = { | ||||
|       "idp/privatekey" = { | ||||
|         owner = "idp"; | ||||
|         group = "idp"; | ||||
|         mode = "0770"; | ||||
|       }; | ||||
|       "idp/admin_password" = { | ||||
|         owner = "idp"; | ||||
|         group = "idp"; | ||||
|       }; | ||||
|       "idp/postgres_password" = { | ||||
|         owner = "idp"; | ||||
|         group = "idp"; | ||||
|       }; | ||||
|       "idp/cookie_salt" = { | ||||
|         owner = "idp"; | ||||
|         group = "idp"; | ||||
|       }; | ||||
|     };   | ||||
|  | ||||
|     users.groups."idp" = { }; | ||||
|     users.users."idp" = { | ||||
|       description = "PVV Identity Provider Service User"; | ||||
|       group = "idp"; | ||||
|       createHome = false; | ||||
|       isSystemUser = true; | ||||
|     }; | ||||
|  | ||||
|     systemd.tmpfiles.settings."10-idp" = { | ||||
|       "/var/cache/idp".d = { | ||||
|         user = "idp"; | ||||
|         group = "idp"; | ||||
|         mode = "0770"; | ||||
|       }; | ||||
|       "/var/lib/idp".d = { | ||||
|         user = "idp"; | ||||
|         group = "idp"; | ||||
|         mode = "0770"; | ||||
|       }; | ||||
|     }; | ||||
|  | ||||
|     services.phpfpm.pools.idp = { | ||||
|       user = "idp"; | ||||
|       group = "idp"; | ||||
|       settings = let | ||||
|         listenUser = config.services.nginx.user; | ||||
|         listenGroup = config.services.nginx.group; | ||||
|       in { | ||||
|         "pm" = "dynamic"; | ||||
|         "pm.max_children" = 32; | ||||
|         "pm.max_requests" = 500; | ||||
|         "pm.start_servers" = 2; | ||||
|         "pm.min_spare_servers" = 2; | ||||
|         "pm.max_spare_servers" = 4; | ||||
|         "listen.owner" = listenUser; | ||||
|         "listen.group" = listenGroup; | ||||
|  | ||||
|         "catch_workers_output" = true; | ||||
|         "php_admin_flag[log_errors]" = true; | ||||
|         # "php_admin_value[error_log]" = "stderr"; | ||||
|       }; | ||||
|     }; | ||||
|  | ||||
|     services.nginx.virtualHosts."idp.pvv.ntnu.no" = { | ||||
|       forceSSL = true; | ||||
|       enableACME = true; | ||||
|       kTLS = true; | ||||
|       root = "${package}/share/php/simplesamlphp/public"; | ||||
|       locations =  { | ||||
|         # based on https://simplesamlphp.org/docs/stable/simplesamlphp-install.html#configuring-nginx | ||||
|         "/" = { | ||||
|           alias = "${package}/share/php/simplesamlphp/public/"; | ||||
|           index = "index.php"; | ||||
|  | ||||
|           extraConfig = '' | ||||
|             location ~ ^/(?<phpfile>.+?\.php)(?<pathinfo>/.*)?$ { | ||||
|               include ${pkgs.nginx}/conf/fastcgi_params; | ||||
|               fastcgi_pass unix:${config.services.phpfpm.pools.idp.socket}; | ||||
|               fastcgi_param SCRIPT_FILENAME ${package}/share/php/simplesamlphp/public/$phpfile; | ||||
|               fastcgi_param SCRIPT_NAME /$phpfile; | ||||
|               fastcgi_param PATH_INFO $pathinfo if_not_empty; | ||||
|             } | ||||
|           ''; | ||||
|         }; | ||||
|         "^~ /simplesaml/".extraConfig = '' | ||||
| 	  rewrite ^/simplesaml/(.*)$ /$1 redirect; | ||||
| 	  return 404; | ||||
| 	''; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										33
									
								
								hosts/bekkalokk/services/idp-simplesamlphp/idp.crt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								hosts/bekkalokk/services/idp-simplesamlphp/idp.crt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,33 @@ | ||||
| -----BEGIN CERTIFICATE----- | ||||
| MIIFqTCCA5GgAwIBAgIUL2+PMM9rE9wI5W2yNnJ2CmfGxh0wDQYJKoZIhvcNAQEL | ||||
| BQAwZDELMAkGA1UEBhMCTk8xEzARBgNVBAgMClNvbWUtU3RhdGUxHjAcBgNVBAoM | ||||
| FVByb2dyYW12YXJldmVya3N0ZWRldDEgMB4GCSqGSIb3DQEJARYRZHJpZnRAcHZ2 | ||||
| Lm50bnUubm8wHhcNMjQwMzMwMDAyNjQ0WhcNMjUwMzMwMDAyNjQ0WjBkMQswCQYD | ||||
| VQQGEwJOTzETMBEGA1UECAwKU29tZS1TdGF0ZTEeMBwGA1UECgwVUHJvZ3JhbXZh | ||||
| cmV2ZXJrc3RlZGV0MSAwHgYJKoZIhvcNAQkBFhFkcmlmdEBwdnYubnRudS5ubzCC | ||||
| AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL/0l0jdV+PoVxdd21F+2NLm | ||||
| JN6sZmSJexOSk/sFjhhF4WMtjOfDAQYjt3hlLPyYl//jCe9WteavvtdCx1tHJitd | ||||
| xjOUJ/leVjHzBttCVZR+iTlQtpsZ2TbRMJ5Fcfl82njlPecV4umJvnnFXawE4Qee | ||||
| dE2OM8ODjjrK1cNaHR74tyZCwmdOxNHXZ7RN22p9kZjLD18LQyNr5igaDBeaZkyk | ||||
| Gxbg4tbP51x9JFRLF7kUlyAc83geFnw6v/wBahr49m/X4y7xE0rdPb2L0moUjmOO | ||||
| Zyl3hvxMI3+g/0FVMM5eKmfIIP2rIVEAa6MWMx0vPjC6h2fIyxkUqg5C8aFlpqav | ||||
| +8f2rUc+JfdiFsIZNrylBXsleGzS+/wY1uB/pAy5Vg9WCp+eC75EtWMt0k2f442G | ||||
| rhKa3lAZ6GIYrtEiQiNGM1aT1Cs1nqTtslfnHiuAKBefLjCXgq9uvL2yRodwe9/m | ||||
| oZiqYnLHy/v1xfnF5rKTcRmOleU3tc+nlN6tZSGC1nZgMpqpoqdcbJXAkvaJ2Km4 | ||||
| sl0YS28VQnztgzuVPNdnv8lcS6HmkaGaNWbepKgWeaH5oT7O6u99wZIv88m+tf5m | ||||
| Eu197YVpcclnojQCYKauWcQFsXS20egsVP87Qk0e2SHmGTUQp6YEYX6RLjkg7/vS | ||||
| BelDBbCldraNVEiC0jmpAgMBAAGjUzBRMB0GA1UdDgQWBBSL0yofG5NEmzFIRuqC | ||||
| xmyiuZW6DTAfBgNVHSMEGDAWgBSL0yofG5NEmzFIRuqCxmyiuZW6DTAPBgNVHRMB | ||||
| Af8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4ICAQAZZVs7BLk/NLq3f4Ik8qH3IoDN | ||||
| 2m4XXRZS+xxw5RwctgSnik7AffgAfv8QQm2co8UYkHbB0whaG1PDz+L7wB1hVkWn | ||||
| DVUaJcKQnn0x+sNU5LoTbjI0PlaST7PO5D0OMFab8FSNxpzzpbUcgZUhelc99Ri/ | ||||
| 2Gh8mf4b3Y3Uzq6YKFsuFM65OuJhH8f1w6onai9x28t6tERHUSUfJ2keXzU4ytCV | ||||
| EitWXwhe759VLqmdP4BATwlCOCuwa5aDeGcWRIqFpYIn0SOAmVV3o4V71JdZc1jE | ||||
| fuOo/PbiHZ+R9ZGbh98aMidb0moL1ZDhmir9KbedezNyki6JJ72mVclhLqUajFxr | ||||
| T39FXd5e2+QBMHPPhVFznQoHWnHEbZigTt61b0cg/TsxaxOkF4Ilmr/2DmSWysWK | ||||
| TF5eq8hp6/53qVbXXSzrCjxd3wzGnRabsEVPX/L2hYDx81hluovJQCtskqTq1joI | ||||
| W2R7AO5Sdyc6NfOR85kl0HXzHa+0Slsf8ZDs5nCz/mOOPoAGl7IxF7xQ6kPO7V+U | ||||
| HdGE2tkblM/TrAObJH0HXySeJGI7Vfya+D1Y8IqGtyZtWyx1DmlA/OezGGf5D3rG | ||||
| 88LywHQQ2mQ+8aosBTE4+HQ+apLKZBprqQKuiDjT1RSUbfUHQkYuL+D1oIVmklAc | ||||
| UxTpf01QJnZkMqf5NQ== | ||||
| -----END CERTIFICATE----- | ||||
							
								
								
									
										22
									
								
								hosts/bekkalokk/services/idp-simplesamlphp/metadata.php.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								hosts/bekkalokk/services/idp-simplesamlphp/metadata.php.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,22 @@ | ||||
| '' | ||||
|   <?php | ||||
|   $metadata['https://idp.pvv.ntnu.no/'] = [ | ||||
|       'metadata-set' => 'saml20-idp-hosted', | ||||
|       'entityid' => 'https://idp.pvv.ntnu.no/', | ||||
|       'SingleSignOnService' => [ | ||||
|           [ | ||||
|               'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', | ||||
|               'Location' => 'https://idp.pvv.ntnu.no/module.php/saml/idp/singleSignOnService', | ||||
|           ], | ||||
|       ], | ||||
|       'SingleLogoutService' => [ | ||||
|           [ | ||||
|               'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect', | ||||
|               'Location' => 'https://idp.pvv.ntnu.no/module.php/saml/idp/singleLogout', | ||||
|           ], | ||||
|       ], | ||||
|       'NameIDFormat' => [ 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient' ], | ||||
|       'certificate' => '${./idp.crt}', | ||||
|   ]; | ||||
|   ?> | ||||
| '' | ||||
							
								
								
									
										27
									
								
								hosts/bekkalokk/services/kerberos/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								hosts/bekkalokk/services/kerberos/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| { config, pkgs, lib, ... }: | ||||
| { | ||||
|   ####################### | ||||
|   # TODO: remove these once nixos 24.05 gets released | ||||
|   ####################### | ||||
|   imports = [ | ||||
|     ./krb5.nix | ||||
|     ./pam.nix | ||||
|   ]; | ||||
|   disabledModules = [ | ||||
|     "config/krb5/default.nix" | ||||
|     "security/pam.nix" | ||||
|   ]; | ||||
|   ####################### | ||||
|  | ||||
|   security.krb5 = { | ||||
|     enable = true; | ||||
|     settings = { | ||||
|       libdefaults = { | ||||
|         default_realm = "PVV.NTNU.NO"; | ||||
|         dns_lookup_realm = "yes"; | ||||
|         dns_lookup_kdc = "yes"; | ||||
|       }; | ||||
|       realms."PVV.NTNU.NO".admin_server = "kdc.pvv.ntnu.no"; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										88
									
								
								hosts/bekkalokk/services/kerberos/krb5-conf-format.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										88
									
								
								hosts/bekkalokk/services/kerberos/krb5-conf-format.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,88 @@ | ||||
| { pkgs, lib, ... }: | ||||
|  | ||||
| # Based on | ||||
| # - https://web.mit.edu/kerberos/krb5-1.12/doc/admin/conf_files/krb5_conf.html | ||||
| # - https://manpages.debian.org/unstable/heimdal-docs/krb5.conf.5heimdal.en.html | ||||
|  | ||||
| let | ||||
|   inherit (lib) boolToString concatMapStringsSep concatStringsSep filter | ||||
|     isAttrs isBool isList mapAttrsToList mdDoc mkOption singleton splitString; | ||||
|   inherit (lib.types) attrsOf bool coercedTo either int listOf oneOf path | ||||
|     str submodule; | ||||
| in | ||||
| { }: { | ||||
|   type = let | ||||
|     section = attrsOf relation; | ||||
|     relation = either (attrsOf value) value; | ||||
|     value = either (listOf atom) atom; | ||||
|     atom = oneOf [int str bool]; | ||||
|   in submodule { | ||||
|     freeformType = attrsOf section; | ||||
|     options = { | ||||
|       include = mkOption { | ||||
|         default = [ ]; | ||||
|         description = mdDoc '' | ||||
|           Files to include in the Kerberos configuration. | ||||
|         ''; | ||||
|         type = coercedTo path singleton (listOf path); | ||||
|       }; | ||||
|       includedir = mkOption { | ||||
|         default = [ ]; | ||||
|         description = mdDoc '' | ||||
|           Directories containing files to include in the Kerberos configuration. | ||||
|         ''; | ||||
|         type = coercedTo path singleton (listOf path); | ||||
|       }; | ||||
|       module = mkOption { | ||||
|         default = [ ]; | ||||
|         description = mdDoc '' | ||||
|           Modules to obtain Kerberos configuration from. | ||||
|         ''; | ||||
|         type = coercedTo path singleton (listOf path); | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   generate = let | ||||
|     indent = str: concatMapStringsSep "\n" (line: "  " + line) (splitString "\n" str); | ||||
|  | ||||
|     formatToplevel = args @ { | ||||
|       include ? [ ], | ||||
|       includedir ? [ ], | ||||
|       module ? [ ], | ||||
|       ... | ||||
|     }: let | ||||
|       sections = removeAttrs args [ "include" "includedir" "module" ]; | ||||
|     in concatStringsSep "\n" (filter (x: x != "") [ | ||||
|       (concatStringsSep "\n" (mapAttrsToList formatSection sections)) | ||||
|       (concatMapStringsSep "\n" (m: "module ${m}") module) | ||||
|       (concatMapStringsSep "\n" (i: "include ${i}") include) | ||||
|       (concatMapStringsSep "\n" (i: "includedir ${i}") includedir) | ||||
|     ]); | ||||
|  | ||||
|     formatSection = name: section: '' | ||||
|       [${name}] | ||||
|       ${indent (concatStringsSep "\n" (mapAttrsToList formatRelation section))} | ||||
|     ''; | ||||
|  | ||||
|     formatRelation = name: relation: | ||||
|       if isAttrs relation | ||||
|       then '' | ||||
|         ${name} = { | ||||
|         ${indent (concatStringsSep "\n" (mapAttrsToList formatValue relation))} | ||||
|         }'' | ||||
|       else formatValue name relation; | ||||
|  | ||||
|     formatValue = name: value: | ||||
|       if isList value | ||||
|       then concatMapStringsSep "\n" (formatAtom name) value | ||||
|       else formatAtom name value; | ||||
|  | ||||
|     formatAtom = name: atom: let | ||||
|       v = if isBool atom then boolToString atom else toString atom; | ||||
|     in "${name} = ${v}"; | ||||
|   in | ||||
|     name: value: pkgs.writeText name '' | ||||
|       ${formatToplevel value} | ||||
|     ''; | ||||
| } | ||||
							
								
								
									
										90
									
								
								hosts/bekkalokk/services/kerberos/krb5.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								hosts/bekkalokk/services/kerberos/krb5.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,90 @@ | ||||
| { config, lib, pkgs, ... }: | ||||
| let | ||||
|   inherit (lib) mdDoc mkIf mkOption mkPackageOption mkRemovedOptionModule; | ||||
|   inherit (lib.types) bool; | ||||
|  | ||||
|   mkRemovedOptionModule' = name: reason: mkRemovedOptionModule ["krb5" name] reason; | ||||
|   mkRemovedOptionModuleCfg = name: mkRemovedOptionModule' name '' | ||||
|     The option `krb5.${name}' has been removed. Use | ||||
|     `security.krb5.settings.${name}' for structured configuration. | ||||
|   ''; | ||||
|  | ||||
|   cfg = config.security.krb5; | ||||
|   format = import ./krb5-conf-format.nix { inherit pkgs lib; } { }; | ||||
| in { | ||||
|   imports = [ | ||||
|     (mkRemovedOptionModuleCfg "libdefaults") | ||||
|     (mkRemovedOptionModuleCfg "realms") | ||||
|     (mkRemovedOptionModuleCfg "domain_realm") | ||||
|     (mkRemovedOptionModuleCfg "capaths") | ||||
|     (mkRemovedOptionModuleCfg "appdefaults") | ||||
|     (mkRemovedOptionModuleCfg "plugins") | ||||
|     (mkRemovedOptionModuleCfg "config") | ||||
|     (mkRemovedOptionModuleCfg "extraConfig") | ||||
|     (mkRemovedOptionModule' "kerberos" '' | ||||
|       The option `krb5.kerberos' has been moved to `security.krb5.package'. | ||||
|     '') | ||||
|   ]; | ||||
|  | ||||
|   options = { | ||||
|     security.krb5 = { | ||||
|       enable = mkOption { | ||||
|         default = false; | ||||
|         description = mdDoc "Enable and configure Kerberos utilities"; | ||||
|         type = bool; | ||||
|       }; | ||||
|  | ||||
|       package = mkPackageOption pkgs "krb5" { | ||||
|         example = "heimdal"; | ||||
|       }; | ||||
|  | ||||
|       settings = mkOption { | ||||
|         default = { }; | ||||
|         type = format.type; | ||||
|         description = mdDoc '' | ||||
|           Structured contents of the {file}`krb5.conf` file. See | ||||
|           {manpage}`krb5.conf(5)` for details about configuration. | ||||
|         ''; | ||||
|         example = { | ||||
|           include = [ "/run/secrets/secret-krb5.conf" ]; | ||||
|           includedir = [ "/run/secrets/secret-krb5.conf.d" ]; | ||||
|  | ||||
|           libdefaults = { | ||||
|             default_realm = "ATHENA.MIT.EDU"; | ||||
|           }; | ||||
|  | ||||
|           realms = { | ||||
|             "ATHENA.MIT.EDU" = { | ||||
|               admin_server = "athena.mit.edu"; | ||||
|               kdc = [ | ||||
|                 "athena01.mit.edu" | ||||
|                 "athena02.mit.edu" | ||||
|               ]; | ||||
|             }; | ||||
|           }; | ||||
|  | ||||
|           domain_realm = { | ||||
|             "mit.edu" = "ATHENA.MIT.EDU"; | ||||
|           }; | ||||
|  | ||||
|           logging = { | ||||
|             kdc = "SYSLOG:NOTICE"; | ||||
|             admin_server = "SYSLOG:NOTICE"; | ||||
|             default = "SYSLOG:NOTICE"; | ||||
|           }; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   config = mkIf cfg.enable { | ||||
|     environment = { | ||||
|       systemPackages = [ cfg.package ]; | ||||
|       etc."krb5.conf".source = format.generate "krb5.conf" cfg.settings; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   meta.maintainers = builtins.attrValues { | ||||
|     inherit (lib.maintainers) dblsaiko h7x4; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										1543
									
								
								hosts/bekkalokk/services/kerberos/pam.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1543
									
								
								hosts/bekkalokk/services/kerberos/pam.nix
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,24 +0,0 @@ | ||||
| { pkgs, config, values, ... }: | ||||
| { | ||||
|   sops.secrets."keys/postgres/keycloak" = { | ||||
|     owner = "keycloak"; | ||||
|     group = "keycloak"; | ||||
|     restartUnits = [ "keycloak.service" ]; | ||||
|   }; | ||||
|  | ||||
|   services.keycloak = { | ||||
|     enable = true; | ||||
|  | ||||
|     settings = { | ||||
|       hostname = "auth.pvv.ntnu.no"; | ||||
|       # hostname-strict-backchannel = true; | ||||
|     }; | ||||
|  | ||||
|     database = { | ||||
|       host = values.hosts.bicep.ipv4; | ||||
|       createLocally = false; | ||||
|       passwordFile = config.sops.secrets."keys/postgres/keycloak".path; | ||||
|       caCert = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
| @@ -1,175 +0,0 @@ | ||||
| { pkgs, lib, config, values, ... }: let | ||||
|   cfg = config.services.mediawiki; | ||||
|  | ||||
|   # "mediawiki" | ||||
|   user = config.systemd.services.mediawiki-init.serviceConfig.User; | ||||
|  | ||||
|   # "mediawiki" | ||||
|   group = config.users.users.${user}.group; | ||||
| in { | ||||
|   sops.secrets = { | ||||
|     "mediawiki/password" = { | ||||
|       restartUnits = [ "mediawiki-init.service" "phpfpm-mediawiki.service" ]; | ||||
|       owner = user; | ||||
|       group = group; | ||||
|     }; | ||||
|     "keys/postgres/mediawiki" = { | ||||
|       restartUnits = [ "mediawiki-init.service" "phpfpm-mediawiki.service" ]; | ||||
|       owner = user; | ||||
|       group = group; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   services.mediawiki = { | ||||
|     enable = true; | ||||
|     name = "Programvareverkstedet"; | ||||
|     passwordFile = config.sops.secrets."mediawiki/password".path; | ||||
|     passwordSender = "drift@pvv.ntnu.no"; | ||||
|  | ||||
|     database = { | ||||
|       type = "postgres"; | ||||
|       host = "postgres.pvv.ntnu.no"; | ||||
|       port = config.services.postgresql.port; | ||||
|       passwordFile = config.sops.secrets."keys/postgres/mediawiki".path; | ||||
|       createLocally = false; | ||||
|       # TODO: create a normal database and copy over old data when the service is production ready | ||||
|       name = "mediawiki_test"; | ||||
|     }; | ||||
|  | ||||
|     # Host through nginx | ||||
|     webserver = "none"; | ||||
|     poolConfig = let | ||||
|       listenUser = config.services.nginx.user; | ||||
|       listenGroup = config.services.nginx.group; | ||||
|     in { | ||||
|       inherit user group; | ||||
|       "pm" = "dynamic"; | ||||
|       "pm.max_children" = 32; | ||||
|       "pm.max_requests" = 500; | ||||
|       "pm.start_servers" = 2; | ||||
|       "pm.min_spare_servers" = 2; | ||||
|       "pm.max_spare_servers" = 4; | ||||
|       "listen.owner" = listenUser; | ||||
|       "listen.group" = listenGroup; | ||||
|       "php_admin_value[error_log]" = "stderr"; | ||||
|       "php_admin_flag[log_errors]" = "on"; | ||||
|       "env[PATH]" = lib.makeBinPath [ pkgs.php ]; | ||||
|       "catch_workers_output" = true; | ||||
|       # to accept *.html file | ||||
|       "security.limit_extensions" = ""; | ||||
|     }; | ||||
|  | ||||
|     extensions = { | ||||
|       DeleteBatch = pkgs.fetchzip { | ||||
|         url = "https://extdist.wmflabs.org/dist/extensions/DeleteBatch-REL1_39-995ea6f.tar.gz"; | ||||
| 	sha256 = "sha256-0F4GLCy2f5WcWIY2YgF1tVxgYbglR0VOsj/pMrW93b8="; | ||||
|       }; | ||||
|       UserMerge = pkgs.fetchzip { | ||||
|         url = "https://extdist.wmflabs.org/dist/extensions/UserMerge-REL1_39-b10d50e.tar.gz"; | ||||
| 	sha256 = "sha256-bXhj1+OlOUJDbvEuc8iwqb1LLEu6cN6+C/7cAvnWPOQ="; | ||||
|       }; | ||||
|       PluggableAuth = pkgs.fetchzip { | ||||
|         url = "https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_39-1210fc3.tar.gz"; | ||||
| 	sha256 = "sha256-F6bTMCzkK3kZwZGIsNE87WlZWqXXmTMhEjApO99YKR0="; | ||||
|       }; | ||||
|       SimpleSAMLphp = pkgs.fetchzip { | ||||
|         url = "https://extdist.wmflabs.org/dist/extensions/SimpleSAMLphp-REL1_39-dcf0acb.tar.gz"; | ||||
|         sha256 = "sha256-tCvFmb2+q2rxms+lRo5pgoI3h6GjCwXAR8XisPg03TQ="; | ||||
|       }; | ||||
|     }; | ||||
|  | ||||
|     extraConfig = let | ||||
|  | ||||
|       SimpleSAMLphpRepo = pkgs.stdenvNoCC.mkDerivation rec { | ||||
|         pname = "configuredSimpleSAML"; | ||||
| 	version = "2.0.4"; | ||||
|         src = pkgs.fetchzip { | ||||
|           url = "https://github.com/simplesamlphp/simplesamlphp/releases/download/v${version}/simplesamlphp-${version}.tar.gz"; | ||||
|           sha256 = "sha256-pfMV/VmqqxgtG7Nx4s8MW4tWSaxOkVPtCRJwxV6RDSE="; | ||||
|         }; | ||||
|  | ||||
| 	buildPhase = '' | ||||
|           cat > config/authsources.php << EOF | ||||
|           <?php | ||||
|           $config = array( | ||||
|             'default-sp' => array( | ||||
|               'saml:SP', | ||||
|               'idp' => 'https://idp.pvv.ntnu.no/', | ||||
|             ), | ||||
|           ); | ||||
| 	  EOF | ||||
| 	''; | ||||
|  | ||||
| 	installPhase = '' | ||||
| 	  cp -r . $out | ||||
| 	''; | ||||
|       }; | ||||
|  | ||||
|     in '' | ||||
|       $wgServer = "https://bekkalokk.pvv.ntnu.no"; | ||||
|       $wgLocaltimezone = "Europe/Oslo"; | ||||
|  | ||||
|       # Only allow login through SSO | ||||
|       $wgEnableEmail = false; | ||||
|       $wgEnableUserEmail = false; | ||||
|       $wgEmailAuthentication = false; | ||||
|       $wgGroupPermissions['*']['createaccount'] = false; | ||||
|       $wgGroupPermissions['*']['autocreateaccount'] = true; | ||||
|       $wgPluggableAuth_EnableAutoLogin = true; | ||||
|  | ||||
|       # Disable anonymous editing | ||||
|       $wgGroupPermissions['*']['edit'] = false; | ||||
|  | ||||
|       # Styling | ||||
|       $wgLogo = "/PNG/PVV-logo.png"; | ||||
|       $wgDefaultSkin = "monobook"; | ||||
|  | ||||
|       # Misc | ||||
|       $wgEmergencyContact = "${cfg.passwordSender}"; | ||||
|       $wgShowIPinHeader = false; | ||||
|       $wgUseTeX = false; | ||||
|       $wgLocalInterwiki = $wgSitename; | ||||
|  | ||||
|       # SimpleSAML | ||||
|       $wgSimpleSAMLphp_InstallDir = "${SimpleSAMLphpRepo}"; | ||||
|       $wgSimpleSAMLphp_AuthSourceId = "default-sp"; | ||||
|       $wgSimpleSAMLphp_RealNameAttribute = "cn"; | ||||
|       $wgSimpleSAMLphp_EmailAttribute = "mail"; | ||||
|       $wgSimpleSAMLphp_UsernameAttribute = "uid"; | ||||
|  | ||||
|       # Fix https://github.com/NixOS/nixpkgs/issues/183097 | ||||
|       $wgDBserver = "${toString cfg.database.host}"; | ||||
|     ''; | ||||
|   }; | ||||
|  | ||||
|   # Override because of https://github.com/NixOS/nixpkgs/issues/183097 | ||||
|   systemd.services.mediawiki-init.script = let | ||||
|     # According to module | ||||
|     stateDir = "/var/lib/mediawiki"; | ||||
|     pkg = cfg.finalPackage; | ||||
|     mediawikiConfig = config.services.phpfpm.pools.mediawiki.phpEnv.MEDIAWIKI_CONFIG; | ||||
|     inherit (lib) optionalString mkForce; | ||||
|   in mkForce '' | ||||
|     if ! test -e "${stateDir}/secret.key"; then | ||||
|       tr -dc A-Za-z0-9 </dev/urandom 2>/dev/null | head -c 64 > ${stateDir}/secret.key | ||||
|     fi | ||||
|  | ||||
|     echo "exit( wfGetDB( DB_MASTER )->tableExists( 'user' ) ? 1 : 0 );" | \ | ||||
|     ${pkgs.php}/bin/php ${pkg}/share/mediawiki/maintenance/eval.php --conf ${mediawikiConfig} && \ | ||||
|     ${pkgs.php}/bin/php ${pkg}/share/mediawiki/maintenance/install.php \ | ||||
|       --confpath /tmp \ | ||||
|       --scriptpath / \ | ||||
|       --dbserver "${cfg.database.host}" \ | ||||
|       --dbport ${toString cfg.database.port} \ | ||||
|       --dbname ${cfg.database.name} \ | ||||
|       ${optionalString (cfg.database.tablePrefix != null) "--dbprefix ${cfg.database.tablePrefix}"} \ | ||||
|       --dbuser ${cfg.database.user} \ | ||||
|       ${optionalString (cfg.database.passwordFile != null) "--dbpassfile ${cfg.database.passwordFile}"} \ | ||||
|       --passfile ${cfg.passwordFile} \ | ||||
|       --dbtype ${cfg.database.type} \ | ||||
|       ${cfg.name} \ | ||||
|       admin | ||||
|  | ||||
|     ${pkgs.php}/bin/php ${pkg}/share/mediawiki/maintenance/update.php --conf ${mediawikiConfig} --quick | ||||
|   ''; | ||||
| } | ||||
							
								
								
									
										201
									
								
								hosts/bekkalokk/services/mediawiki/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										201
									
								
								hosts/bekkalokk/services/mediawiki/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,201 @@ | ||||
| { pkgs, lib, config, values, pkgs-unstable, ... }: let | ||||
|   cfg = config.services.mediawiki; | ||||
|  | ||||
|   # "mediawiki" | ||||
|   user = config.systemd.services.mediawiki-init.serviceConfig.User; | ||||
|  | ||||
|   # "mediawiki" | ||||
|   group = config.users.users.${user}.group; | ||||
|  | ||||
|   simplesamlphp = pkgs.simplesamlphp.override { | ||||
|     extra_files = { | ||||
|       "metadata/saml20-idp-remote.php" = pkgs.writeText "mediawiki-saml20-idp-remote.php" (import ../idp-simplesamlphp/metadata.php.nix); | ||||
|  | ||||
|       "config/authsources.php" = ./simplesaml-authsources.php; | ||||
|  | ||||
|       "config/config.php" = pkgs.runCommandLocal "mediawiki-simplesamlphp-config.php" { } '' | ||||
|         cp ${./simplesaml-config.php} "$out" | ||||
|  | ||||
|         substituteInPlace "$out" \ | ||||
|           --replace '$SAML_COOKIE_SECURE' 'true' \ | ||||
|           --replace '$SAML_COOKIE_SALT' 'file_get_contents("${config.sops.secrets."mediawiki/simplesamlphp/cookie_salt".path}")' \ | ||||
|           --replace '$SAML_ADMIN_NAME' '"Drift"' \ | ||||
|           --replace '$SAML_ADMIN_EMAIL' '"drift@pvv.ntnu.no"' \ | ||||
|           --replace '$SAML_ADMIN_PASSWORD' 'file_get_contents("${config.sops.secrets."mediawiki/simplesamlphp/admin_password".path}")' \ | ||||
|           --replace '$SAML_TRUSTED_DOMAINS' 'array( "wiki.pvv.ntnu.no" )' \ | ||||
|           --replace '$SAML_DATABASE_DSN' '"pgsql:host=postgres.pvv.ntnu.no;port=5432;dbname=mediawiki_simplesamlphp"' \ | ||||
|           --replace '$SAML_DATABASE_USERNAME' '"mediawiki_simplesamlphp"' \ | ||||
|           --replace '$SAML_DATABASE_PASSWORD' 'file_get_contents("${config.sops.secrets."mediawiki/simplesamlphp/postgres_password".path}")' \ | ||||
|           --replace '$CACHE_DIRECTORY' '/var/cache/mediawiki/idp' | ||||
|       ''; | ||||
|     }; | ||||
|   }; | ||||
| in { | ||||
|   services.idp.sp-remote-metadata = [ "https://wiki.pvv.ntnu.no/simplesaml/" ]; | ||||
|  | ||||
|   sops.secrets = lib.pipe [ | ||||
|     "mediawiki/password" | ||||
|     "mediawiki/postgres_password" | ||||
|     "mediawiki/simplesamlphp/postgres_password" | ||||
|     "mediawiki/simplesamlphp/cookie_salt" | ||||
|     "mediawiki/simplesamlphp/admin_password" | ||||
|   ] [ | ||||
|     (map (key: lib.nameValuePair key { | ||||
|       owner = user; | ||||
|       group = group; | ||||
|       restartUnits = [ "phpfpm-mediawiki.service" ]; | ||||
|     })) | ||||
|     lib.listToAttrs | ||||
|   ]; | ||||
|  | ||||
|   services.mediawiki = { | ||||
|     enable = true; | ||||
|     name = "Programvareverkstedet"; | ||||
|     passwordFile = config.sops.secrets."mediawiki/password".path; | ||||
|     passwordSender = "drift@pvv.ntnu.no"; | ||||
|  | ||||
|     database = { | ||||
|       type = "mysql"; | ||||
|       host = "mysql.pvv.ntnu.no"; | ||||
|       port = 3306; | ||||
|       user = "mediawiki"; | ||||
|       passwordFile = config.sops.secrets."mediawiki/postgres_password".path; | ||||
|       createLocally = false; | ||||
|       # TODO: create a normal database and copy over old data when the service is production ready | ||||
|       name = "mediawiki"; | ||||
|     }; | ||||
|  | ||||
|     webserver = "nginx"; | ||||
|     nginx.hostName = "wiki.pvv.ntnu.no"; | ||||
|  | ||||
|     poolConfig = { | ||||
|       inherit user group; | ||||
|       "pm" = "dynamic"; | ||||
|       "pm.max_children" = 32; | ||||
|       "pm.max_requests" = 500; | ||||
|       "pm.start_servers" = 2; | ||||
|       "pm.min_spare_servers" = 2; | ||||
|       "pm.max_spare_servers" = 4; | ||||
|  | ||||
|       "catch_workers_output" = true; | ||||
|       "php_admin_flag[log_errors]" = true; | ||||
|       # "php_admin_value[error_log]" = "stderr"; | ||||
|  | ||||
|       # to accept *.html file | ||||
|       "security.limit_extensions" = ""; | ||||
|     }; | ||||
|  | ||||
|     extensions = { | ||||
|       #inherit (pkgs.mediawiki-extensions) DeleteBatch UserMerge PluggableAuth SimpleSAMLphp VisualEditor; | ||||
|       inherit (pkgs.mediawiki-extensions) UserMerge PluggableAuth SimpleSAMLphp VisualEditor; | ||||
|     }; | ||||
|  | ||||
|     extraConfig = '' | ||||
|       $wgServer = "https://wiki.pvv.ntnu.no"; | ||||
|       $wgLocaltimezone = "Europe/Oslo"; | ||||
|  | ||||
|       # Only allow login through SSO | ||||
|       $wgEnableEmail = false; | ||||
|       $wgEnableUserEmail = false; | ||||
|       $wgEmailAuthentication = false; | ||||
|       $wgGroupPermissions['*']['createaccount'] = false; | ||||
|       $wgGroupPermissions['*']['autocreateaccount'] = true; | ||||
|       $wgPluggableAuth_EnableAutoLogin = false; | ||||
|  | ||||
|       # Misc. permissions | ||||
|       $wgGroupPermissions['*']['edit'] = false; | ||||
|       $wgGroupPermissions['*']['read'] = true; | ||||
|  | ||||
|       # Allow subdirectories in article URLs | ||||
|       $wgNamespacesWithSubpages[NS_MAIN] = true; | ||||
|  | ||||
|       # Styling | ||||
|       $wgLogos = array( | ||||
|         "2x" => "/PNG/PVV-logo.png", | ||||
|         "icon" => "/PNG/PVV-logo.svg", | ||||
|       ); | ||||
|       $wgDefaultSkin = "vector-2022"; | ||||
|       # from https://github.com/wikimedia/mediawiki-skins-Vector/blob/master/skin.json | ||||
|       $wgVectorDefaultSidebarVisibleForAnonymousUser = true; | ||||
|       $wgVectorResponsive = true; | ||||
|  | ||||
|       # Misc | ||||
|       $wgEmergencyContact = "${cfg.passwordSender}"; | ||||
|       $wgShowIPinHeader = false; | ||||
|       $wgUseTeX = false; | ||||
|       $wgLocalInterwiki = $wgSitename; | ||||
|  | ||||
|       # SimpleSAML | ||||
|       $wgSimpleSAMLphp_InstallDir = "${simplesamlphp}/share/php/simplesamlphp/"; | ||||
|       $wgPluggableAuth_Config['Log in using my SAML'] = [ | ||||
|         'plugin' => 'SimpleSAMLphp', | ||||
|         'data' => [ | ||||
|           'authSourceId' => 'default-sp', | ||||
|           'usernameAttribute' => 'uid', | ||||
|           'emailAttribute' => 'mail', | ||||
|           'realNameAttribute' => 'cn', | ||||
|         ] | ||||
|       ]; | ||||
|  | ||||
|       # Fix https://github.com/NixOS/nixpkgs/issues/183097 | ||||
|       $wgDBserver = "${toString cfg.database.host}"; | ||||
|     ''; | ||||
|   }; | ||||
|  | ||||
|   # Cache directory for simplesamlphp | ||||
|   # systemd.services.phpfpm-mediawiki.serviceConfig.CacheDirectory = "mediawiki/simplesamlphp"; | ||||
|   systemd.tmpfiles.settings."10-mediawiki"."/var/cache/mediawiki/simplesamlphp".d = { | ||||
|     user = "mediawiki"; | ||||
|     group = "mediawiki"; | ||||
|     mode = "0770"; | ||||
|   }; | ||||
|  | ||||
|   users.groups.mediawiki.members = [ "nginx" ]; | ||||
|  | ||||
|   services.nginx.virtualHosts."wiki.pvv.ntnu.no" = { | ||||
|     kTLS = true; | ||||
|     forceSSL = true; | ||||
|     enableACME = true; | ||||
|     locations =  { | ||||
|       "= /wiki/Main_Page" = lib.mkForce { | ||||
|         return = "301 /wiki/Programvareverkstedet"; | ||||
|       }; | ||||
|  | ||||
|       # based on https://simplesamlphp.org/docs/stable/simplesamlphp-install.html#configuring-nginx | ||||
|       "^~ /simplesaml/" = { | ||||
|         alias = "${simplesamlphp}/share/php/simplesamlphp/public/"; | ||||
|         index = "index.php"; | ||||
|  | ||||
|         extraConfig = '' | ||||
|           location ~ ^/simplesaml/(?<phpfile>.+?\.php)(?<pathinfo>/.*)?$ { | ||||
|             include ${pkgs.nginx}/conf/fastcgi_params; | ||||
|             fastcgi_pass unix:${config.services.phpfpm.pools.mediawiki.socket};  | ||||
|             fastcgi_param SCRIPT_FILENAME ${simplesamlphp}/share/php/simplesamlphp/public/$phpfile; | ||||
|  | ||||
|             # Must be prepended with the baseurlpath | ||||
|             fastcgi_param SCRIPT_NAME /simplesaml/$phpfile; | ||||
|  | ||||
|             fastcgi_param PATH_INFO $pathinfo if_not_empty; | ||||
|           } | ||||
|         ''; | ||||
|       }; | ||||
|  | ||||
|       "= /PNG/PVV-logo.svg".alias = ../../../../assets/logo_blue_regular.svg; | ||||
|       "= /PNG/PVV-logo.png".alias = ../../../../assets/logo_blue_regular.png; | ||||
|       "= /favicon.ico".alias = pkgs.runCommandLocal "mediawiki-favicon.ico" { | ||||
|         buildInputs = with pkgs; [ imagemagick ]; | ||||
|       } '' | ||||
|         convert \ | ||||
|           -resize x64 \ | ||||
|           -gravity center \ | ||||
|           -crop 64x64+0+0 \ | ||||
|           ${../../../../assets/logo_blue_regular.png} \ | ||||
|           -flatten \ | ||||
|           -colors 256 \ | ||||
|           -background transparent \ | ||||
|           $out | ||||
|       ''; | ||||
|     }; | ||||
|  | ||||
|   }; | ||||
| } | ||||
| @@ -0,0 +1,11 @@ | ||||
| <?php | ||||
| $config = array( | ||||
|     'admin' => array( | ||||
|       'core:AdminPassword' | ||||
|     ), | ||||
|     'default-sp' => array( | ||||
|         'saml:SP', | ||||
|         'entityID' => 'https://wiki.pvv.ntnu.no/simplesaml/', | ||||
|         'idp' => 'https://idp.pvv.ntnu.no/', | ||||
|     ), | ||||
| ); | ||||
							
								
								
									
										1293
									
								
								hosts/bekkalokk/services/mediawiki/simplesaml-config.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1293
									
								
								hosts/bekkalokk/services/mediawiki/simplesaml-config.php
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										4
									
								
								hosts/bekkalokk/services/nginx.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								hosts/bekkalokk/services/nginx.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | ||||
| { pkgs, config, ... }: | ||||
| { | ||||
|   services.nginx.enable = true; | ||||
| } | ||||
| @@ -1,22 +0,0 @@ | ||||
| { pkgs, config, ... }: | ||||
| { | ||||
|   imports = [ | ||||
|     ./ingress.nix | ||||
|   ]; | ||||
|  | ||||
|   security.acme = { | ||||
|     acceptTerms = true; | ||||
|     defaults.email = "drift@pvv.ntnu.no"; | ||||
|   }; | ||||
|  | ||||
|   services.nginx = { | ||||
|     enable = true; | ||||
|  | ||||
|     recommendedTlsSettings = true; | ||||
|     recommendedProxySettings = true; | ||||
|     recommendedOptimisation = true; | ||||
|     recommendedGzipSettings = true; | ||||
|   }; | ||||
|  | ||||
|   networking.firewall.allowedTCPPorts = [ 80 443 ]; | ||||
| } | ||||
| @@ -1,55 +0,0 @@ | ||||
| { config, lib, ... }: | ||||
| { | ||||
|   services.nginx.virtualHosts = { | ||||
|     "www2.pvv.ntnu.no" = { | ||||
|       serverAliases = [ "www2.pvv.org" "pvv.ntnu.no" "pvv.org" ]; | ||||
|       addSSL = true; | ||||
|       enableACME = true; | ||||
|  | ||||
|       locations = { | ||||
|         # Proxy home directories | ||||
|         "/~" = { | ||||
|           extraConfig = '' | ||||
|             proxy_redirect off; | ||||
|             proxy_pass https://tom.pvv.ntnu.no; | ||||
|             proxy_set_header Host $host; | ||||
|             proxy_set_header X-Real-IP $remote_addr; | ||||
|             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||||
|             proxy_set_header X-Forwarded-Proto $scheme; | ||||
|           ''; | ||||
|         }; | ||||
|  | ||||
|         # Redirect old wiki entries | ||||
|         "/disk".return = "301 https://www.pvv.ntnu.no/pvv/Diskkjøp"; | ||||
|         "/dok/boker.php".return = "301 https://www.pvv.ntnu.no/pvv/Bokhyllen"; | ||||
|         "/styret/lover/".return = "301 https://www.pvv.ntnu.no/pvv/Lover"; | ||||
|         "/styret/".return = "301 https://www.pvv.ntnu.no/pvv/Styret"; | ||||
|         "/info/".return = "301 https://www.pvv.ntnu.no/pvv/"; | ||||
|         "/info/maskinpark/".return = "301 https://www.pvv.ntnu.no/pvv/Maskiner"; | ||||
|         "/medlemssider/meldinn.php".return = "301 https://www.pvv.ntnu.no/pvv/Medlemskontingent"; | ||||
|         "/diverse/medlems-sider.php".return = "301 https://www.pvv.ntnu.no/pvv/Medlemssider"; | ||||
|         "/cert/".return = "301 https://www.pvv.ntnu.no/pvv/CERT"; | ||||
|         "/drift".return = "301 https://www.pvv.ntnu.no/pvv/Drift"; | ||||
|         "/diverse/abuse.php".return = "301 https://www.pvv.ntnu.no/pvv/CERT/Abuse"; | ||||
|         "/nerds/".return = "301 https://www.pvv.ntnu.no/pvv/Nerdepizza"; | ||||
|  | ||||
|         # TODO: Redirect webmail | ||||
|         "/webmail".return = "301 https://webmail.pvv.ntnu.no/squirrelmail"; | ||||
|  | ||||
|         # Redirect everything else to the main website | ||||
|         "/".return = "301 https://www.pvv.ntnu.no$request_uri"; | ||||
|  | ||||
|         # Proxy the matrix well-known files | ||||
|         # Host has be set before proxy_pass | ||||
|         # The header must be set so nginx on the other side routes it to the right place | ||||
|         "/.well-known/matrix/" = { | ||||
|           extraConfig = '' | ||||
|             proxy_set_header Host matrix.pvv.ntnu.no; | ||||
|             proxy_pass https://matrix.pvv.ntnu.no/.well-known/matrix/; | ||||
|           ''; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  | ||||
							
								
								
									
										68
									
								
								hosts/bekkalokk/services/vaultwarden.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								hosts/bekkalokk/services/vaultwarden.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,68 @@ | ||||
| { config, pkgs, lib, ... }: | ||||
| let | ||||
|   cfg = config.services.vaultwarden; | ||||
|   domain = "pw.pvv.ntnu.no"; | ||||
|   address = "127.0.1.2"; | ||||
|   port = 3011; | ||||
|   wsPort = 3012; | ||||
| in { | ||||
|   sops.secrets."vaultwarden/environ" = { | ||||
|     owner = "vaultwarden"; | ||||
|     group = "vaultwarden"; | ||||
|   }; | ||||
|  | ||||
|   services.vaultwarden = { | ||||
|     enable = true; | ||||
|     dbBackend = "postgresql"; | ||||
|     environmentFile = config.sops.secrets."vaultwarden/environ".path; | ||||
|     config = { | ||||
|       domain = "https://${domain}"; | ||||
|  | ||||
|       rocketAddress = address; | ||||
|       rocketPort = port; | ||||
|  | ||||
|       websocketEnabled = true; | ||||
|       websocketAddress = address; | ||||
|       websocketPort = wsPort; | ||||
|  | ||||
|       signupsAllowed = true; | ||||
|       signupsVerify = true; | ||||
|       signupsDomainsWhitelist = "pvv.ntnu.no"; | ||||
|  | ||||
|       smtpFrom = "vaultwarden@pvv.ntnu.no"; | ||||
|       smtpFromName = "VaultWarden PVV"; | ||||
|  | ||||
|       smtpHost = "smtp.pvv.ntnu.no"; | ||||
|       smtpUsername = "vaultwarden"; | ||||
|       smtpSecurity = "force_tls"; | ||||
|       smtpAuthMechanism = "Login"; | ||||
|  | ||||
|       # Configured in environ: | ||||
|       # databaseUrl = "postgresql://vaultwarden@/vaultwarden"; | ||||
|       # smtpPassword = hemli | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   services.nginx.virtualHosts."${domain}" = { | ||||
|     forceSSL = true; | ||||
|     enableACME = true; | ||||
|     kTLS = true; | ||||
|  | ||||
|     extraConfig = '' | ||||
|       client_max_body_size 128M; | ||||
|     ''; | ||||
|  | ||||
|     locations."/" = { | ||||
|       proxyPass = "http://${address}:${toString port}"; | ||||
|       proxyWebsockets = true; | ||||
|     }; | ||||
|     locations."/notifications/hub" = { | ||||
|       proxyPass = "http://${address}:${toString wsPort}"; | ||||
|       proxyWebsockets = true; | ||||
|     }; | ||||
|     locations."/notifications/hub/negotiate" = { | ||||
|       proxyPass = "http://${address}:${toString port}"; | ||||
|       proxyWebsockets = true; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
| @@ -2,14 +2,20 @@ | ||||
| { | ||||
|   imports = [ | ||||
|     ./roundcube.nix | ||||
|     ./snappymail.nix | ||||
|   ]; | ||||
|  | ||||
|   services.nginx.virtualHosts."webmail2.pvv.ntnu.no" = { | ||||
|   services.nginx.virtualHosts."webmail.pvv.ntnu.no" = { | ||||
|     forceSSL = true; | ||||
|     enableACME = true; | ||||
|     #locations."/" = lib.mkForce { }; | ||||
|     locations."= /" = { | ||||
|       return = "301 https://www.pvv.ntnu.no/mail/"; | ||||
|     kTLS = true; | ||||
|     locations = { | ||||
|       "= /".return = "302 https://webmail.pvv.ntnu.no/roundcube"; | ||||
|  | ||||
|       "/afterlogic_lite".return = "302 https://webmail.pvv.ntnu.no/roundcube"; | ||||
|       "/squirrelmail".return = "302 https://webmail.pvv.ntnu.no/roundcube"; | ||||
|       "/rainloop".return = "302 https://snappymail.pvv.ntnu.no/"; | ||||
|       "/snappymail".return = "302 https://snappymail.pvv.ntnu.no/"; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
| with lib; | ||||
| let | ||||
|   cfg = config.services.roundcube; | ||||
|   domain = "webmail2.pvv.ntnu.no"; | ||||
|   domain = "webmail.pvv.ntnu.no"; | ||||
| in  | ||||
| { | ||||
|   services.roundcube = { | ||||
| @@ -35,6 +35,7 @@ in | ||||
|   services.nginx.virtualHosts."roundcubeplaceholder.example.com" = lib.mkForce { }; | ||||
|  | ||||
|   services.nginx.virtualHosts.${domain} = { | ||||
|     kTLS = true; | ||||
|     locations."/roundcube" = { | ||||
|       tryFiles = "$uri $uri/ =404"; | ||||
|       index = "index.php"; | ||||
|   | ||||
							
								
								
									
										18
									
								
								hosts/bekkalokk/services/webmail/snappymail.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								hosts/bekkalokk/services/webmail/snappymail.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| { config, lib, pkgs, ... }: | ||||
| let | ||||
|   cfg = config.services.snappymail; | ||||
| in { | ||||
|   imports = [ ../../../../modules/snappymail.nix ]; | ||||
|  | ||||
|   services.snappymail = { | ||||
|     enable = true; | ||||
|     hostname = "snappymail.pvv.ntnu.no"; | ||||
|   }; | ||||
|  | ||||
|   services.nginx.virtualHosts.${cfg.hostname} = { | ||||
|     forceSSL = true; | ||||
|     enableACME = true; | ||||
|     kTLS = true; | ||||
|   }; | ||||
| } | ||||
|  | ||||
| @@ -1,4 +0,0 @@ | ||||
| { ... }: | ||||
| { | ||||
|  | ||||
| } | ||||
							
								
								
									
										131
									
								
								hosts/bekkalokk/services/website/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								hosts/bekkalokk/services/website/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,131 @@ | ||||
| { pkgs, lib, config, ... }: | ||||
| let | ||||
|   format = pkgs.formats.php { }; | ||||
|   cfg = config.services.pvv-nettsiden; | ||||
| in { | ||||
|   imports = [ | ||||
|     ./fetch-gallery.nix | ||||
|   ]; | ||||
|  | ||||
|   sops.secrets = lib.genAttrs [ | ||||
|     "nettsiden/door_secret" | ||||
|     "nettsiden/mysql_password" | ||||
|     "nettsiden/simplesamlphp/admin_password" | ||||
|     "nettsiden/simplesamlphp/cookie_salt" | ||||
|   ] (_: { | ||||
|     owner = config.services.phpfpm.pools.pvv-nettsiden.user; | ||||
|     group = config.services.phpfpm.pools.pvv-nettsiden.group; | ||||
|     restartUnits = [ "phpfpm-pvv-nettsiden.service" ]; | ||||
|   }); | ||||
|  | ||||
|   services.idp.sp-remote-metadata = [ | ||||
|     "https://www.pvv.ntnu.no/simplesaml/" | ||||
|     "https://pvv.ntnu.no/simplesaml/" | ||||
|     "https://www.pvv.org/simplesaml/"  | ||||
|     "https://pvv.org/simplesaml/"  | ||||
|   ]; | ||||
|  | ||||
|   services.pvv-nettsiden = { | ||||
|     enable = true; | ||||
|  | ||||
|     package = pkgs.pvv-nettsiden.override { | ||||
|       extra_files = { | ||||
|         "${pkgs.pvv-nettsiden.passthru.simplesamlphpPath}/metadata/saml20-idp-remote.php" = pkgs.writeText "pvv-nettsiden-saml20-idp-remote.php" (import ../idp-simplesamlphp/metadata.php.nix); | ||||
|         "${pkgs.pvv-nettsiden.passthru.simplesamlphpPath}/config/authsources.php" = pkgs.writeText "pvv-nettsiden-authsources.php" '' | ||||
|           <?php | ||||
|           $config = array( | ||||
|               'admin' => array( | ||||
|                 'core:AdminPassword' | ||||
|               ), | ||||
|               'default-sp' => array( | ||||
|                   'saml:SP', | ||||
|                   'entityID' => 'https://${cfg.domainName}/simplesaml/', | ||||
|                   'idp' => 'https://idp.pvv.ntnu.no/', | ||||
|               ), | ||||
|           ); | ||||
| 	''; | ||||
|       }; | ||||
|     }; | ||||
|  | ||||
|     domainName = "www.pvv.ntnu.no"; | ||||
|  | ||||
|     settings = let | ||||
|       includeFromSops = path: format.lib.mkRaw "file_get_contents('${config.sops.secrets."nettsiden/${path}".path}')"; | ||||
|     in { | ||||
|       DOOR_SECRET = includeFromSops "door_secret"; | ||||
|  | ||||
|       DB = { | ||||
|         DSN = "mysql:dbname=www-data_nettside;host=mysql.pvv.ntnu.no"; | ||||
|         USER = "www-data_nettsi"; | ||||
|         PASS = includeFromSops "mysql_password"; | ||||
|       }; | ||||
|  | ||||
|       # TODO: set up postgres session for simplesamlphp | ||||
|       SAML = { | ||||
|         COOKIE_SALT = includeFromSops "simplesamlphp/cookie_salt"; | ||||
|         COOKIE_SECURE = true; | ||||
|         ADMIN_NAME = "PVV Drift"; | ||||
|         ADMIN_EMAIL = "drift@pvv.ntnu.no"; | ||||
|         ADMIN_PASSWORD = includeFromSops "simplesamlphp/admin_password"; | ||||
|         TRUSTED_DOMAINS = [ cfg.domainName ]; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   services.phpfpm.pools."pvv-nettsiden".settings = { | ||||
|     # "php_admin_value[error_log]" = "stderr"; | ||||
|     "php_admin_flag[log_errors]" = true; | ||||
|     "catch_workers_output" = true; | ||||
|   }; | ||||
|  | ||||
|   services.nginx.virtualHosts.${cfg.domainName} = { | ||||
|     serverAliases = [ | ||||
|       "pvv.ntnu.no" | ||||
|       "www.pvv.org" | ||||
|       "pvv.org" | ||||
|     ]; | ||||
|  | ||||
|     locations = { | ||||
|       # Proxy home directories | ||||
|       "^~ /~" = { | ||||
|         extraConfig = '' | ||||
|           proxy_redirect off; | ||||
|           proxy_pass https://tom.pvv.ntnu.no; | ||||
|           proxy_set_header Host $host; | ||||
|           proxy_set_header X-Real-IP $remote_addr; | ||||
|           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||||
|           proxy_set_header X-Forwarded-Proto $scheme; | ||||
|         ''; | ||||
|       }; | ||||
|  | ||||
|       # Redirect the old webmail/wiki paths from spikkjeposche | ||||
|       "^~ /webmail".return = "301 https://webmail.pvv.ntnu.no"; | ||||
|       "~ /pvv/([^\\n\\r]*)".return = "301 https://wiki.pvv.ntnu.no/wiki/$1"; | ||||
|       "= /pvv".return = "301 https://wiki.pvv.ntnu.no/"; | ||||
|  | ||||
|       # Redirect old wiki entries | ||||
|       "/disk".return = "301 https://wiki.pvv.ntnu.no/wiki/Diskkjøp"; | ||||
|       "/dok/boker.php".return = "301 https://wiki.pvv.ntnu.no/wiki/Bokhyllen"; | ||||
|       "/styret/lover/".return = "301 https://wiki.pvv.ntnu.no/wiki/Lover"; | ||||
|       "/styret/".return = "301 https://wiki.pvv.ntnu.no/wiki/Styret"; | ||||
|       "/info/".return = "301 https://wiki.pvv.ntnu.no/wiki/"; | ||||
|       "/info/maskinpark/".return = "301 https://wiki.pvv.ntnu.no/wiki/Maskiner"; | ||||
|       "/medlemssider/meldinn.php".return = "301 https://wiki.pvv.ntnu.no/wiki/Medlemskontingent"; | ||||
|       "/diverse/medlems-sider.php".return = "301 https://wiki.pvv.ntnu.no/wiki/Medlemssider"; | ||||
|       "/cert/".return = "301 https://wiki.pvv.ntnu.no/wiki/CERT"; | ||||
|       "/drift".return = "301 https://wiki.pvv.ntnu.no/wiki/Drift"; | ||||
|       "/diverse/abuse.php".return = "301 https://wiki.pvv.ntnu.no/wiki/CERT/Abuse"; | ||||
|       "/nerds/".return = "301 https://wiki.pvv.ntnu.no/wiki/Nerdepizza"; | ||||
|  | ||||
|       # Proxy the matrix well-known files | ||||
|       # Host has be set before proxy_pass | ||||
|       # The header must be set so nginx on the other side routes it to the right place | ||||
|       "^~ /.well-known/matrix/" = { | ||||
|         extraConfig = '' | ||||
|           proxy_set_header Host matrix.pvv.ntnu.no; | ||||
|           proxy_pass https://matrix.pvv.ntnu.no/.well-known/matrix/; | ||||
|         ''; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										67
									
								
								hosts/bekkalokk/services/website/fetch-gallery.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								hosts/bekkalokk/services/website/fetch-gallery.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| { pkgs, lib, config, ... }: | ||||
| let | ||||
|   galleryDir = config.services.pvv-nettsiden.settings.GALLERY.DIR; | ||||
|   transferDir = "${config.services.pvv-nettsiden.settings.GALLERY.DIR}-transfer"; | ||||
| in { | ||||
|   users.users.${config.services.pvv-nettsiden.user} = { | ||||
|     useDefaultShell = true; | ||||
|  | ||||
|     # This is pushed from microbel:/var/www/www-gallery/build-gallery.sh | ||||
|     openssh.authorizedKeys.keys = [ | ||||
|     ''command="${pkgs.rrsync}/bin/rrsync -wo ${transferDir}",restrict,no-agent-forwarding,no-port-forwarding,no-pty,no-X11-forwarding ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIjHhC2dikhWs/gG+m7qP1eSohWzTehn4ToNzDSOImyR gallery-publish'' | ||||
|     ]; | ||||
|   }; | ||||
|  | ||||
|   systemd.paths.pvv-nettsiden-gallery-update = { | ||||
|     wantedBy = [ "multi-user.target" ]; | ||||
|     pathConfig = { | ||||
|       PathChanged = "${transferDir}/gallery.tar.gz"; | ||||
|       Unit = "pvv-nettsiden-gallery-update.service"; | ||||
|       MakeDirectory = true; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   systemd.services.pvv-nettsiden-gallery-update = { | ||||
|     path = with pkgs; [ imagemagick gnutar gzip ]; | ||||
|  | ||||
|     script = '' | ||||
|       tar ${lib.cli.toGNUCommandLineShell {} { | ||||
|         extract = true; | ||||
|         file = "${transferDir}/gallery.tar.gz"; | ||||
|         directory = "."; | ||||
|       }} | ||||
|  | ||||
|       # Delete files and directories that exists in the gallery that don't exist in the tarball | ||||
|       filesToRemove=$(uniq -u <(sort <(find . -not -path "./.thumbnails*") <(tar -tf ${transferDir}/gallery.tar.gz | sed 's|/$||'))) | ||||
|       while IFS= read fname; do | ||||
|         rm -f "$fname" ||: | ||||
|         rm -f ".thumbnails/$fname.png" ||: | ||||
|       done <<< "$filesToRemove" | ||||
|  | ||||
|       find . -type d -empty -delete | ||||
|  | ||||
|       mkdir -p .thumbnails | ||||
|       images=$(find . -type f -not -path "./.thumbnails*") | ||||
|  | ||||
|       while IFS= read fname; do | ||||
|         # Skip this file if an up-to-date thumbnail already exists | ||||
|         if [ -f ".thumbnails/$fname.png" ] && \ | ||||
|            [ "$(date -R -r "$fname")" == "$(date -R -r ".thumbnails/$fname.png")" ] | ||||
|         then | ||||
|           continue | ||||
|         fi | ||||
|  | ||||
|         echo "Creating thumbnail for $fname" | ||||
|         mkdir -p $(dirname ".thumbnails/$fname") | ||||
|         convert -define jpeg:size=200x200 "$fname" -thumbnail 300 -auto-orient ".thumbnails/$fname.png" ||: | ||||
| 	touch -m -d "$(date -R -r "$fname")" ".thumbnails/$fname.png" | ||||
|       done <<< "$images" | ||||
|     ''; | ||||
|  | ||||
|     serviceConfig = { | ||||
|       WorkingDirectory = galleryDir; | ||||
|       User = config.services.pvv-nettsiden.user; | ||||
|       Group = config.services.pvv-nettsiden.group; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
| @@ -12,7 +12,8 @@ | ||||
|     ./services/mysql.nix | ||||
|     ./services/postgres.nix | ||||
|     ./services/mysql.nix | ||||
|     ./services/calendar-bot.nix | ||||
|     # TODO: fix the calendar bot | ||||
|     # ./services/calendar-bot.nix | ||||
|  | ||||
|     ./services/matrix | ||||
|   ]; | ||||
|   | ||||
| @@ -5,6 +5,7 @@ in { | ||||
|   services.nginx.virtualHosts."chat.pvv.ntnu.no" = { | ||||
|     enableACME = true; | ||||
|     forceSSL = true; | ||||
|     kTLS = true; | ||||
|  | ||||
|     root = pkgs.element-web.override { | ||||
|       conf = { | ||||
| @@ -24,21 +25,26 @@ in { | ||||
|         features = { | ||||
|           feature_latex_maths = true; | ||||
|           feature_pinning = true; | ||||
|           feature_render_reaction_images = true; | ||||
|           feature_state_counters = true; | ||||
|           feature_custom_status = false; | ||||
|           # element call group calls | ||||
|           feature_group_calls = true; | ||||
|         }; | ||||
|         default_theme = "dark"; | ||||
|         # Servers in this list should provide some sort of valuable scoping | ||||
|         # matrix.org is not useful compared to matrixrooms.info, | ||||
|         # because it has so many general members, rooms of all topics are on it. | ||||
|         # Something matrixrooms.info is already providing. | ||||
|         room_directory.servers = [ | ||||
|           "pvv.ntnu.no" | ||||
|           "matrix.omegav.no" | ||||
|           "matrix.org" | ||||
|           "libera.chat" | ||||
|           "gitter.im" | ||||
|           "mozilla.org" | ||||
|           "kde.org" | ||||
|           "t2bot.io" | ||||
|           "fosdem.org" | ||||
|           "dodsorf.as" | ||||
|           "matrixrooms.info" # Searches all public room directories | ||||
|           "matrix.omegav.no" # Friends | ||||
|           "gitter.im" # gitter rooms | ||||
|           "mozilla.org" # mozilla and friends | ||||
|           "kde.org" # KDE rooms | ||||
|           "fosdem.org" # FOSDEM | ||||
|           "dodsorf.as" # PVV Member | ||||
|           "nani.wtf" # PVV Member | ||||
|         ]; | ||||
|         enable_presence_by_hs_url = { | ||||
|           "https://matrix.org" = false; | ||||
|   | ||||
| @@ -7,6 +7,9 @@ from synapse import module_api | ||||
|  | ||||
| import re | ||||
|  | ||||
| import logging | ||||
| logger = logging.getLogger(__name__) | ||||
|  | ||||
| class SMTPAuthProvider: | ||||
|     def __init__(self, config: dict, api: module_api): | ||||
|         self.api = api | ||||
| @@ -43,8 +46,13 @@ class SMTPAuthProvider: | ||||
|  | ||||
|         if result == True: | ||||
|             userid = self.api.get_qualified_user_id(username) | ||||
|             if not self.api.check_user_exists(userid): | ||||
|                 self.api.register_user(username) | ||||
|  | ||||
|             userid = await self.api.check_user_exists(userid) | ||||
|             if not userid: | ||||
|                 logger.info(f"user did not exist, registering {username}") | ||||
|                 userid = await self.api.register_user(username) | ||||
|                 logger.info(f"registered userid: {userid}") | ||||
|             return (userid, None) | ||||
|         else: | ||||
|             logger.info("returning None") | ||||
|             return None | ||||
|   | ||||
| @@ -134,80 +134,6 @@ in { | ||||
|         "129.241.0.0/16" | ||||
|         "2001:700:300::/44" | ||||
|       ]; | ||||
|  | ||||
|       saml2_config = { | ||||
|         sp_config.metadata.remote = [ | ||||
|           { url = "https://idp.pvv.ntnu.no/simplesaml/saml2/idp/metadata.php"; } | ||||
|         ]; | ||||
|  | ||||
|         description = [ "Matrix Synapse SP" "en" ]; | ||||
|         name = [ "Matrix Synapse SP" "en" ]; | ||||
|  | ||||
|         ui_info = { | ||||
|           display_name = [ | ||||
|             { | ||||
|               lang = "en"; | ||||
|               text = "PVV Matrix login"; | ||||
|             } | ||||
|           ]; | ||||
|           description = [ | ||||
|             { | ||||
|               lang = "en"; | ||||
|               text = "Matrix is a modern free and open federated chat protocol"; | ||||
|             } | ||||
|           ]; | ||||
|           #information_url = [ | ||||
|           #  { | ||||
|           #    lang = "en"; | ||||
|           #    text = ""; | ||||
|           #  }; | ||||
|           #]; | ||||
|           #privacy_statement_url = [ | ||||
|           #  { | ||||
|           #    lang = "en"; | ||||
|           #    text = ""; | ||||
|           #  }; | ||||
|           #]; | ||||
|           keywords = [ | ||||
|             { | ||||
|               lang = "en"; | ||||
|               text = [ "Matrix" "Element" ]; | ||||
|             } | ||||
|           ]; | ||||
|           #logo = [ | ||||
|           #  { | ||||
|           #    lang = "en"; | ||||
|           #    text = ""; | ||||
|           #    width = ""; | ||||
|           #    height = ""; | ||||
|           #  } | ||||
|           #]; | ||||
|         }; | ||||
|  | ||||
|         organization = { | ||||
|           name = "Programvareverkstedet"; | ||||
|           display_name = [ "Programvareverkstedet" "en" ]; | ||||
|           url = "https://www.pvv.ntnu.no"; | ||||
|         }; | ||||
|         contact_person = [ | ||||
|           { given_name = "Drift"; | ||||
|             sur_name = "King"; | ||||
|             email_adress = [ "drift@pvv.ntnu.no" ]; | ||||
|             contact_type = "technical"; | ||||
|           } | ||||
|         ]; | ||||
|  | ||||
|         user_mapping_provider = { | ||||
|           config = { | ||||
|             mxid_source_attribute =  "uid"; # What is this supposed to be? | ||||
|             mxid_mapping = "hexencode"; | ||||
|           }; | ||||
|         }; | ||||
|  | ||||
|         #attribute_requirements = [ | ||||
|         #  {attribute = "userGroup"; value = "medlem";} # Do we have this? | ||||
|         #]; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
| @@ -217,6 +143,9 @@ in { | ||||
|   services.redis.servers."".enable = true; | ||||
|    | ||||
|   services.nginx.virtualHosts."matrix.pvv.ntnu.no" = lib.mkMerge [ | ||||
|   ({ | ||||
|     kTLS = true; | ||||
|   }) | ||||
|   ({ | ||||
|     locations."/.well-known/matrix/server" = { | ||||
|       return = '' | ||||
| @@ -241,6 +170,8 @@ in { | ||||
|         extraConfig = '' | ||||
|           allow ${values.hosts.ildkule.ipv4}; | ||||
|           allow ${values.hosts.ildkule.ipv6}; | ||||
|           allow ${values.hosts.ildkule.ipv4_global}; | ||||
|           allow ${values.hosts.ildkule.ipv6_global}; | ||||
|           deny all; | ||||
|         ''; | ||||
|       })) | ||||
| @@ -252,6 +183,8 @@ in { | ||||
|       extraConfig = '' | ||||
|         allow ${values.hosts.ildkule.ipv4}; | ||||
|         allow ${values.hosts.ildkule.ipv6}; | ||||
|         allow ${values.hosts.ildkule.ipv4_global}; | ||||
|         allow ${values.hosts.ildkule.ipv6_global}; | ||||
|         deny all; | ||||
|       ''; | ||||
|     }; | ||||
|   | ||||
| @@ -1,15 +1,8 @@ | ||||
| { config, values, ... }: | ||||
| { | ||||
|   security.acme = { | ||||
|     acceptTerms = true; | ||||
|     defaults.email = "danio@pvv.ntnu.no"; | ||||
|   }; | ||||
|  | ||||
|   services.nginx = { | ||||
|     enable = true; | ||||
|  | ||||
|     enableReload = true; | ||||
|  | ||||
|     defaultListenAddresses = [ | ||||
|       values.hosts.bicep.ipv4 | ||||
|       "[${values.hosts.bicep.ipv6}]" | ||||
| @@ -18,28 +11,5 @@ | ||||
|       "127.0.0.2" | ||||
|       "[::1]" | ||||
|     ]; | ||||
|  | ||||
|     appendConfig = '' | ||||
|       pcre_jit on; | ||||
|       worker_processes 8; | ||||
|       worker_rlimit_nofile 8192; | ||||
|     ''; | ||||
|  | ||||
|     eventsConfig = '' | ||||
|       multi_accept on; | ||||
|       worker_connections 4096; | ||||
|     ''; | ||||
|  | ||||
|     recommendedProxySettings = true; | ||||
|     recommendedTlsSettings = true; | ||||
|     recommendedGzipSettings = true; | ||||
|     recommendedBrotliSettings = true; | ||||
|     recommendedOptimisation = true; | ||||
|   }; | ||||
|  | ||||
|   networking.firewall.allowedTCPPorts = [ 80 443 ]; | ||||
|  | ||||
|   systemd.services.nginx.serviceConfig = { | ||||
|     LimitNOFILE = 65536; | ||||
|   }; | ||||
| } | ||||
|   | ||||
							
								
								
									
										44
									
								
								hosts/bikkje/configuration.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								hosts/bikkje/configuration.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,44 @@ | ||||
| { config, pkgs, values, ... }: | ||||
| { | ||||
|     networking.nat = { | ||||
|     enable = true; | ||||
|     internalInterfaces = ["ve-+"]; | ||||
|     externalInterface = "ens3"; | ||||
|     # Lazy IPv6 connectivity for the container | ||||
|     enableIPv6 = true; | ||||
|   }; | ||||
|  | ||||
|   containers.bikkje = { | ||||
|     autoStart = true; | ||||
|     config = { config, pkgs, ... }: { | ||||
|       #import packages | ||||
|       packages = with pkgs; [ | ||||
|           alpine | ||||
|           mutt | ||||
|           mutt-ics | ||||
|           mutt-wizard | ||||
|           weechat | ||||
|           weechatScripts.edit | ||||
|           hexchat | ||||
|           irssi | ||||
|           pidgin | ||||
|       ]; | ||||
|  | ||||
|       networking = { | ||||
|         firewall = { | ||||
|           enable = true; | ||||
|           # Allow SSH and HTTP and ports for email and irc | ||||
|           allowedTCPPorts = [ 80 22 194 994 6665 6666 6667 6668 6669 6697 995 993 25 465 587 110 143 993 995 ]; | ||||
|           allowedUDPPorts = [ 80 22 194 994 6665 6666 6667 6668 6669 6697 995 993 25 465 587 110 143 993 995 ]; | ||||
|         }; | ||||
|         # Use systemd-resolved inside the container | ||||
|         # Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686 | ||||
|         useHostResolvConf = mkForce false; | ||||
|       }; | ||||
|        | ||||
|       system.stateVersion = "23.11"; | ||||
|       services.resolved.enable = true; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
| }; | ||||
| @@ -1,19 +1,16 @@ | ||||
| { config, pkgs, values, ... }: | ||||
| { | ||||
|   imports = [ | ||||
|       # Include the results of the hardware scan. | ||||
|       ./hardware-configuration.nix | ||||
|       ../../base.nix | ||||
|       ../../misc/metrics-exporters.nix | ||||
|  | ||||
|       ./services/openvpn-client.nix | ||||
|     ]; | ||||
|     ./hardware-configuration.nix | ||||
|     ../../base.nix | ||||
|     ../../misc/metrics-exporters.nix | ||||
|   ]; | ||||
|  | ||||
|   # buskerud does not support efi? | ||||
|   # boot.loader.systemd-boot.enable = true; | ||||
|   # boot.loader.efi.canTouchEfiVariables = true; | ||||
|   boot.loader.grub.enable = true; | ||||
|   boot.loader.grub.device = "/dev/sda"; | ||||
|   boot.loader.grub.device = "/dev/sdb"; | ||||
|  | ||||
|   networking.hostName = "buskerud"; | ||||
|   networking.search = [ "pvv.ntnu.no" "pvv.org" ]; | ||||
| @@ -25,20 +22,10 @@ | ||||
|     address = with values.hosts.buskerud; [ (ipv4 + "/25") (ipv6 + "/64") ]; | ||||
|   }; | ||||
|  | ||||
|   # Buskerud should use the default gateway received from DHCP | ||||
|   networking.interfaces.enp14s0f1.useDHCP = true; | ||||
|  | ||||
|   # networking.interfaces.tun = { | ||||
|   #   virtual = true; | ||||
|   #   ipv4.adresses = [ {address="129.241.210.252"; prefixLength=25; } ]; | ||||
|   # }; | ||||
|  | ||||
|   # List packages installed in system profile | ||||
|   environment.systemPackages = with pkgs; [ | ||||
|   ]; | ||||
|  | ||||
|   # List services that you want to enable: | ||||
|  | ||||
|   # This value determines the NixOS release from which the default | ||||
|   # settings for stateful data, like file locations and database versions | ||||
|   # on your system were taken. It‘s perfectly fine and recommended to leave | ||||
| @@ -46,5 +33,4 @@ | ||||
|   # Before changing this value read the documentation for this option | ||||
|   # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). | ||||
|   system.stateVersion = "23.05"; # Did you read the comment? | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1,109 +0,0 @@ | ||||
| { lib, values, ... }: | ||||
| { | ||||
|   services.openvpn.servers."ov-tunnel" = { | ||||
|     config = let | ||||
|       conf = { | ||||
|         # TODO: use aliases | ||||
|         client = true; | ||||
|         dev = "tap"; | ||||
|         proto = "udp"; | ||||
|         #remote = "129.241.210.253 1194"; | ||||
|         remote = "129.241.210.191 1194"; | ||||
|  | ||||
|         resolv-retry = "infinite"; | ||||
|         nobind = true; | ||||
|  | ||||
|         ca = "/etc/openvpn/ca.pem"; | ||||
|         cert = "/etc/openvpn/crt.pem"; | ||||
|         key = "/etc/openvpn/key.pem"; | ||||
|         remote-cert-tls = "server"; | ||||
|         cipher = "none"; | ||||
|  | ||||
|         user = "nobody"; | ||||
|         group = "nobody"; | ||||
|  | ||||
|         status = "/var/log/openvpn-status.log"; | ||||
|  | ||||
|         persist-key = true; | ||||
|         persist-tun = true; | ||||
|  | ||||
|         verb = 5; | ||||
|  | ||||
|         # script-security = 2; | ||||
|         # up = "systemctl restart rwhod"; | ||||
|       }; | ||||
|     in lib.pipe conf [ | ||||
|       (lib.filterAttrs (_: value: !(builtins.isNull value || value == false))) | ||||
|       (builtins.mapAttrs (_: value: | ||||
|         if builtins.isList value then builtins.concatStringsSep " " (map toString value) | ||||
|         else if value == true then value | ||||
|         else if builtins.any (f: f value) [ | ||||
|           builtins.isString | ||||
|           builtins.isInt | ||||
|           builtins.isFloat | ||||
|           lib.isPath | ||||
|           lib.isDerivation | ||||
|         ] then toString value | ||||
|         else throw "Unknown value in buskerud openvpn config, deading now\n${value}" | ||||
|       )) | ||||
|       (lib.mapAttrsToList (name: value: if value == true then name else "${name} ${value}")) | ||||
|       (builtins.concatStringsSep "\n") | ||||
|       (x: x + "\n\n") | ||||
|     ]; | ||||
|   }; | ||||
|  | ||||
|   systemd.network.networks."enp14s0f1" = { | ||||
|     matchConfig.Name = "enp14s0f1"; | ||||
|     networkConfig = { | ||||
|       DefaultRouteOnDevice = true; | ||||
|     }; | ||||
|     routes = [ | ||||
|       { routeConfig = { | ||||
|           Type = "unicast"; | ||||
|           Destination = values.hosts.knutsen.ipv4 + "/32"; | ||||
|           Metric = 50; | ||||
|         }; | ||||
|       } | ||||
|     ]; | ||||
|   }; | ||||
|  | ||||
|   systemd.network.netdevs."br0" = { | ||||
|     netdevConfig = { | ||||
|       Kind = "bridge"; | ||||
|       Name = "br0"; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   systemd.network.networks."br0" = { | ||||
|     matchConfig.Name = "br0"; | ||||
|     routes = [ | ||||
|       { routeConfig = { | ||||
|           Type = "unicast"; | ||||
|           Destination = values.ipv4-space; | ||||
|           Metric = 100; | ||||
|         }; | ||||
|       } | ||||
|     ]; | ||||
|   }; | ||||
|  | ||||
|   systemd.network.networks."enp3s0f0" = { | ||||
|     matchConfig.Name = "enp3s0f0"; | ||||
|     networkConfig.DefaultRouteOnDevice = false; | ||||
|   }; | ||||
|  | ||||
|   systemd.network.networks."enp3s0f1" = { | ||||
|     matchConfig.Name = "enp3s0f1"; | ||||
|     bridge = [ "br0" ]; | ||||
|   }; | ||||
|  | ||||
|   systemd.network.networks."tap0" = { | ||||
|     matchConfig.Name = "tap0"; | ||||
|     bridge = [ "br0" ]; | ||||
|   }; | ||||
|  | ||||
|   #networking.nat = { | ||||
|   #  enable = true; | ||||
|   #  externalInterface = "enp14s0f1"; | ||||
|   #  internalInterfaces  = [ "tun" ]; | ||||
|   #}; | ||||
| } | ||||
							
								
								
									
										133
									
								
								hosts/elysium/base.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										133
									
								
								hosts/elysium/base.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,133 @@ | ||||
| { config, lib, pkgs, inputs, values, ... }: | ||||
|  | ||||
| { | ||||
|   imports = [ | ||||
|     ./modules/snakeoil-certs.nix | ||||
|   ]; | ||||
|  | ||||
|   networking.domain = "pvv.ntnu.no"; | ||||
|   networking.useDHCP = false; | ||||
|   # networking.search = [ "pvv.ntnu.no" "pvv.org" ]; | ||||
|   # networking.nameservers = lib.mkDefault [ "129.241.0.200" "129.241.0.201" ]; | ||||
|   # networking.tempAddresses = lib.mkDefault "disabled"; | ||||
|   # networking.defaultGateway = values.hosts.gateway; | ||||
|  | ||||
|   systemd.network.enable = true; | ||||
|  | ||||
|   services.resolved = { | ||||
|     enable = lib.mkDefault true; | ||||
|     dnssec = "false"; # Supposdly this keeps breaking and the default is to allow downgrades anyways... | ||||
|   }; | ||||
|  | ||||
|   time.timeZone = "Europe/Oslo"; | ||||
|  | ||||
|   i18n.defaultLocale = "en_US.UTF-8"; | ||||
|   console = { | ||||
|     font = "Lat2-Terminus16"; | ||||
|     keyMap = "no"; | ||||
|   }; | ||||
|  | ||||
|   system.autoUpgrade = { | ||||
|     enable = true; | ||||
|     flake = "git+https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git"; | ||||
|     flags = [ | ||||
|       "--update-input" "nixpkgs" | ||||
|       "--update-input" "nixpkgs-unstable" | ||||
|       "--no-write-lock-file" | ||||
|     ]; | ||||
|   }; | ||||
|   nix.gc.automatic = true; | ||||
|   nix.gc.options = "--delete-older-than 2d"; | ||||
|  | ||||
|   nix.settings.experimental-features = [ "nix-command" "flakes" ]; | ||||
|  | ||||
|   /* This makes commandline tools like | ||||
|   ** nix run nixpkgs#hello | ||||
|   ** and nix-shell -p hello | ||||
|   ** use the same channel the system | ||||
|   ** was built with | ||||
|   */ | ||||
|   nix.registry = { | ||||
|     nixpkgs.flake = inputs.nixpkgs; | ||||
|   }; | ||||
|   nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; | ||||
|  | ||||
|   environment.systemPackages = with pkgs; [ | ||||
|     file | ||||
|     git | ||||
|     gnupg | ||||
|     htop | ||||
|     nano | ||||
|     ripgrep | ||||
|     rsync | ||||
|     screen | ||||
|     tmux | ||||
|     vim | ||||
|     wget | ||||
|  | ||||
|     kitty.terminfo | ||||
|     foot.terminfo | ||||
|   ]; | ||||
|  | ||||
|   programs.zsh.enable = true; | ||||
|  | ||||
|   users.groups."drift".name = "drift"; | ||||
|  | ||||
|   # Trusted users on the nix builder machines | ||||
|   users.groups."nix-builder-users".name = "nix-builder-users"; | ||||
|  | ||||
|   services.openssh = { | ||||
|     enable = true; | ||||
|     extraConfig = '' | ||||
|       PubkeyAcceptedAlgorithms=+ssh-rsa | ||||
|     ''; | ||||
|     settings.PermitRootLogin = "yes"; | ||||
|   }; | ||||
|  | ||||
|   # nginx return 444 for all nonexistent virtualhosts | ||||
|  | ||||
|   systemd.services.nginx.after = [ "generate-snakeoil-certs.service" ]; | ||||
|  | ||||
|   environment.snakeoil-certs = lib.mkIf config.services.nginx.enable { | ||||
|     "/etc/certs/nginx" = { | ||||
|       owner = "nginx"; | ||||
|       group = "nginx"; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   services.nginx = { | ||||
|     recommendedTlsSettings = true; | ||||
|     recommendedProxySettings = true; | ||||
|     recommendedOptimisation = true; | ||||
|     recommendedGzipSettings = true; | ||||
|  | ||||
|     appendConfig = '' | ||||
|       pcre_jit on; | ||||
|       worker_processes auto; | ||||
|       worker_rlimit_nofile 100000; | ||||
|     ''; | ||||
|     eventsConfig = '' | ||||
|       worker_connections 2048; | ||||
|       use epoll; | ||||
|       multi_accept on; | ||||
|     ''; | ||||
|   }; | ||||
|  | ||||
|   systemd.services.nginx.serviceConfig = lib.mkIf config.services.nginx.enable { | ||||
|     LimitNOFILE = 65536; | ||||
|   }; | ||||
|  | ||||
|   services.nginx.virtualHosts."_" = lib.mkIf config.services.nginx.enable { | ||||
|     sslCertificate = "/etc/certs/nginx.crt"; | ||||
|     sslCertificateKey = "/etc/certs/nginx.key"; | ||||
|     addSSL = true; | ||||
|     extraConfig = "return 444;"; | ||||
|   }; | ||||
|  | ||||
|   networking.firewall.allowedTCPPorts = lib.mkIf config.services.nginx.enable [ 80 443 ]; | ||||
|  | ||||
|   security.acme = { | ||||
|     acceptTerms = true; | ||||
|     defaults.email = "drift@pvv.ntnu.no"; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										167
									
								
								hosts/elysium/configuration.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										167
									
								
								hosts/elysium/configuration.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,167 @@ | ||||
| { config, pkgs, values, ... }: | ||||
| { | ||||
|   imports = [ | ||||
|       # Include the results of the hardware scan. | ||||
|       ./hardware-configuration.nix | ||||
|       ./nvidia.nix | ||||
|       ./base.nix | ||||
|       ../../misc/metrics-exporters.nix | ||||
|     ]; | ||||
|  | ||||
|   sops.defaultSopsFile = ../../secrets/elysium/elysium.yaml; | ||||
|   sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; | ||||
|   sops.age.keyFile = "/var/lib/sops-nix/key.txt"; | ||||
|   sops.age.generateKey = true; | ||||
|  | ||||
|   boot.loader.systemd-boot.enable = true; | ||||
|   boot.loader.efi.canTouchEfiVariables = true; | ||||
|  | ||||
|   networking.hostName = "elysium"; # Define your hostname. | ||||
|  | ||||
|   #update this to actual network card. | ||||
|   systemd.network.networks."30-ens18" = values.defaultNetworkConfig // { | ||||
|     matchConfig.Name = "ens18"; | ||||
|     address = with values.hosts.elysium; [ (ipv4 + "/25") (ipv6 + "/64") ]; | ||||
|   }; | ||||
|  | ||||
|   # List packages installed in system profile | ||||
|   environment.systemPackages = with pkgs; [ | ||||
|           zsh | ||||
|           bash | ||||
|           fish | ||||
|           tcsh | ||||
|  | ||||
|           alpine | ||||
|           mutt | ||||
|           mutt-ics | ||||
|           mutt-wizard | ||||
|           notmuch | ||||
|           mailutils | ||||
|           procmail | ||||
|  | ||||
|           irssi | ||||
|           weechat | ||||
|           weechatScripts.edit | ||||
|  | ||||
|           coreutils-full | ||||
|           diffutils | ||||
|           findutils | ||||
|           ripgrep | ||||
|           cvs | ||||
|           gawk | ||||
|           git | ||||
|           gnupg | ||||
|           gnused | ||||
|           groff | ||||
|           less | ||||
|           p7zip | ||||
|           rcs | ||||
|           screen | ||||
|           tmux | ||||
|           tree | ||||
|           unzip | ||||
|           zip | ||||
|  | ||||
|           emacs | ||||
|           helix | ||||
|           joe | ||||
|           micro | ||||
|           nano | ||||
|           neovim | ||||
|  | ||||
|           autossh | ||||
|           inetutils | ||||
|           lynx | ||||
|           mosh | ||||
|           rsync | ||||
|           w3m | ||||
|  | ||||
|           clang | ||||
|           gcc | ||||
|           guile | ||||
|           lua | ||||
|           perl | ||||
|           php | ||||
|           python3 | ||||
|           (python3.withPackages (ps: with ps; [ | ||||
|             numpy | ||||
|             sympy | ||||
|             scipy | ||||
|             requests | ||||
|             imageio | ||||
|             pillow | ||||
|             httpx | ||||
|             pycryptodome | ||||
|             pandas | ||||
|             matplotlib | ||||
|           ])) | ||||
|           ruby | ||||
|           tcl | ||||
|  | ||||
|  | ||||
|           openscad | ||||
|           cura | ||||
|           where-is-my-sddm-theme | ||||
|           firefox | ||||
|  | ||||
|   ]; | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|   fonts.packages = with pkgs; [ | ||||
|     noto-fonts | ||||
|     noto-fonts-cjk | ||||
|     noto-fonts-emoji | ||||
|     liberation_ttf | ||||
|     fira-code | ||||
|     fira-code-symbols | ||||
|     mplus-outline-fonts.githubRelease | ||||
|     dina-font | ||||
|     proggyfonts | ||||
|     nerdfonts | ||||
|     ubuntu_font_family | ||||
|  | ||||
|   ]; | ||||
|  | ||||
|   # Enable CUPS to print documents. | ||||
|   services.printing.enable = true; | ||||
|  | ||||
|   security.polkit.enable = true; | ||||
|    | ||||
|   services.displayManager = { | ||||
|     enable = true; | ||||
|     sessionPackages = with pkgs; [ sway ]; | ||||
|     sddm = { | ||||
|       enable = true; | ||||
|       theme = "${pkgs.where-is-my-sddm-theme}"; | ||||
|       wayland.enable = true; | ||||
|       wayland.compositor = "kwin"; | ||||
|       autoNumlock = true; | ||||
|       enableHidpi = true; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   services.desktopManager.plasma6.enable = true; | ||||
|   services.desktopManager.plasma6.enableQt5Integration = true; | ||||
|  | ||||
|   qt.platformTheme = "kde"; | ||||
|  | ||||
|   # Configure keymap in X11 | ||||
|   services.xserver.xkb = { | ||||
|     layout = "us,no"; | ||||
|     variant = ","; | ||||
|   }; | ||||
|  | ||||
|  | ||||
|   # List services that you want to enable: | ||||
|  | ||||
|   # This value determines the NixOS release from which the default | ||||
|   # settings for stateful data, like file locations and database versions | ||||
|   # on your system were taken. It‘s perfectly fine and recommended to leave | ||||
|   # this value at the release version of the first install of this system. | ||||
|   # Before changing this value read the documentation for this option | ||||
|   # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). | ||||
|   system.stateVersion = "23.05"; # Did you read the comment? | ||||
|  | ||||
| } | ||||
							
								
								
									
										42
									
								
								hosts/elysium/hardware-configuration.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								hosts/elysium/hardware-configuration.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | ||||
| # Do not modify this file!  It was generated by ‘nixos-generate-config’ | ||||
| # and may be overwritten by future invocations.  Please make changes | ||||
| # to /etc/nixos/configuration.nix instead. | ||||
| { config, lib, pkgs, modulesPath, ... }: | ||||
|  | ||||
| { | ||||
|   #imports = | ||||
|   #  [ (modulesPath + "/profiles/qemu-guest.nix") | ||||
|   #  ]; | ||||
|   imports = | ||||
|     [ (modulesPath + "/installer/scan/not-detected.nix") | ||||
|     ]; | ||||
|  | ||||
|  | ||||
|   boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; | ||||
|   boot.initrd.kernelModules = [ ]; | ||||
|   boot.kernelModules = [ ]; | ||||
|   boot.extraModulePackages = [ ]; | ||||
|  | ||||
|   fileSystems."/" = | ||||
|     { device = "/dev/disk/by-uuid/224c45db-9fdc-45d4-b3ad-aaf20b3efa8a"; | ||||
|       fsType = "ext4"; | ||||
|     }; | ||||
|  | ||||
|   fileSystems."/boot" = | ||||
|     { device = "/dev/disk/by-uuid/CC37-F5FE"; | ||||
|       fsType = "vfat"; | ||||
|     }; | ||||
|  | ||||
|   swapDevices = | ||||
|     [ { device = "/dev/disk/by-uuid/a1ce3234-78b1-4565-9643-f4a05004424f"; } | ||||
|     ]; | ||||
|  | ||||
|   # Enables DHCP on each ethernet and wireless interface. In case of scripted networking | ||||
|   # (the default) this is the recommended approach. When using systemd-networkd it's | ||||
|   # still possible to use this option, but it's recommended to use it in conjunction | ||||
|   # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. | ||||
|   networking.useDHCP = lib.mkDefault true; | ||||
|   # networking.interfaces.ens18.useDHCP = lib.mkDefault true; | ||||
|  | ||||
|   nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; | ||||
| } | ||||
							
								
								
									
										52
									
								
								hosts/elysium/nvidia.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								hosts/elysium/nvidia.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,52 @@ | ||||
| { config, lib, pkgs, ... }: | ||||
| { | ||||
|   # Enable OpenGL | ||||
|   hardware.opengl = { | ||||
|     enable = true; | ||||
|     driSupport = true; | ||||
|     driSupport32Bit = true; | ||||
|   }; | ||||
|    | ||||
|   # Load nvidia driver for Xorg and Wayland | ||||
|   services.xserver.videoDrivers = ["nvidia"]; | ||||
|   #boot with nvidia kernel module | ||||
|   boot.initrd.kernelModules = [ "nvidia" ]; | ||||
|   hardware.nvidia = { | ||||
|     # Modesetting is required. | ||||
|     modesetting.enable = true; | ||||
|       # Nvidia power management. Experimental, and can cause sleep/suspend to fail. | ||||
|       #powerManagement.enable = true; | ||||
|       # Fine-grained power management. Turns off GPU when not in use. | ||||
|       # Experimental and only works on modern Nvidia GPUs (Turing or newer). | ||||
|       #powerManagement.finegrained = true; | ||||
|  | ||||
|       # Use the NVidia open source kernel module (not to be confused with the | ||||
|       # independent third-party "nouveau" open source driver). | ||||
|       # Support is limited to the Turing and later architectures. Full list of  | ||||
|       # supported GPUs is at:  | ||||
|       # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus  | ||||
|       # Only available from driver 515.43.04+ | ||||
|       # Currently alpha-quality/buggy, so false is currently the recommended setting. | ||||
|       open = false; | ||||
|  | ||||
|       # Enable the Nvidia settings menu, | ||||
|       # accessible via `nvidia-settings`. | ||||
|       nvidiaSettings = true; | ||||
|  | ||||
|       # Optionally, you may need to select the appropriate driver version for your specific GPU. | ||||
|       package = config.boot.kernelPackages.nvidiaPackages.legacy_470; | ||||
|     }; | ||||
|  | ||||
|  | ||||
|     # Enable the CUDA toolkit | ||||
|     #install packages  | ||||
|     environment.systemPackages = with pkgs; [ | ||||
|       #cudaPackages.cudnn | ||||
|       #cudaPackages.cudatoolkit | ||||
|        | ||||
|       nvtopPackages.nvidia | ||||
|        | ||||
|     ]; | ||||
|  | ||||
|  | ||||
|   } | ||||
| @@ -6,8 +6,8 @@ | ||||
|       ../../base.nix | ||||
|       ../../misc/metrics-exporters.nix | ||||
|  | ||||
|       ./services/monitoring | ||||
|       ./services/nginx | ||||
|       ./services/metrics | ||||
|     ]; | ||||
|  | ||||
|   sops.defaultSopsFile = ../../secrets/ildkule/ildkule.yaml; | ||||
| @@ -15,28 +15,21 @@ | ||||
|   sops.age.keyFile = "/var/lib/sops-nix/key.txt"; | ||||
|   sops.age.generateKey = true; | ||||
|  | ||||
|   boot.loader.systemd-boot.enable = true; | ||||
|   boot.loader.efi.canTouchEfiVariables = true; | ||||
|   boot.loader.grub.device = "/dev/vda"; | ||||
|   boot.tmp.cleanOnBoot = true; | ||||
|   zramSwap.enable = true; | ||||
|  | ||||
|   networking.hostName = "ildkule"; # Define your hostname. | ||||
|  | ||||
|   systemd.network.networks."30-ens18" = values.defaultNetworkConfig // { | ||||
|     matchConfig.Name = "ens18"; | ||||
|     address = with values.hosts.ildkule; [ (ipv4 + "/25") (ipv6 + "/64") ]; | ||||
|   systemd.network.networks."30-all" = values.defaultNetworkConfig // { | ||||
|     matchConfig.Name = "en*"; | ||||
|     DHCP = "yes"; | ||||
|     gateway = [ ]; | ||||
|   }; | ||||
|  | ||||
|   # List packages installed in system profile | ||||
|   environment.systemPackages = with pkgs; [ | ||||
|   ]; | ||||
|  | ||||
|   # List services that you want to enable: | ||||
|  | ||||
|   # This value determines the NixOS release from which the default | ||||
|   # settings for stateful data, like file locations and database versions | ||||
|   # on your system were taken. It‘s perfectly fine and recommended to leave | ||||
|   # this value at the release version of the first install of this system. | ||||
|   # Before changing this value read the documentation for this option | ||||
|   # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). | ||||
|   system.stateVersion = "21.11"; # Did you read the comment? | ||||
|   system.stateVersion = "23.11"; # Did you read the comment? | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -1,37 +1,9 @@ | ||||
| # Do not modify this file!  It was generated by ‘nixos-generate-config’ | ||||
| # and may be overwritten by future invocations.  Please make changes | ||||
| # to /etc/nixos/configuration.nix instead. | ||||
| { config, lib, pkgs, modulesPath, ... }: | ||||
|  | ||||
| { modulesPath, lib, ... }: | ||||
| { | ||||
|   imports = | ||||
|     [ (modulesPath + "/profiles/qemu-guest.nix") | ||||
|     ]; | ||||
|   imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; | ||||
|   boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ]; | ||||
|   boot.initrd.kernelModules = [ "nvme" ]; | ||||
|   fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; }; | ||||
|  | ||||
|   boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "sr_mod" "virtio_blk" ]; | ||||
|   boot.initrd.kernelModules = [ ]; | ||||
|   boot.kernelModules = [ ]; | ||||
|   boot.extraModulePackages = [ ]; | ||||
|  | ||||
|   fileSystems."/" = | ||||
|     { device = "/dev/disk/by-uuid/afe70fe4-681a-4675-8cbd-e5d08cdcf5b5"; | ||||
|       fsType = "ext4"; | ||||
|     }; | ||||
|  | ||||
|   fileSystems."/boot" = | ||||
|     { device = "/dev/disk/by-uuid/B71A-E5CD"; | ||||
|       fsType = "vfat"; | ||||
|     }; | ||||
|  | ||||
|   swapDevices = [ ]; | ||||
|  | ||||
|   # Enables DHCP on each ethernet and wireless interface. In case of scripted networking | ||||
|   # (the default) this is the recommended approach. When using systemd-networkd it's | ||||
|   # still possible to use this option, but it's recommended to use it in conjunction | ||||
|   # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. | ||||
|   networking.useDHCP = lib.mkDefault true; | ||||
|   # networking.interfaces.ens18.useDHCP = lib.mkDefault true; | ||||
|  | ||||
|   nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; | ||||
|   hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; | ||||
| } | ||||
|   | ||||
| @@ -2,8 +2,9 @@ | ||||
| 
 | ||||
| { | ||||
|   imports = [ | ||||
|     ./prometheus | ||||
|     ./grafana.nix | ||||
|     ./loki.nix | ||||
|     ./prometheus | ||||
|     ./uptime-kuma.nix | ||||
|   ]; | ||||
| } | ||||
| @@ -7,7 +7,6 @@ in { | ||||
|   in { | ||||
|     "keys/grafana/secret_key" = { inherit owner group; }; | ||||
|     "keys/grafana/admin_password" = { inherit owner group; }; | ||||
|     "keys/postgres/grafana" = { inherit owner group; }; | ||||
|   }; | ||||
| 
 | ||||
|   services.grafana = { | ||||
| @@ -18,7 +17,7 @@ in { | ||||
|       secretFile = path: "$__file{${path}}"; | ||||
|     in { | ||||
|       server = { | ||||
|         domain = "ildkule.pvv.ntnu.no"; | ||||
|         domain = "grafana.pvv.ntnu.no"; | ||||
|         http_port = 2342; | ||||
|         http_addr = "127.0.0.1"; | ||||
|       }; | ||||
| @@ -27,13 +26,6 @@ in { | ||||
|         secret_key = secretFile config.sops.secrets."keys/grafana/secret_key".path; | ||||
|         admin_password = secretFile config.sops.secrets."keys/grafana/admin_password".path; | ||||
|       }; | ||||
| 
 | ||||
|       database = { | ||||
|         type = "postgres"; | ||||
|         user = "grafana"; | ||||
|         host = "${values.hosts.bicep.ipv4}:5432"; | ||||
|         password = secretFile config.sops.secrets."keys/postgres/grafana".path; | ||||
|       }; | ||||
|     }; | ||||
| 
 | ||||
|     provision = { | ||||
| @@ -91,6 +83,7 @@ in { | ||||
|   services.nginx.virtualHosts.${cfg.settings.server.domain} = { | ||||
|     enableACME = true; | ||||
|     forceSSL = true; | ||||
|     kTLS = true; | ||||
|     locations = { | ||||
|       "/" = { | ||||
|         proxyPass = "http://127.0.0.1:${toString cfg.settings.server.http_port}"; | ||||
							
								
								
									
										20
									
								
								hosts/ildkule/services/monitoring/uptime-kuma.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								hosts/ildkule/services/monitoring/uptime-kuma.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| { config, pkgs, lib, ... }: | ||||
| let | ||||
|   cfg = config.services.uptime-kuma; | ||||
|   domain = "status.pvv.ntnu.no"; | ||||
| in { | ||||
|   services.uptime-kuma = { | ||||
|     enable = true; | ||||
|     settings = { | ||||
|       PORT = "5059"; | ||||
|       HOST = "127.0.1.2"; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   services.nginx.virtualHosts.${domain} = { | ||||
|     enableACME = true; | ||||
|     forceSSL = true; | ||||
|     kTLS = true; | ||||
|     locations."/".proxyPass = "http://${cfg.settings.HOST}:${cfg.settings.PORT}"; | ||||
|   }; | ||||
| } | ||||
| @@ -1,29 +1,7 @@ | ||||
| { config, values, ... }: | ||||
| { | ||||
|   security.acme = { | ||||
|     acceptTerms = true; | ||||
|     defaults.email = "drift@pvv.ntnu.no"; | ||||
|   }; | ||||
|  | ||||
|   services.nginx = { | ||||
|     enable = true; | ||||
|  | ||||
|     enableReload = true; | ||||
|  | ||||
|     defaultListenAddresses = [ | ||||
|       values.hosts.ildkule.ipv4 | ||||
|       "[${values.hosts.ildkule.ipv6}]" | ||||
|  | ||||
|       "127.0.0.1" | ||||
|       "127.0.0.2" | ||||
|       "[::1]" | ||||
|     ]; | ||||
|  | ||||
|     recommendedProxySettings = true; | ||||
|     recommendedTlsSettings = true; | ||||
|     recommendedGzipSettings = true; | ||||
|     recommendedOptimisation = true; | ||||
|   }; | ||||
|  | ||||
|   networking.firewall.allowedTCPPorts = [ 80 443 ]; | ||||
| } | ||||
|   | ||||
| @@ -14,6 +14,8 @@ | ||||
|       "::1" | ||||
|       values.hosts.ildkule.ipv4 | ||||
|       values.hosts.ildkule.ipv6 | ||||
|       values.hosts.ildkule.ipv4_global | ||||
|       values.hosts.ildkule.ipv6_global | ||||
|     ]; | ||||
|   }; | ||||
|  | ||||
|   | ||||
| @@ -24,15 +24,12 @@ in { | ||||
|   services.grzegorz-webui.hostName = "${config.networking.fqdn}"; | ||||
|   services.grzegorz-webui.apiBase = "http://${toString grg.listenAddr}:${toString grg.listenPort}/api"; | ||||
|  | ||||
|   security.acme.acceptTerms = true; | ||||
|   security.acme.defaults.email = "pederbs@pvv.ntnu.no"; | ||||
|  | ||||
|   services.nginx.enable = true; | ||||
|   networking.firewall.allowedTCPPorts = [ 80 443 ]; | ||||
|  | ||||
|   services.nginx.virtualHosts."${config.networking.fqdn}" = { | ||||
|     forceSSL = true; | ||||
|     enableACME = true; | ||||
|     kTLS = true; | ||||
|     serverAliases = [ | ||||
|       "${config.networking.hostName}.pvv.org" | ||||
|     ]; | ||||
|   | ||||
							
								
								
									
										83
									
								
								modules/snakeoil-certs.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										83
									
								
								modules/snakeoil-certs.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,83 @@ | ||||
| { config, pkgs, lib, ... }: | ||||
| let | ||||
|   cfg = config.environment.snakeoil-certs; | ||||
| in | ||||
| { | ||||
|   options.environment.snakeoil-certs = lib.mkOption { | ||||
|     default = { }; | ||||
|     description = "Self signed certs, which are rotated regularly"; | ||||
|     type = lib.types.attrsOf (lib.types.submodule ({ name, ... }: { | ||||
|       options = { | ||||
|         owner = lib.mkOption { | ||||
|           type = lib.types.str; | ||||
|           default = "root"; | ||||
|         }; | ||||
|         group = lib.mkOption { | ||||
|           type = lib.types.str; | ||||
|           default = "root"; | ||||
|         }; | ||||
|         mode = lib.mkOption { | ||||
|           type = lib.types.str; | ||||
|           default = "0660"; | ||||
|         }; | ||||
|         daysValid = lib.mkOption { | ||||
|           type = lib.types.str; | ||||
|           default = "90"; | ||||
|         }; | ||||
|         extraOpenSSLArgs = lib.mkOption { | ||||
|           type = with lib.types; listOf str; | ||||
|           default = [ ]; | ||||
|         }; | ||||
|         certificate = lib.mkOption { | ||||
|           type = lib.types.str; | ||||
|           default = "${name}.crt"; | ||||
|         }; | ||||
|         certificateKey = lib.mkOption { | ||||
|           type = lib.types.str; | ||||
|           default = "${name}.key"; | ||||
|         }; | ||||
| 	subject = lib.mkOption { | ||||
| 	  type = lib.types.str; | ||||
| 	  default = "/C=NO/O=Programvareverkstedet/CN=*.pvv.ntnu.no/emailAddress=drift@pvv.ntnu.no"; | ||||
| 	}; | ||||
|       }; | ||||
|     })); | ||||
|   }; | ||||
|  | ||||
|   config = { | ||||
|     systemd.services."generate-snakeoil-certs" = { | ||||
|       enable = true; | ||||
|       serviceConfig.Type = "oneshot"; | ||||
|       script = let | ||||
|         openssl = lib.getExe pkgs.openssl; | ||||
|       in lib.concatMapStringsSep "\n----------------\n" ({ name, value }: '' | ||||
|         mkdir -p $(dirname "${value.certificate}") $(dirname "${value.certificateKey}") | ||||
|         if ! ${openssl} x509 -checkend 86400 -noout -in ${value.certificate} | ||||
|         then | ||||
|            echo "Regenerating '${value.certificate}'" | ||||
|            ${openssl} req \ | ||||
|              -newkey rsa:4096 \ | ||||
|              -new -x509 \ | ||||
|              -days "${toString value.daysValid}" \ | ||||
|              -nodes \ | ||||
|              -subj "${value.subject}" \ | ||||
|              -out "${value.certificate}" \ | ||||
|              -keyout "${value.certificateKey}" \ | ||||
|              ${lib.escapeShellArgs value.extraOpenSSLArgs} | ||||
|         fi | ||||
|         chown "${value.owner}:${value.group}" "${value.certificate}" | ||||
|         chown "${value.owner}:${value.group}" "${value.certificateKey}" | ||||
|         chmod "${value.mode}" "${value.certificate}" | ||||
|         chmod "${value.mode}" "${value.certificateKey}" | ||||
|       '') (lib.attrsToList cfg); | ||||
|     }; | ||||
|     systemd.timers."generate-snakeoil-certs" = { | ||||
|       wantedBy = [ "timers.target" ]; | ||||
|       timerConfig = { | ||||
|         OnCalendar = "*-*-* 02:00:00"; | ||||
|         Persistent = true; | ||||
|         Unit = "generate-snakeoil-certs.service"; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
							
								
								
									
										103
									
								
								modules/snappymail.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								modules/snappymail.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,103 @@ | ||||
| { config, pkgs, lib, ... }: | ||||
|  | ||||
| let | ||||
|   inherit (lib) mkDefault mkEnableOption mkForce mkIf mkOption mkPackageOption generators types; | ||||
|  | ||||
|   cfg = config.services.snappymail; | ||||
|   maxUploadSize = "256M"; | ||||
| in { | ||||
|   options.services.snappymail = { | ||||
|     enable = mkEnableOption "Snappymail"; | ||||
|  | ||||
|     package = mkPackageOption pkgs "snappymail" { }; | ||||
|  | ||||
|     dataDir = mkOption { | ||||
|       type = types.str; | ||||
|       default = "/var/lib/snappymail"; | ||||
|       description = "State directory for snappymail"; | ||||
|     }; | ||||
|  | ||||
|     hostname = mkOption { | ||||
|       type = types.nullOr types.str; | ||||
|       default = null; | ||||
|       example = "mail.example.com"; | ||||
|       description = "Enable nginx with this hostname, null disables nginx"; | ||||
|     }; | ||||
|  | ||||
|     user = mkOption { | ||||
|       type = types.str; | ||||
|       default = "snappymail"; | ||||
|       description = "System user under which snappymail runs"; | ||||
|     }; | ||||
|  | ||||
|     group = mkOption { | ||||
|       type = types.str; | ||||
|       default = "snappymail"; | ||||
|       description = "System group under which snappymail runs"; | ||||
|     }; | ||||
|   }; | ||||
|  | ||||
|   config = mkIf cfg.enable { | ||||
|     users.users = mkIf (cfg.user == "snappymail") { | ||||
|       snappymail = { | ||||
|         description = "Snappymail service"; | ||||
|         group = cfg.group; | ||||
|         home = cfg.dataDir; | ||||
|         isSystemUser = true; | ||||
|       }; | ||||
|     }; | ||||
|  | ||||
|     users.groups = mkIf (cfg.group == "snappymail") { | ||||
|       snappymail = {}; | ||||
|     }; | ||||
|  | ||||
|     services.phpfpm.pools.snappymail = { | ||||
|       user = cfg.user; | ||||
|       group = cfg.group; | ||||
|       phpOptions = generators.toKeyValue {} { | ||||
|         upload_max_filesize = maxUploadSize; | ||||
|         post_max_size = maxUploadSize; | ||||
|         memory_limit = maxUploadSize; | ||||
|       }; | ||||
|  | ||||
|       settings = { | ||||
|         "listen.owner" = config.services.nginx.user; | ||||
|         "listen.group" = config.services.nginx.group; | ||||
|         "pm" = "ondemand"; | ||||
|         "pm.max_children" = 32; | ||||
|         "pm.process_idle_timeout" = "10s"; | ||||
|         "pm.max_requests" = 500; | ||||
|       }; | ||||
|     }; | ||||
|  | ||||
|     services.nginx = mkIf (cfg.hostname != null) { | ||||
|       virtualHosts."${cfg.hostname}" = { | ||||
|         locations."/".extraConfig = '' | ||||
|           index index.php; | ||||
|           autoindex on; | ||||
|           autoindex_exact_size off; | ||||
|           autoindex_localtime on; | ||||
|         ''; | ||||
|         locations."^~ /data".extraConfig = '' | ||||
|           deny all; | ||||
|         ''; | ||||
|         locations."~ \\.php$".extraConfig = '' | ||||
|           include ${config.services.nginx.package}/conf/fastcgi_params; | ||||
|  | ||||
|           fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||||
|           fastcgi_pass unix:${config.services.phpfpm.pools.snappymail.socket}; | ||||
|         ''; | ||||
|         extraConfig = '' | ||||
|           client_max_body_size ${maxUploadSize}; | ||||
|         ''; | ||||
|  | ||||
|         root = if (cfg.package == pkgs.snappymail) then | ||||
|           pkgs.snappymail.override { | ||||
|             dataPath = cfg.dataDir; | ||||
|           } | ||||
|         else cfg.package; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
|  | ||||
							
								
								
									
										8
									
								
								packages/mediawiki-extensions/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								packages/mediawiki-extensions/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| { pkgs, lib }: | ||||
| { | ||||
|   DeleteBatch = pkgs.callPackage ./delete-batch { }; | ||||
|   PluggableAuth = pkgs.callPackage ./pluggable-auth { }; | ||||
|   SimpleSAMLphp = pkgs.callPackage ./simple-saml-php { }; | ||||
|   UserMerge = pkgs.callPackage ./user-merge { }; | ||||
|   VisualEditor = pkgs.callPackage ./visual-editor { }; | ||||
| } | ||||
							
								
								
									
										13
									
								
								packages/mediawiki-extensions/delete-batch/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								packages/mediawiki-extensions/delete-batch/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| { fetchzip }: | ||||
| let | ||||
|   commit = "a53af3b8269ed19ede3cf1fa811e7ec8cb00af92"; | ||||
|   project-name = "UserMerge"; | ||||
|   tracking-branch = "REL1_41"; | ||||
| in | ||||
| fetchzip { | ||||
|   name = "mediawiki-delete-batch"; | ||||
|   url = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/${project-name}/+archive/${commit}.tar.gz"; | ||||
|   hash = "sha256-0ofCZhhv4aVTGq469Fdu7k0oVQu3kG3HFa8zaBbUr/M="; | ||||
|   stripRoot = false; | ||||
|   passthru = { inherit project-name tracking-branch; }; | ||||
| } | ||||
							
								
								
									
										13
									
								
								packages/mediawiki-extensions/pluggable-auth/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								packages/mediawiki-extensions/pluggable-auth/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| { fetchzip }: | ||||
| let | ||||
|   commit = "d5b3ad8f03b65d3746e025cdd7fe3254ad6e4026"; | ||||
|   project-name = "PluggableAuth"; | ||||
|   tracking-branch = "REL1_41"; | ||||
| in | ||||
| fetchzip { | ||||
|   name = "mediawiki-pluggable-auth-source"; | ||||
|   url = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/${project-name}/+archive/${commit}.tar.gz"; | ||||
|   hash = "sha256-mLepavgeaNUGYxrrCKVpybGO2ecjc3B5IU8q+gZTx2U="; | ||||
|   stripRoot = false; | ||||
|   passthru = { inherit project-name tracking-branch; }; | ||||
| } | ||||
							
								
								
									
										13
									
								
								packages/mediawiki-extensions/simple-saml-php/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								packages/mediawiki-extensions/simple-saml-php/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| { fetchzip }: | ||||
| let | ||||
|   commit = "9ae0678d77a9175285a1cfadd5adf28379dbdb3d"; | ||||
|   project-name = "SimpleSAMLphp"; | ||||
|   tracking-branch = "REL1_41"; | ||||
| in | ||||
| fetchzip { | ||||
|   name = "mediawiki-simple-saml-php-source"; | ||||
|   url = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/${project-name}/+archive/${commit}.tar.gz"; | ||||
|   hash = "sha256-s6Uw1fNzGBF0HEMl0LIRLhJkOHugrCE0aTnqawYi/pE="; | ||||
|   stripRoot = false; | ||||
|   passthru = { inherit project-name tracking-branch; }; | ||||
| } | ||||
							
								
								
									
										106
									
								
								packages/mediawiki-extensions/update-mediawiki-extensions.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										106
									
								
								packages/mediawiki-extensions/update-mediawiki-extensions.py
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,106 @@ | ||||
| #!/usr/bin/env nix-shell | ||||
| #!nix-shell -i python3 -p "python3.withPackages(ps: with ps; [ beautifulsoup4 requests ])" | ||||
|  | ||||
| import os | ||||
| from pathlib import Path | ||||
| import re | ||||
| import subprocess | ||||
| from collections import defaultdict | ||||
| from pprint import pprint | ||||
| from dataclasses import dataclass | ||||
|  | ||||
| import bs4 | ||||
| import requests | ||||
|  | ||||
| BASE_URL = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions" | ||||
|  | ||||
| @dataclass | ||||
| class PluginMetadata: | ||||
|     project_name: str | ||||
|     tracking_branch: str | ||||
|     commit: str | ||||
|  | ||||
|  | ||||
| def get_metadata(file_content: str) -> dict[str,str] | None: | ||||
|     commit_search = re.search(f'commit = "([^"]*?)";', file_content) | ||||
|     tracking_branch_search = re.search(f'tracking-branch = "([^"]+?)";', file_content) | ||||
|     project_name_search = re.search(f'project-name = "([^"]+?)";', file_content) | ||||
|     if commit_search is None: | ||||
|         print("Could not find commit in file:") | ||||
|         print(file_content) | ||||
|         return None | ||||
|     if tracking_branch_search is None: | ||||
|         print("Could not find tracking branch in file:") | ||||
|         print(file_content) | ||||
|         return None | ||||
|     if project_name_search is None: | ||||
|         print("Could not find project name in file:") | ||||
|         print(file_content) | ||||
|         return None | ||||
|     return PluginMetadata( | ||||
|         commit = commit_search.group(1), | ||||
|         tracking_branch = tracking_branch_search.group(1), | ||||
|         project_name = project_name_search.group(1), | ||||
|     ) | ||||
|  | ||||
|  | ||||
| def get_newest_commit(project_name: str, tracking_branch: str) -> str: | ||||
|     content = requests.get(f"{BASE_URL}/{project_name}/+log/refs/heads/{tracking_branch}/").text | ||||
|     soup = bs4.BeautifulSoup(content, features="html.parser") | ||||
|     a = soup.find('li').findChild('a') | ||||
|     commit_sha = a['href'].split('/')[-1] | ||||
|     return commit_sha | ||||
|  | ||||
|  | ||||
| def get_nix_hash(tar_gz_url: str) -> str: | ||||
|     out, err = subprocess.Popen( | ||||
|         ["nix-prefetch-url", "--unpack", "--type", "sha256", tar_gz_url], | ||||
|         stdout=subprocess.PIPE, | ||||
|         stderr=subprocess.PIPE | ||||
|     ).communicate() | ||||
|     out, err = subprocess.Popen( | ||||
|         ["nix", "hash", "to-sri", "--type", "sha256", out.decode().strip()], | ||||
|         stdout=subprocess.PIPE, | ||||
|         stderr=subprocess.PIPE | ||||
|     ).communicate() | ||||
|  | ||||
|     return out.decode().strip() | ||||
|  | ||||
|  | ||||
| def set_commit_and_hash(file_content: str, commit: str, sha256: str) -> str: | ||||
|     result = file_content | ||||
|     result = re.sub('commit = "[^"]*";', f'commit = "{commit}";', result) | ||||
|     result = re.sub('hash = "[^"]*";', f'hash = "{sha256}";', result) | ||||
|     return result | ||||
|  | ||||
| def update(package_file: Path) -> None: | ||||
|     with open(package_file) as file: | ||||
|         file_content = file.read() | ||||
|  | ||||
|     metadata = get_metadata(file_content) | ||||
|     if metadata is None: | ||||
|         return | ||||
|     if metadata.commit == "": | ||||
|         metadata.commit = "<none>" | ||||
|  | ||||
|     new_commit = get_newest_commit(metadata.project_name, metadata.tracking_branch) | ||||
|     if new_commit == metadata.commit: | ||||
|         return | ||||
|  | ||||
|     new_url = f"{BASE_URL}/{metadata.project_name}/+archive/{new_commit}.tar.gz" | ||||
|     new_hash = get_nix_hash(new_url) | ||||
|  | ||||
|     print(f"Updating {metadata.project_name}: {metadata.commit} -> {new_commit}") | ||||
|  | ||||
|     new_file_content = set_commit_and_hash(file_content, new_commit, new_hash) | ||||
|  | ||||
|     with open(package_file, 'w') as file: | ||||
|         file.write(new_file_content) | ||||
|  | ||||
|  | ||||
| if __name__ == "__main__": | ||||
|     for direntry in os.scandir(Path(__file__).parent): | ||||
|         if direntry.is_dir(): | ||||
|             package_file = Path(direntry) / "default.nix" | ||||
|             assert package_file.is_file() | ||||
|             update(package_file) | ||||
							
								
								
									
										13
									
								
								packages/mediawiki-extensions/user-merge/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								packages/mediawiki-extensions/user-merge/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| { fetchzip }: | ||||
| let | ||||
|   commit = "a53af3b8269ed19ede3cf1fa811e7ec8cb00af92"; | ||||
|   project-name = "UserMerge"; | ||||
|   tracking-branch = "REL1_41"; | ||||
| in | ||||
| fetchzip { | ||||
|   name = "mediawiki-user-merge-source"; | ||||
|   url = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/${project-name}/+archive/${commit}.tar.gz"; | ||||
|   hash = "sha256-0ofCZhhv4aVTGq469Fdu7k0oVQu3kG3HFa8zaBbUr/M="; | ||||
|   stripRoot = false; | ||||
|   passthru = { inherit project-name tracking-branch; }; | ||||
| } | ||||
							
								
								
									
										13
									
								
								packages/mediawiki-extensions/visual-editor/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								packages/mediawiki-extensions/visual-editor/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| { fetchzip }: | ||||
| let | ||||
|   commit = "bb92d4b0bb81cebd73a3dbabfb497213dac349f2"; | ||||
|   project-name = "VisualEditor"; | ||||
|   tracking-branch = "REL1_40"; | ||||
| in | ||||
| fetchzip { | ||||
|   name = "mediawiki-visual-editor-source"; | ||||
|   url = "https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/${project-name}/+archive/${commit}.tar.gz"; | ||||
|   hash = "sha256-lShpSoR+NLfdd5i7soM6J40pq+MzCMG0M1tSYsS+jAg="; | ||||
|   stripRoot = false; | ||||
|   passthru = { inherit project-name tracking-branch; }; | ||||
| } | ||||
							
								
								
									
										38
									
								
								packages/simplesamlphp/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								packages/simplesamlphp/default.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,38 @@ | ||||
| { lib | ||||
| , php | ||||
| , writeText | ||||
| , fetchFromGitHub | ||||
| , extra_files ? { } | ||||
|  | ||||
| }: | ||||
|  | ||||
| php.buildComposerProject rec { | ||||
|   pname = "simplesamlphp"; | ||||
|   version = "2.2.1"; | ||||
|  | ||||
|   src = fetchFromGitHub { | ||||
|     owner = "simplesamlphp"; | ||||
|     repo = "simplesamlphp"; | ||||
|     rev = "v${version}"; | ||||
|     hash = "sha256-jo7xma60M4VZgeDgyFumvJp1Sm+RP4XaugDkttQVB+k="; | ||||
|   }; | ||||
|  | ||||
|   composerStrictValidation = false; | ||||
|  | ||||
|   vendorHash = "sha256-n6lJ/Fb6xI124PkKJMbJBDiuISlukWQcHl043uHoBb4="; | ||||
|  | ||||
|   # TODO: metadata could be fetched automagically with these: | ||||
|   #   - https://simplesamlphp.org/docs/contrib_modules/metarefresh/simplesamlphp-automated_metadata.html | ||||
|   #   - https://idp.pvv.ntnu.no/simplesaml/saml2/idp/metadata.php | ||||
|   postPatch = lib.pipe extra_files [ | ||||
|     (lib.mapAttrsToList (target_path: source_path: '' | ||||
|       mkdir -p $(dirname "${target_path}") | ||||
|       cp -r "${source_path}" "${target_path}" | ||||
|     '')) | ||||
|     (lib.concatStringsSep "\n") | ||||
|   ]; | ||||
|  | ||||
|   postInstall = '' | ||||
|     ln -sr $out/share/php/simplesamlphp/vendor/simplesamlphp/simplesamlphp-assets-base $out/share/php/simplesamlphp/public/assets/base | ||||
|   ''; | ||||
| } | ||||
| @@ -1,6 +1,7 @@ | ||||
| gitea: | ||||
|     password: ENC[AES256_GCM,data:hlNzdU1ope0t50/3aztyLeXjMHd2vFPpwURX+Iu8f49DOqgSnEMtV+KtLA==,iv:qljRnSnchL5cFmaUAfCH9GQYQxcy5cyWejgk1x6bFgI=,tag:tIhboFU5kZsj5oAQR3hLbw==,type:str] | ||||
|     database: ENC[AES256_GCM,data:UlS33IdCEyeSvT6ngpmnkBWHuSEqsB//DT+3b7C+UwbD8UXWJlsLf1X8/w==,iv:mPRW5ldyZaHP+y/0vC2JGSLZmlkhgmkvXPk4LazkSDs=,tag:gGk6Z/nbPvzE1zG+tJC8Sw==,type:str] | ||||
|     email-password: ENC[AES256_GCM,data:KRwC+aL1aPvJuXt91Oq1ttATMnFTnuUy,iv:ats8TygB/2pORkaTZzPOLufZ9UmvVAKoRcWNvYF1z6w=,tag:Do0fA+4cZ3+l7JJyu8hjBg==,type:str] | ||||
|     passwd-ssh-key: ENC[AES256_GCM,data:L0lF0wvpayss1NU9m3A45cH0bCMQzODTFVrq6EPd1JHx54wIcoaRBYLmxXKXASzBlCg9zlwXMUIk3OQcS3kdzMKL0iqcSL2iicAcKjFIHyrWLqXgwV5pRSP/tRPcVw8KW8gz0bh33EgESs5ReddZ3VZ0Cy1s2YupMRQvBXr89k1+Hv70OWB6P06hvxhv/zKcMGI1N/dWLroMgrQuT9imw4+/Q1RqwzTYeEU+eUn24AM9GjcBg4qf3OI+6g0nXUat/upIYE28iF5J3lbUSmDSmirBLc8xgHLdOyyJPTObWYWYxlSL78T7IqiMm9lI3rtBlpJDDcn/YxZpVqN5bg2154GISNK+uR0TVSLdJ+drdGHIfIX3G78XSxf2L9rbJyRn8MQlgStfdBIQicLavQKVMrmj+XQfvEMez23WbPLjH4oViBQFI+GrOHOGy/f16cz8Sn4n+69OcsOeTxs3tKYdfq6r1XLYSJ/fe/zvxBpaZiyGXljsuyEdIyBL2A8D6uSXe3Nd3/DAdBtceFfIdN1olCdutixzVWgxaJnrel161z5A/4w=,iv:Uy46yY3jFYSvpxrgCHxRMUksnWfhf5DViLMvCXVMMl4=,tag:wFEJ5+icFrOKkc56gY0A5g==,type:str] | ||||
|     ssh-known-hosts: ENC[AES256_GCM,data:zlRLoelQeumMxGqPmgMTB69X1RVWXIs2jWwc67lk0wrdNOHUs5UzV5TUA1JnQ43RslBU92+js7DkyvE5enGzw7zZE5F1ZYdGv/eCgvkTMC9BoLfzHzP6OzayPLYEt3xJ5PRocN8JUAD55cuu4LgsuebuydHPi2oWOfpbSUBKSeCh6dvk5Pp1XRDprPS5SzGLW8Xjq98QlzmfGv50meI9CDJZVF9Wq/72gkyfgtb3YVdr,iv:AF06TBitHegfWk6w07CdkHklh4ripQCmA45vswDQgss=,tag:zKh7WVXMJN2o9ZIwIkby3Q==,type:str] | ||||
|     import-user-env: ENC[AES256_GCM,data:vfaqjGEnUM9VtOPvBurz7nFwzGZt3L2EqijrQej4wiOcGCrRA4tN6kBV6NmhHqlFPsw=,iv:viPGkyOOacCWcgTu25da4qH7DC4wz2qdeC1W2WcMUdI=,tag:BllNqGQoaxqUo3lTz9LGnw==,type:str] | ||||
| @@ -10,9 +11,25 @@ gitea: | ||||
|         epsilon: ENC[AES256_GCM,data:JMnZVBdiy+5oPyXgDpfYvy7qLzIEfHy09fQSBDpNG4zDXTil2pSKBKxk09h5xg==,iv:/8oXKJW6+sMBjDt51MqVAWjQPM5nk02Lv5QqbZsZ5ms=,tag:+Rx7ursfVWc0EcExCLgLhQ==,type:str] | ||||
| mediawiki: | ||||
|     password: ENC[AES256_GCM,data:HsBuA1E7187roGnKuFPfPDYxA16GFjAUucgUtrdUFmcOzmTNiFH+NWY2ZQ==,iv:vDYUmmZftcrkDtJxNYKAJSx9j+AQcmQarC62QRHR4IM=,tag:3TKjNrGRivFWoK3djC748g==,type:str] | ||||
|     database: ENC[AES256_GCM,data:EvVK3Mo6cZiIZS+gTxixU4r9SXN41VqwaWOtortZRNH+WPJ4xcYvzYMJNg==,iv:JtFTRLn3fzKIfgAPRqRgQjct7EdkEHtiyQKPy8/sZ2Q=,tag:nqzseG6BC0X5UNI/3kZZ3A==,type:str] | ||||
| keycloak: | ||||
|     database: ENC[AES256_GCM,data:76+AZnNR5EiturTP7BdOCKE90bFFkfGlRtviSP5NHxPbb3RfFPJEMlwtzA==,iv:nS7VTossHdlrHjPeethhX+Ysp9ukrb5JD7kjG28OFpY=,tag:OMpiEv9nQA7v6lWJfNxEEw==,type:str] | ||||
|     postgres_password: ENC[AES256_GCM,data:XIOmrOVXWvMMcPJtmovhdyZvLlhmrsrwjuMMkdEY1NIXWjevj5XEkp6Cpw==,iv:KMPTRzu3H/ewfEhc/O0q3o230QNkABfPYF/D1SYL2R8=,tag:sFZiFPHWxwzD9HndPmH3pQ==,type:str] | ||||
|     simplesamlphp: | ||||
|         postgres_password: ENC[AES256_GCM,data:FzykBVtJbA+Bey1GE5VqnSuv2GeobH1j,iv:wayQH3+y0FYFkr3JjmulI53SADk0Ikur/2mUS5kFrTk=,tag:d+nQ/se2bDA5aaQfBicnPQ==,type:str] | ||||
|         cookie_salt: ENC[AES256_GCM,data:BioRPAvL4F9ORBJDFdqHot81RhVpAOf32v1ah3pvOLq8E88bxGyKFQZxAwpIL3UkWQIsWMnEerm5MEMYL1C2OQ==,iv:yMVqiPTQ8hO1IVAax6PIkD0V9YTOEunwDTtnGcmy6Kc=,tag:Z4+bZF4olLlkx7YpXeQiUw==,type:str] | ||||
|         admin_password: ENC[AES256_GCM,data:4eUXvcO7NLOWke9XShfKzj+x3FvqPONa,iv:3iZ+BTBTZ7yMJ0HT14cEMebKZattWUcYEevRsl/6WOk=,tag:CU0iDhPP2ndztdX5U5A4cw==,type:str] | ||||
| idp: | ||||
|     cookie_salt: ENC[AES256_GCM,data:cyV6HDCPHKQIa8T1+rFBFh6EuHtG5B508lg6uFYENK7qVpYuiTUIokdVQhY8SRLs2mECx/ampgnUHxCRB/Cc/A==,iv:QRrRUhzRQrLkmg38rrYtCEfF8U4/7ZHZUDSEq++BlbI=,tag:fLqFSLd+CKqJvmCh1fx8vg==,type:str] | ||||
|     admin_password: ENC[AES256_GCM,data:Vf33Oenk6x6BIij1uW8RQDjTPcKhUVYA,iv:RNeyCNpTAYdBPrZwE3Y6CCjoAML/3XUvjfJCrr06IEU=,tag:zVOrx1oXnEyr/VwFCFaCDQ==,type:str] | ||||
|     postgres_password: ENC[AES256_GCM,data:HGwKLbn/umPLPgH+qpXtugvXzOcXdlhK,iv:ypTW0VLSape8K5aCYu3BdjG/oMmqvfDSLw9uGLthb0Q=,tag:qlDMGz59qzMwEwBYxsC0XQ==,type:str] | ||||
|     privatekey: ENC[AES256_GCM,data:pK74wjuk9lt2PNJIzi6NpPBkxcSRsBZJl28BElUiri2zz17CY81x66CMlFsNjvzKB3JVX+b28FHFuSsEpd/mAPtmzZPR+CoWBHvU+OrSYYoufBxexRTtXzu0vx/KFL4X5tsb+GCgfm72CM+u9dElYHJzn3teBUmZc0pIoF29slTuwF+iZrbFwaieECxXMjHC9f+ivxWQsOvYFjhmAwgjBw/LsfURgLxZwcIRiiKsN41P2WtR9a/hjN53sJnihL9VZw/Xbbynm+bDmaAwhKUAZR28TU9Q1PTfNPEAOMoRgKF4MFuhQ5o0Cxq8RRz7fwCcCTV2sK4jgL7gKiy/gI/K41ybPQPon3NrDj3U2G1VhNgBfSNaTHgygiWI08HGWRHk83eJPHp3Ph8/A774g15SE10BXkL12n0kzodsZWYu3ybrhp167vL/ZW3xUnvFFlm4dTX/ndwS5rp1dIW0a5/0EDwMoGIJw94W5ph5sK9YoUTXwLdAJ9UWRZKQGk6iJstq2BMEBAN2BCSPHS2cflMjoVV4KKX1eq6s8/w6YFzCSQkt3+pGQ3DmiOaaqiv7sUfxyfMDzDcuTVETYRhsvr1ChfBFNn1yoH8BffeVTI2Ei3Edek1vXcg05mHxslhCmzQ4U4us0agtpm2Ar6ppvuedJHLWLFz8pgWSENeGdRcbz0CXiy7lIEYW4uQBru4MAjQ+ZQhz/F4L6At60Q4NelYMDxryQ8LxV0fA/ba2llwl8bDHDFDYkxu3/IaaWG8bp1i6gqvEao3/CRpPt/OAJGAHO3HViPm6xmWlWinUEatNlgCoDotkc56eZU/Af/P7R0QPQF0PpEIDHPcNjc/HcfheUXzJSzkD7wja8VB6rtqdRHFC793QsgdHJMJ+/bvJWZSQciSwaY3PBKLLuB6vrn7VD2NB4cE6beaGwneiAn83lAV+I4cJMDQFLkhWm8LIC7JIZKq/7eBfDEmajWEBL6wSbomBi/UGbA+FyvOokYYMemwVu1JGULcz9Lvn6pxkftQlN0gqE3MncrcZ/l59fepbka/z8oqH6i+3nKdaEh6D+WudD/0xiJSdXAVM6jGrxQtFc1R+OmGTTKJB4aLqgcM25YQ760wKavx5+B52pSki7XdYLmb6Xbnnv7AnyCNmGcpcj795P7qasE2sVokqq9a2PZD7VhP9TPHGtEO6QkkNV5gLxGsGvmshMM8KQgjK60HPQuSfHFVN/SlcOKvvH5ec8sBuYUt24xcDPewV9cXZwjcmwufFOVbC72FTEmU5qvmKobJTGjjbhWsHwpopESctmXuArIcVPsX5jSe3C9Y+9tjbkBGW6/+o8pTfodsjioXevVDXwjVBmGYk8xjZtF6/xfhpWvfunDXgEhnpT4i6ikoQiva8Mw8NvLe8U8Ivr6qCDE4ys4RTs56aw/CJHzydKjX96ZPzim52fAIJvEt1HvMvQx/O/q00h0WujYBcSBivYDtl7hC2fl6pBvM7fjipbeF04idkAKKXf4j6SGunx4hWq+eIA5tnlG8XVZZKIpdXKLgarvWs5pLlTSAK5ckF/yddcik7gAZc+pwo8kCAXIXPisX/yw9cZhI51PNTG1yxtPHAWKgULYLoWcnBCGTmPVXmj6IhpGuNuQ18TTpEtwnrMmcGq6aG/M2ZI+oq0q6suJUWwsCKUVM/TS6SKXEArzDtOMdXgyyDC/H3u+w3Bt/DwALLacq6lwoKBJZxQ6ewv3+ZkLcOkMRKu97hgV+rKmFqdPXqs+Skrf2MRl48sUCPIUXhD46ocFNpemcXcr73G7AxmmFLT6T4ZFm69K6eftUP6FsgUwbed+SaWTeptaG+wueL1NECoXafGlJAmXkjbBdWVgF2oMQFP3Kau135fiqmHpoWGzG5UhKxshTTtRIvbG/296NOkNZWBT/VzjwZti3IUka7HjC3leu28IlLsN0fsNPjQc2uIR3uVsR020g6et0m/Nys9gHDWXG/aCAYKhrgU8w37ZHBs383rkl4uUIYJH61SmTS4JP/wgh/+Q1aU8gXaZ8/Bc0BZUJdF3JR48fjkuMi2A8q5vkTQ1yFCvbBTtdg336v5tZc/xOW5/pt0W1Y7IgPFwHNh4iPAtKQZ3Qybh5PXs4N80YeYFWIjV6Ai0uY4yPdwYPfd1pRdpf3Ll+bhnbDPg0ye4f9lAhSR/cAZpft7BTd6W6jCv8QfWZcDmoBGZy68GZsYfCJ3QAo6szxzDtuyp7WMJRxioPt1EVA9q+8Rp7hHmZosoZOIUV+q3W5yZymL/PXZABiIc2OW9kryNlxQlBo79CSLGdXWeMq3dN1MSWoKJzxEseQqtSY5E1DYQosT1+3B8DXm77WSLMuB6OLjEz760y8jyIiLTGAVslcOb5XNfrQf5+l52nxCl/uSZo9FxiKg7ip0v3PZLuFSTSEaR2R2WeSuv/KoXi7WxFiG6VskpyL5jMhBwjepExFVosrOi4XugqR8vD3byTYUnmQvWJyyrI2LqQsYsa3o65SIO4g8SMKRsJJ8WWHpywLjF00HJSWiGRu8bQguvDTQd3UP6lgudzpubERXuUIBiMPqBKFJ1QTWA6N/t7dxR7NVaSexrGmY4ZSoIBKb9Jnge/+lkKrO9CgqDQpTAAvwwBZpFOV7EYLZNRpW+F8HaCNMeql7V/nFqdaaNdm9yLBhXbaeujalyiLtvBCghe330JVjbBTYWiRulJ2xnlX4GLzORBRIVHJYjxEKzCeVW7J2wAKkJ6gx5rlfDOd6r+Tf+1L8ZZoJEdBhIW7flslxo4amGRTI9QGJKVCIq/hrUGEgIAKsDsqTd21lVdhy+EDM+gumO7FbMcqVPRpwmQMFAZbJgH6TeS46tA4XQJGbwQhhBaqVb3jz7OJVOZ9C3/XfxPPpK4B2OyqINKNIRfyZ0fSmGlIT4LPf2IUEDCEKuPd3ClX51qNnVAPt/MbooF++Vp91KImdqCHwdiAygZTH9u91UN8S9IW8vo0XE4eAgdInjOM+IzUPhC+G8i6UNHbOpfQ7dntDc2nCv4nFKLjLZrgpm2kFrQ60/gDlbXBFF2eRcfYkSQSxVLWC4kWF1ce9YZf/j6erm6GnsQiyNoePe/Nb0v2f5DAR+9yoSJEOAi/AHacA9Dq5kfcoOYCrLkoc17SKQYmy/M9m5Mh3inI/O4wbUQrYDKHT0j77BJnkY11M6AiEF9YC0F4lCV4hIefQ3PnI4nmmo9b8rHnqvmrwUZrcOom6Zp+A7ydo4t0Bw1cDzEwJfpcb3JjpFi7F32/vHHLtGuPDvcJqkhw8VLuaAWAcEPJcIHJ+vAKCGWtDH7yQEOhFq4touwyPYDWBA5tqPY2xkFIAImFRhyLtTQupiNbZVR4G4dj24l8uQl2iz9aoDbJlNhoT+9YhwrKrYdM6hqnvpmiYqLIM+2kijZ8JmBS0BWNLCr+6rnbZbEB5e1ezokice8HQ1XcXbsegcI+eJ+gfDhYKw75VVyOd1Uy/pjLCCwQTywTIbf3iSuETvs3YjQrET1m7GJm3q8G4dx2M9c2B7R6B0ej06pkC4WwzFg3hEG6z2BaNrkopKkoE99bjoB2VHkgGTe+YM1Q3t+jA8IB7XNlnVH82AJ6eDMqgGSWBZiGxwx0KVUMg7cTi0iD6JNSYea0ykw+fh7Mj+8N0zhmzdUjdNBwZqxHVUbqIhUhk6meGRN5EASyt6qR329AqzbKaloS2VqjLjDkSEMhQfL4jHa8yPp8Cyj6EjgM2n5LnZs0u/43eh0h4ig3zQYMkwrHixI5hNQTBwSm3QnNpr3OnXAlypCPbCTiMC5sxHfrSTFkmjduT29aZ5qHQOc5zYG5bE2CmhWJdCOZm1s1mUT+Pxbxf4m/sh8w7TwnA+leD1rUvwYfyl5WI8f071vPcg62uTwScxr+TErvdzAkg9HElnsO6km0IncHIh79zexCR51CrtrZAVxc1gnnDtTLsaKmcEDkqIY4U2cUv+1CtPWz7IfKea9B56x+bFY32pwqYeXCHdDVfBGSMuM7mqZUBu+3jETSbglozYrukbgjftdWob3s/hR0WB0lH9uwkugfoGVonasPkmPvBhuvozkCLvP9aplqwUoL74D4JhHFLciPvV+Cmw5ag1WtErB89Oimm3tnOpynCJwZTQM+NVgBtKjom0qOnyn7l0vYIKQFJwV2k5w+RfrX5EOOjFfg9D2u+gHgmrqzaSl6kk2dHlQYmfeP+nJxiH7eGO5D3ooYHp7JKZBAaJHcAWWpgqVL/L8pjSJLCPRGBF/5DnfggwFdNprl3LqYnr4io+Wp4+Du74uvQHNpojrUQ4j7Qp330rSbCK9iX5v14zYr6RlqKe5CtTqHjPzuL8CxFUI1ImHgViNpff4=,iv:8cb1FcIm0oGkcrfLNqXamx4aDA3owBZoHur8+uFsdmA=,tag:oFPP/Yene6QrxFDKlmoVcA==,type:str] | ||||
| nettsiden: | ||||
|     mysql_password: ENC[AES256_GCM,data:Uv74HhWtYRbaFHcfh0Rk/Q==,iv:/lRTaMepwpJKZJWHnwb98Ywa1zP4e2EqYGmwI7BCl1I=,tag:ZnE0u2/65zdkONcoiBGSOQ==,type:str] | ||||
|     door_secret: ENC[AES256_GCM,data:t0jEN1WnyEi10KRSg4Dlcd7IuIMBiOU7riOdYSZjvZTQqPijRYIoMEQ6OemIkD1Yg67uISTxnjxP,iv:Ss02VGKRa4oZMubbi8IfQDAjh3h295+n07vOx/IZGBs=,tag:OvdxqIUdYi/cR7IjopSVQQ==,type:str] | ||||
|     simplesamlphp: | ||||
|         postgres_password: ENC[AES256_GCM,data:SvbrdHF4vQ94DgoEfy67QS5oziAsMT8H,iv:LOHBqMecA6mgV3NMfmfTh3zDGiDve+t3+uaO53dIxt4=,tag:9ffz84ozIqytNdGB1COMhA==,type:str] | ||||
|         cookie_salt: ENC[AES256_GCM,data:VmODSLOP1YDBrpHdk/49qx9BS+aveEYDQ1D24d4zCi06kZsCENCr+vdPAnTeM1pw98RTr3yZAEQTh4s90b6v8Q==,iv:vRClu6neyYPFdtD63kjnvK2iNOIHMbh+9qEGph7CI60=,tag:66fgppVxY0egs4+9XfDBPA==,type:str] | ||||
|         admin_password: ENC[AES256_GCM,data:SADr/zN3F0tW339kSK1nD9Pb38rw7hz8,iv:s5jgl1djXd5JKwx1WG/w2Q4STMMpjJP91qxOwAoNcL0=,tag:N8bKnO9N0ei06HDkSGt6XQ==,type:str] | ||||
| vaultwarden: | ||||
|     environ: ENC[AES256_GCM,data:CST5I8x8qAkrTy/wbMLL6aFSPDPIU7aWsD1L1MnIATRmk7fcUhfTSFds7quJmIpb2znsIT/WxNI/V/7UW+9ZdPKI64hfPR8MtvrJcbOhU5Fe2IiytFymFbhcOgWAXjbGzs7knQmpfMxSl98sU71oLkRuFdkousdnh4VQFZhUCYM=,iv:Is6xQ7DGdcAQgrrXCS9NbJk67O2uR82rbKOXBTzZHWw=,tag:XVEjCEM5t8qJl6jL89zrkw==,type:str] | ||||
| sops: | ||||
|     kms: [] | ||||
|     gcp_kms: [] | ||||
| @@ -46,8 +63,8 @@ sops: | ||||
|             akVjeTNTeGorZjJQOVlMeCtPRUVYL3MK+VMvGxrbzGz4Q3sdaDDWjal+OiK+JYKX | ||||
|             GHiMXVHQJZu/RrlxMjHKN6V3iaqxZpuvLAEJ2Lzy5EOHPtuiiRyeHQ== | ||||
|             -----END AGE ENCRYPTED FILE----- | ||||
|     lastmodified: "2023-09-17T02:02:24Z" | ||||
|     mac: ENC[AES256_GCM,data:Lkvj9UOdE/WZtFReMs6n8ucFuJNPb76ZhPHFpYAEqYEe8d9FdMPMzq05DBAJe9IqpFS0jc9SWxJUPHfGgoMR8nPciZuR/mpJ+4s/cRkPbApwBPcLlvatE/qkbcxzoLlb1vN0gth5G/U7UEfk5Pp9gIz6Yo4sEIS3Za42tId1MpI=,iv:s3VELgU/RJ98/lbQV3vPtOLXtwFzB3KlY7bMKbAzp/g=,tag:D8s0XyGnd8UhbCseB/TyFg==,type:str] | ||||
|     lastmodified: "2024-05-26T02:07:41Z" | ||||
|     mac: ENC[AES256_GCM,data:CRaJefV1zcJc6eyzyjTLgd0+Wv46VT8o4iz2YAGU+c2b/Cr97Tj290LoEO6UXTI3uFwVfzii2yZ2l+4FK3nVVriD4Cx1O/9qWcnLa5gfK30U0zof6AsJx8qtGu1t6oiPlGUCF7sT0BW9Wp8cPumrY6cZp9QbhmIDV0o0aJNUNN4=,iv:8OSYV1eG6kYlJD4ovZZhcD1GaYnmy7vHPa/+7egM1nE=,tag:OPI13rpDh2l1ViFj8TBFWg==,type:str] | ||||
|     pgp: | ||||
|         - created_at: "2023-05-21T00:28:40Z" | ||||
|           enc: | | ||||
| @@ -70,4 +87,5 @@ sops: | ||||
|             -----END PGP MESSAGE----- | ||||
|           fp: F7D37890228A907440E1FD4846B9228E814A2AAC | ||||
|     unencrypted_suffix: _unencrypted | ||||
|     version: 3.7.3 | ||||
|     version: 3.8.1 | ||||
|  | ||||
|   | ||||
| @@ -15,7 +15,6 @@ keys: | ||||
|         secret_key: ENC[AES256_GCM,data:+WoAJbDBEgKs0RoHT+7oEELAVQ+/2Xt+5RTMSXg23moCqVRx+Gzll9P5Drw=,iv:AkRn/Y20iEe5i1T+84wAgLCTFtAox2G3giyawAkltAw=,tag:BZbt5Wb5lYLIJBm/pfP4GQ==,type:str] | ||||
|         admin_password: ENC[AES256_GCM,data:ttKwfC4WuXeL/6x4,iv:x1X+e3z08CR992GzC62YnFIN7SGrE81/nDNrgcgVzx0=,tag:YajUoy61kYbpeGeC7yNrXQ==,type:str] | ||||
|     postgres: | ||||
|         grafana: ENC[AES256_GCM,data:D6qkg98WZYzKYegSNBb31v8o+KHisGmJ+ab5Ut7EMtsJz36kUup5RS4EbtM=,iv:rfE1uH1QycKMTpSq2p1ntQ2BIvptAh2J3l/QcQhiuLo=,tag:QxmGFcekjFRPf6orN86IxQ==,type:str] | ||||
|         postgres_exporter_env: ENC[AES256_GCM,data:8MEoikoA6tFNm9qZbk0DFWANd7nRs5QSqrsGLoLKPIc1xykJaXTlyP5v8ywVGR8j7bfPs4p6QfpUIWK8CCnfQ1QhsFPXUMksl8p+K+xuMakYZr9OoWigGqvOHpFb9blfBN1FBdRrk38REXWAMUn74KSRI9v+0i5lpC4=,iv:anpjWVUadKfSAm9XbkeAKu+jAk+LxcpVYQ+gUe5szYw=,tag:4tzb/8B/e1uVoqTsQGlcKA==,type:str] | ||||
|         postgres_exporter_knakelibrak_env: ENC[AES256_GCM,data:xjC7DGXrW2GIJq8XioIZb+jSe/Hzcz0tv9cUHmX/n1nhI+D64lYt+EKnq1+RX/vJzU4sTaKjveKBh88Qqnv6RQm+MZC//dIxcvnnAdl50qnHZyBCaFFEzSNI8I8vGyArMk8Ja72clBq3kMpUz/pLBP0qDrjblKDoWkU=,iv:ZW98hJy8A5t4Oxtu17R3tM7gou183VLbgBsHA8LFuJY=,tag:VMOvQz3X/XDylV1YFg2Jsg==,type:str] | ||||
| sops: | ||||
| @@ -24,55 +23,55 @@ sops: | ||||
|     azure_kv: [] | ||||
|     hc_vault: [] | ||||
|     age: | ||||
|         - recipient: age1mrnldl334l2nszuta6ywvewng0fswv2dz9l5g4qcwe3nj4yxf92qjskdx6 | ||||
|         - recipient: age1x28hmzvuv6f2n66c0jtqcca3h9rput8d7j5uek6jcpx8n9egd52sqpejq0 | ||||
|           enc: | | ||||
|             -----BEGIN AGE ENCRYPTED FILE----- | ||||
|             YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBrN3lJM2xWTUZ3UkRBaENI | ||||
|             VmJiWDlQbHd0VUNYdllPdURyQmUvL3lKMzJzCkZlRFVxbmNLOVNqUFg1akJQQlBP | ||||
|             VmdOMUdjZ1M4U2lLVEpGaGI5NjNTR2MKLS0tIDRlQUtucEZhZmRYbmpadVdKK01v | ||||
|             cWxCQlBRR1VaZTBDQnkzNGE0WGttWm8KK5s/coWNsdCP5lKQ8LMK7/3ku179+Lg1 | ||||
|             4ujTVn4LhvXy6JvgGTWS/UbMmJjJebVxkulzf5St3YMMs2mcIYjOtA== | ||||
|             YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBURkY4WTZhQzJoREpxV1Vr | ||||
|             aUExZ1dxNkIyMkJtUXpqOWtTT1J0MGpmMkY4ClR4Wm1FTmhKN2pIMENRdERrWVY2 | ||||
|             SUlHblpEc3VackMrbFpHUUJwM2ltZHcKLS0tIEovMEtiOWc1L2tzZDh3ekZKbStr | ||||
|             NEFkcW03ZTRJODNxTlVuUnFlcFFUUncKEZzOeUtRsZiuugTLzG2xU4eJ3XtVuop7 | ||||
|             hhlDBL/YoFn/CO3HjqFdCVv33QoPu7KKMeV52pbVEnv93mvdEeFxVA== | ||||
|             -----END AGE ENCRYPTED FILE----- | ||||
|         - recipient: age17tagmpwqjk3mdy45rfesrfey6h863x8wfq38wh33tkrlrywxducs0k6tpq | ||||
|           enc: | | ||||
|             -----BEGIN AGE ENCRYPTED FILE----- | ||||
|             YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBSa25taGsxdlhrUS96cXBi | ||||
|             cUo3WDVmdEhKN256THJhS2tHSitDRkVraDJNCmhGZzlFUDFkN0JKNkFWUlVLVzcz | ||||
|             MjFhcDdmcmpxdTA3V3JRREFNVmNUbEEKLS0tIFNSU2xNZzN2Y1ZzR2hFM0dOK0Zy | ||||
|             Tmk4bXd0ZHhPemxDSDREb3IvSjFza1EKsjtC6J3kYGRe8oLAoUZmg1BUmpkMyC98 | ||||
|             uYq+IQmfJt48R/MKDei00j1w3zIK5+E5GU4o8+jILzwfpzYUUZWwiA== | ||||
|             YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBSY3cxSGFvdDdWcFVLRTRy | ||||
|             Zng2VnhjZlFkc1RQN0NqUjJGeW02WlFaMlFZCjVZc2x2UXNXS1I2WDBxeHdjNUdr | ||||
|             WnZGc0l5NlArekUwUGU3Qkdub25EVm8KLS0tIDB2bGo3ZURtZ0pSZjFzcGpOdW5D | ||||
|             aTI3aTBUS0d1MzFmMTVMbUlFYTR4VlUKzOvNCAzan1GTXjoRxeySkUYIYtI4Mpvu | ||||
|             MC0Q8e350SyoOsrF7fUvw+Ru68fDMLW27H6Ly36xP7D3eo/h4eZVXw== | ||||
|             -----END AGE ENCRYPTED FILE----- | ||||
|         - recipient: age1hn45n46ypyrvypv0mwfnpt9ddrlmw34dwlpf33n8v67jexr3lucq6ahc9x | ||||
|         - recipient: age1mrnldl334l2nszuta6ywvewng0fswv2dz9l5g4qcwe3nj4yxf92qjskdx6 | ||||
|           enc: | | ||||
|             -----BEGIN AGE ENCRYPTED FILE----- | ||||
|             YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBPb09qTTc4cjRMcjIzRmxu | ||||
|             RzZWTDBNTGdvaEc2VFJPakYvakRMK1RnS1FnCktHRVkwZGlUUXl4UTBRcGxMQzdn | ||||
|             QVBCYVdlWEw5NW9tNytJTGIzRlpwa0UKLS0tIGdDdUtFMUgyT0phMXBxZE41Y1h4 | ||||
|             a2hQVVprakt5NURpNXdQUjREczJKWTgKn60yrLqco9brlqigAolO8rEkww9z3y3u | ||||
|             KmefLVZCGfoko+fnKLVE9UKFS/tAowqgPS1qE76u1Mmkk6yqZoG9rg== | ||||
|             YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBFbDBYMDNQcWkySC8vN05t | ||||
|             U3hLMjlYVUE3Zms3U2R4R0VnMUtFcmVQclZvClY4aWZEYWZPdkltMElkUWxQeUtP | ||||
|             TEF0a0txbVQ4d3lrelp3cG9TbG5OSkEKLS0tIHR1V3JIVEwwUjM3RVdES2pQUmhP | ||||
|             T1MwME1tbGQ2NysrOEVNYVZRT1R0YmcKFpfe9GfH7s779CNQswRm/W7zwYO6wK11 | ||||
|             z6IGPxtBlUGdshYiHA1BEz7fMVg3ZolL2D98cTNMM24U89Gssiw9qw== | ||||
|             -----END AGE ENCRYPTED FILE----- | ||||
|     lastmodified: "2023-07-08T12:46:19Z" | ||||
|     mac: ENC[AES256_GCM,data:bQWG/GgSIv5LdhGTsyx3ENOAywtYVKjzK6nxOnUEZvD+RSi6jxj9Wze7qOhXvgjKWCz/cZj5oSuMQNRyoI8p8xJdxf0+UNdX8uPT05HiKuF7CBcXzprjKri/H6yFp87epOM9fMdn7ZUACn/iT1IZBo+5OuMtDnqVUm/GEmMcsog=,iv:ll/vEeiXsD3crbbxEFsJlxGbm9dZDUPC4GeO95RZZX4=,tag:TGCA721vK9EY3xlY6zIeIg==,type:str] | ||||
|     lastmodified: "2024-04-20T23:41:59Z" | ||||
|     mac: ENC[AES256_GCM,data:38Ask+adT2FshF8DYEfCWeVWt4KiaJsTXhF7Ib3xxdfQ6vAixM2OXTaK/qqUvN6gQok9TFF+HMJBJ+jezV00nVcKUYn04FaU2/D2zdam44eEEYEEovmfAZ6vbC+CiDv4d/DCc3hnYtDZCEgUTfP4gsZ9rLZFAOwaOFWRJxcDi6Y=,iv:BzuWdTjn6LhscNeouHjM7IYKxTahA8PzzlHSCYZ618s=,tag:BWtPbNwzdOJb788eOO5ZNA==,type:str] | ||||
|     pgp: | ||||
|         - created_at: "2023-01-21T19:52:08Z" | ||||
|           enc: | | ||||
|         - created_at: "2024-04-20T23:15:17Z" | ||||
|           enc: |- | ||||
|             -----BEGIN PGP MESSAGE----- | ||||
|  | ||||
|             hQIMA0av/duuklWYAQ//Sw5EHNbC9iPXcHSULYVmSMOQCAH7GSGvaaFvey/KffPD | ||||
|             5gbFr00vIi1JfjYXmYfn3KKpUfs/mMMo5NzYU2Ou5fWcPsqFLXOwubebuf61X6p7 | ||||
|             7YfLYQMnjgBzkpb972AJl2tWUlcBcOz89tIw3oMi8R5vvXjRjEdDY8Yp+Z2Apj9V | ||||
|             YJCoSIe6RLBlubMs4I6VIOaTaKIM1DWthg95dozlShXYsEgFTYaJ6FbN9RuZOZPa | ||||
|             KzFs2DXtbylXXJtiCArQCHnOgA1Jnp80VvMYLO1ldteQhqGdmnxnqwjETx/uqy4l | ||||
|             QE31LcRf2JFKi0BBJdQfEqBGW9LD4Mjfwi6tWbHq4Mn29u8IT6z5HJIB99JRAV/9 | ||||
|             RfBPzF7UVLq2baWxDwG/M6TvZlVJPdAyhJ5QqhkVdrWir7D1D108u+cgtJWw+vlS | ||||
|             cP3hT73LWCo2bXUrHXxFnrWdDQQSDpew/x2cTHUNvqdqLZgMJWdZgh+mXOQLjzHP | ||||
|             xGkjt0ae5/CEnUIse/Qt3SyoKN3rGVKJgoQ4D0AeBFU5z7NEOx7Ebl9t6IgVnJIB | ||||
|             sDJXg+7jJ8A0V1xGan6BP8dFi7m0aAJH0xi8RB9jC1ZRVNxUjFow3Szh0JQ7u2P5 | ||||
|             4jZ3FT4tWzPzLQsgJUd/H41QyKSd3ke4VMf97mEKULJ7prtXdyxQfRDcE93UgVXS | ||||
|             XAF0u7pIl+O2RlJtki+UvuwVDszPBRSmGmfiQa4vsYfXahO4fmBjhdl2hdLtz82F | ||||
|             dh+dPu+RSD9OKwIhUwsDLtWWlI/4BvIB1yXbQxP2MyjZm3uVf1CtgUHyjWw8 | ||||
|             =rri5 | ||||
|             hQIMA0av/duuklWYAQ/+LSTWjii2dblTAkuqHan3uuuRRpt1ppmHEgHYkQZD+RzE | ||||
|             g+ljNaM/BPqci7Kr1NHFDw+cU2MYm/40Tz63l1cvfE3NEoVefsmoA5voNI3G/bx/ | ||||
|             LTAe2aacPwO/TNoLtrCgRkzNyKXluUkM9OoIvkvB5DEGjYbe82+gI5Zi+NbW9N/p | ||||
|             5ilr9Cc1jvIivjZMGGPLRgkAc/twOOuyrZlsFd9kddAL9YFO7wpd/dko886y1jE5 | ||||
|             jz9n9F4SKYOcgLPqZuG1iZ8qaA2zGT2bP2caai/QJAmL90stQCiRWtQgB8KeWugm | ||||
|             nRFBm5BLamtoqjXXwzdtXGKbFAhvL5/h+kPxnJDjylfFVbgCpoWJ/fxdE5xxxZtq | ||||
|             zCcGCQQsaa85eWkBByhu7TdwyAW7bJCm8z6kfFPGqhNDkS8ifxnEWm6ulgYVokiL | ||||
|             WVBvuQCd1s8KSExs6zNWGcGlqgvcbovHXyVlmLeqZfBA7i/vYqksZtBT47rG7nCS | ||||
|             YGfHy69yVrMdj4KrLuMXNfjtS92hkQqWmCyl5X5zOSJXqEL2dorMzSZn89gK4nL4 | ||||
|             V4zOKkKtsj2MqynYn/XAoUf3AfYs2wtRhJiU+r/q+rx9Hx31H8mnUuUerT58yQCY | ||||
|             mAkjIhTzvZcWIalQo7xnZhos4p1IYaA7MAuGC6HxuWVaOsyiFkRaKwB9svWyZ/DS | ||||
|             XAFID3fQ1xfNyYsW8nvXQmvZubnhE+dAQPaiAFP9ujY4RVXWBFOrV6NAs7y/LID/ | ||||
|             89lpfWN87JWSJWUk6DCD3AQ+1GiBCFy7uswUJkG4zou1RQBSl7X88ziVDILU | ||||
|             =tXkN | ||||
|             -----END PGP MESSAGE----- | ||||
|           fp: F7D37890228A907440E1FD4846B9228E814A2AAC | ||||
|     unencrypted_suffix: _unencrypted | ||||
|     version: 3.7.3 | ||||
|     version: 3.8.1 | ||||
|   | ||||
| @@ -6,15 +6,21 @@ | ||||
|     extraGroups = [ | ||||
|       "wheel" | ||||
|       "drift" | ||||
|       "nix-builder-users" | ||||
|     ]; | ||||
|  | ||||
|     packages = with pkgs; [ | ||||
|       exa | ||||
|       neovim | ||||
|       htop | ||||
|       ripgrep | ||||
|       vim | ||||
|       foot.terminfo | ||||
|     ]; | ||||
|  | ||||
|     openssh.authorizedKeys.keys = [ | ||||
|       "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFa5y7KyLn2tjxed1czMbyM5scnEpo9v/GfnhL/28ckM legolas" | ||||
|       "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICf7SlyHR6KgP7+IeFr/Iuiu2lL5vaSlzqPonaO8XU0J gunalx@aragon" | ||||
|       "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEj+Y0RUrSaF8gUW8m2BY6i8e7/0bUWhu8u8KW+AoHDh gunalx@nixos" | ||||
|     ]; | ||||
|   }; | ||||
| } | ||||
|   | ||||
							
								
								
									
										18
									
								
								users/eirikwit.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								users/eirikwit.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,18 @@ | ||||
| { pkgs, ... }: | ||||
| { | ||||
|   users.users.eirikwit = { | ||||
|     isNormalUser = true; | ||||
|     extraGroups = [ | ||||
|       "wheel" | ||||
|       "drift" | ||||
|     ]; | ||||
|  | ||||
|     packages = with pkgs; [ | ||||
|       micro | ||||
|     ]; | ||||
|  | ||||
|     openssh.authorizedKeys.keys = [ | ||||
|       "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGZusOSiUVSMjrvNdUq4R91Gafq4XVs9C77Zt+LMPhCU eirikw@live.no" | ||||
|     ]; | ||||
|   }; | ||||
| } | ||||
| @@ -11,7 +11,7 @@ | ||||
|  | ||||
|     packages = with pkgs; [ | ||||
|       bottom | ||||
|       exa | ||||
|       eza | ||||
|       neovim | ||||
|       diskonaut | ||||
|       ripgrep | ||||
|   | ||||
| @@ -30,8 +30,11 @@ in rec { | ||||
|       ipv6 = pvv-ipv6 168; | ||||
|     }; | ||||
|     ildkule = { | ||||
|       ipv4 = pvv-ipv4 187; | ||||
|       ipv6 = pvv-ipv6 "1:187"; | ||||
|       ipv4 = "10.212.25.209"; | ||||
|       ipv6 = "2001:700:300:6025:f816:3eff:feee:812d"; | ||||
|  | ||||
|       ipv4_global = "129.241.153.213"; | ||||
|       ipv6_global = "2001:700:300:6026:f816:3eff:fe58:f1e8"; | ||||
|     }; | ||||
|     bicep = { | ||||
|       ipv4 = pvv-ipv4 209; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user