]> Untitled Git - awful.systems.git/commitdiff
add flakified lemmy (0.14.4) and sneer-archive
authorself <self@awful.systems>
Mon, 21 Aug 2023 19:19:26 +0000 (12:19 -0700)
committerself <self@awful.systems>
Mon, 21 Aug 2023 19:19:26 +0000 (12:19 -0700)
flake.lock
flake.nix
hosts/more/configuration.nix
hosts/these/configuration.nix
lemmy/dev/default.nix
lemmy/dev/module.nix
lemmy/prod/default.nix
lemmy/prod/module.nix
sneer-archive/default.nix [new file with mode: 0644]
sneer-archive/proxy-pass.nix [new file with mode: 0644]

index 3f61a2f73582d57e3014920caa1ee8f0b8de1f8d..3c1424925476375755594e25e3e6277d4a6c9e56 100644 (file)
@@ -1,5 +1,24 @@
 {
   "nodes": {
+    "archive-data": {
+      "inputs": {
+        "flake-utils": "flake-utils_5",
+        "nixpkgs": "nixpkgs_5"
+      },
+      "locked": {
+        "lastModified": 1690842193,
+        "narHash": "sha256-XJlNRnOkkdBSo0T9/aSAIzuRBCX9D+lWR06JutzgRE0=",
+        "ref": "refs/heads/main",
+        "rev": "262b488c58c37aa5428a465e1847609656c94236",
+        "revCount": 1,
+        "type": "git",
+        "url": "git://these.awful.systems/sneer-archive-data.git"
+      },
+      "original": {
+        "type": "git",
+        "url": "git://these.awful.systems/sneer-archive-data.git"
+      }
+    },
     "flake-utils": {
       "inputs": {
         "systems": "systems"
         "type": "github"
       }
     },
+    "flake-utils_2": {
+      "inputs": {
+        "systems": "systems_2"
+      },
+      "locked": {
+        "lastModified": 1689068808,
+        "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_3": {
+      "inputs": {
+        "systems": "systems_3"
+      },
+      "locked": {
+        "lastModified": 1689068808,
+        "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_4": {
+      "inputs": {
+        "systems": "systems_4"
+      },
+      "locked": {
+        "lastModified": 1689068808,
+        "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_5": {
+      "inputs": {
+        "systems": "systems_5"
+      },
+      "locked": {
+        "lastModified": 1689068808,
+        "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "flake-utils_6": {
+      "inputs": {
+        "systems": "systems_6"
+      },
+      "locked": {
+        "lastModified": 1687709756,
+        "narHash": "sha256-Y5wKlQSkgEK2weWdOu4J3riRd+kV/VCgHsqLNTTWQ/0=",
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "rev": "dbabf0ca0c0c4bce6ea5eaf65af5cb694d2082c7",
+        "type": "github"
+      },
+      "original": {
+        "owner": "numtide",
+        "repo": "flake-utils",
+        "type": "github"
+      }
+    },
+    "lemmy": {
+      "inputs": {
+        "flake-utils": "flake-utils_2",
+        "lemmy-translations": "lemmy-translations",
+        "nixpkgs": "nixpkgs"
+      },
+      "locked": {
+        "lastModified": 1692643794,
+        "narHash": "sha256-GPL8JJF6cVVFVf9U+liCpeEqcoX/bFYg2LU60MynP/I=",
+        "ref": "refs/heads/main",
+        "rev": "162ec83017a9d7f15c7e7ad7cefec62ab1e86d35",
+        "revCount": 4271,
+        "type": "git",
+        "url": "git://these.awful.systems/lemmy.git"
+      },
+      "original": {
+        "type": "git",
+        "url": "git://these.awful.systems/lemmy.git"
+      }
+    },
+    "lemmy-js-client": {
+      "inputs": {
+        "flake-utils": "flake-utils_4",
+        "nixpkgs": "nixpkgs_2"
+      },
+      "locked": {
+        "lastModified": 1690365721,
+        "narHash": "sha256-cCgcUW2CLWUI7kUacs2O//rXRBlnUsix2M/QggVhFh4=",
+        "path": "/home/j/lemmy-js-client",
+        "type": "path"
+      },
+      "original": {
+        "path": "/home/j/lemmy-js-client",
+        "type": "path"
+      }
+    },
+    "lemmy-translations": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1690314617,
+        "narHash": "sha256-fkv6l6/888XOdxZ8Y0P+Ww/y+8Wh4F8SIStncAmifu8=",
+        "owner": "lemmynet",
+        "repo": "lemmy-translations",
+        "rev": "68d14665d4f854fc20f9117636b5cde7176e91dd",
+        "type": "github"
+      },
+      "original": {
+        "owner": "lemmynet",
+        "repo": "lemmy-translations",
+        "type": "github"
+      }
+    },
+    "lemmy-translations_2": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1690314617,
+        "narHash": "sha256-fkv6l6/888XOdxZ8Y0P+Ww/y+8Wh4F8SIStncAmifu8=",
+        "owner": "lemmynet",
+        "repo": "lemmy-translations",
+        "rev": "68d14665d4f854fc20f9117636b5cde7176e91dd",
+        "type": "github"
+      },
+      "original": {
+        "owner": "lemmynet",
+        "repo": "lemmy-translations",
+        "type": "github"
+      }
+    },
+    "lemmy-ui": {
+      "inputs": {
+        "flake-utils": "flake-utils_3",
+        "lemmy-js-client": "lemmy-js-client",
+        "lemmy-translations": "lemmy-translations_2",
+        "nixpkgs": "nixpkgs_3"
+      },
+      "locked": {
+        "lastModified": 1692644033,
+        "narHash": "sha256-mvph4dGG7AntWCl+YR+PpUyYIwsp9ifYEiVy90YS/eQ=",
+        "ref": "refs/heads/main",
+        "rev": "d0708bf0499687e12332940db1ddf1a2248cc6f2",
+        "revCount": 1920,
+        "type": "git",
+        "url": "git://these.awful.systems/lemmy-ui.git"
+      },
+      "original": {
+        "type": "git",
+        "url": "git://these.awful.systems/lemmy-ui.git"
+      }
+    },
     "nixpkgs": {
       "locked": {
-        "lastModified": 1689431009,
-        "narHash": "sha256-hPgQCRWP5q/Xc4qOIP3c2krR9nQua78+t9EDiuey5nc=",
+        "lastModified": 1690031011,
+        "narHash": "sha256-kzK0P4Smt7CL53YCdZCBbt9uBFFhE0iNvCki20etAf4=",
         "owner": "NixOS",
         "repo": "nixpkgs",
-        "rev": "af8279f65fe71ce5a448408034a8c06e2b4b2c66",
+        "rev": "12303c652b881435065a98729eb7278313041e49",
         "type": "github"
       },
       "original": {
         "id": "nixpkgs",
-        "ref": "nixos-23.05",
+        "ref": "nixos-unstable",
         "type": "indirect"
       }
     },
       }
     },
     "nixpkgs_2": {
+      "locked": {
+        "lastModified": 1690179384,
+        "narHash": "sha256-+arbgqFTAtoeKtepW9wCnA0njCOyoiDFyl0Q0SBSOtE=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "b12803b6d90e2e583429bb79b859ca53c348b39a",
+        "type": "github"
+      },
+      "original": {
+        "id": "nixpkgs",
+        "ref": "nixos-unstable",
+        "type": "indirect"
+      }
+    },
+    "nixpkgs_3": {
+      "locked": {
+        "lastModified": 1690031011,
+        "narHash": "sha256-kzK0P4Smt7CL53YCdZCBbt9uBFFhE0iNvCki20etAf4=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "12303c652b881435065a98729eb7278313041e49",
+        "type": "github"
+      },
+      "original": {
+        "id": "nixpkgs",
+        "ref": "nixos-unstable",
+        "type": "indirect"
+      }
+    },
+    "nixpkgs_4": {
+      "locked": {
+        "lastModified": 1689431009,
+        "narHash": "sha256-hPgQCRWP5q/Xc4qOIP3c2krR9nQua78+t9EDiuey5nc=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "af8279f65fe71ce5a448408034a8c06e2b4b2c66",
+        "type": "github"
+      },
+      "original": {
+        "id": "nixpkgs",
+        "ref": "nixos-23.05",
+        "type": "indirect"
+      }
+    },
+    "nixpkgs_5": {
+      "locked": {
+        "lastModified": 1689078114,
+        "narHash": "sha256-osG8BrX5RpKJ7wH+vI6auOU+ctvNOblT4XXCgknK47c=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "b6cc7ff8fee93789bc871a267ab876c3fca042cb",
+        "type": "github"
+      },
+      "original": {
+        "id": "nixpkgs",
+        "type": "indirect"
+      }
+    },
+    "nixpkgs_6": {
+      "locked": {
+        "lastModified": 1688556768,
+        "narHash": "sha256-mhd6g0iJGjEfOr3+6mZZOclUveeNr64OwxdbNtLc8mY=",
+        "owner": "NixOS",
+        "repo": "nixpkgs",
+        "rev": "27bd67e55fe09f9d68c77ff151c3e44c4f81f7de",
+        "type": "github"
+      },
+      "original": {
+        "id": "nixpkgs",
+        "type": "indirect"
+      }
+    },
+    "nixpkgs_7": {
       "locked": {
         "lastModified": 1689413807,
         "narHash": "sha256-exuzOvOhGAEKWQKwDuZAL4N8a1I837hH5eocaTcIbLc=",
     "root": {
       "inputs": {
         "flake-utils": "flake-utils",
-        "nixpkgs": "nixpkgs",
+        "lemmy": "lemmy",
+        "lemmy-ui": "lemmy-ui",
+        "nixpkgs": "nixpkgs_4",
         "pkgs-unstable": "pkgs-unstable",
+        "sneer-archive-site": "sneer-archive-site",
         "sops-nix": "sops-nix"
       }
     },
+    "sneer-archive-site": {
+      "inputs": {
+        "archive-data": "archive-data",
+        "flake-utils": "flake-utils_6",
+        "nixpkgs": "nixpkgs_6"
+      },
+      "locked": {
+        "lastModified": 1690843079,
+        "narHash": "sha256-pivK6BRgSyZpVjH93WoXLr989y/PoeM5SP9tVxpVQGI=",
+        "ref": "refs/heads/main",
+        "rev": "6f0dc5d89caa2b6600b1a174dba81f5522fd4109",
+        "revCount": 1,
+        "type": "git",
+        "url": "git://these.awful.systems/sneer-archive-site.git"
+      },
+      "original": {
+        "type": "git",
+        "url": "git://these.awful.systems/sneer-archive-site.git"
+      }
+    },
     "sops-nix": {
       "inputs": {
-        "nixpkgs": "nixpkgs_2",
+        "nixpkgs": "nixpkgs_7",
         "nixpkgs-stable": "nixpkgs-stable"
       },
       "locked": {
         "repo": "default",
         "type": "github"
       }
+    },
+    "systems_2": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    },
+    "systems_3": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    },
+    "systems_4": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    },
+    "systems_5": {
+      "locked": {
+        "lastModified": 1681028828,
+        "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+        "owner": "nix-systems",
+        "repo": "default",
+        "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+        "type": "github"
+      },
+      "original": {
+        "owner": "nix-systems",
+        "repo": "default",
+        "type": "github"
+      }
+    },
+    "systems_6": {
+      "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",
index 8653d48629fc32ee44c93077910794fa40b8d033..d2d716e38451b4c7ac9b29fb222637a914fe75a4 100644 (file)
--- a/flake.nix
+++ b/flake.nix
@@ -6,9 +6,13 @@
     flake-utils.url = "github:numtide/flake-utils";
     pkgs-unstable.url = "nixpkgs/nixos-unstable";
     sops-nix.url = "github:Mic92/sops-nix";
+    lemmy.url = "git://these.awful.systems/lemmy.git";
+    lemmy-ui.url = "git://these.awful.systems/lemmy-ui.git";
+    sneer-archive-site.url = "git://these.awful.systems/sneer-archive-site.git";
   };
 
-  outputs = { self, nixpkgs, flake-utils, sops-nix, ... }@attrs:
+  outputs = { self, nixpkgs, flake-utils, sops-nix, lemmy, lemmy-ui
+    , sneer-archive-site, ... }@attrs:
     {
       nixosConfigurations = {
         these = nixpkgs.lib.nixosSystem {
             (go "more" "root@more.awful.systems")
             init-secrets
             pkgs.bashInteractive
+
+            # cache these packages:
+            lemmy.packages.${system}.lemmy-server
+            lemmy-ui.packages.${system}.lemmy-ui
+            sneer-archive-site.packages.${system}.default
           ];
         };
-        packages.maint-mode =
-          (pkgs.callPackage ./maint-mode/site.nix {});
+        packages.maint-mode = (pkgs.callPackage ./maint-mode/site.nix { });
       });
 }
