Compare commits

..

No commits in common. "673ead7863bec924ffc3ba7c971423c9b5d02e27" and "2d26b36e31ee449e0f01fdc2b3d41101f838bc22" have entirely different histories.

11 changed files with 26 additions and 52 deletions

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.home.mail.msmtp; cfg = config.my.home.mail.msmtp;
in in

View file

@ -7,7 +7,7 @@ in
enable = mkDisableOption "ssh configuration"; enable = mkDisableOption "ssh configuration";
}; };
config.programs.ssh = lib.mkIf cfg.enable { config.programs.ssh = {
enable = true; enable = true;
matchBlocks = { matchBlocks = {

View file

@ -12,7 +12,8 @@ let
}; };
mylib = makeExtensible (self: mylib = makeExtensible (self:
mapModules ./. (file: import file { inherit self lib pkgs inputs; }) with self; mapModules ./.
(file: import file { inherit self lib pkgs inputs; })
); );
in in
mylib.extend (self: super: mylib.extend (self: super:

View file

@ -3,48 +3,21 @@ let
inherit (builtins) readDir pathExists; inherit (builtins) readDir pathExists;
inherit (lib) hasPrefix hasSuffix nameValuePair removeSuffix; inherit (lib) hasPrefix hasSuffix nameValuePair removeSuffix;
inherit (self.attrs) mapFilterAttrs; 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 in
if v == "directory" {
then mapModules = dir: fn:
if pathExists "${path}/default.nix" 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) then nameValuePair n (fn path)
else recurseStep n path fn else if v == "regular" &&
else if v == "regular" && n != "default.nix" && hasSuffix ".nix" n n != "default.nix" &&
hasSuffix ".nix" n
then nameValuePair (removeSuffix ".nix" n) (fn path) then nameValuePair (removeSuffix ".nix" n) (fn path)
else nameValuePair "" null) else nameValuePair "" null)
(readDir dir); (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;
} }

View file

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ ... }: { config, pkgs, ... }:
{ {
imports = [ imports = [

View file

@ -1,4 +1,4 @@
{ ... }: { lib, ... }:
{ {
config.my.services = { config.my.services = {
wireguard = { wireguard = {

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.hardware.upower; cfg = config.my.hardware.upower;
in in

View file

@ -1,4 +1,4 @@
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.paperless; cfg = config.my.services.paperless;
in in

View file

@ -1,5 +1,5 @@
# A simple podcast fetcher # A simple podcast fetcher
{ config, lib, ... }: { config, lib, pkgs, ... }:
let let
cfg = config.my.services.podgrab; cfg = config.my.services.podgrab;
in in

View file

@ -1,4 +1,4 @@
{ lib, fetchurl, stdenv }: { lib, fetchurl, gnulib, stdenv }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "nolimips"; pname = "nolimips";
version = "0.11"; version = "0.11";

View file

@ -1,4 +1,4 @@
{ lib, gawk, stdenvNoCC, unified-hosts-lists }: { lib, fetchFromGitHub, gawk, stdenvNoCC, unified-hosts-lists }:
stdenvNoCC.mkDerivation rec { stdenvNoCC.mkDerivation rec {
name = "unbound-zones-adblock"; name = "unbound-zones-adblock";
version = unified-hosts-lists.version; version = unified-hosts-lists.version;