mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 15:11: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, ... }:
|
{ 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";
|
isTailscaleDomain = domain: domain |> lib.hasSuffix ".ts.net";
|
||||||
|
|
||||||
subdomainOf = domain: domain |> lib.splitString "." |> lib.head;
|
subdomainOf = domain: domain |> lib.splitString "." |> lib.head;
|
||||||
|
|
@ -15,4 +19,6 @@ lib: {
|
||||||
|
|
||||||
mkUnprotectedMessage =
|
mkUnprotectedMessage =
|
||||||
name: "${name} should only be exposed on private networks; access control isn't yet configured";
|
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,
|
config,
|
||||||
self,
|
self,
|
||||||
lib,
|
lib,
|
||||||
|
lib',
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -34,10 +35,10 @@ in
|
||||||
|> lib.map (value: value.options.meta.domains.list.definitionsWithLocations)
|
|> lib.map (value: value.options.meta.domains.list.definitionsWithLocations)
|
||||||
|> lib.concatLists
|
|> lib.concatLists
|
||||||
|> lib.concatMap (
|
|> lib.concatMap (
|
||||||
entry:
|
{ file, value }:
|
||||||
entry.value
|
value
|
||||||
|> lib.map (domain: {
|
|> lib.map (domain: {
|
||||||
file = entry.file |> lib.removePrefix "${self}/";
|
file = lib'.relativePath file;
|
||||||
inherit domain;
|
inherit domain;
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
config,
|
config,
|
||||||
options,
|
options,
|
||||||
self,
|
|
||||||
lib,
|
lib,
|
||||||
|
lib',
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
|
|
@ -28,10 +28,10 @@ in
|
||||||
protocol:
|
protocol:
|
||||||
options.meta.ports.${protocol}.list.definitionsWithLocations
|
options.meta.ports.${protocol}.list.definitionsWithLocations
|
||||||
|> lib.concatMap (
|
|> lib.concatMap (
|
||||||
entry:
|
{ file, value }:
|
||||||
entry.value
|
value
|
||||||
|> lib.map (port: {
|
|> lib.map (port: {
|
||||||
file = entry.file |> lib.removePrefix "${self}/";
|
file = lib'.relativePath file;
|
||||||
inherit port;
|
inherit port;
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue