mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 11:41:34 +01:00
Add global lib relativePath
This commit is contained in:
parent
39bd59c8ee
commit
56f11d4ade
4 changed files with 19 additions and 9 deletions
|
|
@ -1,4 +1,7 @@
|
|||
{ self, inputs, ... }:
|
||||
{
|
||||
flake.lib = import "${self}/lib" inputs.nixpkgs.lib;
|
||||
flake.lib = import "${self}/lib" {
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
inherit self;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,8 @@
|
|||
lib: {
|
||||
{
|
||||
lib,
|
||||
self,
|
||||
}:
|
||||
{
|
||||
isTailscaleDomain = domain: domain |> lib.hasSuffix ".ts.net";
|
||||
|
||||
subdomainOf = domain: domain |> lib.splitString "." |> lib.head;
|
||||
|
|
@ -15,4 +19,6 @@ lib: {
|
|||
|
||||
mkUnprotectedMessage =
|
||||
name: "${name} should only be exposed on private networks; access control isn't yet configured";
|
||||
|
||||
relativePath = path: path |> toString |> lib.removePrefix "${self}/";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
config,
|
||||
self,
|
||||
lib,
|
||||
lib',
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
|
@ -34,10 +35,10 @@ in
|
|||
|> lib.map (value: value.options.meta.domains.list.definitionsWithLocations)
|
||||
|> lib.concatLists
|
||||
|> lib.concatMap (
|
||||
entry:
|
||||
entry.value
|
||||
{ file, value }:
|
||||
value
|
||||
|> lib.map (domain: {
|
||||
file = entry.file |> lib.removePrefix "${self}/";
|
||||
file = lib'.relativePath file;
|
||||
inherit domain;
|
||||
})
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
config,
|
||||
options,
|
||||
self,
|
||||
lib,
|
||||
lib',
|
||||
...
|
||||
}:
|
||||
let
|
||||
|
|
@ -28,10 +28,10 @@ in
|
|||
protocol:
|
||||
options.meta.ports.${protocol}.list.definitionsWithLocations
|
||||
|> lib.concatMap (
|
||||
entry:
|
||||
entry.value
|
||||
{ file, value }:
|
||||
value
|
||||
|> lib.map (port: {
|
||||
file = entry.file |> lib.removePrefix "${self}/";
|
||||
file = lib'.relativePath file;
|
||||
inherit port;
|
||||
})
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue