style: removed with lib;

This commit is contained in:
catvayor 2024-12-15 17:22:49 +01:00
parent d27db1e3ca
commit f315e3c7c3
Signed by: lbailly
GPG key ID: CE3E645251AC63F3
4 changed files with 71 additions and 26 deletions

View file

@ -6,7 +6,19 @@
self-meta,
...
}:
with lib;
let
inherit (lib)
mkEnableOption
mkOption
mkMerge
mkIf
mkDefault
;
inherit (lib.types)
str
package
;
in
{
imports = [
./users
@ -20,13 +32,13 @@ with lib;
default = true;
};
wireguardPubKey = mkOption {
type = types.str;
type = str;
};
fqdn = mkOption {
type = types.str;
type = str;
};
anywhere = lib.mkOption {
type = lib.types.package;
anywhere = mkOption {
type = package;
readOnly = true;
};
};

View file

@ -5,21 +5,36 @@
nodes ? { },
...
}:
with lib;
let
inherit (lib)
mkOption
mkEnableOption
mkIf
mapAttrs
concatStringsSep
fold
;
inherit (lib.types)
port
listOf
submodule
coercedTo
str
raw
;
redirected-ports-mod.options = {
external = mkOption {
type = types.port;
type = port;
};
internal = mkOption {
type = types.port;
type = port;
};
};
redirection-port-type = types.coercedTo types.port (port: {
redirection-port-type = coercedTo port (port: {
external = port;
internal = port;
}) (types.submodule redirected-ports-mod);
}) (submodule redirected-ports-mod);
inherit (config.kat) fqdn;
hostname = config.networking.hostName;
@ -34,7 +49,7 @@ let
'';
redirections =
lib.fold
fold
(a: b: {
domains = a.domains ++ b.domains;
tcp = a.tcp ++ b.tcp;
@ -87,29 +102,29 @@ in
};
ip = mkOption {
type = types.str;
type = str;
};
aliases = mkOption {
type = types.listOf types.str;
type = listOf str;
default = [ ];
};
open-tcp = mkOption {
type = types.listOf redirection-port-type;
type = listOf redirection-port-type;
default = [ ];
};
open-udp = mkOption {
type = types.listOf redirection-port-type;
type = listOf redirection-port-type;
default = [ ];
};
redirects = mkOption {
type = types.listOf types.str;
type = listOf str;
default = [ ];
};
test = mkOption {
type = types.raw;
type = raw;
};
};
config = mkIf cfg.enable {

View file

@ -1,6 +1,15 @@
{ lib }:
with lib;
let
inherit (lib)
filterAttrs
trim
splitString
filter
hasPrefix
readFile
mapAttrs'
removeSuffix
;
key-files = filterAttrs (name: _: name != "default.nix") (builtins.readDir ./.);
readKeys =
file:

View file

@ -3,8 +3,12 @@
lib,
...
}:
with lib;
let
inherit (lib)
mkEnableOption
mkMerge
mkIf
;
basecfg = {
enable = true;
defaultEditor = true;
@ -200,13 +204,18 @@ let
require('luasnip').lsp_expand(args.body)
end
'';
sources = map (name: { inherit name; }) [
"luasnip"
"nvim_lsp"
"buffer"
] ++ [
{ name = "latex_symbols"; option.strategy = 2; }
];
sources =
map (name: { inherit name; }) [
"luasnip"
"nvim_lsp"
"buffer"
]
++ [
{
name = "latex_symbols";
option.strategy = 2;
}
];
mapping = {
"<C-Space>" = "cmp.mapping.complete()";
"<C-d>" = "cmp.mapping.scroll_docs(-4)";