diff options
author | Azat Bahawi <azat@bahawi.net> | 2023-11-12 17:50:43 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2023-11-12 17:50:43 +0300 |
commit | 011c1632f3762e1bc1ecfdee9d9f3b3f44be74e5 (patch) | |
tree | e9d7d5955f25f82cdb671f1c44da663d2d839485 /lib/default.nix | |
parent | 2023-11-09 (diff) |
2023-11-12
Diffstat (limited to '')
-rw-r--r-- | lib/default.nix | 34 |
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}") + ]; + }; } |