treewide: replace builtins with lib
This commit is contained in:
parent
cebe5df3d0
commit
ae8f0f2433
11 changed files with 27 additions and 29 deletions
|
@ -127,7 +127,7 @@ in {
|
||||||
|
|
||||||
# naive but works(tm)
|
# naive but works(tm)
|
||||||
# "http://127.0.0.1:1234/" -> "127.0.0.1 1234"
|
# "http://127.0.0.1:1234/" -> "127.0.0.1 1234"
|
||||||
proxy = builtins.replaceStrings ["http://" ":" "/"] ["" " " ""] cfg.proxy.httpProxy;
|
proxy = lib.replaceStrings ["http://" ":" "/"] ["" " " ""] cfg.proxy.httpProxy;
|
||||||
in
|
in
|
||||||
lib.concatMapStrings (x: ''
|
lib.concatMapStrings (x: ''
|
||||||
${networksetup} -setwebproxystate "${x}" on
|
${networksetup} -setwebproxystate "${x}" on
|
||||||
|
|
|
@ -36,7 +36,7 @@ in {
|
||||||
### launchd service
|
### launchd service
|
||||||
# TODO: not run as root user
|
# TODO: not run as root user
|
||||||
launchd.daemons."mihomo" = {
|
launchd.daemons."mihomo" = {
|
||||||
command = builtins.concatStringsSep " " [
|
command = lib.concatStringsSep " " [
|
||||||
(lib.getExe cfg.package)
|
(lib.getExe cfg.package)
|
||||||
"-d /etc/mihomo"
|
"-d /etc/mihomo"
|
||||||
(lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}")
|
(lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{lib, ...}: {
|
{lib, ...}: {
|
||||||
# Allow unfree applications
|
# Allow unfree applications
|
||||||
nixpkgs.config.allowUnfreePredicate = pkg:
|
nixpkgs.config.allowUnfreePredicate = pkg:
|
||||||
builtins.elem (lib.getName pkg) [
|
lib.elem (lib.getName pkg) [
|
||||||
"keka"
|
"keka"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
# workspace binds
|
# workspace binds
|
||||||
builtins.listToAttrs (builtins.concatMap (x: [
|
lib.listToAttrs (lib.concatMap (x: [
|
||||||
{
|
{
|
||||||
name = "${modifier}+${x}";
|
name = "${modifier}+${x}";
|
||||||
value = "workspace ${x}";
|
value = "workspace ${x}";
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
name = "${modifier}+Shift+${x}";
|
name = "${modifier}+Shift+${x}";
|
||||||
value = "move container to workspace ${x}";
|
value = "move container to workspace ${x}";
|
||||||
}
|
}
|
||||||
]) (builtins.genList (x: toString (x + 1)) 9));
|
]) (lib.genList (x: toString (x + 1)) 9));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
allowNonSource = false;
|
allowNonSource = false;
|
||||||
allowNonSourcePredicate = pkg:
|
allowNonSourcePredicate = pkg:
|
||||||
builtins.elem (lib.getName pkg) [
|
lib.elem (lib.getName pkg) [
|
||||||
"adoptopenjdk-hotspot-bin"
|
"adoptopenjdk-hotspot-bin"
|
||||||
"cargo-bootstrap"
|
"cargo-bootstrap"
|
||||||
"cef-binary"
|
"cef-binary"
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
allowUnfree = false;
|
allowUnfree = false;
|
||||||
allowUnfreePredicate = pkg:
|
allowUnfreePredicate = pkg:
|
||||||
builtins.elem (lib.getName pkg) [
|
lib.elem (lib.getName pkg) [
|
||||||
"fcitx5-pinyin-minecraft"
|
"fcitx5-pinyin-minecraft"
|
||||||
"fcitx5-pinyin-moegirl"
|
"fcitx5-pinyin-moegirl"
|
||||||
"libXNVCtrl"
|
"libXNVCtrl"
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
allowNonSource = false;
|
allowNonSource = false;
|
||||||
allowNonSourcePredicate = pkg:
|
allowNonSourcePredicate = pkg:
|
||||||
builtins.elem (lib.getName pkg) [
|
lib.elem (lib.getName pkg) [
|
||||||
"adoptopenjdk-hotspot-bin"
|
"adoptopenjdk-hotspot-bin"
|
||||||
"cargo-bootstrap"
|
"cargo-bootstrap"
|
||||||
"minecraft-server"
|
"minecraft-server"
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
allowUnfree = false;
|
allowUnfree = false;
|
||||||
allowUnfreePredicate = pkg:
|
allowUnfreePredicate = pkg:
|
||||||
builtins.elem (lib.getName pkg) [
|
lib.elem (lib.getName pkg) [
|
||||||
"broadcom-sta"
|
"broadcom-sta"
|
||||||
"minecraft-server"
|
"minecraft-server"
|
||||||
];
|
];
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
######## Secrets
|
######## Secrets
|
||||||
sops = {
|
sops = {
|
||||||
secrets = builtins.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
|
secrets = lib.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
|
||||||
"synapse/secret" = {
|
"synapse/secret" = {
|
||||||
restartUnits = ["matrix-synapse.service"];
|
restartUnits = ["matrix-synapse.service"];
|
||||||
owner = config.systemd.services.matrix-synapse.serviceConfig.User;
|
owner = config.systemd.services.matrix-synapse.serviceConfig.User;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
nixpkgs.config = {
|
nixpkgs.config = {
|
||||||
allowNonSource = false;
|
allowNonSource = false;
|
||||||
allowNonSourcePredicate = pkg:
|
allowNonSourcePredicate = pkg:
|
||||||
builtins.elem (lib.getName pkg) [
|
lib.elem (lib.getName pkg) [
|
||||||
"adoptopenjdk-hotspot-bin"
|
"adoptopenjdk-hotspot-bin"
|
||||||
"cargo-bootstrap"
|
"cargo-bootstrap"
|
||||||
"rustc-bootstrap"
|
"rustc-bootstrap"
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
allowUnfree = false;
|
allowUnfree = false;
|
||||||
allowUnfreePredicate = pkg:
|
allowUnfreePredicate = pkg:
|
||||||
builtins.elem (lib.getName pkg) [
|
lib.elem (lib.getName pkg) [
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,7 @@
|
||||||
boot.kernelPackages = pkgs.linuxPackages;
|
boot.kernelPackages = pkgs.linuxPackages;
|
||||||
|
|
||||||
### Secrets
|
### Secrets
|
||||||
sops = {
|
sops.secrets = lib.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
|
||||||
secrets = builtins.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
|
|
||||||
"hysteria/auth" = {
|
"hysteria/auth" = {
|
||||||
restartUnits = ["hysteria.service"];
|
restartUnits = ["hysteria.service"];
|
||||||
};
|
};
|
||||||
|
@ -46,7 +45,6 @@
|
||||||
restartUnits = ["miniflux.service"];
|
restartUnits = ["miniflux.service"];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
### Services
|
### Services
|
||||||
networking.firewall.allowedUDPPorts = [443]; # hysteria
|
networking.firewall.allowedUDPPorts = [443]; # hysteria
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
### sops-nix
|
### sops-nix
|
||||||
sops.secrets = builtins.mapAttrs (_name: value:
|
sops.secrets = lib.mapAttrs (_name: value:
|
||||||
value
|
value
|
||||||
// {
|
// {
|
||||||
restartUnits = ["mihomo.service"];
|
restartUnits = ["mihomo.service"];
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
sops.templates."clash.yaml".file = let
|
sops.templates."clash.yaml".file = let
|
||||||
convert = url: "https://sub.maoxiongnet.com/sub?target=clash&list=true&url=${url}";
|
convert = url: "https://sub.maoxiongnet.com/sub?target=clash&list=true&url=${url}";
|
||||||
substituteV2 = {src, ...} @ args: let
|
substituteV2 = {src, ...} @ args: let
|
||||||
args' = builtins.removeAttrs args ["src"];
|
args' = lib.removeAttrs args ["src"];
|
||||||
in
|
in
|
||||||
pkgs.substitute {
|
pkgs.substitute {
|
||||||
inherit src;
|
inherit src;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{lib, ...}: {
|
{lib, ...}: {
|
||||||
sops.secrets = builtins.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
|
sops.secrets = lib.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
|
||||||
"wireless/wangxiaobo".path = "/var/lib/iwd/wangxiaobo.psk";
|
"wireless/wangxiaobo".path = "/var/lib/iwd/wangxiaobo.psk";
|
||||||
"wireless/ImmortalWrt".path = "/var/lib/iwd/ImmortalWrt.psk";
|
"wireless/ImmortalWrt".path = "/var/lib/iwd/ImmortalWrt.psk";
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue