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)
|
||||
# "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
|
||||
lib.concatMapStrings (x: ''
|
||||
${networksetup} -setwebproxystate "${x}" on
|
||||
|
|
|
@ -36,7 +36,7 @@ in {
|
|||
### launchd service
|
||||
# TODO: not run as root user
|
||||
launchd.daemons."mihomo" = {
|
||||
command = builtins.concatStringsSep " " [
|
||||
command = lib.concatStringsSep " " [
|
||||
(lib.getExe cfg.package)
|
||||
"-d /etc/mihomo"
|
||||
(lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}")
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{lib, ...}: {
|
||||
# Allow unfree applications
|
||||
nixpkgs.config.allowUnfreePredicate = pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
lib.elem (lib.getName pkg) [
|
||||
"keka"
|
||||
];
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@
|
|||
}
|
||||
//
|
||||
# workspace binds
|
||||
builtins.listToAttrs (builtins.concatMap (x: [
|
||||
lib.listToAttrs (lib.concatMap (x: [
|
||||
{
|
||||
name = "${modifier}+${x}";
|
||||
value = "workspace ${x}";
|
||||
|
@ -138,7 +138,7 @@
|
|||
name = "${modifier}+Shift+${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;
|
||||
allowNonSourcePredicate = pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
lib.elem (lib.getName pkg) [
|
||||
"adoptopenjdk-hotspot-bin"
|
||||
"cargo-bootstrap"
|
||||
"cef-binary"
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
allowUnfree = false;
|
||||
allowUnfreePredicate = pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
lib.elem (lib.getName pkg) [
|
||||
"fcitx5-pinyin-minecraft"
|
||||
"fcitx5-pinyin-moegirl"
|
||||
"libXNVCtrl"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
allowNonSource = false;
|
||||
allowNonSourcePredicate = pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
lib.elem (lib.getName pkg) [
|
||||
"adoptopenjdk-hotspot-bin"
|
||||
"cargo-bootstrap"
|
||||
"minecraft-server"
|
||||
|
@ -17,7 +17,7 @@
|
|||
|
||||
allowUnfree = false;
|
||||
allowUnfreePredicate = pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
lib.elem (lib.getName pkg) [
|
||||
"broadcom-sta"
|
||||
"minecraft-server"
|
||||
];
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
######## Secrets
|
||||
sops = {
|
||||
secrets = builtins.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
|
||||
secrets = lib.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
|
||||
"synapse/secret" = {
|
||||
restartUnits = ["matrix-synapse.service"];
|
||||
owner = config.systemd.services.matrix-synapse.serviceConfig.User;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
nixpkgs.config = {
|
||||
allowNonSource = false;
|
||||
allowNonSourcePredicate = pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
lib.elem (lib.getName pkg) [
|
||||
"adoptopenjdk-hotspot-bin"
|
||||
"cargo-bootstrap"
|
||||
"rustc-bootstrap"
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
allowUnfree = false;
|
||||
allowUnfreePredicate = pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
lib.elem (lib.getName pkg) [
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -31,20 +31,18 @@
|
|||
boot.kernelPackages = pkgs.linuxPackages;
|
||||
|
||||
### Secrets
|
||||
sops = {
|
||||
secrets = builtins.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
|
||||
"hysteria/auth" = {
|
||||
restartUnits = ["hysteria.service"];
|
||||
};
|
||||
"pixivfe/environment" = {
|
||||
restartUnits = ["pixivfe.service"];
|
||||
};
|
||||
"searx/environment" = {
|
||||
restartUnits = ["searx.service"];
|
||||
};
|
||||
"miniflux/environment" = {
|
||||
restartUnits = ["miniflux.service"];
|
||||
};
|
||||
sops.secrets = lib.mapAttrs (_name: value: value // {sopsFile = ./secrets.yaml;}) {
|
||||
"hysteria/auth" = {
|
||||
restartUnits = ["hysteria.service"];
|
||||
};
|
||||
"pixivfe/environment" = {
|
||||
restartUnits = ["pixivfe.service"];
|
||||
};
|
||||
"searx/environment" = {
|
||||
restartUnits = ["searx.service"];
|
||||
};
|
||||
"miniflux/environment" = {
|
||||
restartUnits = ["miniflux.service"];
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
};
|
||||
|
||||
### sops-nix
|
||||
sops.secrets = builtins.mapAttrs (_name: value:
|
||||
sops.secrets = lib.mapAttrs (_name: value:
|
||||
value
|
||||
// {
|
||||
restartUnits = ["mihomo.service"];
|
||||
|
@ -42,7 +42,7 @@
|
|||
sops.templates."clash.yaml".file = let
|
||||
convert = url: "https://sub.maoxiongnet.com/sub?target=clash&list=true&url=${url}";
|
||||
substituteV2 = {src, ...} @ args: let
|
||||
args' = builtins.removeAttrs args ["src"];
|
||||
args' = lib.removeAttrs args ["src"];
|
||||
in
|
||||
pkgs.substitute {
|
||||
inherit src;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{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/ImmortalWrt".path = "/var/lib/iwd/ImmortalWrt.psk";
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue