mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 14:19:08 +01:00
lib: Refactor
This commit is contained in:
parent
1f6a3818a5
commit
59551461e6
2 changed files with 16 additions and 24 deletions
|
|
@ -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}/";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}/";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue