diff --git a/home/mail/msmtp.nix b/home/mail/msmtp.nix index c469982..3e725e8 100644 --- a/home/mail/msmtp.nix +++ b/home/mail/msmtp.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let cfg = config.my.home.mail.msmtp; in diff --git a/home/ssh.nix b/home/ssh.nix index 3bd7f28..22f85d3 100644 --- a/home/ssh.nix +++ b/home/ssh.nix @@ -7,7 +7,7 @@ in enable = mkDisableOption "ssh configuration"; }; - config.programs.ssh = lib.mkIf cfg.enable { + config.programs.ssh = { enable = true; matchBlocks = { diff --git a/lib/default.nix b/lib/default.nix index fa37c23..9014f85 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -12,7 +12,8 @@ let }; mylib = makeExtensible (self: - mapModules ./. (file: import file { inherit self lib pkgs inputs; }) + with self; mapModules ./. + (file: import file { inherit self lib pkgs inputs; }) ); in mylib.extend (self: super: diff --git a/lib/modules.nix b/lib/modules.nix index 5b8c4c3..92e8476 100644 --- a/lib/modules.nix +++ b/lib/modules.nix @@ -3,48 +3,21 @@ let inherit (builtins) readDir pathExists; inherit (lib) hasPrefix hasSuffix nameValuePair removeSuffix; inherit (self.attrs) mapFilterAttrs; - - implOptionalRecursion = recurse: - let - recurseStep = - if recurse - then (n: path: fn: nameValuePair n (impl path fn)) - else (_: _: _: nameValuePair "" null); - impl = dir: fn: - mapFilterAttrs - (n: _: n != "" && !(hasPrefix "_" n)) - (n: v: - let - path = "${toString dir}/${n}"; - in - if v == "directory" - then - if pathExists "${path}/default.nix" - then nameValuePair n (fn path) - else recurseStep n path fn - else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n - then nameValuePair (removeSuffix ".nix" n) (fn path) - else nameValuePair "" null) - (readDir dir); - in - impl; in { - # Find all nix modules in a directory, discard any prefixed with "_", - # map a function to each resulting path, and generate an attribute set - # to associate module name to resulting value. - # - # mapModules :: - # path - # (path -> any) - # attrs - mapModules = implOptionalRecursion false; - - # Recursive version of mapModules. - # - # mapModulesRec :: - # path - # (path -> any) - # attrs - mapModulesRec = implOptionalRecursion true; + mapModules = dir: fn: + mapFilterAttrs + (n: v: + v != null && + !(hasPrefix "_" n)) + (n: v: + let path = "${toString dir}/${n}"; in + if v == "directory" && pathExists "${path}/default.nix" + then nameValuePair n (fn path) + else if v == "regular" && + n != "default.nix" && + hasSuffix ".nix" n + then nameValuePair (removeSuffix ".nix" n) (fn path) + else nameValuePair "" null) + (readDir dir); } diff --git a/machines/aramis/default.nix b/machines/aramis/default.nix index e2211f4..878f2c9 100644 --- a/machines/aramis/default.nix +++ b/machines/aramis/default.nix @@ -2,7 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ ... }: +{ config, pkgs, ... }: { imports = [ diff --git a/machines/aramis/services.nix b/machines/aramis/services.nix index 0287c30..30dc47d 100644 --- a/machines/aramis/services.nix +++ b/machines/aramis/services.nix @@ -1,4 +1,4 @@ -{ ... }: +{ lib, ... }: { config.my.services = { wireguard = { diff --git a/modules/hardware/upower.nix b/modules/hardware/upower.nix index 95fa282..f21b9d2 100644 --- a/modules/hardware/upower.nix +++ b/modules/hardware/upower.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let cfg = config.my.hardware.upower; in diff --git a/modules/services/paperless.nix b/modules/services/paperless.nix index 0e29325..b4e1f44 100644 --- a/modules/services/paperless.nix +++ b/modules/services/paperless.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let cfg = config.my.services.paperless; in diff --git a/modules/services/podgrab.nix b/modules/services/podgrab.nix index 9793d60..bc16178 100644 --- a/modules/services/podgrab.nix +++ b/modules/services/podgrab.nix @@ -1,5 +1,5 @@ # A simple podcast fetcher -{ config, lib, ... }: +{ config, lib, pkgs, ... }: let cfg = config.my.services.podgrab; in diff --git a/pkgs/nolimips/default.nix b/pkgs/nolimips/default.nix index 65d847d..2a1dc33 100644 --- a/pkgs/nolimips/default.nix +++ b/pkgs/nolimips/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchurl, stdenv }: +{ lib, fetchurl, gnulib, stdenv }: stdenv.mkDerivation rec { pname = "nolimips"; version = "0.11"; diff --git a/pkgs/unbound-zones-adblock/default.nix b/pkgs/unbound-zones-adblock/default.nix index ecec917..845c123 100644 --- a/pkgs/unbound-zones-adblock/default.nix +++ b/pkgs/unbound-zones-adblock/default.nix @@ -1,4 +1,4 @@ -{ lib, gawk, stdenvNoCC, unified-hosts-lists }: +{ lib, fetchFromGitHub, gawk, stdenvNoCC, unified-hosts-lists }: stdenvNoCC.mkDerivation rec { name = "unbound-zones-adblock"; version = unified-hosts-lists.version;