mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 17:31:34 +01:00
refactor: normalize usage of lib and builtins namespaces
This commit is contained in:
parent
043a996319
commit
062fd5de0b
17 changed files with 24 additions and 24 deletions
|
|
@ -14,7 +14,7 @@ let
|
|||
hostFiles =
|
||||
"${self}/hosts/${hostName}"
|
||||
|> lib.filesystem.listFilesRecursive
|
||||
|> builtins.filter (lib.hasSuffix ".nix");
|
||||
|> lib.filter (lib.hasSuffix ".nix");
|
||||
in
|
||||
[
|
||||
{ networking = { inherit hostName; }; }
|
||||
|
|
@ -46,6 +46,6 @@ in
|
|||
|> lib.filterAttrs (_: type: type == "directory")
|
||||
|> lib.mapAttrs (name: _: mkDeployNode name);
|
||||
|
||||
checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
|
||||
checks = lib.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) inputs.deploy-rs.lib;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{ self, lib, ... }:
|
||||
let
|
||||
modulesOf = dir: dir |> lib.filesystem.listFilesRecursive |> builtins.filter (lib.hasSuffix ".nix");
|
||||
modulesOf = dir: dir |> lib.filesystem.listFilesRecursive |> lib.filter (lib.hasSuffix ".nix");
|
||||
in
|
||||
{
|
||||
flake = {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|> lib.filterAttrs (_: value: value.config.home-manager.users.seb.custom.sops.enable or false)
|
||||
|> lib.mapAttrsToList (_: value: mkCreationRule value.config.home-manager.users.seb.custom.sops);
|
||||
|
||||
jsonConfig = { creation_rules = hostCreationRules ++ userCreationRules; } |> builtins.toJSON;
|
||||
jsonConfig = { creation_rules = hostCreationRules ++ userCreationRules; } |> lib.strings.toJSON;
|
||||
in
|
||||
pkgs.runCommand "sops-config" { buildInputs = [ pkgs.yj ]; } ''
|
||||
mkdir $out
|
||||
|
|
|
|||
|
|
@ -51,8 +51,8 @@
|
|||
|
||||
# Switch workspace
|
||||
${lib.concatMapStringsSep "\n" (n: ''
|
||||
bind = SUPER, ${toString n}, focusworkspaceoncurrentmonitor, ${toString n}
|
||||
bind = SUPER SHIFT, ${toString n}, movetoworkspacesilent, ${toString n}
|
||||
bind = SUPER, ${builtins.toString n}, focusworkspaceoncurrentmonitor, ${builtins.toString n}
|
||||
bind = SUPER SHIFT, ${builtins.toString n}, movetoworkspacesilent, ${builtins.toString n}
|
||||
'') (lib.range 1 9)}
|
||||
|
||||
# Manage session
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
"sidebar.revamp" = false;
|
||||
};
|
||||
|
||||
extraConfig = builtins.readFile "${inputs.betterfox}/user.js";
|
||||
extraConfig = lib.readFile "${inputs.betterfox}/user.js";
|
||||
};
|
||||
|
||||
policies.ExtensionSettings =
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
let
|
||||
aliasList = lib.mapCartesianProduct ({ a, b, c }: a + b + c) { a = ["ll" "lt" "l"]; b = ["" "a"]; c = ["" "d" "f"]; };
|
||||
eza = "eza --header --group --time-style=long-iso --group-directories-first --sort=name --icons=auto --git --git-repos-no-status --binary ";
|
||||
convertAliasToCmd = str: eza + (builtins.replaceStrings ["ll" "lt" "l" "a" "d" "f"] ["--long " "--tree " "--oneline --dereference " "--all " "--only-dirs " "--only-files "] str);
|
||||
convertAliasToCmd = str: eza + (lib.replaceStrings ["ll" "lt" "l" "a" "d" "f"] ["--long " "--tree " "--oneline --dereference " "--all " "--only-dirs " "--only-files "] str);
|
||||
in
|
||||
(lib.genAttrs aliasList convertAliasToCmd) // { ls = "l"; };
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ in
|
|||
};
|
||||
secrets = lib.mkOption {
|
||||
type = lib.types.anything;
|
||||
default = absoluteSecretsPath |> builtins.readFile |> builtins.fromJSON;
|
||||
default = absoluteSecretsPath |> lib.readFile |> lib.strings.fromJSON;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -33,12 +33,12 @@ in
|
|||
|> lib.concatLists
|
||||
|> lib.concatMap (
|
||||
entry:
|
||||
map (domain: {
|
||||
lib.map (domain: {
|
||||
file = entry.file;
|
||||
inherit domain;
|
||||
}) entry.value
|
||||
)
|
||||
|> lib.groupBy (entry: toString entry.domain)
|
||||
|> lib.groupBy (entry: builtins.toString entry.domain)
|
||||
|> lib.filterAttrs (domain: entries: lib.length entries > 1);
|
||||
|
||||
errorMessage =
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ in
|
|||
options.meta.ports.list.definitionsWithLocations
|
||||
|> lib.concatMap (
|
||||
entry:
|
||||
map (port: {
|
||||
lib.map (port: {
|
||||
inherit (entry) file;
|
||||
inherit port;
|
||||
}) entry.value
|
||||
)
|
||||
|> lib.groupBy (entry: toString entry.port)
|
||||
|> lib.groupBy (entry: builtins.toString entry.port)
|
||||
|> lib.filterAttrs (port: entries: lib.length entries > 1);
|
||||
|
||||
errorMessage =
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ let
|
|||
logFormat = "output file ${config.services.caddy.logDir}/access-${domain}.log { mode 640 }";
|
||||
extraConfig = ''
|
||||
${lib.optionalString (isTailscaleDomain domain) "bind tailscale/${getSubdomain domain}"}
|
||||
reverse_proxy localhost:${toString port}
|
||||
reverse_proxy localhost:${builtins.toString port}
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -52,8 +52,8 @@ in
|
|||
package = inputs.crowdsec.packages.${pkgs.system}.crowdsec;
|
||||
enrollKeyFile = config.sops.secrets."crowdsec/enrollment-key".path;
|
||||
settings = {
|
||||
api.server.listen_uri = "127.0.0.1:${toString cfg.apiPort}";
|
||||
cscli.prometheus_uri = "http://127.0.0.1:${toString cfg.prometheusPort}";
|
||||
api.server.listen_uri = "127.0.0.1:${builtins.toString cfg.apiPort}";
|
||||
cscli.prometheus_uri = "http://127.0.0.1:${builtins.toString cfg.prometheusPort}";
|
||||
};
|
||||
|
||||
allowLocalJournalAccess = true;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ in
|
|||
package = inputs.crowdsec.packages.${pkgs.system}.crowdsec-firewall-bouncer;
|
||||
settings = {
|
||||
api_key = "cs-firewall-bouncer";
|
||||
api_url = "http://127.0.0.1:${toString cfg.apiPort}";
|
||||
api_url = "http://127.0.0.1:${builtins.toString cfg.apiPort}";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ in
|
|||
database.SQLITE_JOURNAL_MODE = "WAL";
|
||||
cache = {
|
||||
ADAPTER = "twoqueue";
|
||||
HOST = builtins.toJSON {
|
||||
HOST = lib.strings.toJSON {
|
||||
size = 100;
|
||||
recent_ratio = 0.25;
|
||||
ghost_ratio = 0.5;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ in
|
|||
|
||||
services.static-web-server = {
|
||||
enable = true;
|
||||
listen = "[::]:${toString cfg.port}";
|
||||
listen = "[::]:${builtins.toString cfg.port}";
|
||||
root = "${pkgs.it-tools}/lib";
|
||||
configuration.general.health = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ in
|
|||
enable = true;
|
||||
settings = {
|
||||
base-url = "https://${cfg.domain}";
|
||||
listen-http = ":${toString cfg.port}";
|
||||
listen-http = ":${builtins.toString cfg.port}";
|
||||
behind-proxy = true;
|
||||
web-root = "disable";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ in
|
|||
group = lib.mkIf (!cfg.isServer) "users";
|
||||
dataDir = lib.mkIf (!cfg.isServer) "/home/seb";
|
||||
|
||||
guiAddress = lib.mkIf cfg.isServer "127.0.0.1:${toString cfg.gui.port}";
|
||||
guiAddress = lib.mkIf cfg.isServer "127.0.0.1:${builtins.toString cfg.gui.port}";
|
||||
|
||||
cert = lib.mkIf useStaticTls config.sops.secrets."syncthing/cert".path;
|
||||
key = lib.mkIf useStaticTls config.sops.secrets."syncthing/key".path;
|
||||
|
|
@ -81,7 +81,7 @@ in
|
|||
|> lib.mapAttrs (
|
||||
name: value: {
|
||||
id = value.config.custom.services.syncthing.deviceId;
|
||||
addresses = [ "tcp://${name}.${tailscaleCfg.domain}:${toString cfg.syncPort}" ];
|
||||
addresses = [ "tcp://${name}.${tailscaleCfg.domain}:${builtins.toString cfg.syncPort}" ];
|
||||
}
|
||||
);
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ in
|
|||
];
|
||||
|
||||
options = {
|
||||
listenAddress = "tcp://0.0.0.0:${toString cfg.syncPort}";
|
||||
listenAddress = "tcp://0.0.0.0:${builtins.toString cfg.syncPort}";
|
||||
globalAnnounceEnabled = false;
|
||||
localAnnounceEnabled = false;
|
||||
relaysEnabled = false;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ in
|
|||
};
|
||||
secrets = lib.mkOption {
|
||||
type = lib.types.anything;
|
||||
default = absoluteSecretsPath |> builtins.readFile |> builtins.fromJSON;
|
||||
default = absoluteSecretsPath |> lib.readFile |> lib.strings.fromJSON;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue