Merge remote-tracking branch 'ni/master'
This commit is contained in:
commit
0699b41b05
@ -16,7 +16,6 @@ let
|
|||||||
|
|
||||||
api = {
|
api = {
|
||||||
enable = mkEnableOption "krebs.urlwatch";
|
enable = mkEnableOption "krebs.urlwatch";
|
||||||
|
|
||||||
dataDir = mkOption {
|
dataDir = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "/var/lib/urlwatch";
|
default = "/var/lib/urlwatch";
|
||||||
@ -54,6 +53,18 @@ let
|
|||||||
The format is described in systemd.time(7), CALENDAR EVENTS.
|
The format is described in systemd.time(7), CALENDAR EVENTS.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
sendmail.enable = mkEnableOption "krebs.urlwatch.sendmail" // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
telegram = {
|
||||||
|
enable = mkEnableOption "krebs.urlwatch.telegram";
|
||||||
|
botToken = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
};
|
||||||
|
chatId = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
urls = mkOption {
|
urls = mkOption {
|
||||||
type = with types; listOf (either str subtypes.job);
|
type = with types; listOf (either str subtypes.job);
|
||||||
default = [];
|
default = [];
|
||||||
@ -110,6 +121,11 @@ let
|
|||||||
color = true;
|
color = true;
|
||||||
enabled = true;
|
enabled = true;
|
||||||
};
|
};
|
||||||
|
${if cfg.telegram.enable then "telegram" else null} = {
|
||||||
|
enabled = cfg.telegram.enable;
|
||||||
|
bot_token = cfg.telegram.botToken;
|
||||||
|
chat_id = cfg.telegram.chatId;
|
||||||
|
};
|
||||||
text = {
|
text = {
|
||||||
details = true;
|
details = true;
|
||||||
footer = true;
|
footer = true;
|
||||||
@ -158,19 +174,21 @@ let
|
|||||||
--urls=${shell.escape urlsFile} \
|
--urls=${shell.escape urlsFile} \
|
||||||
> changes || :
|
> changes || :
|
||||||
|
|
||||||
if test -s changes; then
|
${optionalString cfg.sendmail.enable /* sh */ ''
|
||||||
{
|
if test -s changes; then
|
||||||
echo Date: $(date -R)
|
{
|
||||||
echo From: ${shell.escape cfg.from}
|
echo Date: $(date -R)
|
||||||
echo Subject: $(
|
echo From: ${shell.escape cfg.from}
|
||||||
sed -n 's/^\(CHANGED\|ERROR\|NEW\): //p' changes \
|
echo Subject: $(
|
||||||
| tr '\n' ' '
|
sed -n 's/^\(CHANGED\|ERROR\|NEW\): //p' changes \
|
||||||
)
|
| tr '\n' ' '
|
||||||
echo To: ${shell.escape cfg.mailto}
|
)
|
||||||
echo
|
echo To: ${shell.escape cfg.mailto}
|
||||||
cat changes
|
echo
|
||||||
} | /run/wrappers/bin/sendmail -t
|
cat changes
|
||||||
fi
|
} | /run/wrappers/bin/sendmail -t
|
||||||
|
fi
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -49,6 +49,13 @@ with import <stockholm/lib>;
|
|||||||
|
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
# XXX reload to work around occasional "Failed to load firmware chunk!"
|
||||||
|
# TODO only do this if firmware is actually broken(?)
|
||||||
|
system.activationScripts.reload-iwlwifi = /* sh */ ''
|
||||||
|
${pkgs.kmod}/bin/modprobe -vr iwlwifi
|
||||||
|
${pkgs.kmod}/bin/modprobe -v iwlwifi
|
||||||
|
'';
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
chromium
|
chromium
|
||||||
firefoxWrapper
|
firefoxWrapper
|
||||||
|
@ -120,6 +120,7 @@ with import <stockholm/lib>;
|
|||||||
|
|
||||||
{
|
{
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
|
pkgs.field
|
||||||
pkgs.get
|
pkgs.get
|
||||||
pkgs.git
|
pkgs.git
|
||||||
pkgs.git-crypt
|
pkgs.git-crypt
|
||||||
|
@ -5,12 +5,6 @@ with import <stockholm/lib>;
|
|||||||
{
|
{
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hostKeys = [
|
|
||||||
{
|
|
||||||
type = "ed25519";
|
|
||||||
path = "/etc/ssh/ssh_host_ed25519_key";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
tv.iptables.input-internet-accept-tcp = singleton "ssh";
|
tv.iptables.input-internet-accept-tcp = singleton "ssh";
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
with import <stockholm/lib>;
|
with import <stockholm/lib>;
|
||||||
{ config, pkgs, ... }: let
|
{ config, pkgs, ... }: let
|
||||||
json = url: {
|
exec = filename: args: url: {
|
||||||
inherit url;
|
inherit url;
|
||||||
filter = "system:${pkgs.jq}/bin/jq .";
|
filter = "system:${
|
||||||
|
concatMapStringsSep " " shell.escape ([filename] ++ toList args)
|
||||||
|
}";
|
||||||
};
|
};
|
||||||
|
json = json' ["."];
|
||||||
|
json' = exec "${pkgs.jq}/bin/jq";
|
||||||
|
xml = xml' ["--format" "-"];
|
||||||
|
xml' = exec "${pkgs.libxml2}/bin/xmllint";
|
||||||
in {
|
in {
|
||||||
krebs.urlwatch = {
|
krebs.urlwatch = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
6
tv/5pkgs/simple/field.nix
Normal file
6
tv/5pkgs/simple/field.nix
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{ gawk, writeDashBin }:
|
||||||
|
|
||||||
|
writeDashBin "field" ''
|
||||||
|
set -u
|
||||||
|
exec ${gawk}/bin/awk -v n="$1" '{print$n}'
|
||||||
|
''
|
@ -63,16 +63,28 @@ with import <stockholm/lib>;
|
|||||||
syn cluster nix_ind_strings contains=NixIND_STRING
|
syn cluster nix_ind_strings contains=NixIND_STRING
|
||||||
syn cluster nix_strings contains=NixSTRING
|
syn cluster nix_strings contains=NixSTRING
|
||||||
|
|
||||||
${concatStringsSep "\n" (mapAttrsToList (name: {
|
${concatStringsSep "\n" (let
|
||||||
|
alts = xs: ''\(${concatStringsSep ''\|'' xs}\)'';
|
||||||
|
capitalize = s: let
|
||||||
|
xs = stringToCharacters s;
|
||||||
|
in
|
||||||
|
toUpper (head xs) + concatStrings (tail xs);
|
||||||
|
comment = k: ''/\* ${k} \*/'';
|
||||||
|
def = k: ''${k}[ \t\r\n]*='';
|
||||||
|
writer = k: ''write${k}[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)'';
|
||||||
|
writerExt = k: writerName ''[^"]*\.${k}'';
|
||||||
|
writerName = k:
|
||||||
|
''${alts [''toFile'' ''write[^ \t\r\n]*'']}*[ \t\r\n]*"${k}"'';
|
||||||
|
in mapAttrsToList (name: {
|
||||||
extraStart ? null,
|
extraStart ? null,
|
||||||
lang ? name
|
lang ? name
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
startAlts = filter isString [
|
startAlts = filter isString [
|
||||||
''/\* ${name} \*/''
|
(comment name)
|
||||||
extraStart
|
extraStart
|
||||||
];
|
];
|
||||||
sigil = ''\(${concatStringsSep ''\|'' startAlts}\)[ \t\r\n]*'';
|
sigil = ''${alts startAlts}[ \t\r\n]*'';
|
||||||
in /* vim */ ''
|
in /* vim */ ''
|
||||||
syn include @nix_${lang}_syntax syntax/${lang}.vim
|
syn include @nix_${lang}_syntax syntax/${lang}.vim
|
||||||
if exists("b:current_syntax")
|
if exists("b:current_syntax")
|
||||||
@ -111,22 +123,7 @@ with import <stockholm/lib>;
|
|||||||
" This is required because containedin isn't transitive.
|
" This is required because containedin isn't transitive.
|
||||||
syn cluster nix_has_dollar_curly
|
syn cluster nix_has_dollar_curly
|
||||||
\ add=@nix_${lang}_syntax
|
\ add=@nix_${lang}_syntax
|
||||||
'') (let
|
'') {
|
||||||
|
|
||||||
# TODO move this higher
|
|
||||||
capitalize = s: let
|
|
||||||
xs = stringToCharacters s;
|
|
||||||
in
|
|
||||||
toUpper (head xs) + concatStrings (tail xs);
|
|
||||||
|
|
||||||
alts = xs: ''\(${concatStringsSep ''\|'' xs}\)'';
|
|
||||||
def = k: ''${k}[ \t\r\n]*='';
|
|
||||||
writer = k: ''write${k}[^ \t\r\n]*[ \t\r\n]*\("[^"]*"\|[a-z]\+\)'';
|
|
||||||
|
|
||||||
writerExt = k: writerName ''[^"]*\.${k}'';
|
|
||||||
writerName = k: ''write[^ \t\r\n]*[ \t\r\n]*"${k}"'';
|
|
||||||
|
|
||||||
in {
|
|
||||||
c = {};
|
c = {};
|
||||||
cabal = {};
|
cabal = {};
|
||||||
diff = {};
|
diff = {};
|
||||||
@ -136,10 +133,13 @@ with import <stockholm/lib>;
|
|||||||
(writer "Jq")
|
(writer "Jq")
|
||||||
(writerExt "jq")
|
(writerExt "jq")
|
||||||
];
|
];
|
||||||
javascript.extraStart = ''/\* js \*/'';
|
javascript.extraStart = comment "jq";
|
||||||
lua = {};
|
lua = {};
|
||||||
#nginx = {};
|
#nginx = {};
|
||||||
python.extraStart = ''/\* py \*/'';
|
python.extraStart = alts [
|
||||||
|
(comment "py")
|
||||||
|
(writerExt "py")
|
||||||
|
];
|
||||||
sed.extraStart = writer "Sed";
|
sed.extraStart = writer "Sed";
|
||||||
sh.extraStart = let
|
sh.extraStart = let
|
||||||
phases = [
|
phases = [
|
||||||
@ -172,7 +172,7 @@ with import <stockholm/lib>;
|
|||||||
];
|
];
|
||||||
xdefaults = {};
|
xdefaults = {};
|
||||||
xmodmap = {};
|
xmodmap = {};
|
||||||
}))}
|
})}
|
||||||
|
|
||||||
" Clear syntax that interferes with nixINSIDE_DOLLAR_CURLY.
|
" Clear syntax that interferes with nixINSIDE_DOLLAR_CURLY.
|
||||||
syn clear shVarAssign
|
syn clear shVarAssign
|
||||||
|
Loading…
Reference in New Issue
Block a user