1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat: convert inputs to flakes

This commit is contained in:
2023-02-23 16:53:53 +01:00
parent b98ac4ebce
commit c51db2b53c
12 changed files with 217 additions and 140 deletions

View File

@@ -265,7 +265,7 @@ in {
./sudo.nix ./sudo.nix
./themes.nix ./themes.nix
./tmux.nix ./tmux.nix
# ./traadfri.nix ./traadfri.nix
./unclutter.nix ./unclutter.nix
./vscode.nix ./vscode.nix
./watson.nix ./watson.nix

View File

@@ -60,8 +60,6 @@
' $out/astrolog/astrolog.as ' $out/astrolog/astrolog.as
''; '';
}); });
recht = pkgs.callPackage inputs.recht.outPath {};
in { in {
home-manager.users.me.home.file = { home-manager.users.me.home.file = {
".csl".source = cslDirectory; ".csl".source = cslDirectory;
@@ -168,7 +166,6 @@ in {
scripts.betacode # ancient greek betacode to unicode converter scripts.betacode # ancient greek betacode to unicode converter
scripts.meteo scripts.meteo
scripts.mahlzeit scripts.mahlzeit
recht
scripts.vimv scripts.vimv
scripts.swallow # window swallowing scripts.swallow # window swallowing
scripts.literature-quote scripts.literature-quote
@@ -190,7 +187,6 @@ in {
scripts.mpv-radio scripts.mpv-radio
# kmein.slide # kmein.slide
termdown termdown
scripts.alarm
scripts.tolino-screensaver scripts.tolino-screensaver
scripts.rfc scripts.rfc
scripts.tag scripts.tag
@@ -203,7 +199,8 @@ in {
par par
qrencode qrencode
inputs.menstruation-backend inputs.menstruation-backend.defaultPackage.x86_64-linux
inputs.recht.defaultPackage.x86_64-linux
(pkgs.writers.writeDashBin "worldradio" '' (pkgs.writers.writeDashBin "worldradio" ''
shuf ${worldradio} | ${pkgs.findutils}/bin/xargs ${pkgs.mpv}/bin/mpv --no-video shuf ${worldradio} | ${pkgs.findutils}/bin/xargs ${pkgs.mpv}/bin/mpv --no-video
@@ -216,6 +213,23 @@ in {
(pkgs.writers.writeDashBin "ncmpcpp-zaatar" ''MPD_HOST=${(import ../lib/local-network.nix).zaatar} exec ${pkgs.ncmpcpp}/bin/ncmpcpp "$@"'') (pkgs.writers.writeDashBin "ncmpcpp-zaatar" ''MPD_HOST=${(import ../lib/local-network.nix).zaatar} exec ${pkgs.ncmpcpp}/bin/ncmpcpp "$@"'')
(pkgs.writers.writeDashBin "mpc-zaatar" ''MPD_HOST=${(import ../lib/local-network.nix).zaatar} exec ${pkgs.mpc_cli}/bin/mpc "$@"'') (pkgs.writers.writeDashBin "mpc-zaatar" ''MPD_HOST=${(import ../lib/local-network.nix).zaatar} exec ${pkgs.mpc_cli}/bin/mpc "$@"'')
(pkgs.writers.writeDashBin "alarm" ''
set -efu
export PATH=${lib.makeBinPath [pkgs.coreutils pkgs.bc inputs.scripts.packages.x86_64-linux.rusty-jeep]}
for i in `seq 8000 1000 10000`; do
echo $i 100
done | rusty-jeep
echo 'if you heard that sound, then goto sleep..^_^'
echo sleep "$@"
sleep "$@"
echo 'wake up!'
while :; do
echo $(echo "($(od -tu -An -N 2 /dev/urandom)%1000)+500"|bc) $(echo "($(od -tu -An -N 2 /dev/urandom)%500)+100"|bc)
done | rusty-jeep 1
'')
spotify spotify
ncspot ncspot
playerctl playerctl

View File

@@ -1,12 +1,13 @@
{ {
config,
pkgs, pkgs,
lib, lib,
... ...
}: let }: let
inherit (import <niveum/lib>) localAddresses; inherit (import ../lib) localAddresses;
living-room-id = 131090; living-room-id = 131090;
in { in {
imports = [<niveum/modules/traadfri.nix>]; imports = [../modules/traadfri.nix];
environment.systemPackages = [ environment.systemPackages = [
(pkgs.writers.writeDashBin "traadfri-party" '' (pkgs.writers.writeDashBin "traadfri-party" ''
@@ -20,11 +21,13 @@ in {
'') '')
]; ];
age.secrets.traadfri-key.file = ../secrets/traadfri-key.age;
niveum.traadfri = { niveum.traadfri = {
enable = true; enable = true;
user = "kmein"; user = "kmein";
host = localAddresses.tradfri; host = localAddresses.tradfri;
key = lib.strings.fileContents <secrets/traadfri.key>; keyFile = config.age.secrets.traadfri-key.path;
rooms = { rooms = {
corridor = 131080; corridor = 131080;
kitchen = 131081; kitchen = 131081;

206
flake.lock generated
View File

@@ -21,6 +21,22 @@
"type": "github" "type": "github"
} }
}, },
"blessings": {
"flake": false,
"locked": {
"lastModified": 1549397368,
"narHash": "sha256-YVIGRG+/ey4nFEZl1ZPHj7Hx/Of3rsUGnkLK4V4zZd0=",
"ref": "refs/heads/master",
"rev": "d94712a015636efe7ec79bc0a2eec6739d0be779",
"revCount": 18,
"type": "git",
"url": "https://cgit.krebsco.de/blessings"
},
"original": {
"type": "git",
"url": "https://cgit.krebsco.de/blessings"
}
},
"darwin": { "darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -133,6 +149,51 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils_7": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_8": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_9": {
"locked": {
"lastModified": 1676283394,
"narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -181,8 +242,6 @@
"menstruation-backend": { "menstruation-backend": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
"menstruation-backend",
"rust-overlay",
"flake-utils" "flake-utils"
], ],
"nixpkgs": [ "nixpkgs": [
@@ -256,7 +315,9 @@
}, },
"nixinate": { "nixinate": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_4" "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1671116920, "lastModified": 1671116920,
@@ -321,22 +382,6 @@
} }
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": {
"lastModified": 1653060744,
"narHash": "sha256-kfRusllRumpt33J1hPV+CeCCylCXEU7e0gn2/cIM7cY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "dfd82985c273aac6eced03625f454b334daae2e8",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": { "locked": {
"lastModified": 1676895851, "lastModified": 1676895851,
"narHash": "sha256-xdhBKw2el790G+88tZYpRWlP9VjQC9OLR5Jx84VPe08=", "narHash": "sha256-xdhBKw2el790G+88tZYpRWlP9VjQC9OLR5Jx84VPe08=",
@@ -352,7 +397,38 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_5": {
"locked": {
"lastModified": 1677158633,
"narHash": "sha256-t7za78oRkDIjdFQF0PCilfCziFyhfowCgs9Ry+sEvE4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "129b6f78121802d18d215c9f9e04d7971c58ea0c",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_6": { "nixpkgs_6": {
"locked": {
"lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_7": {
"locked": { "locked": {
"lastModified": 1659446231, "lastModified": 1659446231,
"narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=", "narHash": "sha256-hekabNdTdgR/iLsgce5TGWmfIDZ86qjPhxDg/8TlzhE=",
@@ -368,7 +444,7 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_7": { "nixpkgs_8": {
"locked": { "locked": {
"lastModified": 1665296151, "lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
@@ -384,6 +460,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_9": {
"locked": {
"lastModified": 1669418739,
"narHash": "sha256-T86oFvcUIRwHWBWUt7WjaP4BP/3lDGbv5AppQSI1FkI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "695b3515251873e0a7e2021add4bba643c56cde3",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "695b3515251873e0a7e2021add4bba643c56cde3",
"type": "github"
}
},
"nur": { "nur": {
"locked": { "locked": {
"lastModified": 1677062856, "lastModified": 1677062856,
@@ -400,13 +492,17 @@
} }
}, },
"recht": { "recht": {
"flake": false, "inputs": {
"blessings": "blessings",
"flake-utils": "flake-utils_5",
"nixpkgs": "nixpkgs_5"
},
"locked": { "locked": {
"lastModified": 1677161248, "lastModified": 1677165419,
"narHash": "sha256-/yEG92y5ukwjoGrw++VEnis8Qw/tW/CkcE+mA8ufjGM=", "narHash": "sha256-pjYpXg+09rayon6uhSNd30ryrT2zYLOlDLBHQ9pnGZg=",
"owner": "kmein", "owner": "kmein",
"repo": "recht", "repo": "recht",
"rev": "a8a2f2a2c244ef052f54cc45149895a591da3231", "rev": "5fa158ce21de797bd95a934dab8d4403b7531d20",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -439,7 +535,7 @@
"menstruation-backend": "menstruation-backend", "menstruation-backend": "menstruation-backend",
"menstruation-telegram": "menstruation-telegram", "menstruation-telegram": "menstruation-telegram",
"nixinate": "nixinate", "nixinate": "nixinate",
"nixpkgs": "nixpkgs_5", "nixpkgs": "nixpkgs_4",
"nur": "nur", "nur": "nur",
"recht": "recht", "recht": "recht",
"retiolum": "retiolum", "retiolum": "retiolum",
@@ -490,7 +586,26 @@
"rust-overlay_3": { "rust-overlay_3": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_6", "flake-utils": "flake-utils_6",
"nixpkgs": "nixpkgs_7" "nixpkgs": "nixpkgs_6"
},
"locked": {
"lastModified": 1677119371,
"narHash": "sha256-L0Da4eKzDZrsy8ysOS1lhgDjAgEqGvYGf/lXaRd5/YQ=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "c67c79ea25664d66e74ae91a6fa0d6c65d12d3a7",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_4": {
"inputs": {
"flake-utils": "flake-utils_8",
"nixpkgs": "nixpkgs_8"
}, },
"locked": { "locked": {
"lastModified": 1677119371, "lastModified": 1677119371,
@@ -507,13 +622,25 @@
} }
}, },
"scripts": { "scripts": {
"flake": false, "inputs": {
"flake-utils": [
"scripts",
"rust-overlay",
"flake-utils"
],
"nixpkgs": [
"scripts",
"rust-overlay",
"nixpkgs"
],
"rust-overlay": "rust-overlay_3"
},
"locked": { "locked": {
"lastModified": 1675238486, "lastModified": 1677166498,
"narHash": "sha256-Hs9NKK0UFaNqrui2VauBnMnV/14U3eNWaI12EmVYXWY=", "narHash": "sha256-az31wr2tF98+2l3SgCrIy0AcoJdN+qkTCHe2vMmBWnk=",
"owner": "kmein", "owner": "kmein",
"repo": "scripts", "repo": "scripts",
"rev": "5cefa5f112e7fe54e0302b7bc33bc06e1f762002", "rev": "bdc2ccb7081f5b09dedccba4f8875cc1b938ef04",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -524,8 +651,8 @@
}, },
"telebots": { "telebots": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_5", "flake-utils": "flake-utils_7",
"nixpkgs": "nixpkgs_6" "nixpkgs": "nixpkgs_7"
}, },
"locked": { "locked": {
"lastModified": 1677156381, "lastModified": 1677156381,
@@ -544,14 +671,12 @@
"tinc-graph": { "tinc-graph": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
"tinc-graph",
"rust-overlay",
"flake-utils" "flake-utils"
], ],
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"rust-overlay": "rust-overlay_3" "rust-overlay": "rust-overlay_4"
}, },
"locked": { "locked": {
"lastModified": 1677154877, "lastModified": 1677154877,
@@ -568,13 +693,16 @@
} }
}, },
"traadfri": { "traadfri": {
"flake": false, "inputs": {
"flake-utils": "flake-utils_9",
"nixpkgs": "nixpkgs_9"
},
"locked": { "locked": {
"lastModified": 1640451803, "lastModified": 1677165914,
"narHash": "sha256-zS/b93uFpPM9basNP7ngmm+YjYV0IUQAmNghetHA6Ss=", "narHash": "sha256-3N08NabgDwTUy1n5wxpT27iddFrgXW35E1x2UgAKkDQ=",
"owner": "kmein", "owner": "kmein",
"repo": "traadfri", "repo": "traadfri",
"rev": "cf46bd09cd3263b90a09b0ca979aa705a4c3671c", "rev": "11571116ed5d2c6478c615d663d1f96f57a97ba9",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -12,9 +12,11 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
recht.url = "github:kmein/recht"; recht.url = "github:kmein/recht";
scripts.url = "github:kmein/scripts";
retiolum.url = "git+https://git.thalheim.io/Mic92/retiolum"; retiolum.url = "git+https://git.thalheim.io/Mic92/retiolum";
telebots.url = "github:kmein/telebots"; telebots.url = "github:kmein/telebots";
tinc-graph.url = "github:kmein/tinc-graph"; tinc-graph.url = "github:kmein/tinc-graph";
traadfri.url = "github:kmein/traadfri";
agenix.inputs.nixpkgs.follows = "nixpkgs"; agenix.inputs.nixpkgs.follows = "nixpkgs";
home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
@@ -22,24 +24,9 @@
krops.inputs.nixpkgs.follows = "nixpkgs"; krops.inputs.nixpkgs.follows = "nixpkgs";
menstruation-backend.inputs.flake-utils.follows = "flake-utils"; menstruation-backend.inputs.flake-utils.follows = "flake-utils";
menstruation-backend.inputs.nixpkgs.follows = "nixpkgs"; menstruation-backend.inputs.nixpkgs.follows = "nixpkgs";
menstruation-telegram.inputs.flake-utils.follows = "flake-utils";
menstruation-telegram.inputs.nixpkgs.follows = "nixpkgs";
nixinate.inputs.nixpkgs.follows = "nixpkgs"; nixinate.inputs.nixpkgs.follows = "nixpkgs";
recht.inputs.flake-utils.follows = "flake-utils";
recht.inputs.nixpkgs.follows = "nixpkgs";
retiolum.inputs.nixpkgs.follows = "nixpkgs";
tinc-graph.inputs.flake-utils.follows = "flake-utils"; tinc-graph.inputs.flake-utils.follows = "flake-utils";
tinc-graph.inputs.nixpkgs.follows = "nixpkgs"; tinc-graph.inputs.nixpkgs.follows = "nixpkgs";
# legacy
scripts = {
url = "github:kmein/scripts";
flake = false;
};
traadfri = {
url = "github:kmein/traadfri";
flake = false;
};
}; };
outputs = inputs @ { outputs = inputs @ {

View File

@@ -2,19 +2,17 @@
pkgs, pkgs,
lib, lib,
config, config,
inputs,
... ...
}: }:
with lib; let with lib; let
cfg = config.niveum.traadfri; cfg = config.niveum.traadfri;
traadfri = pkgs.callPackage <traadfri> {
libcoap = pkgs.callPackage <niveum/packages/libcoap.nix> {tls = true;};
};
in { in {
options.niveum.traadfri = { options.niveum.traadfri = {
enable = mkEnableOption "Trådfri CLI"; enable = mkEnableOption "Trådfri CLI";
user = mkOption {type = types.str;}; user = mkOption {type = types.str;};
host = mkOption {type = types.str;}; host = mkOption {type = types.str;};
key = mkOption {type = types.str;}; keyFile = mkOption {type = types.path;};
rooms = mkOption { rooms = mkOption {
type = types.attrsOf types.int; type = types.attrsOf types.int;
default = {}; default = {};
@@ -29,10 +27,10 @@ in {
environment.systemPackages = environment.systemPackages =
[ [
(pkgs.writers.writeDashBin "traadfri" '' (pkgs.writers.writeDashBin "traadfri" ''
TRAADFRI_USER="${cfg.user}" \ export TRAADFRI_USER="${cfg.user}"
TRAADFRI_KEY="${cfg.key}" \ export TRAADFRI_KEY="$(cat ${lib.escapeShellArg cfg.keyFile})"
TRAADFRI_HUB="${cfg.host}" \ export TRAADFRI_HUB="${cfg.host}"
${traadfri}/bin/traadfri $@ ${inputs.traadfri.defaultPackage.x86_64-linux}/bin/traadfri $@
'') '')
] ]
++ lib.mapAttrsToList (name: value: ++ lib.mapAttrsToList (name: value:

View File

@@ -1,31 +0,0 @@
{
lib,
fetchFromGitHub,
rustPlatform,
pkg-config,
alsa-lib,
}:
rustPlatform.buildRustPackage {
pname = "rusty-jeep";
version = "1.0.0";
src = let
repo = fetchFromGitHub {
owner = "kmein";
repo = "scripts";
rev = "c8e80b34c08e427f83b6af19a361e8c0711a4e6c";
sha256 = "18jlf9zkhni4jsvzrlkkllqvv5dkhjmilggcchbs32hr1km51q84";
};
in "${repo}/rusty-jeep";
nativeBuildInputs = [pkg-config];
buildInputs = [alsa-lib];
cargoHash = "sha256-8qbYTqRk+4InJNX6xK95VxISamDb5KID+wbmUDJYJ94=";
meta = with lib; {
description = "A beeping program inspired by K_belwagen";
license = licenses.wtfpl;
maintainers = [maintainers.kmein];
};
}

View File

@@ -34,25 +34,6 @@ in
name = "instaget"; name = "instaget";
}; };
alarm = let
rusty-jeep = pkgs.callPackage ../rusty-jeep.nix {};
in
pkgs.writers.writeDashBin "alarm" ''
export PATH=${lib.makeBinPath [pkgs.coreutils pkgs.bc rusty-jeep]}
for i in `seq 8000 1000 10000`; do
echo $i 100
done | rusty-jeep
echo 'if you heard that sound, then goto sleep..^_^'
echo sleep "$@"
sleep "$@"
echo 'wake up!'
while :; do
echo $(echo "($(od -tu -An -N 2 /dev/urandom)%1000)+500"|bc) $(echo "($(od -tu -An -N 2 /dev/urandom)%500)+100"|bc)
done | rusty-jeep 1
'';
infschmv = pkgs.writers.writeDashBin "InfSchMV" '' infschmv = pkgs.writers.writeDashBin "InfSchMV" ''
${pkgs.curl}/bin/curl -sSL https://www.berlin.de/corona/massnahmen/verordnung/ \ ${pkgs.curl}/bin/curl -sSL https://www.berlin.de/corona/massnahmen/verordnung/ \
| ${pkgs.pup}/bin/pup .textile \ | ${pkgs.pup}/bin/pup .textile \

Submodule secrets updated: c7d15a9174...32212338c0

View File

@@ -41,13 +41,13 @@ in {
}; };
passwordFile = config.age.secrets.restic.path; passwordFile = config.age.secrets.restic.path;
paths = [ paths = [
"/var/lib/codimd"
config.services.postgresqlBackup.location config.services.postgresqlBackup.location
config.services.nextcloud.home
config.services.grafana.dataDir
config.services.gitea.stateDir
config.services.weechat.root
"/var/lib/weechat" "/var/lib/weechat"
"/var/lib/nextcloud" "/var/lib/codimd"
"/var/lib/grafana"
"/var/lib/gitea"
"/var/lib/redis"
]; ];
}; };

View File

@@ -5,8 +5,6 @@
... ...
}: let }: let
port = 5703; port = 5703;
onomap-src = inputs.scripts.outPath + "/onomastics-ng";
onomap = pkgs.haskellPackages.callCabal2nix "onomap" onomap-src {};
in { in {
systemd.services.names = { systemd.services.names = {
wants = ["network-online.target"]; wants = ["network-online.target"];
@@ -14,7 +12,7 @@ in {
description = "Better clone of geogen.stoepel.net"; description = "Better clone of geogen.stoepel.net";
serviceConfig = { serviceConfig = {
DynamicUser = true; DynamicUser = true;
ExecStart = "${onomap}/bin/onomap-web"; ExecStart = "${inputs.scripts.packages.x86_64-linux.onomap}/bin/onomap-web";
Restart = "on-failure"; Restart = "on-failure";
RestartSec = "15s"; RestartSec = "15s";
}; };

View File

@@ -10,6 +10,8 @@
urlsFile = pkgs.writeText "urls" (builtins.concatStringsSep "\n---\n" (map builtins.toJSON urls)); urlsFile = pkgs.writeText "urls" (builtins.concatStringsSep "\n---\n" (map builtins.toJSON urls));
tokensFile = config.age.secrets.urlwatch-tokens.path;
urls = [ urls = [
{ {
name = "Corona-Verordnung"; name = "Corona-Verordnung";
@@ -124,7 +126,7 @@
} }
]; ];
configFile = (pkgs.formats.yaml {}).generate "urlwatch.yaml" { configFile = (pkgs.formats.json {}).generate "urlwatch.json" {
display = { display = {
error = true; error = true;
new = true; new = true;
@@ -141,14 +143,12 @@
port = 587; port = 587;
starttls = true; starttls = true;
auth = true; auth = true;
# insecure_password = lib.strings.fileContents <secrets/mail/cock>; TODO how?
}; };
subject = "{count} changes: {jobs}"; subject = "{count} changes: {jobs}";
to = kieran.email; to = kieran.email;
}; };
telegram = { telegram = {
enabled = false; enabled = true;
# bot_token = lib.strings.fileContents <system-secrets/telegram/kmein.token>; TODO how?
chat_id = "-1001504043752"; chat_id = "-1001504043752";
}; };
html.diff = "unified"; html.diff = "unified";
@@ -157,11 +157,6 @@
enabled = true; enabled = true;
}; };
text.footer = false; text.footer = false;
# telegram = {
# enabled = false;
# bot_token = lib.strings.fileContents <system-secrets/telegram/kmein.token>;
# chat_id = [ "18980945" ];
# };
}; };
}; };
urlwatch = pkgs.urlwatch.overrideAttrs (attrs: { urlwatch = pkgs.urlwatch.overrideAttrs (attrs: {
@@ -175,6 +170,8 @@ in {
group = "urlwatch"; group = "urlwatch";
}; };
age.secrets.urlwatch-tokens.file = ../../secrets/urlwatch-tokens.json.age;
users.groups.urlwatch = {}; users.groups.urlwatch = {};
systemd.services.urlwatch = { systemd.services.urlwatch = {
@@ -182,7 +179,9 @@ in {
startAt = "12:00"; startAt = "12:00";
script = '' script = ''
${urlwatch}/bin/urlwatch \ ${urlwatch}/bin/urlwatch \
--config=${lib.escapeShellArg configFile} \ --config=<(
${pkgs.jq}/bin/jq -s '.[0] * .[1]' ${toString configFile} ${toString tokensFile}
) \
--urls=${lib.escapeShellArg urlsFile} --urls=${lib.escapeShellArg urlsFile}
''; '';
serviceConfig = { serviceConfig = {