From 011c1632f3762e1bc1ecfdee9d9f3b3f44be74e5 Mon Sep 17 00:00:00 2001 From: Azat Bahawi Date: Sun, 12 Nov 2023 17:50:43 +0300 Subject: 2023-11-12 --- lib/default.nix | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'lib') 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 '' '${lib.concatStrings text}'; - sub_filter_once on; - ''; - htmlPlausibleScript = { - domain ? "$host", - src ? "https://plausible.shire.net/js/script.js", - }: ''''; + 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}") + ]; + }; } -- cgit 1.4.1