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

chore: format

This commit is contained in:
2022-03-13 10:31:19 +01:00
parent 730070bc9d
commit a4d002e293
11 changed files with 153 additions and 150 deletions

56
ci.nix
View File

@@ -19,12 +19,12 @@
}
'';
nixPath = nixpkgs.lib.concatStringsSep ":" ([
"niveum=${toString ./.}"
"nixos-config=${toString ./.}/systems/${name}/configuration.nix"
"system-secrets=${systemSecrets}"
"secrets=${sharedSecrets}"
]
++ nixpkgs.lib.mapAttrsToList (name: value: "${name}=${value}") inputs);
"niveum=${toString ./.}"
"nixos-config=${toString ./.}/systems/${name}/configuration.nix"
"system-secrets=${systemSecrets}"
"secrets=${sharedSecrets}"
]
++ nixpkgs.lib.mapAttrsToList (name: value: "${name}=${value}") inputs);
# cd ~/.password-store/shared && find * -type f | sed 's/.gpg$//'
sharedSecrets = ensureFiles [
"di.fm/key"
@@ -54,28 +54,28 @@
kabsa = ensureFiles basic;
manakish = ensureFiles basic;
makanek = ensureFiles ([
"irc/retiolum"
"irc/hackint"
"irc/libera"
"irc/oftc"
"matrix/nibbana"
"maxmind/license.key"
"moodle-dl/faye.token"
"nextcloud/admin"
"nextcloud/database"
"telegram/nachtischsatan.token"
"telegram/reverse.token"
"telegram/odyssey.token"
"telegram/betacode.token"
"telegram/moodle-dl.token"
"telegram/proverb.token"
"telegram/menstruation.token"
"telegram/cool_village.token"
"telegram/kmein.token"
"telegram/prometheus.token"
"weechat/relay"
]
++ basic);
"irc/retiolum"
"irc/hackint"
"irc/libera"
"irc/oftc"
"matrix/nibbana"
"maxmind/license.key"
"moodle-dl/faye.token"
"nextcloud/admin"
"nextcloud/database"
"telegram/nachtischsatan.token"
"telegram/reverse.token"
"telegram/odyssey.token"
"telegram/betacode.token"
"telegram/moodle-dl.token"
"telegram/proverb.token"
"telegram/menstruation.token"
"telegram/cool_village.token"
"telegram/kmein.token"
"telegram/prometheus.token"
"weechat/relay"
]
++ basic);
}
.${name};
in

View File

@@ -194,11 +194,12 @@ in {
};
}
{
networking.hosts = lib.mapAttrs' (name: address: {
name = address;
value = ["${name}.local"];
})
localAddresses;
networking.hosts =
lib.mapAttrs' (name: address: {
name = address;
value = ["${name}.local"];
})
localAddresses;
}
./alacritty.nix
./backup.nix

View File

@@ -191,14 +191,14 @@ in {
# set accordingly: postponed trash record
${
lib.concatStringsSep "\n\n" (lib.mapAttrsToList (name: account: let
imapRoot = "imaps://${account.user}@${account.imap}";
in ''
account-hook ${account.user}@${account.imap} 'set imap_user="${account.user}" imap_pass="${account.password}"'
account-hook ${account.user}@${account.smtp} 'set smtp_user="${account.user}" smtp_pass="${account.password}"'
folder-hook ${account.user}@${account.imap} 'set smtp_url="${account.smtpSettings "${account.user}@${account.smtp}"}" from="${account.address}" record="${imapRoot}/${account.folders.sent}" postponed="${imapRoot}/${account.folders.drafts}" trash="${imapRoot}/${account.folders.trash}"'
named-mailboxes "${name}" "${imapRoot}" "${name}" "${imapRoot}/${account.folders.sent}"
'')
accounts)
imapRoot = "imaps://${account.user}@${account.imap}";
in ''
account-hook ${account.user}@${account.imap} 'set imap_user="${account.user}" imap_pass="${account.password}"'
account-hook ${account.user}@${account.smtp} 'set smtp_user="${account.user}" smtp_pass="${account.password}"'
folder-hook ${account.user}@${account.imap} 'set smtp_url="${account.smtpSettings "${account.user}@${account.smtp}"}" from="${account.address}" record="${imapRoot}/${account.folders.sent}" postponed="${imapRoot}/${account.folders.drafts}" trash="${imapRoot}/${account.folders.trash}"'
named-mailboxes "${name}" "${imapRoot}" "${name}" "${imapRoot}/${account.folders.sent}"
'')
accounts)
}
''
}

View File

