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 cdeaae18..7439e687 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 e27d036c..1514d37a 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 b27fc373..b5a2b21b 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 ba6c7de3..c7c856e5 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 438ef1c0..2343dabf 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 33ba3a6a..5c607522 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 2e77e311..5afa4035 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 84c0255e..c72c25de 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 60e084f5..525453ea 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 55adc79d..d4ea78c9 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 aa452287..88c27288 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 e39c4807..bcddf164 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 5272f75d..3f2f0c68 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 16a6295a..324523f8 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 0ac9fab6..c580907c 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 f0341636..fe6f2696 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 ed147b30..79af31c0 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 57620155..fc92da12 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 c6307c9d..e4296d41 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 cb071f5b..cdd82076 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 b3d6ba29..b0ecbb85 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