lib: Refactor

This commit is contained in:
SebastianStork 2026-02-04 00:17:14 +01:00
parent 1f6a3818a5
commit 59551461e6
Signed by: SebastianStork
SSH key fingerprint: SHA256:tRrGdjYOwgHxpSc/wTOZQZEjxcb15P0tyXRsbAfd+2Q
2 changed files with 16 additions and 24 deletions

View file

@ -1,7 +1,19 @@
{ self, inputs, ... }:
{ self, lib, ... }:
{
flake.lib = import "${self}/lib" {
inherit (inputs.nixpkgs) lib;
inherit self;
flake.lib = {
isPrivateDomain = domain: domain |> lib.hasSuffix ".splitleaf.de";
listNixFilesRecursively =
dir: dir |> lib.filesystem.listFilesRecursive |> lib.filter (lib.hasSuffix ".nix");
listDirectoryNames =
path: path |> builtins.readDir |> lib.filterAttrs (_: type: type == "directory") |> lib.attrNames;
genAttrs = f: names: lib.genAttrs names f;
mkUnprotectedMessage =
name: "${name} should only be exposed on private networks; access control isn't yet configured";
relativePath = path: path |> toString |> lib.removePrefix "${self}/";
};
}

View file

@ -1,20 +0,0 @@
{
lib,
self,
}:
{
isPrivateDomain = domain: domain |> lib.hasSuffix ".splitleaf.de";
listNixFilesRecursively =
dir: dir |> lib.filesystem.listFilesRecursive |> lib.filter (lib.hasSuffix ".nix");
listDirectoryNames =
path: path |> builtins.readDir |> lib.filterAttrs (_: type: type == "directory") |> lib.attrNames;
genAttrs = f: names: lib.genAttrs names f;
mkUnprotectedMessage =
name: "${name} should only be exposed on private networks; access control isn't yet configured";
relativePath = path: path |> toString |> lib.removePrefix "${self}/";
}