@@ -275,24 +275,24 @@
'';
in {
environment.etc.stardict.source = toString (makeStardictDataDir ({
Crum = pkgs.fetchzip {
url = "http://download.huzheng.org/misc/stardict-Coptic-English_all_dialects-2.4.2.tar.bz2";
sha256 = "1fi281mb9yzv40wjsdapi8fzpa7x2yscz582lv2qnss9g8zzzzr9";
};
SmithBiographyMythology = pkgs.fetchzip {
url = "https://github.com/latin-dict/Smith1873/releases/download/v1.0/Smith1873-stardict.zip";
sha256 = "01h5fxacp2m60xir8kzslkfy772vs3vmz07zhdwfhcwdaxif2af2";
};
SmithAntiquities = pkgs.fetchzip {
url = "https://github.com/latin-dict/Smith1890/releases/download/v1.0/Smith1890-stardict.zip";
sha256 = "0vpsv62p2lrzmgys4d1swpnc6lqhdi7rxwkj2ngy3lz5dk3fysyb";
};
}
// dictionaries.classics
// dictionaries.sanskrit
// dictionaries.oed
// dictionaries.russian
// dictionaries.englishGerman));
Crum = pkgs.fetchzip {
url = "http://download.huzheng.org/misc/stardict-Coptic-English_all_dialects-2.4.2.tar.bz2";
sha256 = "1fi281mb9yzv40wjsdapi8fzpa7x2yscz582lv2qnss9g8zzzzr9";
};
SmithBiographyMythology = pkgs.fetchzip {
url = "https://github.com/latin-dict/Smith1873/releases/download/v1.0/Smith1873-stardict.zip";
sha256 = "01h5fxacp2m60xir8kzslkfy772vs3vmz07zhdwfhcwdaxif2af2";
};
SmithAntiquities = pkgs.fetchzip {
url = "https://github.com/latin-dict/Smith1890/releases/download/v1.0/Smith1890-stardict.zip";
sha256 = "0vpsv62p2lrzmgys4d1swpnc6lqhdi7rxwkj2ngy3lz5dk3fysyb";
};
}
// dictionaries.classics
// dictionaries.sanskrit
// dictionaries.oed
// dictionaries.russian
// dictionaries.englishGerman));
environment.systemPackages = [
pkgs.goldendict

View File

@@ -18,50 +18,49 @@ in {
environment.systemPackages = [pkgs.sxiv];
# TODO fix
home-manager.users.me.xdg.configFile."sxiv/exec/key-handler".source =
pkgs.writers.writeDash "key-handler" ''
PATH=$PATH:${
lib.makeBinPath [
pkgs.gnused
pkgs.gawk
pkgs.dmenu
pkgs.coreutils
pkgs.libnotify
pkgs.imagemagick
pkgs.xclip
]
}
home-manager.users.me.xdg.configFile."sxiv/exec/key-handler".source = pkgs.writers.writeDash "key-handler" ''
PATH=$PATH:${
lib.makeBinPath [
pkgs.gnused
pkgs.gawk
pkgs.dmenu
pkgs.coreutils
pkgs.libnotify
pkgs.imagemagick
pkgs.xclip
]
}
echo >&2 key "$1" pressed
while read file; do
case "$1" in
"c")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${important-directories} | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." &
;;
"m")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${important-directories} | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
;;
"r")
convert -rotate 90 "$file" "$file" ;;
"R")
convert -rotate -90 "$file" "$file" ;;
"f")
convert -flop "$file" "$file" ;;
"y")
echo -n "$file" | xclip -selection clipboard &&
notify-send "$file copied to clipboard" & ;;
"Y")
readlink -f "$file" | xclip -selection clipboard &&
notify-send "$(readlink -f "$file") copied to clipboard" & ;;
"d")
[ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
esac
done
'';
echo >&2 key "$1" pressed
while read file; do
case "$1" in
"c")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${important-directories} | awk '{print $2}' | dmenu -l 20 -i -p "Copy file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
cp "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file copied to $destdir." &
;;
"m")
[ -z "$destdir" ] && destdir="$(sed "s/\s.*#.*$//;/^\s*$/d" ${important-directories} | awk '{print $2}' | dmenu -l 20 -i -p "Move file(s) to where?" | sed "s|~|$HOME|g")"
[ -z "$destdir" ] && exit
[ ! -d "$destdir" ] && notify-send "$destdir is not a directory, cancelled." && exit
mv "$file" "$destdir" && notify-send -i "$(readlink -f "$file")" "$file moved to $destdir." &
;;
"r")
convert -rotate 90 "$file" "$file" ;;
"R")
convert -rotate -90 "$file" "$file" ;;
"f")
convert -flop "$file" "$file" ;;
"y")
echo -n "$file" | xclip -selection clipboard &&
notify-send "$file copied to clipboard" & ;;
"Y")
readlink -f "$file" | xclip -selection clipboard &&
notify-send "$(readlink -f "$file") copied to clipboard" & ;;
"d")
[ "$(printf "No\\nYes" | dmenu -i -p "Really delete $file?")" = "Yes" ] && rm "$file" && notify-send "$file deleted." ;;
esac
done
'';
}

View File

@@ -15,14 +15,14 @@ with lib; let
mode = "0400"; # readonly (user)
text =
(foldlAttrs (accum: {
name,
value,
}: ''
${accum}
name,
value,
}: ''
${accum}
[${name}] ${mkProfileEntry value}'')
"# Generated by nixos-networkmanager-profiles"
profileAttrs)
[${name}] ${mkProfileEntry value}'')
"# Generated by nixos-networkmanager-profiles"
profileAttrs)
+ "\n";
};

