about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/default.nix34
1 files changed, 17 insertions, 17 deletions
diff --git a/lib/default.nix b/lib/default.nix
index be32e60..7fbaeec 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -14,7 +14,7 @@ lib: _: rec {
     assert exponent > 0;
       builtins.foldl' (x: _: x * base) 1 (builtins.genList (_: _) exponent);
 
-  mapListToAttrs = f: xs:
+  mapListToAttrs = f: attrs:
     builtins.listToAttrs (map (name: {
         name =
           if builtins.isList name
@@ -22,25 +22,25 @@ lib: _: rec {
           else name;
         value = f name;
       })
-      xs);
+      attrs);
 
   mkTcpMem = min: ini: max:
     assert min <= ini && ini <= max;
       lib.concatMapStrings (x: toString x + " ") (map (pow 2) [min ini max]);
 
-  # TODO Move these to the NGINX module.
-  nginxInternalOnly = ''
-    if ($internal != 1) {
-      return 403;
-    }
-    access_log off;
-  '';
-  nginxAppendHead = text: ''
-    sub_filter '</head>' '${lib.concatStrings text}</head>';
-    sub_filter_once on;
-  '';
-  htmlPlausibleScript = {
-    domain ? "$host",
-    src ? "https://plausible.shire.net/js/script.js",
-  }: ''<script defer data-domain="${domain}" src="${src}"></script>'';
+  moduleFromRef = module: ref: sha256: {
+    disabledModules = [module];
+    imports = [
+      (let
+        src = builtins.fetchTarball {
+          url = let
+            cons = lib.splitString ":" ref;
+            owner = lib.head cons;
+            branch = lib.last cons;
+          in "https://github.com/${owner}/nixpkgs/archive/refs/heads/${branch}.tar.gz";
+          inherit sha256;
+        };
+      in "${src}/nixos/modules/${module}")
+    ];
+  };
 }

Consider giving Nix/NixOS a try! <3