checkpoint

This commit is contained in:
Chris Kruining 2026-04-13 15:58:41 +02:00
parent 59e8ca812c
commit 6b3389c4b1
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
13 changed files with 608 additions and 188 deletions

View file

@ -14,7 +14,47 @@ in {
type = types.submoduleWith {
modules = [../types/endpoint.nix];
};
default = name;
default = {};
apply = attrs:
attrs
// {
__toString = self: let
protocol =
if self.protocol != null
then "${self.protocol}://"
else "";
port =
if self.port != null
then ":${toString self.port}"
else "";
path =
if self.path != null
then "/${self.path}"
else "";
query =
if self.query != null
then "?${toString self.query
|> lib.attrsToList
|> lib.map ({
name,
value,
}: "${name}=${value}")}"
else "";
hash =
if self.hash != null
then "#${toString self.hash
|> lib.attrsToList
|> lib.map ({
name,
value,
}: "${name}=${value}")}"
else "";
in "${protocol}${self.host}${port}${path}${query}${hash}";
};
};
# protocol = mkOption {

View file

@ -2,17 +2,18 @@
inherit (lib) mkOption types;
in {
options = {
protocol = mkOption {
type = types.str;
default = "http";
};
host = mkOption {
type = types.str;
default = "localhost";
};
port = mkOption {
type = types.port;
};
protocol = mkOption {
type = types.nullOr types.str;
type = types.nullOr types.port;
default = null;
};