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

View File

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

View File

@@ -191,14 +191,14 @@ in {
# set accordingly: postponed trash record # set accordingly: postponed trash record
${ ${
lib.concatStringsSep "\n\n" (lib.mapAttrsToList (name: account: let lib.concatStringsSep "\n\n" (lib.mapAttrsToList (name: account: let
imapRoot = "imaps://${account.user}@${account.imap}"; imapRoot = "imaps://${account.user}@${account.imap}";
in '' in ''
account-hook ${account.user}@${account.imap} 'set imap_user="${account.user}" imap_pass="${account.password}"' 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}"' 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}"' 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}" named-mailboxes "${name}" "${imapRoot}" "${name}" "${imapRoot}/${account.folders.sent}"
'') '')
accounts) accounts)
} }
'' ''
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -67,7 +67,7 @@ in {
autoconnect = true; autoconnect = true;
address = "irc.libera.chat/6697"; address = "irc.libera.chat/6697";
ssl = true; 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_mechanism = "plain";
sasl_username = nick; sasl_username = nick;
sasl_password = lib.strings.fileContents <system-secrets/irc/libera>; sasl_password = lib.strings.fileContents <system-secrets/irc/libera>;