From 512232b72a5eab6a63a7e23ff1371b2821d5b065 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 4 Jul 2023 11:33:54 +0200 Subject: permown: fix flakify fuckups --- krebs/3modules/permown.nix | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/permown.nix b/krebs/3modules/permown.nix index 3ebbc44fe..ae8702978 100644 --- a/krebs/3modules/permown.nix +++ b/krebs/3modules/permown.nix @@ -1,4 +1,6 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, lib, ... }: let + slib = import ../../lib/pure.nix { inherit lib; }; +in with lib; { options.krebs.permown = mkOption { @@ -16,7 +18,7 @@ with lib; { group = mkOption { apply = x: if x == null then "" else x; default = null; - type = types.nullOr types.groupname; + type = types.nullOr slib.types.groupname; }; keepGoing = mkOption { default = false; @@ -28,15 +30,15 @@ with lib; { ''; }; owner = mkOption { - type = types.username; + type = slib.types.username; }; path = mkOption { default = config._module.args.name; - type = types.absolute-pathname; + type = slib.types.absolute-pathname; }; umask = mkOption { default = "0027"; - type = types.file-mode; + type = slib.types.file-mode; }; }; })); @@ -48,11 +50,11 @@ with lib; { system.activationScripts.permown = let mkdir = plan: /* sh */ '' - ${pkgs.coreutils}/bin/mkdir -p ${shell.escape plan.path} + ${pkgs.coreutils}/bin/mkdir -p ${slib.shell.escape plan.path} ''; in concatMapStrings mkdir plans; - systemd.services = genAttrs' plans (plan: let + systemd.services = slib.genAttrs' plans (plan: let continuable = command: if plan.keepGoing then /* sh */ "{ ${command}; } || :" -- cgit v1.3.1 From 537fa18f762e28f2f475f9e00dedf71914a0c8f6 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 4 Jul 2023 13:00:04 +0200 Subject: treewide: replaceChars -> replaceStrings --- krebs/2configs/shack/prometheus/unifi.nix | 2 +- krebs/3modules/acl.nix | 2 +- krebs/5pkgs/simple/netcup/default.nix | 2 +- lib/pure.nix | 4 ++-- makefu/3modules/snapraid.nix | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/2configs/shack/prometheus/unifi.nix b/krebs/2configs/shack/prometheus/unifi.nix index 401ecb024..34e47add9 100644 --- a/krebs/2configs/shack/prometheus/unifi.nix +++ b/krebs/2configs/shack/prometheus/unifi.nix @@ -5,6 +5,6 @@ unifiAddress = "https://unifi.shack:8443/"; unifiInsecure = true; unifiUsername = "prometheus"; # needed manual login after setup to confirm the password - unifiPassword = lib.replaceChars ["\n"] [""] (builtins.readFile ); + unifiPassword = lib.replaceStrings ["\n"] [""] (builtins.readFile ); }; } diff --git a/krebs/3modules/acl.nix b/krebs/3modules/acl.nix index d23706499..05f7e824b 100644 --- a/krebs/3modules/acl.nix +++ b/krebs/3modules/acl.nix @@ -33,7 +33,7 @@ in { default = {}; }; config = { - systemd.services = lib.mapAttrs' (path: rules: lib.nameValuePair "acl-${lib.replaceChars ["/"] ["_"] path}" { + systemd.services = lib.mapAttrs' (path: rules: lib.nameValuePair "acl-${lib.replaceStrings ["/"] ["_"] path}" { wantedBy = [ "multi-user.target" ]; path = [ pkgs.acl diff --git a/krebs/5pkgs/simple/netcup/default.nix b/krebs/5pkgs/simple/netcup/default.nix index 408672eff..750e9cfa9 100644 --- a/krebs/5pkgs/simple/netcup/default.nix +++ b/krebs/5pkgs/simple/netcup/default.nix @@ -3,7 +3,7 @@ with stockholm.lib; let readJSON = path: fromJSON (readFile path); - sed.escape = replaceChars ["/"] ["\\/"]; # close enough + sed.escape = replaceStrings ["/"] ["\\/"]; # close enough PATH = makeBinPath [ coreutils curl diff --git a/lib/pure.nix b/lib/pure.nix index bb2d586f6..3329db022 100644 --- a/lib/pure.nix +++ b/lib/pure.nix @@ -26,7 +26,7 @@ let krops = import ../submodules/krops/lib; shell = import ./shell.nix { inherit (stockholm) lib; }; systemd = { - encodeName = replaceChars ["/"] ["\\x2f"]; + encodeName = replaceStrings ["/"] ["\\x2f"]; }; types = nixpkgs-lib.types // import ./types.nix { lib = stockholm.lib; }; uri = import ./uri.nix { inherit (stockholm) lib; }; @@ -79,7 +79,7 @@ let string = toJSON x; # close enough }.${type} or reject; - indent = replaceChars ["\n"] ["\n "]; + indent = replaceStrings ["\n"] ["\n "]; stripAttr = converge (filterAttrsRecursive (n: v: v != {} && v != null)); diff --git a/makefu/3modules/snapraid.nix b/makefu/3modules/snapraid.nix index 1a2c08475..25254c142 100644 --- a/makefu/3modules/snapraid.nix +++ b/makefu/3modules/snapraid.nix @@ -4,7 +4,7 @@ with import ; let # returns dirname without / , used as disk name - dname = dir: replaceChars ["/"] [""] (head (reverseList (splitString "/" dir))); + dname = dir: replaceStrings ["/"] [""] (head (reverseList (splitString "/" dir))); snapraid-conf = '' # Disks ${concatMapStringsSep "\n" (d: "disk ${dname d} ${d}") cfg.disks} -- cgit v1.3.1 From f5cb4940f997d521045445642aa4825d7b0ab5f3 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 4 Jul 2023 16:10:23 +0200 Subject: iana-etc: fix flakify fuckups --- krebs/3modules/iana-etc.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'krebs/3modules') diff --git a/krebs/3modules/iana-etc.nix b/krebs/3modules/iana-etc.nix index 3195f71d9..dabe2f8aa 100644 --- a/krebs/3modules/iana-etc.nix +++ b/krebs/3modules/iana-etc.nix @@ -1,5 +1,6 @@ -{ config, pkgs, lib, ... }: -with lib; { +{ config, lib, pkgs, ... }: let + slib = import ../../lib/pure.nix { inherit lib; }; +in with lib; { options.krebs.iana-etc.services = mkOption { default = {}; @@ -7,7 +8,7 @@ with lib; { options = { port = mkOption { default = config._module.args.name; - type = types.addCheck types.str (test "[1-9][0-9]*"); + type = types.addCheck types.str (slib.test "[1-9][0-9]*"); }; } // genAttrs ["tcp" "udp"] (protocol: mkOption { default = null; @@ -30,7 +31,7 @@ with lib; { (proto: let line = "${entry.${proto}.name} ${entry.port}/${proto}"; in /* sh */ '' - echo ${shell.escape line} + echo ${slib.shell.escape line} '') (filter (proto: entry.${proto} != null) ["tcp" "udp"])} '') (attrValues config.krebs.iana-etc.services)} -- cgit v1.3.1 [cgit] Unable to lock slot /tmp/cgit/57000000.lock: No such file or directory (2)