From a4d002e293babce5fcab8c3ed8973f7f3286ce85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Sun, 13 Mar 2022 10:31:19 +0100 Subject: [PATCH] chore: format --- ci.nix | 56 ++++++++-------- configs/default.nix | 11 ++-- configs/neomutt.nix | 16 ++--- configs/stardict.nix | 36 +++++------ configs/sxiv.nix | 89 +++++++++++++------------- modules/networkmanager-declarative.nix | 14 ++-- modules/retiolum.nix | 7 +- modules/telegram-bot.nix | 20 +++--- overlays/overlays.nix | 10 +-- packages/scripts/default.nix | 42 ++++++------ systems/makanek/weechat.nix | 2 +- 11 files changed, 153 insertions(+), 150 deletions(-) diff --git a/ci.nix b/ci.nix index f2aae09..24f71d1 100644 --- a/ci.nix +++ b/ci.nix @@ -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 diff --git a/configs/default.nix b/configs/default.nix index 8b72fb8..446e668 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -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 diff --git a/configs/neomutt.nix b/configs/neomutt.nix index 7923f40..af4905f 100644 --- a/configs/neomutt.nix +++ b/configs/neomutt.nix @@ -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) } '' } diff --git a/configs/stardict.nix b/configs/stardict.nix index 416c5e8..63c89f2 100644 --- a/configs/stardict.nix +++ b/configs/stardict.nix @@ -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 diff --git a/configs/sxiv.nix b/configs/sxiv.nix index 068191d..cbc39c9 100644 --- a/configs/sxiv.nix +++ b/configs/sxiv.nix @@ -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 + ''; } diff --git a/modules/networkmanager-declarative.nix b/modules/networkmanager-declarative.nix index cae5689..da3f5d5 100644 --- a/modules/networkmanager-declarative.nix +++ b/modules/networkmanager-declarative.nix @@ -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"; }; diff --git a/modules/retiolum.nix b/modules/retiolum.nix index 6d541ab..908a356 100644 --- a/modules/retiolum.nix +++ b/modules/retiolum.nix @@ -33,9 +33,10 @@ in { config = { services.tinc.networks.${netname} = { name = cfg.nodename; - hosts = builtins.mapAttrs - (name: _: builtins.readFile "${}/${name}") - (builtins.readDir ); + hosts = + builtins.mapAttrs + (name: _: builtins.readFile "${}/${name}") + (builtins.readDir ); rsaPrivateKeyFile = toString ; ed25519PrivateKeyFile = toString ; extraConfig = '' diff --git a/modules/telegram-bot.nix b/modules/telegram-bot.nix index 38d89a3..5eeb6e1 100644 --- a/modules/telegram-bot.nix +++ b/modules/telegram-bot.nix @@ -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 { diff --git a/overlays/overlays.nix b/overlays/overlays.nix index 728b0e0..97ac9ed 100644 --- a/overlays/overlays.nix +++ b/overlays/overlays.nix @@ -1,6 +1,6 @@ self: super: - with super.lib; let - eval = import ; - paths = (eval {modules = [(import )];}).config.nixpkgs.overlays; - in - foldl' (flip extends) (_: super) paths self +with super.lib; let + eval = import ; + paths = (eval {modules = [(import )];}).config.nixpkgs.overlays; +in + foldl' (flip extends) (_: super) paths self diff --git a/packages/scripts/default.nix b/packages/scripts/default.nix index 85545e2..e485086 100644 --- a/packages/scripts/default.nix +++ b/packages/scripts/default.nix @@ -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 {}; diff --git a/systems/makanek/weechat.nix b/systems/makanek/weechat.nix index b7dddc8..56388e6 100644 --- a/systems/makanek/weechat.nix +++ b/systems/makanek/weechat.nix @@ -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 ;