View File

@@ -33,9 +33,10 @@ in {
config = {
services.tinc.networks.${netname} = {
name = cfg.nodename;
hosts = builtins.mapAttrs
(name: _: builtins.readFile "${<retiolum/hosts>}/${name}")
(builtins.readDir <retiolum/hosts>);
hosts =
builtins.mapAttrs
(name: _: builtins.readFile "${<retiolum/hosts>}/${name}")
(builtins.readDir <retiolum/hosts>);
rsaPrivateKeyFile = toString <system-secrets/retiolum.key>;
ed25519PrivateKeyFile = toString <system-secrets/retiolum.ed25519>;
extraConfig = ''

View File

@@ -14,16 +14,16 @@ with lib; let
serviceConfig.Type = "oneshot";
wants = ["network-online.target"];
script = strings.concatStringsSep "\n" (["QUOTE=$(${bot.command})" "if [ -n \"$QUOTE\" ]; then"]
++ map (chatId: ''
${pkgs.curl}/bin/curl -s -X POST "https://api.telegram.org/bot${bot.token}/sendMessage" \
-d chat_id="${chatId}" \
-d text="$QUOTE" ${
lib.strings.optionalString (bot.parseMode != null)
"-d parse_mode=${bot.parseMode}"
}
'')
bot.chatIds
++ ["fi"]);
++ map (chatId: ''
${pkgs.curl}/bin/curl -s -X POST "https://api.telegram.org/bot${bot.token}/sendMessage" \
-d chat_id="${chatId}" \
-d text="$QUOTE" ${
lib.strings.optionalString (bot.parseMode != null)
"-d parse_mode=${bot.parseMode}"
}
'')
bot.chatIds
++ ["fi"]);
};
in {
options.niveum.telegramBots = mkOption {

View File

@@ -1,6 +1,6 @@
self: super:
with super.lib; let
eval = import <nixpkgs/nixos/lib/eval-config.nix>;
paths = (eval {modules = [(import <nixos-config>)];}).config.nixpkgs.overlays;
in
foldl' (flip extends) (_: super) paths self
with super.lib; let
eval = import <nixpkgs/nixos/lib/eval-config.nix>;
paths = (eval {modules = [(import <nixos-config>)];}).config.nixpkgs.overlays;
in
foldl' (flip extends) (_: super) paths self

View File

@@ -307,31 +307,33 @@ in
packages = [pkgs.xdo];
};
ipa = pkgs.writers.writeHaskellBin "ipa" {
libraries = with pkgs; [haskellPackages.text haskellPackages.ipa];
} ''
import Data.Maybe (fromJust)
import Language.IPA
import qualified Data.Text as T
import qualified Data.Text.IO as T
main = T.interact (T.unwords . map (unIPA . fromJust . (xSampaToIpa =<<) . mkXSampa) . T.words)
'';
ipa =
pkgs.writers.writeHaskellBin "ipa" {
libraries = with pkgs; [haskellPackages.text haskellPackages.ipa];
} ''
import Data.Maybe (fromJust)
import Language.IPA
import qualified Data.Text as T
import qualified Data.Text.IO as T
main = T.interact (T.unwords . map (unIPA . fromJust . (xSampaToIpa =<<) . mkXSampa) . T.words)
'';
default-gateway = pkgs.writers.writeDashBin "default-gateway" ''
${pkgs.iproute}/bin/ip -json route | ${pkgs.jq}/bin/jq --raw-output '.[0].gateway'
'';
betacode = pkgs.writers.writeHaskellBin "betacode" {
libraries = with pkgs; [
(haskell.lib.unmarkBroken (haskell.lib.doJailbreak haskellPackages.betacode))
haskellPackages.text
];
} ''
import qualified Data.Text.IO as T
import qualified Data.Text as T
import Text.BetaCode
main = T.interact (either (error . T.unpack) id . fromBeta)
'';
betacode =
pkgs.writers.writeHaskellBin "betacode" {
libraries = with pkgs; [
(haskell.lib.unmarkBroken (haskell.lib.doJailbreak haskellPackages.betacode))
haskellPackages.text
];
} ''
import qualified Data.Text.IO as T
import qualified Data.Text as T
import Text.BetaCode
main = T.interact (either (error . T.unpack) id . fromBeta)
'';
devanagari = pkgs.callPackage ../devanagari {};

View File

@@ -67,7 +67,7 @@ in {
autoconnect = true;
address = "irc.libera.chat/6697";
ssl = true;
autojoin = ["#flipdot" "#haskell" "#nixos" "#fysi" "#binaergewitter" "#neovim" "#lojban" "#vim" "#newsboat" ];
autojoin = ["#flipdot" "#haskell" "#nixos" "#fysi" "#binaergewitter" "#neovim" "#lojban" "#vim" "#newsboat"];
sasl_mechanism = "plain";
sasl_username = nick;
sasl_password = lib.strings.fileContents <system-secrets/irc/libera>;