|
| 1 | +{ |
| 2 | + config, |
| 3 | + pkgs, |
| 4 | + ... |
| 5 | +}: |
| 6 | +let |
| 7 | + sectracker = import ../. { inherit pkgs; }; |
| 8 | +in |
| 9 | +{ |
| 10 | + imports = [ |
| 11 | + sectracker.module |
| 12 | + ./configuration.nix |
| 13 | + ]; |
| 14 | + networking.hostName = "sectracker"; |
| 15 | + |
| 16 | + fileSystems."/" = { |
| 17 | + device = "/dev/disk/by-partlabel/disk-main-root"; |
| 18 | + fsType = "ext4"; |
| 19 | + }; |
| 20 | + fileSystems."/boot" = { |
| 21 | + device = "/dev/disk/by-partlabel/disk-main-ESP"; |
| 22 | + fsType = "vfat"; |
| 23 | + }; |
| 24 | + |
| 25 | + systemd.network.networks."10-wan" = { |
| 26 | + matchConfig.MACAddress = "96:00:04:64:8e:77"; |
| 27 | + address = [ |
| 28 | + "91.99.31.214/32" |
| 29 | + "2a01:4f8:1c1b:6921::1/64" |
| 30 | + ]; |
| 31 | + routes = [ |
| 32 | + # create default routes for both IPv6 and IPv4 |
| 33 | + { Gateway = "fe80::1"; } |
| 34 | + # or when the gateway is not on the same network |
| 35 | + { |
| 36 | + Gateway = "172.31.1.1"; |
| 37 | + GatewayOnLink = true; |
| 38 | + } |
| 39 | + ]; |
| 40 | + # make the routes on this interface a dependency for network-online.target |
| 41 | + linkConfig.RequiredForOnline = "routable"; |
| 42 | + }; |
| 43 | + |
| 44 | + nixpkgs.overlays = sectracker.overlays; |
| 45 | + services = { |
| 46 | + nginx = { |
| 47 | + enable = true; |
| 48 | + recommendedTlsSettings = true; |
| 49 | + recommendedProxySettings = true; |
| 50 | + recommendedGzipSettings = true; |
| 51 | + recommendedOptimisation = true; |
| 52 | + }; |
| 53 | + postgresql = { |
| 54 | + enableJIT = true; |
| 55 | + settings = { |
| 56 | + # Derived using PGTune for an 8 core, 16GB RAM host |
| 57 | + max_connections = 200; |
| 58 | + shared_buffers = "4GB"; |
| 59 | + effective_cache_size = "12GB"; |
| 60 | + maintenance_work_mem = "1GB"; |
| 61 | + checkpoint_completion_target = "0.9"; |
| 62 | + wal_buffers = "16MB"; |
| 63 | + default_statistics_target = "100"; |
| 64 | + random_page_cost = "1.1"; |
| 65 | + effective_io_concurrency = "200"; |
| 66 | + work_mem = "5242kB"; |
| 67 | + huge_pages = "off"; |
| 68 | + min_wal_size = "1GB"; |
| 69 | + max_wal_size = "4GB"; |
| 70 | + max_worker_processes = "8"; |
| 71 | + max_parallel_workers_per_gather = "4"; |
| 72 | + max_parallel_workers = "8"; |
| 73 | + max_parallel_maintenance_workers = "4"; |
| 74 | + }; |
| 75 | + authentication = '' |
| 76 | + local all all trust |
| 77 | + ''; |
| 78 | + }; |
| 79 | + }; |
| 80 | + security.acme.acceptTerms = true; |
| 81 | + security.acme.defaults.email = "[email protected]"; |
| 82 | + networking.firewall.allowedTCPPorts = [ |
| 83 | + 80 |
| 84 | + 443 |
| 85 | + ]; |
| 86 | + services.web-security-tracker = { |
| 87 | + enable = true; |
| 88 | + production = true; |
| 89 | + domain = "tracker.security.nixos.org"; |
| 90 | + env = { |
| 91 | + SYNC_GITHUB_STATE_AT_STARTUP = true; |
| 92 | + # set to `true` when going live |
| 93 | + GH_ISSUES_PING_MAINTAINERS = false; |
| 94 | + GH_ORGANIZATION = "nixos"; |
| 95 | + GH_ISSUES_REPO = "nixpkgs"; |
| 96 | + GH_SECURITY_TEAM = "security"; |
| 97 | + GH_COMMITTERS_TEAM = "nixpkgs-committers"; |
| 98 | + GH_ISSUES_COMMITTERS_ONLY = true; |
| 99 | + }; |
| 100 | + |
| 101 | + secrets = { |
| 102 | + SECRET_KEY = config.age.secrets.django-secret-key.path; |
| 103 | + GH_CLIENT_ID = config.age.secrets.gh-client.path; |
| 104 | + GH_SECRET = config.age.secrets.gh-secret.path; |
| 105 | + GH_WEBHOOK_SECRET = config.age.secrets.gh-webhook-secret.path; |
| 106 | + GH_APP_PRIVATE_KEY = config.age.secrets.gh-app-private-key.path; |
| 107 | + GH_APP_INSTALLATION_ID = config.age.secrets.gh-app-installation-id.path; |
| 108 | + }; |
| 109 | + maxJobProcessors = 1; |
| 110 | + }; |
| 111 | + |
| 112 | + age.secrets = { |
| 113 | + django-secret-key.file = ./secrets/django-secret-key.age; |
| 114 | + gh-client.file = ./secrets/gh-client.age; |
| 115 | + gh-secret.file = ./secrets/gh-secret.age; |
| 116 | + gh-webhook-secret.file = ./secrets/gh-webhook-secret.age; |
| 117 | + gh-app-private-key.file = ./secrets/nixpkgs-security-tracker.private-key.pem.age; |
| 118 | + gh-app-installation-id.file = ./secrets/gh-app-installation-id.age; |
| 119 | + }; |
| 120 | + |
| 121 | + nix.optimise.automatic = true; |
| 122 | +} |
0 commit comments