index cf2a60afc542d93eb4cdf85f76641c9b507a29a7..bc390741b06148a58250ca968121ddc608398fb1 100644 (file)
@@ -6,6 +6,7 @@
     ../../secrets
     ../../lemmy/prod
     ../../git/proxy-pass.nix
+    ../../sneer-archive/proxy-pass.nix
     ../../maint-mode
   ];
 
index e3ad13645a274ea1874992f518b20b9ac3750f8d..f12872662250324c3042f04287e8d36d17e93f26 100644 (file)
@@ -5,10 +5,11 @@
     ../../hardware/hetzner-cloud/cx21.nix
     ../../secrets
     ../../pass
-    ../../lemmy/staging
+    #../../lemmy/staging
     ../../lemmy/dev
     ../../maint-mode
     ../../git
+    ../../sneer-archive
   ];
 
   networking.hostName = "these";
index 7bf0d31341b08511493ef639967f90e033673553..eab1b1204d8577a5581477ef7fa07c350d9f8fc9 100644 (file)
@@ -1,12 +1,13 @@
-{ config, lib, pkgs, pkgs-unstable, ... }:
+{ config, lib, pkgs, pkgs-unstable, lemmy, lemmy-ui, ... }:
 
 {
   imports = [ ./module.nix ];
 
   services.lemmy-dev = {
     enable = true;
-    server.package = pkgs.callPackage ../server.nix { Security = null; };
-    ui.package = pkgs.callPackage ../ui.nix { };
+    server.package =
+      lemmy.packages.${pkgs.stdenv.hostPlatform.system}.lemmy-server;
+    ui.package = lemmy-ui.packages.${pkgs.stdenv.hostPlatform.system}.lemmy-ui;
     nginx.enable = true;
     database.createLocally = true;
 
@@ -33,7 +34,8 @@
   sops.templates.lemmy-dev.content = builtins.toJSON
     (config.services.lemmy-dev.settings // {
       setup = config.services.lemmy-dev.settings.setup // {
-        admin_password = config.sops.placeholder."lemmy-dev/initial_admin_password";
+        admin_password =
+          config.sops.placeholder."lemmy-dev/initial_admin_password";
       };
 
       # email = {
@@ -49,8 +51,7 @@
     serviceConfig = {
       User = "lemmy_dev";
       Group = "lemmy_dev";
-      LoadCredential =
-        "lemmy-dev:${config.sops.templates.lemmy-dev.path}";
+      LoadCredential = "lemmy-dev:${config.sops.templates.lemmy-dev.path}";
     };
 
     environment = {
index 97887c09aae3d1cc5b7160e7c978ea230026ea04..81b1eb72c863a3ac9c3f2f9f984609fe57a5c36f 100644 (file)
@@ -159,6 +159,9 @@ in {
       backend = "http://127.0.0.1:${toString cfg.settings.port}";
     in mkIf cfg.nginx.enable {
       enable = mkDefault true;
+      eventsConfig = ''
+        worker_connections 20000;
+      '';
       appendHttpConfig = ''
         map "$request_method:$http_accept" $proxpass {
             # If no explicit matches exists below, send traffic to lemmy-ui
index f7c48b8876b1c8488975cef6aaf70a4ff9c64a8f..c87142213e8d3b4b6ad73ea79fc1ba1f672cf8bc 100644 (file)
@@ -1,12 +1,13 @@
-{ config, lib, pkgs, pkgs-unstable, ... }:
+{ config, lib, pkgs, pkgs-unstable, lemmy, lemmy-ui, ... }:
 
 {
   imports = [ ./module.nix ];
 
   services.lemmy-prod = {
     enable = true;
-    server.package = pkgs.callPackage ../server.nix { Security = null; };
-    ui.package = pkgs.callPackage ../ui.nix { };
+    server.package =
+      lemmy.packages.${pkgs.stdenv.hostPlatform.system}.lemmy-server;
+    ui.package = lemmy-ui.packages.${pkgs.stdenv.hostPlatform.system}.lemmy-ui;
     nginx.enable = true;
     database.createLocally = true;
 
@@ -45,7 +46,7 @@
     serviceConfig = {
       User = "lemmy";
       Group = "lemmy";
-      LoadCredential = ''lemmy-prod:${config.sops.templates.lemmy-prod.path}'';
+      LoadCredential = "lemmy-prod:${config.sops.templates.lemmy-prod.path}";
     };
 
     environment = {
index dc24bd703e7a5134d4d32dbe5653ed96ba2ec803..6d99284ff84e18407eba13736dedca0c54af7779 100644 (file)
@@ -159,6 +159,9 @@ in {
       backend = "http://127.0.0.1:${toString cfg.settings.port}";
     in mkIf cfg.nginx.enable {
       enable = mkDefault true;
+      eventsConfig = ''
+        worker_connections 20000;
+      '';
       appendHttpConfig = ''
         map "$request_method:$http_accept" $proxpass {
             # If no explicit matches exists below, send traffic to lemmy-ui
diff --git a/sneer-archive/default.nix b/sneer-archive/default.nix
new file mode 100644 (file)
index 0000000..b106034
--- /dev/null
@@ -0,0 +1,17 @@
+{ config, lib, pkgs, sneer-archive-site, ... }:
+
+{
+  services.nginx = {
+    enable = true;
+    virtualHosts."_".locations."/archives" = {
+      root =
+        sneer-archive-site.packages.${pkgs.stdenv.hostPlatform.system}.default;
+      tryFiles = "$uri $uri.html $uri/ =404";
+      extraConfig = ''
+        if ($request_uri ~ ^/(.*)\.html(\?|$)) {
+           return 301 /$1;
+        }
+      '';
+    };
+  };
+}
diff --git a/sneer-archive/proxy-pass.nix b/sneer-archive/proxy-pass.nix
new file mode 100644 (file)
index 0000000..a7ed8e2
--- /dev/null
@@ -0,0 +1,7 @@
+{ config, lib, pkgs, ... }:
+
+{
+  services.nginx.virtualHosts."awful.systems".locations."/archives" = {
+    proxyPass = "http://these";
+  };
+}