From 0df7c346705957a29136bd5802a4a0ef38cc3b52 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 11 Jun 2023 00:26:29 +0200 Subject: modules: import lib via relative path --- krebs/1systems/arcadeomat/config.nix | 14 ++++----- krebs/1systems/filebitch/config.nix | 20 ++++++------ krebs/1systems/news/config.nix | 12 ++++---- krebs/3modules/airdcpp.nix | 7 +++-- krebs/3modules/announce-activation.nix | 15 ++++----- krebs/3modules/backup.nix | 2 +- krebs/3modules/build.nix | 2 +- krebs/3modules/ci/default.nix | 2 +- krebs/3modules/dns.nix | 2 +- krebs/3modules/exim.nix | 2 +- krebs/3modules/git.nix | 2 +- krebs/3modules/htgen.nix | 2 +- krebs/3modules/konsens.nix | 2 +- krebs/3modules/reaktor2.nix | 2 +- krebs/3modules/repo-sync.nix | 2 +- krebs/3modules/secret.nix | 2 +- krebs/3modules/sync-containers3.nix | 2 +- krebs/3modules/systemd.nix | 12 +++++--- krebs/3modules/tinc.nix | 2 +- .../3modules/upstream/window-managers/default.nix | 36 +++++++++++----------- krebs/3modules/users.nix | 7 +++-- 21 files changed, 77 insertions(+), 72 deletions(-) diff --git a/krebs/1systems/arcadeomat/config.nix b/krebs/1systems/arcadeomat/config.nix index cdeaae180..7439e687e 100644 --- a/krebs/1systems/arcadeomat/config.nix +++ b/krebs/1systems/arcadeomat/config.nix @@ -9,15 +9,15 @@ in { imports = [ ./hw.nix - - + ../../../krebs + ../../../krebs/2configs - # - # + #../../../krebs/2configs/binary-cache/nixos.nix + #../../../krebs/2configs/binary-cache/prism.nix - - - + ../../../krebs/2configs/shack/ssh-keys.nix + ../../../krebs/2configs/save-diskspace.nix + ../../../krebs/2configs/shack/prometheus/node.nix ]; # use your own binary cache, fallback use cache.nixos.org (which is used by diff --git a/krebs/1systems/filebitch/config.nix b/krebs/1systems/filebitch/config.nix index e27d036c8..1514d37ad 100644 --- a/krebs/1systems/filebitch/config.nix +++ b/krebs/1systems/filebitch/config.nix @@ -5,16 +5,16 @@ in { imports = [ ./hardware-configuration.nix - - - # + ../../../krebs + ../../../krebs/2configs + # ../../../krebs/2configs/secret-passwords.nix - # - # - - + # ../../../krebs/2configs/binary-cache/nixos.nix + # ../../../krebs/2configs/binary-cache/prism.nix + ../../../krebs/2configs/shack/ssh-keys.nix + ../../../krebs/2configs/shack/prometheus/node.nix # provides access to /home/share for smbuser via smb - + ../../../krebs/2configs/shack/share.nix { fileSystems."/home/share" = { device = "/serve"; @@ -23,8 +23,8 @@ in } ## Collect local statistics via collectd and send to collectd - # - # + # ../../../krebs/2configs/stats/shack-client.nix + # ../../../krebs/2configs/stats/shack-debugging.nix ]; krebs.build.host = config.krebs.hosts.filebitch; diff --git a/krebs/1systems/news/config.nix b/krebs/1systems/news/config.nix index b27fc3737..b5a2b21ba 100644 --- a/krebs/1systems/news/config.nix +++ b/krebs/1systems/news/config.nix @@ -2,15 +2,15 @@ { imports = [ - - + ../../../krebs + ../../../krebs/2configs - - + ../../../krebs/2configs/ircd.nix + ../../../krebs/2configs/go.nix #### NEWS #### - - + ../../../krebs/2configs/ircd.nix + ../../../krebs/2configs/news.nix ]; krebs.build.host = config.krebs.hosts.news; diff --git a/krebs/3modules/airdcpp.nix b/krebs/3modules/airdcpp.nix index ba6c7de37..c7c856e5f 100644 --- a/krebs/3modules/airdcpp.nix +++ b/krebs/3modules/airdcpp.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: -with lib; #genid +with lib; let + slib = import ../../lib/lib.nix { inherit lib; }; cfg = config.krebs.airdcpp; out = { @@ -265,14 +266,14 @@ let }; users = lib.mkIf (cfg.user == "airdcpp") { users.airdcpp = { - uid = pkgs.stockholm.lib.genid "airdcpp"; + uid = slib.genid "airdcpp"; home = cfg.stateDir; createHome = true; isSystemUser = true; group = "airdcpp"; inherit (cfg) extraGroups; }; - groups.airdcpp.gid = pkgs.stockholm.lib.genid "airdcpp"; + groups.airdcpp.gid = slib.genid "airdcpp"; }; }; in diff --git a/krebs/3modules/announce-activation.nix b/krebs/3modules/announce-activation.nix index 438ef1c0f..2343dabf6 100644 --- a/krebs/3modules/announce-activation.nix +++ b/krebs/3modules/announce-activation.nix @@ -1,14 +1,15 @@ -{ config, pkgs, lib, stockholm, ... }: +{ config, pkgs, lib, ... }: let + slib = import ../../lib/lib.nix { inherit lib; }; cfg = config.krebs.announce-activation; announce-activation = pkgs.writeDash "announce-activation" '' set -efu message=$(${cfg.get-message}) exec ${pkgs.irc-announce}/bin/irc-announce \ - ${pkgs.stockholm.lib.shell.escape cfg.irc.server} \ - ${pkgs.stockholm.lib.shell.escape (toString cfg.irc.port)} \ - ${pkgs.stockholm.lib.shell.escape cfg.irc.nick} \ - ${pkgs.stockholm.lib.shell.escape cfg.irc.channel} \ + ${slib.shell.escape cfg.irc.server} \ + ${slib.shell.escape (toString cfg.irc.port)} \ + ${slib.shell.escape cfg.irc.nick} \ + ${slib.shell.escape cfg.irc.channel} \ ${lib.escapeShellArg cfg.irc.tls} \ "$message" ''; @@ -41,7 +42,7 @@ in { }; nick = lib.mkOption { default = config.krebs.build.host.name; - type = pkgs.stockholm.lib.types.label; + type = slib.types.label; }; port = lib.mkOption { default = 6667; @@ -49,7 +50,7 @@ in { }; server = lib.mkOption { default = "irc.r"; - type = pkgs.stockholm.lib.types.hostname; + type = slib.types.hostname; }; tls = lib.mkOption { default = false; diff --git a/krebs/3modules/backup.nix b/krebs/3modules/backup.nix index 33ba3a6a6..5c607522a 100644 --- a/krebs/3modules/backup.nix +++ b/krebs/3modules/backup.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: -with pkgs.stockholm.lib; +with import ../../lib/lib.nix { inherit lib; }; let out = { options.krebs.backup = api; diff --git a/krebs/3modules/build.nix b/krebs/3modules/build.nix index 2e77e3117..5afa4035e 100644 --- a/krebs/3modules/build.nix +++ b/krebs/3modules/build.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, ... }: -with pkgs.stockholm.lib; +with import ../../lib/lib.nix { inherit lib; }; { options.krebs.build = { diff --git a/krebs/3modules/ci/default.nix b/krebs/3modules/ci/default.nix index 84c0255eb..c72c25de0 100644 --- a/krebs/3modules/ci/default.nix +++ b/krebs/3modules/ci/default.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: -with pkgs.stockholm.lib; +with import ../../../lib/lib.nix { inherit lib; }; let cfg = config.krebs.ci; diff --git a/krebs/3modules/dns.nix b/krebs/3modules/dns.nix index 60e084f50..525453eae 100644 --- a/krebs/3modules/dns.nix +++ b/krebs/3modules/dns.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: -with pkgs.stockholm.lib; { +with import ../../lib/lib.nix { inherit lib; }; { options = { krebs.dns.providers = mkOption { type = types.attrsOf types.str; diff --git a/krebs/3modules/exim.nix b/krebs/3modules/exim.nix index 55adc79d3..d4ea78c97 100644 --- a/krebs/3modules/exim.nix +++ b/krebs/3modules/exim.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: with pkgs.stockholm.lib; let +{ config, lib, pkgs, ... }: with import ../../lib/lib.nix { inherit lib; }; let cfg = config.krebs.exim; in { options.krebs.exim = { diff --git a/krebs/3modules/git.nix b/krebs/3modules/git.nix index aa4522876..88c27288c 100644 --- a/krebs/3modules/git.nix +++ b/krebs/3modules/git.nix @@ -6,7 +6,7 @@ # TODO when authorized_keys changes, then restart ssh # (or kill already connected users somehow) -with pkgs.stockholm.lib; +with import ../../lib/lib.nix { inherit lib; }; let cfg = config.krebs.git; diff --git a/krebs/3modules/htgen.nix b/krebs/3modules/htgen.nix index e39c48075..bcddf1648 100644 --- a/krebs/3modules/htgen.nix +++ b/krebs/3modules/htgen.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, ... }: -with pkgs.stockholm.lib; +with import ../../lib/lib.nix { inherit lib; }; let optionalAttr = name: value: if name != null then diff --git a/krebs/3modules/konsens.nix b/krebs/3modules/konsens.nix index 5272f75db..3f2f0c687 100644 --- a/krebs/3modules/konsens.nix +++ b/krebs/3modules/konsens.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: -with pkgs.stockholm.lib; +with import ../../lib/lib.nix { inherit lib; }; let cfg = config.krebs.konsens; diff --git a/krebs/3modules/reaktor2.nix b/krebs/3modules/reaktor2.nix index 16a6295a3..324523f80 100644 --- a/krebs/3modules/reaktor2.nix +++ b/krebs/3modules/reaktor2.nix @@ -1,5 +1,5 @@ { config, pkgs, lib, ... }: -with pkgs.stockholm.lib; { +with import ../../lib/lib.nix { inherit lib; }; { options.krebs.reaktor2 = mkOption { default = {}; diff --git a/krebs/3modules/repo-sync.nix b/krebs/3modules/repo-sync.nix index 0ac9fab6b..c580907cc 100644 --- a/krebs/3modules/repo-sync.nix +++ b/krebs/3modules/repo-sync.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, ... }: -with pkgs.stockholm.lib; +with import ../../lib/lib.nix { inherit lib; }; let cfg = config.krebs.repo-sync; diff --git a/krebs/3modules/secret.nix b/krebs/3modules/secret.nix index f03416368..fe6f26962 100644 --- a/krebs/3modules/secret.nix +++ b/krebs/3modules/secret.nix @@ -1,5 +1,5 @@ { config, lib, pkgs, ... }: -with pkgs.stockholm.lib; let +with import ../../lib/lib.nix { inherit lib; }; let cfg = config.krebs.secret; in { options.krebs.secret = { diff --git a/krebs/3modules/sync-containers3.nix b/krebs/3modules/sync-containers3.nix index ed147b30e..79af31c0f 100644 --- a/krebs/3modules/sync-containers3.nix +++ b/krebs/3modules/sync-containers3.nix @@ -1,6 +1,6 @@ { config, lib, pkgs, ... }: let cfg = config.krebs.sync-containers3; - slib = pkgs.stockholm.lib; + slib = import ../../lib/lib.nix { inherit lib; }; in { options.krebs.sync-containers3 = { inContainer = { diff --git a/krebs/3modules/systemd.nix b/krebs/3modules/systemd.nix index 57620155d..fc92da128 100644 --- a/krebs/3modules/systemd.nix +++ b/krebs/3modules/systemd.nix @@ -1,5 +1,7 @@ { config, pkgs, lib, ... }: let { + slib = import ../../lib/lib.nix { inherit lib; }; + body.options.krebs.systemd.services = lib.mkOption { default = {}; type = lib.types.attrsOf (lib.types.submodule (cfg_: let @@ -12,14 +14,14 @@ lib.sort lib.lessThan (lib.filter - pkgs.stockholm.lib.types.absolute-pathname.check + slib.types.absolute-pathname.check (map - (pkgs.stockholm.lib.compose [ pkgs.stockholm.lib.maybeHead (pkgs.stockholm.lib.match "[^:]*:(.*)") ]) + (slib.compose [ slib.maybeHead (builtins.match "[^:]*:(.*)") ]) (lib.toList cfg.serviceConfig.LoadCredential))); readOnly = true; }; credentialUnitName = lib.mkOption { - default = "trigger-${pkgs.stockholm.lib.systemd.encodeName serviceName}"; + default = "trigger-${slib.systemd.encodeName serviceName}"; readOnly = true; }; restartIfCredentialsChange = lib.mkOption { @@ -53,7 +55,7 @@ pkgs.systemd ]} - cache=/var/lib/credentials/${pkgs.stockholm.lib.shell.escape serviceName}.sha1sum + cache=/var/lib/credentials/${slib.shell.escape serviceName}.sha1sum tmpfile=$(mktemp -t "$(basename "$cache")".XXXXXXXX) trap 'rm -f "$tmpfile"' EXIT @@ -63,7 +65,7 @@ fi mv "$tmpfile" "$cache" - systemctl restart ${pkgs.stockholm.lib.shell.escape serviceName} + systemctl restart ${slib.shell.escape serviceName} ''; }; }; diff --git a/krebs/3modules/tinc.nix b/krebs/3modules/tinc.nix index c6307c9db..e4296d414 100644 --- a/krebs/3modules/tinc.nix +++ b/krebs/3modules/tinc.nix @@ -1,5 +1,5 @@ { config, pkgs, lib, ... }: -with pkgs.stockholm.lib; { +with import ../../lib/lib.nix { inherit lib; }; { options.krebs.tinc = mkOption { default = {}; description = '' diff --git a/krebs/3modules/upstream/window-managers/default.nix b/krebs/3modules/upstream/window-managers/default.nix index cb071f5b8..cdd82076d 100644 --- a/krebs/3modules/upstream/window-managers/default.nix +++ b/krebs/3modules/upstream/window-managers/default.nix @@ -1,22 +1,22 @@ { imports = [ - # # Replace upstream xmonad module with one that will be reloaded if changed. - # # - # # This module is intended to be upstreamed once fully tested. - # # The patch to be committed can be obtained using: - # # - # # diff -u \ - # # - # # - # { - # disabledModules = [ "services/x11/window-managers/xmonad.nix" ]; - # imports = [ ./xmonad.nix ]; - # nixpkgs.overlays = [(self: super: { - # writers = super.writers // { - # writeHaskellBin = name: spec: - # super.writers.writeHaskellBin name (builtins.removeAttrs spec ["ghcArgs"]); - # }; - # })]; - # } + # Replace upstream xmonad module with one that will be reloaded if changed. + # + # This module is intended to be upstreamed once fully tested. + # The patch to be committed can be obtained using: + # + # diff -u \ + # + # + { + disabledModules = [ "services/x11/window-managers/xmonad.nix" ]; + imports = [ ./xmonad.nix ]; + nixpkgs.overlays = [(self: super: { + writers = super.writers // { + writeHaskellBin = name: spec: + super.writers.writeHaskellBin name (builtins.removeAttrs spec ["ghcArgs"]); + }; + })]; + } ]; } diff --git a/krebs/3modules/users.nix b/krebs/3modules/users.nix index b3d6ba29d..b0ecbb850 100644 --- a/krebs/3modules/users.nix +++ b/krebs/3modules/users.nix @@ -1,7 +1,8 @@ -{ config, lib, pkgs, ... }: -{ +{ config, lib, pkgs, ... }: let + slib = import ../../lib/lib.nix { inherit lib; }; +in { options.krebs.users = lib.mkOption { - type = with pkgs.stockholm.lib.types; attrsOf user; + type = with slib.types; attrsOf user; }; config = lib.mkIf config.krebs.enable { krebs.users = { -- cgit v1.2.3