diff --git a/packages/scripts/avesta.sed b/.bin/avesta.sed similarity index 100% rename from packages/scripts/avesta.sed rename to .bin/avesta.sed diff --git a/packages/scripts/chunk-pdf b/.bin/chunk-pdf similarity index 100% rename from packages/scripts/chunk-pdf rename to .bin/chunk-pdf diff --git a/packages/scripts/mushakkil.sh b/.bin/mushakkil.sh similarity index 100% rename from packages/scripts/mushakkil.sh rename to .bin/mushakkil.sh diff --git a/packages/scripts/nix-haddock-index b/.bin/nix-haddock-index similarity index 100% rename from packages/scripts/nix-haddock-index rename to .bin/nix-haddock-index diff --git a/packages/scripts/notetags.sh b/.bin/notetags.sh similarity index 100% rename from packages/scripts/notetags.sh rename to .bin/notetags.sh diff --git a/.bin/unicode b/.bin/unicode new file mode 100644 index 0000000..15fd968 --- /dev/null +++ b/.bin/unicode @@ -0,0 +1,8 @@ +import sys +import unicodedata + +for index, character in enumerate(sys.stdin.read().strip()): + try: + print(index, character, hex(ord(character)), unicodedata.category(character), unicodedata.name(character)) + except: + print(index, character, hex(ord(character))) diff --git a/configs/aerc.nix b/configs/aerc.nix index f729376..a7edefd 100644 --- a/configs/aerc.nix +++ b/configs/aerc.nix @@ -21,30 +21,44 @@ in { email-password-cock = { file = ../secrets/email-password-cock.age; owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; }; email-password-fysi = { file = ../secrets/email-password-fysi.age; owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; }; email-password-posteo = { file = ../secrets/email-password-posteo.age; owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; }; email-password-meinhark = { file = ../secrets/email-password-meinhark.age; owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; }; email-password-meinhaki = { file = ../secrets/email-password-meinhaki.age; owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; }; email-password-dslalewa = { file = ../secrets/email-password-dslalewa.age; owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; }; email-password-fsklassp = { file = ../secrets/email-password-fsklassp.age; owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; }; }; diff --git a/configs/cloud.nix b/configs/cloud.nix index 9d16ec7..2dcc0f7 100644 --- a/configs/cloud.nix +++ b/configs/cloud.nix @@ -96,7 +96,12 @@ in { '') ]; - age.secrets.mega-password.file = ../secrets/mega-password.age; + age.secrets.mega-password = { + file = ../secrets/mega-password.age; + owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; + }; fileSystems."/media/moodle" = { device = "zaatar.r:/moodle"; diff --git a/configs/default.nix b/configs/default.nix index 4614ae8..b4fd5fc 100644 --- a/configs/default.nix +++ b/configs/default.nix @@ -2,12 +2,11 @@ pkgs, lib, config, - options, + niveumPackages, ... }: let inherit (lib.strings) makeBinPath; inherit (import ../lib) localAddresses kieran; - scripts = import ../packages/scripts {inherit config pkgs lib;}; defaultApplications = (import ../lib).defaultApplications {inherit pkgs;}; in { imports = [ @@ -27,10 +26,6 @@ in { allowUnfree = true; packageOverrides = pkgs: { dmenu = pkgs.writers.writeDashBin "dmenu" ''exec ${pkgs.rofi}/bin/rofi -dmenu "$@"''; - gfs-fonts = pkgs.callPackage ../packages/gfs-fonts.nix {}; - tocharian-font = pkgs.callPackage ../packages/tocharian-font.nix {}; - iolanguage = pkgs.callPackage ../packages/iolanguage.nix {}; - ix = pkgs.callPackage ../packages/ix.nix {}; }; permittedInsecurePackages = [ "qtwebkit-5.212.0-alpha4" @@ -43,7 +38,20 @@ in { boot.loader.timeout = 1; } { - age.secrets.di-fm-key.file = ../secrets/di-fm-key.age; + age.secrets = { + di-fm-key = { + file = ../secrets/di-fm-key.age; + owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; + }; + restic = { + file = ../secrets/restic.age; + owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; + }; + }; } { home-manager.users.me = { @@ -88,7 +96,7 @@ in { cd "$(mktemp -d)" pwd ''; - swallow = command: "${scripts.swallow}/bin/swallow ${command}"; + swallow = command: "${niveumPackages.swallow}/bin/swallow ${command}"; in { "ß" = "${pkgs.util-linux}/bin/setsid"; cat = "${pkgs.bat}/bin/bat --style=plain"; diff --git a/configs/flameshot.nix b/configs/flameshot.nix index c5c2c8f..451500d 100644 --- a/configs/flameshot.nix +++ b/configs/flameshot.nix @@ -2,10 +2,7 @@ lib, pkgs, ... -}: let - inherit (import ) defaultApplications; - flameshot-once = pkgs.callPackage {}; -in { +}: { home-manager.users.me = { services.flameshot = { enable = true; @@ -19,25 +16,7 @@ in { showHelp = false; squareMagnifier = true; uploadWithoutConfirmation = true; - buttons = lib.concatStringsSep " " [ - "TYPE_ARROW" - "TYPE_CIRCLE" - "TYPE_CIRCLECOUNT" - "TYPE_COPY" - "TYPE_DRAWER" - "TYPE_EXIT" - "TYPE_IMAGEUPLOADER" - "TYPE_MARKER" - "TYPE_MOVESELECTION" - "TYPE_PENCIL" - "TYPE_PIXELATE" - "TYPE_RECTANGLE" - "TYPE_SAVE" - "TYPE_SELECTION" - # "TYPE_SELECTIONINDICATOR" - "TYPE_TEXT" - "TYPE_UNDO" - ]; + buttons = ''@Variant(\0\0\0\x7f\0\0\0\vQList\0\0\0\0\x10\0\0\0\x2\0\0\0\x5\0\0\0\x13\0\0\0\xa\0\0\0\x1\0\0\0\xc\0\0\0\xd\0\0\0\x6\0\0\0\x8\0\0\0\0\0\0\0\xf\0\0\0\x4\0\0\0\xb\0\0\0\x3\0\0\0\x12\0\0\0\x9)''; }; }; }; diff --git a/configs/fonts.nix b/configs/fonts.nix index 40c17e8..077fcf6 100644 --- a/configs/fonts.nix +++ b/configs/fonts.nix @@ -1,4 +1,8 @@ -{pkgs, ...}: let +{ + pkgs, + niveumPackages, + ... +}: let zip-font = name: arguments: let directory = pkgs.fetchzip arguments; in @@ -76,7 +80,7 @@ in { font-awesome galatia-sil gentium - gfs-fonts + niveumPackages.gfs-fonts gyre-fonts ibm-plex jetbrains-mono @@ -96,7 +100,7 @@ in { source-sans-pro source-serif-pro theano - tocharian-font + niveumPackages.tocharian-font vistafonts vollkorn zilla-slab diff --git a/configs/git.nix b/configs/git.nix index 5e904f5..d2ec5dd 100644 --- a/configs/git.nix +++ b/configs/git.nix @@ -2,10 +2,10 @@ pkgs, config, lib, + inputs, ... }: let inherit (import ../lib) kieran ignorePaths; - git-preview = pkgs.callPackage ../packages/git-preview.nix {}; in { environment.systemPackages = [ pkgs.mr @@ -19,7 +19,7 @@ in { pkgs.gitstats pkgs.patch pkgs.patchutils - git-preview + inputs.self.packages.x86_64-linux.git-preview ]; environment.shellAliases = { diff --git a/configs/i3.nix b/configs/i3.nix index ce88047..3c6b09e 100644 --- a/configs/i3.nix +++ b/configs/i3.nix @@ -2,12 +2,12 @@ config, pkgs, lib, + niveumPackages, ... }: let inherit (import ../lib) defaultApplications colours; - scripts = import ../packages/scripts {inherit config pkgs lib;}; - klem = import ../packages/scripts/klem.nix { - inherit pkgs lib; + klem = niveumPackages.klem.override { + config.dmenu = "${pkgs.dmenu}/bin/dmenu -i -p klem"; config.scripts = { "p.r" = pkgs.writers.writeDash "p.r" '' ${pkgs.curl}/bin/curl -fSs http://p.r --data-binary @- \ @@ -36,10 +36,10 @@ ${pkgs.coreutils}/bin/tr '[A-Za-z]' '[N-ZA-Mn-za-m]' ''; "ipa" = pkgs.writers.writeDash "ipa" '' - ${scripts.ipa}/bin/ipa + ${niveumPackages.ipa}/bin/ipa ''; "betacode" = pkgs.writers.writeDash "betacode" '' - ${scripts.betacode}/bin/betacode + ${niveumPackages.betacode}/bin/betacode ''; "curl" = pkgs.writers.writeDash "curl" '' ${pkgs.curl}/bin/curl -fSs "$(${pkgs.coreutils}/bin/cat)" @@ -60,14 +60,14 @@ in { age.secrets = { github-token-i3status-rust = { file = ../secrets/github-token-i3status-rust.age; - owner = "kfm"; - group = "users"; + owner = config.users.users.me.name; + group = config.users.users.me.group; mode = "400"; }; openweathermap-api-key = { file = ../secrets/openweathermap-api-key.age; - owner = "kfm"; - group = "users"; + owner = config.users.users.me.name; + group = config.users.users.me.group; mode = "400"; }; }; @@ -254,9 +254,9 @@ in { "${modifier}+Return" = "exec ${(defaultApplications pkgs).terminal}"; "${modifier}+t" = "exec ${(defaultApplications pkgs).fileManager}"; "${modifier}+y" = "exec ${(defaultApplications pkgs).browser}"; - "${modifier}+0" = "exec ${scripts.menu-calc}/bin/="; + "${modifier}+0" = "exec ${niveumPackages.menu-calc}/bin/="; - "${modifier}+Shift+w" = "exec ${scripts.k-lock}/bin/k-lock"; + "${modifier}+Shift+w" = "exec ${niveumPackages.k-lock}/bin/k-lock"; "${modifier}+d" = "exec ${pkgs.writers.writeDash "run" ''exec rofi -modi run,ssh,window -show run''}"; "${modifier}+Shift+d" = "exec ${ pkgs.writers.writeDash "notemenu" '' @@ -279,16 +279,22 @@ in { }"; "${modifier}+p" = "exec rofi-pass"; "${modifier}+Shift+p" = "exec rofi-pass --insert"; - "${modifier}+u" = "exec ${scripts.unicodmenu}/bin/unicodmenu"; + "${modifier}+u" = "exec ${niveumPackages.unicodmenu}/bin/unicodmenu"; "${modifier}+F6" = "exec ${pkgs.xorg.xkill}/bin/xkill"; - "${modifier}+F7" = "exec ${scripts.showkeys-toggle}/bin/showkeys-toggle"; + "${modifier}+F7" = "exec ${pkgs.writers.writeDash "showkeys-toggle" '' + if ${pkgs.procps}/bin/pgrep screenkey; then + exec ${pkgs.procps}/bin/pkill screenkey + else + exec ${pkgs.screenkey}/bin/screenkey + fi + ''}"; "${modifier}+F8" = "exec switch-theme toggle"; "${modifier}+F9" = "exec ${pkgs.redshift}/bin/redshift -O 4000 -b 0.85"; "${modifier}+F10" = "exec ${pkgs.redshift}/bin/redshift -x"; "${modifier}+F11" = "exec ${pkgs.xcalib}/bin/xcalib -invert -alter"; "${modifier}+F12" = "exec ${klem}/bin/klem"; - "Print" = "exec flameshot-once"; + "Print" = "exec flameshot gui"; "XF86AudioLowerVolume" = "exec ${pkgs.pamixer}/bin/pamixer -d 5"; "XF86AudioMute" = "exec ${pkgs.pamixer}/bin/pamixer -t"; "XF86AudioRaiseVolume" = "exec ${pkgs.pamixer}/bin/pamixer -i 5"; @@ -298,9 +304,9 @@ in { "XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; "XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; "XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop"; - "XF86ScreenSaver" = "exec ${scripts.k-lock}/bin/k-lock"; + "XF86ScreenSaver" = "exec ${niveumPackages.k-lock}/bin/k-lock"; - "XF86Display" = "exec ${scripts.dmenurandr}/bin/dmenurandr"; + "XF86Display" = "exec ${niveumPackages.dmenu-randr}/bin/dmenurandr"; # key names detected with xorg.xev: # XF86WakeUp (fn twice) diff --git a/configs/khal.nix b/configs/khal.nix index 4e7eb4a..3129971 100644 --- a/configs/khal.nix +++ b/configs/khal.nix @@ -17,8 +17,18 @@ }; in { age.secrets = { - nextcloud-password-kieran.file = ../secrets/nextcloud-password-kieran.age; - nextcloud-password-fysi.file = ../secrets/nextcloud-password-fysi.age; + nextcloud-password-kieran = { + file = ../secrets/nextcloud-password-kieran.age; + owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; + }; + nextcloud-password-fysi = { + file = ../secrets/nextcloud-password-fysi.age; + owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; + }; }; environment.systemPackages = [ diff --git a/configs/mpv.nix b/configs/mpv.nix index 36e9f95..037dc0b 100644 --- a/configs/mpv.nix +++ b/configs/mpv.nix @@ -2,10 +2,10 @@ pkgs, lib, config, + niveumPackages, ... }: let - scripts = import ../packages/scripts {inherit config pkgs lib;}; - swallow = command: "${scripts.swallow}/bin/swallow ${command}"; + swallow = command: "${niveumPackages.swallow}/bin/swallow ${command}"; in { environment.shellAliases.smpv = swallow "mpv"; @@ -37,7 +37,7 @@ in { }; scripts = [ pkgs.mpvScripts.youtube-quality - (pkgs.callPackage ../packages/mpv-visualizer.nix {}) + niveumPackages.mpv-visualizer ]; }; }; diff --git a/configs/neovim.nix b/configs/neovim.nix index a1d2a58..e4313c2 100644 --- a/configs/neovim.nix +++ b/configs/neovim.nix @@ -1,25 +1,13 @@ -{pkgs, ...}: { +{ + pkgs, + niveumPackages, + ... +}: { environment.variables.EDITOR = pkgs.lib.mkForce "nvim"; environment.shellAliases.vi = "nvim"; environment.shellAliases.vim = "nvim"; environment.shellAliases.view = "nvim -R"; - nixpkgs.config.packageOverrides = pkgs: { - vimPlugins = - pkgs.vimPlugins - // { - cheat-sh-vim = pkgs.callPackage ../packages/vimPlugins/cheat-sh.nix {}; - vim-fetch = pkgs.callPackage ../packages/vimPlugins/vim-fetch.nix {}; - vim-colors-paramount = pkgs.callPackage ../packages/vimPlugins/vim-colors-paramount.nix {}; - vim-256noir = pkgs.callPackage ../packages/vimPlugins/vim-256noir.nix {}; - icalendar-vim = pkgs.callPackage ../packages/vimPlugins/icalendar-vim.nix {}; - jq-vim = pkgs.callPackage ../packages/vimPlugins/jq-vim.nix {}; - vim-fsharp = pkgs.callPackage ../packages/vimPlugins/vim-fsharp.nix {}; - vim-reason-plus = pkgs.callPackage ../packages/vimPlugins/vim-reason-plus.nix {}; - vim-mail = pkgs.callPackage ../packages/vimPlugins/vim-mail.nix {}; - }; - }; - environment.systemPackages = [ (pkgs.writers.writeDashBin "vim" ''neovim "$@"'') (pkgs.neovim.override { @@ -34,11 +22,11 @@ undotree tabular # vimwiki - vim-colors-paramount + niveumPackages.vimPlugins-vim-colors-paramount vim-commentary vim-css-color vim-eunuch - vim-fetch + niveumPackages.vimPlugins-vim-fetch vim-fugitive vim-gitgutter vim-repeat @@ -61,8 +49,8 @@ elm-vim emmet-vim haskell-vim - icalendar-vim - jq-vim + niveumPackages.vimPlugins-icalendar-vim + niveumPackages.vimPlugins-jq-vim rust-vim typescript-vim vim-javascript @@ -71,7 +59,7 @@ vimtex vim-pandoc vim-pandoc-syntax - vim-256noir + niveumPackages.vimPlugins-vim-256noir ]; }; }; diff --git a/configs/newsboat.nix b/configs/newsboat.nix index 7112938..a07d20f 100644 --- a/configs/newsboat.nix +++ b/configs/newsboat.nix @@ -4,8 +4,6 @@ lib, ... }: let - scripts = import {inherit pkgs lib;}; - ytdl-format = "'bestvideo[height<=?720][fps<=?30][vcodec!=?vp9]+bestaudio/best'"; youtube-download = "${pkgs.ts}/bin/ts ${pkgs.yt-dlp}/bin/yt-dlp -f ${ytdl-format} --add-metadata"; diff --git a/configs/packages.nix b/configs/packages.nix index c529864..f3c7ba1 100644 --- a/configs/packages.nix +++ b/configs/packages.nix @@ -3,17 +3,10 @@ pkgs, lib, inputs, + niveumPackages, ... }: let - hc = pkgs.callPackage ../packages/hc.nix {}; worldradio = pkgs.callPackage ../packages/worldradio.nix {}; - pandoc-doc = pkgs.callPackage ../packages/man/pandoc.nix {}; - dic = pkgs.callPackage ../packages/dic.nix {}; - untilport = pkgs.callPackage ../packages/untilport.nix {}; - cyberlocker-tools = pkgs.callPackage ../packages/cyberlocker-tools.nix {}; - kpaste = pkgs.callPackage ../packages/kpaste.nix {}; - - scripts = import ../packages/scripts {inherit config pkgs lib;}; zoteroStyle = { name, @@ -141,60 +134,58 @@ in { okular # the word is nucular xournalpp # for annotating pdfs pdfpc # presenter console for pdf slides - hc # print files as qr codes + niveumPackages.hc # print files as qr codes yt-dlp espeak bc # calculator pari # gp -- better calculator rink # unit converter - scripts.auc - scripts.stackoverflow - scripts.infschmv - scripts.qrpaste - scripts.ttspaste - scripts.new-mac # get a new mac address - scripts.scanned - scripts.default-gateway - scripts.showkeys-toggle - scripts.kirciuoklis - scripts.favicon - scripts.heuretes - scripts.ipa # XSAMPA to IPA converter - scripts.playlist - scripts.mpv-tv - scripts.devanagari - scripts.betacode # ancient greek betacode to unicode converter - scripts.meteo - scripts.mahlzeit - scripts.vimv - scripts.swallow # window swallowing - scripts.literature-quote + niveumPackages.auc + niveumPackages.cheat-sh + niveumPackages.infschmv + niveumPackages.qrpaste + niveumPackages.ttspaste + niveumPackages.new-mac # get a new mac address + niveumPackages.scanned + niveumPackages.default-gateway + niveumPackages.kirciuoklis + niveumPackages.image-convert-favicon + niveumPackages.heuretes + niveumPackages.ipa # XSAMPA to IPA converter + niveumPackages.pls + niveumPackages.mpv-tv + niveumPackages.devanagari + niveumPackages.betacode # ancient greek betacode to unicode converter + niveumPackages.meteo + niveumPackages.mahlzeit + niveumPackages.vimv + niveumPackages.swallow # window swallowing + niveumPackages.literature-quote jless # less(1) for json - scripts.notetags - scripts.booksplit - scripts.dmenurandr - scripts.interdimensional-cable - scripts.dmenubluetooth - scripts.manual-sort - scripts.dns-sledgehammer + niveumPackages.booksplit + niveumPackages.dmenu-randr + niveumPackages.dmenu-bluetooth + niveumPackages.manual-sort + niveumPackages.dns-sledgehammer ts - scripts.vg - scripts.fkill - scripts.wttr - scripts.unicodmenu - scripts.closest - scripts.trans - scripts.mpv-radio + niveumPackages.vg + niveumPackages.fkill + niveumPackages.wttr + niveumPackages.unicodmenu + niveumPackages.closest + niveumPackages.trans + (niveumPackages.mpv-radio.override { + di-fm-key-file = config.age.secrets.di-fm-key.path; + }) # kmein.slide termdown - scripts.tolino-screensaver - scripts.rfc - scripts.tag - scripts.timer - python3Packages.eyeD3 - scripts.menu-calc + niveumPackages.image-convert-tolino + niveumPackages.rfc + niveumPackages.tag + niveumPackages.timer + niveumPackages.menu-calc nix-prefetch-git - scripts.nix-git + niveumPackages.nix-git nixfmt par qrencode @@ -213,35 +204,20 @@ in { (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 "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 - '') + inputs.scripts.packages.x86_64-linux.alarm spotify ncspot playerctl nix-index - scripts.nix-index-update + niveumPackages.nix-index-update #krebs - dic - cyberlocker-tools - untilport - kpaste + niveumPackages.dic + niveumPackages.cyberlocker-tools + niveumPackages.untilport + niveumPackages.kpaste config.nur.repos.mic92.ircsink (python3.withPackages (py: [ @@ -269,14 +245,14 @@ in { latexrun (aspellWithDicts (dict: [dict.de dict.en dict.en-computers])) # haskellPackages.pandoc-citeproc - scripts.text2pdf + niveumPackages.text2pdf lowdown glow # markdown to term libreoffice # gnumeric dia pandoc - pandoc-doc + niveumPackages.man-pandoc # proselint asciidoctor wordnet @@ -291,7 +267,12 @@ in { '') ]; - age.secrets.home-assistant-token.file = ../secrets/home-assistant-token.age; + age.secrets.home-assistant-token = { + file = ../secrets/home-assistant-token.age; + owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; + }; home-manager.users.me.xdg.configFile."pycodestyle".text = '' [pycodestyle] diff --git a/configs/telegram-bots/literature-quote.nix b/configs/telegram-bots/literature-quote.nix index 67fb7f5..a251234 100644 --- a/configs/telegram-bots/literature-quote.nix +++ b/configs/telegram-bots/literature-quote.nix @@ -2,17 +2,15 @@ pkgs, config, lib, + niveumPackages, ... -}: let - scripts = import ../../packages/scripts {inherit config pkgs lib;}; - inherit (scripts) literature-quote; -in { +}: { niveum.telegramBots.quotebot = { enable = true; time = "08/6:00"; tokenFile = config.age.secrets.telegram-token-kmein.path; chatIds = ["-1001760262519"]; - command = "${literature-quote}/bin/literature-quote"; + command = "${niveumPackages.literature-quote}/bin/literature-quote"; parseMode = "Markdown"; }; diff --git a/configs/traadfri.nix b/configs/traadfri.nix index 09c8fc1..a2fc460 100644 --- a/configs/traadfri.nix +++ b/configs/traadfri.nix @@ -21,7 +21,12 @@ in { '') ]; - age.secrets.traadfri-key.file = ../secrets/traadfri-key.age; + age.secrets.traadfri-key = { + file = ../secrets/traadfri-key.age; + owner = config.users.users.me.name; + group = config.users.users.me.group; + mode = "400"; + }; niveum.traadfri = { enable = true; diff --git a/flake.lock b/flake.lock index bd3ccd9..92f9d3f 100644 --- a/flake.lock +++ b/flake.lock @@ -542,7 +542,8 @@ "scripts": "scripts", "telebots": "telebots", "tinc-graph": "tinc-graph", - "traadfri": "traadfri" + "traadfri": "traadfri", + "voidrice": "voidrice" } }, "rust-overlay": { @@ -636,11 +637,11 @@ "rust-overlay": "rust-overlay_3" }, "locked": { - "lastModified": 1677166498, - "narHash": "sha256-az31wr2tF98+2l3SgCrIy0AcoJdN+qkTCHe2vMmBWnk=", + "lastModified": 1677171835, + "narHash": "sha256-z8qXF2v++ErEhxGI2PEnX8NcXRiRK3DD0JzZbr/Qjk0=", "owner": "kmein", "repo": "scripts", - "rev": "bdc2ccb7081f5b09dedccba4f8875cc1b938ef04", + "rev": "6ef4ee97824371e1322aa8306b4670d6fa49359d", "type": "github" }, "original": { @@ -725,6 +726,22 @@ "repo": "flake-utils", "type": "github" } + }, + "voidrice": { + "flake": false, + "locked": { + "lastModified": 1677155625, + "narHash": "sha256-fxkeRwTfdzfHTRmwvUpbbL/bcCtDot/b7sUXfyq3+Vo=", + "owner": "Lukesmithxyz", + "repo": "voidrice", + "rev": "2062e8110cc6b4479417ff5c5f966aebe337a6da", + "type": "github" + }, + "original": { + "owner": "Lukesmithxyz", + "repo": "voidrice", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 6e387e5..8260e06 100644 --- a/flake.nix +++ b/flake.nix @@ -17,6 +17,7 @@ telebots.url = "github:kmein/telebots"; tinc-graph.url = "github:kmein/tinc-graph"; traadfri.url = "github:kmein/traadfri"; + voidrice.url = "github:Lukesmithxyz/voidrice"; agenix.inputs.nixpkgs.follows = "nixpkgs"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; @@ -27,6 +28,7 @@ nixinate.inputs.nixpkgs.follows = "nixpkgs"; tinc-graph.inputs.flake-utils.follows = "flake-utils"; tinc-graph.inputs.nixpkgs.follows = "nixpkgs"; + voidrice.flake = false; }; outputs = inputs @ { @@ -37,113 +39,246 @@ nixinate, agenix, retiolum, + flake-utils, ... }: let - in { - apps = nixinate.nixinate.x86_64-linux self; + in + { + apps = nixinate.nixinate.x86_64-linux self; - nixosConfigurations = { - ful = nixpkgs.lib.nixosSystem { - system = "aarch64-linux"; - modules = [ - systems/ful/configuration.nix - agenix.nixosModules.default - retiolum.nixosModules.retiolum - ]; + nixosConfigurations = { + ful = nixpkgs.lib.nixosSystem rec { + system = "aarch64-linux"; + specialArgs = { + niveumPackages = inputs.self.packages.${system}; + inherit inputs; + }; + modules = [ + { + _module.args.nixinate = { + host = "ful"; + sshUser = "root"; + buildOn = "remote"; + substituteOnTarget = true; + hermetic = false; + }; + } + systems/ful/configuration.nix + agenix.nixosModules.default + retiolum.nixosModules.retiolum + ]; + }; + zaatar = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + specialArgs = { + niveumPackages = inputs.self.packages.${system}; + inherit inputs; + }; + modules = [ + { + _module.args.nixinate = { + host = "zaatar"; + sshUser = "root"; + buildOn = "remote"; + substituteOnTarget = true; + hermetic = false; + }; + } + systems/zaatar/configuration.nix + agenix.nixosModules.default + retiolum.nixosModules.retiolum + ]; + }; + makanek = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + # for using inputs in other config files + specialArgs = { + niveumPackages = inputs.self.packages.${system}; + inherit inputs; + }; + modules = [ + { + _module.args.nixinate = { + host = "makanek"; + sshUser = "root"; + buildOn = "remote"; + substituteOnTarget = true; + hermetic = false; + }; + } + systems/makanek/configuration.nix + agenix.nixosModules.default + retiolum.nixosModules.retiolum + nur.nixosModules.nur + ]; + }; + tahina = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + systems/tahina/configuration.nix + agenix.nixosModules.default + retiolum.nixosModules.retiolum + ]; + }; + tabula = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + systems/tabula/configuration.nix + agenix.nixosModules.default + retiolum.nixosModules.retiolum + ]; + }; + manakish = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + specialArgs = { + niveumPackages = inputs.self.packages.${system}; + inherit inputs; + }; + modules = [ + { + _module.args.nixinate = { + host = "manakish"; + sshUser = "root"; + buildOn = "remote"; + substituteOnTarget = true; + hermetic = false; + }; + } + systems/manakish/configuration.nix + agenix.nixosModules.default + retiolum.nixosModules.retiolum + home-manager.nixosModules.home-manager + nur.nixosModules.nur + ]; + }; + kabsa = nixpkgs.lib.nixosSystem rec { + system = "x86_64-linux"; + specialArgs = { + niveumPackages = inputs.self.packages.${system}; + inherit inputs; + }; + modules = [ + { + _module.args.nixinate = { + host = "kabsa"; + sshUser = "root"; + buildOn = "remote"; + substituteOnTarget = true; + hermetic = false; + }; + } + systems/kabsa/configuration.nix + agenix.nixosModules.default + retiolum.nixosModules.retiolum + home-manager.nixosModules.home-manager + nur.nixosModules.nur + ]; + }; }; - zaatar = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - { - _module.args.nixinate = { - host = "zaatar"; - sshUser = "root"; - buildOn = "remote"; - substituteOnTarget = true; - hermetic = false; - }; - } - systems/zaatar/configuration.nix - agenix.nixosModules.default - retiolum.nixosModules.retiolum - ]; + } + // flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { + inherit system; + overlays = [nur.overlay]; }; - makanek = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - # for using inputs in other config files - specialArgs = {inherit inputs;}; - modules = [ - { - _module.args.nixinate = { - host = "makanek"; - sshUser = "root"; - buildOn = "remote"; - substituteOnTarget = true; - hermetic = false; - }; - } - systems/makanek/configuration.nix - agenix.nixosModules.default - retiolum.nixosModules.retiolum - nur.nixosModules.nur - ]; + wrapScript = { + packages ? [], + name, + script, + }: + pkgs.writers.writeDashBin name ''PATH=$PATH:${nixpkgs.lib.makeBinPath (packages ++ [pkgs.findutils pkgs.coreutils pkgs.gnused pkgs.gnugrep])} ${script} "$@"''; + in { + packages = { + auc = pkgs.callPackage packages/auc.nix {}; + betacode = pkgs.callPackage packages/betacode.nix {}; + cheat-sh = pkgs.callPackage packages/cheat-sh.nix {}; + closest = pkgs.callPackage packages/closest {}; + cyberlocker-tools = pkgs.callPackage packages/cyberlocker-tools.nix {}; + default-gateway = pkgs.callPackage packages/default-gateway.nix {}; + depp = pkgs.callPackage packages/depp.nix {}; + devanagari = pkgs.callPackage packages/devanagari {}; + devour = pkgs.callPackage packages/devour.nix {}; + dic = pkgs.callPackage packages/dic.nix {}; + dirmir = pkgs.callPackage packages/dirmir.nix {}; + dmenu-bluetooth = pkgs.callPackage packages/dmenu-bluetooth.nix {}; + dmenu-scrot = pkgs.callPackage packages/dmenu-scrot.nix {}; + dns-sledgehammer = pkgs.callPackage packages/dns-sledgehammer.nix {}; + fkill = pkgs.callPackage packages/fkill.nix {}; + fzfmenu = pkgs.callPackage packages/fzfmenu.nix {}; + genius = pkgs.callPackage packages/genius.nix {}; + gfs-fonts = pkgs.callPackage packages/gfs-fonts.nix {}; + git-preview = pkgs.callPackage packages/git-preview.nix {}; + hc = pkgs.callPackage packages/hc.nix {}; + heuretes = pkgs.callPackage packages/heuretes.nix {}; + htgen = pkgs.callPackage packages/htgen.nix {}; + image-convert-favicon = pkgs.callPackage packages/image-convert-favicon.nix {}; + image-convert-tolino = pkgs.callPackage packages/image-convert-tolino.nix {}; + infschmv = pkgs.callPackage packages/infschmv.nix {}; + iolanguage = pkgs.callPackage packages/iolanguage.nix {}; + ipa = pkgs.writers.writePython3Bin "ipa" {flakeIgnore = ["E501"];} (builtins.readFile packages/ipa.py); + ix = pkgs.callPackage packages/ix.nix {}; + jsesh = pkgs.callPackage packages/jsesh.nix {}; + k-lock = pkgs.callPackage packages/k-lock.nix {}; + kirciuoklis = pkgs.callPackage packages/kirciuoklis.nix {}; + klem = pkgs.callPackage packages/klem.nix {}; + kpaste = pkgs.callPackage packages/kpaste.nix {}; + literature-quote = pkgs.callPackage packages/literature-quote.nix {}; + mahlzeit = pkgs.haskellPackages.callPackage packages/mahlzeit.nix {}; + man-pandoc = pkgs.callPackage packages/man/pandoc.nix {}; + man-pdf = pkgs.callPackage packages/man-pdf.nix {}; + mansplain = pkgs.callPackage packages/mansplain.nix {}; + manual-sort = pkgs.callPackage packages/manual-sort.nix {}; + menu-calc = pkgs.callPackage packages/menu-calc.nix {}; + meteo = pkgs.callPackage packages/meteo.nix {}; + mpv-radio = pkgs.callPackage packages/mpv-radio.nix {di-fm-key-file = "/dev/null";}; + mpv-tv = pkgs.callPackage packages/mpv-tv.nix {}; + mpv-visualizer = pkgs.callPackage packages/mpv-visualizer.nix {}; + new-mac = pkgs.callPackage packages/new-mac.nix {}; + nix-git = pkgs.callPackage packages/nix-git.nix {}; + nix-index-update = pkgs.callPackage packages/nix-index-update.nix {inherit system;}; + opustags = pkgs.callPackage packages/opustags.nix {}; + pls = pkgs.callPackage packages/pls.nix {}; + qrpaste = pkgs.callPackage packages/qrpaste.nix {}; + rfc = pkgs.callPackage packages/rfc.nix {}; + scanned = pkgs.callPackage packages/scanned.nix {}; + swallow = pkgs.callPackage packages/swallow.nix {}; + text2pdf = pkgs.callPackage packages/text2pdf.nix {}; + timer = pkgs.callPackage packages/timer.nix {}; + tocharian-font = pkgs.callPackage packages/tocharian-font.nix {}; + trans = pkgs.callPackage packages/trans.nix {}; + ttspaste = pkgs.callPackage packages/ttspaste.nix {}; + unicodmenu = pkgs.callPackage packages/unicodmenu.nix {}; + untilport = pkgs.callPackage packages/untilport.nix {}; + vg = pkgs.callPackage packages/vg.nix {}; + vimPlugins-cheat-sh-vim = pkgs.callPackage packages/vimPlugins/cheat-sh.nix {}; + vimPlugins-icalendar-vim = pkgs.callPackage packages/vimPlugins/icalendar-vim.nix {}; + vimPlugins-jq-vim = pkgs.callPackage packages/vimPlugins/jq-vim.nix {}; + vimPlugins-vim-256noir = pkgs.callPackage packages/vimPlugins/vim-256noir.nix {}; + vimPlugins-vim-colors-paramount = pkgs.callPackage packages/vimPlugins/vim-colors-paramount.nix {}; + vimPlugins-vim-fetch = pkgs.callPackage packages/vimPlugins/vim-fetch.nix {}; + vimPlugins-vim-fsharp = pkgs.callPackage packages/vimPlugins/vim-fsharp.nix {}; + vimPlugins-vim-mail = pkgs.callPackage packages/vimPlugins/vim-mail.nix {}; + vimPlugins-vim-reason-plus = pkgs.callPackage packages/vimPlugins/vim-reason-plus.nix {}; + vimv = pkgs.callPackage packages/vimv.nix {}; + weechat-declarative = pkgs.callPackage packages/weechat-declarative.nix {}; + weechatScripts-hotlist2extern = pkgs.callPackage packages/weechatScripts/hotlist2extern.nix {}; + wttr = pkgs.callPackage packages/wttr.nix {}; + + booksplit = wrapScript { + script = inputs.voidrice.outPath + "/.local/bin/booksplit"; + name = "booksplit"; + packages = [pkgs.ffmpeg pkgs.glibc.bin]; + }; + dmenu-randr = wrapScript { + script = inputs.voidrice.outPath + "/.local/bin/displayselect"; + name = "dmenu-randr"; + packages = [pkgs.dmenu pkgs.bc pkgs.psmisc pkgs.util-linux pkgs.xorg.xrandr pkgs.gawk pkgs.libnotify pkgs.arandr (pkgs.writers.writeDashBin "setbg" "")]; + }; + tag = wrapScript { + script = inputs.voidrice.outPath + "/.local/bin/tag"; + name = "tag"; + packages = [pkgs.ffmpeg]; + }; }; - tahina = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - systems/tahina/configuration.nix - agenix.nixosModules.default - retiolum.nixosModules.retiolum - ]; - }; - tabula = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - systems/tabula/configuration.nix - agenix.nixosModules.default - retiolum.nixosModules.retiolum - ]; - }; - manakish = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = {inherit inputs;}; - modules = [ - { - _module.args.nixinate = { - host = "manakish"; - sshUser = "root"; - buildOn = "remote"; - substituteOnTarget = true; - hermetic = false; - }; - } - systems/manakish/configuration.nix - agenix.nixosModules.default - retiolum.nixosModules.retiolum - home-manager.nixosModules.home-manager - nur.nixosModules.nur - ]; - }; - kabsa = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - specialArgs = {inherit inputs;}; - modules = [ - { - _module.args.nixinate = { - host = "kabsa"; - sshUser = "root"; - buildOn = "remote"; - substituteOnTarget = true; - hermetic = false; - }; - } - systems/kabsa/configuration.nix - agenix.nixosModules.default - retiolum.nixosModules.retiolum - home-manager.nixosModules.home-manager - nur.nixosModules.nur - ]; - }; - }; - }; + }); } diff --git a/packages/scripts/auc.nix b/packages/auc.nix similarity index 100% rename from packages/scripts/auc.nix rename to packages/auc.nix diff --git a/packages/betacode.nix b/packages/betacode.nix new file mode 100644 index 0000000..01cb8a4 --- /dev/null +++ b/packages/betacode.nix @@ -0,0 +1,16 @@ +{ + writers, + haskell, + haskellPackages, +}: +writers.writeHaskellBin "betacode" { + libraries = [ + (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) +'' diff --git a/packages/cheat-sh.nix b/packages/cheat-sh.nix new file mode 100644 index 0000000..334ce07 --- /dev/null +++ b/packages/cheat-sh.nix @@ -0,0 +1,9 @@ +# https://nitter.net/igor_chubin/status/1557793569104183298 +{ + writers, + curl, +}: +writers.writeDashBin "so" '' + IFS=+ + ${curl}/bin/curl -sSL http://cht.sh/"$*" +'' diff --git a/packages/closest/default.nix b/packages/closest/default.nix new file mode 100644 index 0000000..cc24ac9 --- /dev/null +++ b/packages/closest/default.nix @@ -0,0 +1,18 @@ +{ + writers, + fetchurl, + haskellPackages, +}: +writers.writeDashBin "closest" '' + ${ + writers.writeHaskellBin "closest" { + libraries = with haskellPackages; [parallel optparse-applicative edit-distance]; + ghcArgs = ["-O3" "-threaded"]; + } (builtins.readFile ./distance.hs) + }/bin/closest +RTS -N4 -RTS --dictionary ${ + fetchurl { + url = "https://gist.github.com/MarvinJWendt/2f4f4154b8ae218600eb091a5706b5f4/raw/36b70dd6be330aa61cd4d4cdfda6234dcb0b8784/wordlist-german.txt"; + sha256 = "0vr4lmlckgvj4s8sk502sknq9pf3297rvasj5sqqm05zzbdgpppj"; + } + } "$@" +'' diff --git a/packages/scripts/distance.hs b/packages/closest/distance.hs similarity index 100% rename from packages/scripts/distance.hs rename to packages/closest/distance.hs diff --git a/packages/daybook.nix b/packages/daybook.nix deleted file mode 100644 index 93038fd..0000000 --- a/packages/daybook.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - lib, - stdenv, - makeWrapper, - pandoc, - fetchFromGitHub, -}: -stdenv.mkDerivation { - name = "daybook"; - src = fetchFromGitHub { - owner = "kmein"; - repo = "daybook"; - rev = "db2c34830e09183c80f3381bf5e4c44d52f05d53"; - sha256 = "0nbsv8f12qh5spq7zhimhdf3p7msk33xrb0ilqvlc6jmlkpislmv"; - }; - nativeBuildInputs = [makeWrapper]; - buildInputs = [pandoc]; - buildPhase = '' - mkdir -p $out/man/man1 - pandoc --standalone --to man daybook.1.md -o $out/man/man1/daybook.1 - ''; - installPhase = '' - mkdir -p $out/bin - install daybook $out/bin - wrapProgram $out/bin/daybook --prefix PATH ":" ${pandoc}/bin ; - ''; - meta = with lib; { - homepage = https://github.com/kmein/daybook; - description = "A diary writing utility in sh"; - license = licenses.mit; - platforms = platforms.linux; - }; -} diff --git a/packages/default-gateway.nix b/packages/default-gateway.nix new file mode 100644 index 0000000..87e4b9c --- /dev/null +++ b/packages/default-gateway.nix @@ -0,0 +1,8 @@ +{ + writers, + iproute2, + jq, +}: +writers.writeDashBin "default-gateway" '' + ${iproute2}/bin/ip -json route | ${jq}/bin/jq --raw-output '.[0].gateway' +'' diff --git a/packages/dirmir.nix b/packages/dirmir.nix new file mode 100644 index 0000000..c8745e2 --- /dev/null +++ b/packages/dirmir.nix @@ -0,0 +1,24 @@ +{writers}: +writers.writeDashBin "dirmir" '' + SOURCE="$1" + TARGET="$2" + + if [ ! -d "$SOURCE" ] || [ $# -ne 2 ]; then + echo >/dev/stderr "Usage: dirmir SOURCE TARGET" + exit 1 + fi + + if [ -e "$TARGET" ]; then + echo >/dev/stderr "$TARGET" already exists. Please use a different name. + exit 1 + fi + + find "$SOURCE" | while read -r entry; do + if [ -d "$entry" ]; then + mkdir -p "$TARGET/$entry" + else + # create a file with the same permissions as $entry + install -m "$(stat -c %a "$entry")" /dev/null "$TARGET/$entry" + fi + done +'' diff --git a/packages/dmenu-bluetooth.nix b/packages/dmenu-bluetooth.nix new file mode 100644 index 0000000..971c478 --- /dev/null +++ b/packages/dmenu-bluetooth.nix @@ -0,0 +1,64 @@ +{ + writers, + libnotify, + dmenu, + bluez5, + lib, +}: +writers.writeDashBin "dmenu-bluetooth" '' + # UI for connecting to bluetooth devices + set -efu + PATH=$PATH=${lib.makeBinPath [libnotify dmenu bluez5]} + + bluetooth_notify() { + notify-send --app-name=" Bluetooth" "$@" + } + + chose_device() { + # the output from `bluetoothctl {paired-,}devices` has a first column which always contains `Device` followed by a MAC address and the device name + cut -d ' ' -f2- | dmenu -i -l 5 -p "Bluetooth device" + } + + bluetoothctl scan on & + + case "$(printf "pair\nconnect\ndisconnect" | dmenu -i)" in + pair) + chosen="$(bluetoothctl devices | chose_device)" + chosen_name="$(echo "$chosen" | cut -d ' ' -f2-)" + + bluetooth_notify "$chosen_name" "Pairing ..." + + if bluetoothctl pair "$(echo "$chosen" | cut -d ' ' -f1)"; then + bluetooth_notify "✔ $chosen_name" "Paired with device." + else + test "$chosen" && bluetooth_notify "❌ $chosen_name" "Failed to pair with device." + fi + ;; + + connect) + chosen="$(bluetoothctl paired-devices | chose_device)" + chosen_name="$(echo "$chosen" | cut -d ' ' -f2-)" + + bluetooth_notify "$chosen_name" "Trying to connect ..." + + if bluetoothctl connect "$(echo "$chosen" | cut -d ' ' -f1)"; then + bluetooth_notify "✔ $chosen_name" "Connected to device." + else # something was selected but it didn't work + test "$chosen" && bluetooth_notify "❌ $chosen_name" "Failed to connect to device." + fi + ;; + + disconnect) + chosen="$(bluetoothctl paired-devices | chose_device)" + chosen_name="$(echo "$chosen" | cut -d ' ' -f2-)" + + bluetooth_notify "$chosen_name" "Disconnecting ..." + + if bluetoothctl disconnect "$(echo "$chosen" | cut -d ' ' -f1)"; then + bluetooth_notify "✔ $chosen_name" "Disconnected from device." + else # something was selected but it didn't work + test "$chosen" && bluetooth_notify "❌ $chosen_name" "Failed to disconnect from device." + fi + ;; + esac +'' diff --git a/packages/dmenu-scrot.nix b/packages/dmenu-scrot.nix new file mode 100644 index 0000000..6d89351 --- /dev/null +++ b/packages/dmenu-scrot.nix @@ -0,0 +1,42 @@ +{ + writers, + lib, + dmenu, + scrot, + libnotify, + xclip, + screenshotsDirectory ? "/tmp", +}: +writers.writeDashBin "dmenu-scrot" '' + # ref https://gitlab.com/dwt1/dotfiles/-/blob/master/.dmenu/dmenu-scrot.sh + PATH=$PATH:${lib.makeBinPath [dmenu scrot libnotify xclip]} + + APP_NAME="📸 Scrot" + IMG_PATH="${screenshotsDirectory}" + TIME=3000 #Miliseconds notification should remain visible + + cmd=$(printf "fullscreen\nsection\nupload_fullscreen\nupload_section\n" | dmenu -p 'Screenshot') + + cd "$IMG_PATH" || exit + case ''${cmd%% *} in + fullscreen) + scrot -d 1 \ + && notify-send -u low -t $TIME -a "$APP_NAME" 'Screenshot (full screen) saved.' + ;; + + section) + scrot -s \ + && notify-send -u low -t $TIME -a "$APP_NAME" 'Screenshot (section) saved.' + ;; + + upload_fullscreen) + scrot -d 1 -e "kpaste < \$f" | tail --lines=1 | xclip -selection clipboard -in \ + && notify-send -u low -t $TIME -a "$APP_NAME" "Screenshot (full screen) uploaded: $(xclip -selection clipboard -out)" + ;; + + upload_section) + scrot -s -e "kpaste < \$f" | tail --lines=1 | xclip -selection clipboard -in \ + && notify-send -u low -t $TIME -a "$APP_NAME" "Screenshot (section) uploaded: $(xclip -selection clipboard -out)" + ;; + esac +'' diff --git a/packages/dns-sledgehammer.nix b/packages/dns-sledgehammer.nix new file mode 100644 index 0000000..885f979 --- /dev/null +++ b/packages/dns-sledgehammer.nix @@ -0,0 +1,7 @@ +{ + writers, + coreutils, +}: +writers.writeDashBin "dns-sledgehammer" '' + ${coreutils}/bin/printf '%s\n' 'nameserver 1.1.1.1' 'options edns0' > /etc/resolv.conf +'' diff --git a/packages/fkill.nix b/packages/fkill.nix new file mode 100644 index 0000000..19000b0 --- /dev/null +++ b/packages/fkill.nix @@ -0,0 +1,22 @@ +{ + writers, + lib, + procps, + gawk, + gnused, + fzf, +}: +writers.writeBashBin "fkill" '' + PATH=$PATH:${lib.makeBinPath [procps gawk gnused fzf]} + + if [ "$UID" != "0" ]; then + pid=$(ps -f -u "$UID" | sed 1d | fzf -m | awk '{print $2}') + else + pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') + fi + + if [ "x$pid" != "x" ] + then + echo "$pid" | xargs kill "-''${1:-9}" + fi +'' diff --git a/packages/fzfmenu.nix b/packages/fzfmenu.nix new file mode 100644 index 0000000..8ebbd95 --- /dev/null +++ b/packages/fzfmenu.nix @@ -0,0 +1,53 @@ +{ + st, + fzf, + writers, + dash, + lib, +}: +writers.writeBashBin "fzfmenu" '' + # fzfmenu - fzf as dmenu replacement + # https://github.com/junegunn/fzf/wiki/Examples#fzf-as-dmenu-replacement + set -efu + + PATH=$PATH:${lib.makeBinPath [st fzf dash]} + + input=$(mktemp -u --suffix .fzfmenu.input) + output=$(mktemp -u --suffix .fzfmenu.output) + mkfifo "$input" + mkfifo "$output" + chmod 600 "$input" "$output" + + for i in "$@"; do + case $i in + -p) + PROMPT="$2" + shift + shift + break ;; + -l) + # no reason to filter number of lines + shift + shift + break ;; + -i) + # we do this anyway + shift + break ;; + *) + echo "Unknown option $1" >&2 + shift ;; + esac + done + + # it's better to use st here (starts a lot faster than pretty much everything else) + st -c fzfmenu -n fzfmenu -g 85x10 \ + -e dash \ + -c "cat $input | fzf --reverse --prompt="''${PROMPT+> }" --print-query $* | tee $output" & disown + + # handle ctrl+c outside child terminal window + trap 'kill $! 2>/dev/null; rm -f $input $output' EXIT + + cat > "$input" + cat "$output" +'' diff --git a/packages/genius.nix b/packages/genius.nix new file mode 100644 index 0000000..1e4b718 --- /dev/null +++ b/packages/genius.nix @@ -0,0 +1,28 @@ +{ + writers, + curl, + coreutils, + gnused, + pandoc, +}: +writers.writeDashBin "genius" '' + ${coreutils}/bin/test "$#" -eq 2 || ( + echo "usage: $0 " + exit 1 + ) + + normalize() { + ${coreutils}/bin/tr -d -c '0-9A-Za-z ' | ${coreutils}/bin/tr ' ' - | ${coreutils}/bin/tr '[:upper:]' '[:lower:]' + } + + ARTIST=$(echo "$1" | normalize | ${gnused}/bin/sed 's/./\U&/') + TITLE=$(echo "$2" | normalize) + GENIUS_URL="https://genius.com/$ARTIST-$TITLE-lyrics" + + ${curl}/bin/curl -s "$GENIUS_URL" \ + | ${gnused}/bin/sed -ne '/class="lyrics"/,/<\/p>/p' \ + | ${pandoc}/bin/pandoc -f html -s -t plain \ + | ${gnused}/bin/sed 's/^_/\x1b[3m/g;s/_$/\x1b[0m/g;s/^\[/\n\x1b\[1m\[/g;s/\]$/\]\x1b[0m/g' + + printf "\n%s\n" "$GENIUS_URL" >/dev/stderr +'' diff --git a/packages/gourmet.nix b/packages/gourmet.nix deleted file mode 100644 index 17d946a..0000000 --- a/packages/gourmet.nix +++ /dev/null @@ -1,14 +0,0 @@ -# { stdenv, python }: -{pkgs ? import {}}: -with pkgs; -with pkgs.python2Packages; - buildPythonApplication rec { - pname = "gourmet"; - version = "0.17.4"; - src = builtins.fetchTarball { - url = "https://github.com/thinkle/gourmet/archive/${version}.tar.gz"; - }; - buildInputs = [distutils_extra intltool]; - propagatedBuildInputs = [sqlalchemy reportlab lxml]; - meta = with stenv.lib; {maintainers = with maintainers; [kmein];}; - } diff --git a/packages/heuretes.nix b/packages/heuretes.nix new file mode 100644 index 0000000..e726d4c --- /dev/null +++ b/packages/heuretes.nix @@ -0,0 +1,13 @@ +{ + writers, + fetchurl, + xsv, +}: let + database = fetchurl { + url = "http://c.krebsco.de/greek.csv"; + hash = "sha256-SYL10kerNI0HzExG6JXh765+CBBCHLO95B6OKErQ/sU="; + }; +in + writers.writeDashBin "heuretes" '' + ${xsv}/bin/xsv search -s simple "^$*$" ${database} | ${xsv}/bin/xsv table + '' diff --git a/packages/image-convert-favicon.nix b/packages/image-convert-favicon.nix new file mode 100644 index 0000000..452d63e --- /dev/null +++ b/packages/image-convert-favicon.nix @@ -0,0 +1,7 @@ +{ + writers, + imagemagick, +}: +writers.writeDashBin "image-convert-favicon" '' + ${imagemagick}/bin/convert "$1" -define icon:auto-resize=64,48,32,16 "''${2-favicon.ico}" +'' diff --git a/packages/image-convert-tolino.nix b/packages/image-convert-tolino.nix new file mode 100644 index 0000000..454e0da --- /dev/null +++ b/packages/image-convert-tolino.nix @@ -0,0 +1,14 @@ +{ + writers, + imagemagick, +}: +writers.writeDashBin "image-convert-tolino" '' + source_image="$1" + + if [ -e "$source_image" ]; then + ${imagemagick}/bin/convert -type Grayscale -resize 758x1024 "$source_image" "suspend.jpg" + else + echo >/dev/stderr "$1 must exist." + exit 1 + fi +'' diff --git a/packages/infschmv.nix b/packages/infschmv.nix new file mode 100644 index 0000000..f2d294e --- /dev/null +++ b/packages/infschmv.nix @@ -0,0 +1,13 @@ +{ + writers, + pup, + curl, + pandoc, + man, +}: +writers.writeDashBin "InfSchMV" '' + ${curl}/bin/curl -sSL https://www.berlin.de/corona/massnahmen/verordnung/ \ + | ${pup}/bin/pup .textile \ + | ${pandoc}/bin/pandoc -f html -t man -s \ + | ${man}/bin/man -l - +'' diff --git a/packages/scripts/ipa.py b/packages/ipa.py old mode 100755 new mode 100644 similarity index 99% rename from packages/scripts/ipa.py rename to packages/ipa.py index 95ef73f..2aeba9d --- a/packages/scripts/ipa.py +++ b/packages/ipa.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python3 import sys # https://www.phon.ucl.ac.uk/home/sampa/x-sampa.htm diff --git a/packages/scripts/k-lock.nix b/packages/k-lock.nix similarity index 100% rename from packages/scripts/k-lock.nix rename to packages/k-lock.nix diff --git a/packages/kirciuoklis.nix b/packages/kirciuoklis.nix new file mode 100644 index 0000000..ec3a9d6 --- /dev/null +++ b/packages/kirciuoklis.nix @@ -0,0 +1,17 @@ +{ + writers, + curl, + jq, +}: +writers.writeDashBin "kirciuoklis" '' + ${curl}/bin/curl -sSL 'https://kalbu.vdu.lt/wp-admin/admin-ajax.php' -F action=text_accents -F body="$(cat)" \ + | ${jq}/bin/jq -r .message \ + | if [ "$1" = "--json" ] + then ${jq}/bin/jq .textParts + else ${jq}/bin/jq -r ' + .textParts + | map(if has("accented") then .accented else .string end) + | join("") + ' + fi +'' diff --git a/packages/scripts/klem.nix b/packages/klem.nix similarity index 100% rename from packages/scripts/klem.nix rename to packages/klem.nix diff --git a/packages/libcoap.nix b/packages/libcoap.nix deleted file mode 100644 index 5157628..0000000 --- a/packages/libcoap.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - lib, - pkg-config, - fetchFromGitHub, - automake, - autoconf, - which, - libtool, - stdenv, - gnutls, - doxygen, - asciidoc, - tls ? false, - docs ? true, -}: -stdenv.mkDerivation { - name = "libcoap"; - version = "unstable-2021-05-28"; - src = fetchFromGitHub { - repo = "libcoap"; - owner = "obgm"; - rev = "62b2be4da1d0fdf4b7217487ee83dc5920174425"; - sha256 = "1igjv0hbwmakdccp5in4gw9w2p5swxdwsdx0glyna2s29sh1d37x"; - fetchSubmodules = true; - }; - buildInputs = - [which pkg-config automake autoconf libtool] - ++ lib.optionals docs [doxygen asciidoc] - ++ lib.optional tls gnutls; - # preConfigure = "./autogen.sh"; - # configureFlags = lib.optional (!docs) "--disable-documentation" ++ lib.optional tls "--enable-dtls"; - configurePhase = '' - ./autogen.sh || : - ./configure --enable-dtls --prefix=$out - ''; - buildPhase = "make"; - installPhase = "make install"; - meta = with lib; { - homepage = "https://github.com/obgm/libcoap"; - description = "A CoAP (RFC 7252) implementation in C"; - platforms = platforms.linux; - license = licenses.bsd2; - maintainers = [maintainers.kmein]; - }; -} diff --git a/packages/literature-quote.nix b/packages/literature-quote.nix new file mode 100644 index 0000000..38eb3b8 --- /dev/null +++ b/packages/literature-quote.nix @@ -0,0 +1,19 @@ +{ + writers, + lib, + xsv, + curl, + gnused, +}: +writers.writeDashBin "literature-quote" '' + PATH=$PATH:${lib.makeBinPath [xsv curl gnused]} + ROW=$(curl -Ls http://kmein.github.io/logotheca/quotes.csv | shuf -n1) + + ( + printf '%s\n\n— %s: _%s_, %s\n' \ + "$(echo "$ROW" | xsv select 4)" \ + "$(echo "$ROW" | xsv select 1)" \ + "$(echo "$ROW" | xsv select 2)" \ + "$(echo "$ROW" | xsv select 3 | tr : ,)" + ) | sed 's/ | /\n/g;s/ || /\n\n/g;s/"\(.*\)"/\1/' +'' diff --git a/packages/man-pdf.nix b/packages/man-pdf.nix new file mode 100644 index 0000000..947e92a --- /dev/null +++ b/packages/man-pdf.nix @@ -0,0 +1,10 @@ +{ + writers, + ghostscript, + man-db, + gnused, +}: +writers.writeDashBin "man-pdf" '' + set -efu + ${man-db}/bin/man -t "$@" | ${ghostscript}/bin/ps2pdf - "$(echo "$*" | ${gnused}/bin/sed 's/\s\+/_/g').pdf" +'' diff --git a/packages/mansplain.nix b/packages/mansplain.nix new file mode 100644 index 0000000..2668f93 --- /dev/null +++ b/packages/mansplain.nix @@ -0,0 +1,18 @@ +# https://www.youtube.com/watch?v=8E8sUNHdzG8 +{ + writers, + man-db, + dmenu, + gnused, + findutils, + coreutils, + zathura, +}: +writers.writeDashBin "mansplain" '' + ${man-db}/bin/man -k . \ + | ${coreutils}/bin/cut -d" " -f1,2 \ + | ${dmenu}/bin/dmenu -l 5 \ + | ${gnused}/bin/sed 's/\(.*\) (\(.*\))/\2 \1/' \ + | ${findutils}/bin/xargs -r ${man-db}/bin/man -t \ + | ${zathura}/bin/zathura - +'' diff --git a/packages/manual-sort.nix b/packages/manual-sort.nix new file mode 100644 index 0000000..c8b51c8 --- /dev/null +++ b/packages/manual-sort.nix @@ -0,0 +1,30 @@ +{writers}: +writers.writeHaskellBin "manual-sort" {} '' + {-# LANGUAGE LambdaCase #-} + import Data.Char (toLower) + import System.Environment (getArgs) + import System.IO (BufferMode(NoBuffering), hSetBuffering, stdout) + + insertionSortM :: Monad f => (a -> a -> f Ordering) -> [a] -> f [a] + insertionSortM cmp = foldr ((=<<) . insertByM cmp) (pure []) + where + insertByM cmp x = \case + [] -> pure [x] + yys@(y : ys) -> cmp x y >>= \case + GT -> (y :) <$> insertByM cmp x ys + _ -> pure (x : yys) + + ask :: Show a => a -> a -> IO Ordering + ask a b = do + putStr (show a ++ " > " ++ show b ++ "? (y/n) ") + map toLower <$> getLine >>= \case + 'y' : _ -> return GT + _ -> return LT + + main :: IO () + main = do + hSetBuffering stdout NoBuffering + argv <- getArgs + sorted <- insertionSortM ask argv + mapM_ (\(place, thing) -> putStrLn (show place ++ ". " ++ show thing)) $ zip [1 ..] (reverse sorted) +'' diff --git a/packages/menu-calc.nix b/packages/menu-calc.nix new file mode 100644 index 0000000..c1c71c4 --- /dev/null +++ b/packages/menu-calc.nix @@ -0,0 +1,21 @@ +{ + writers, + gnused, + pari, + dmenu, + xclip, +}: +writers.writeDashBin "=" '' + # https://github.com/onespaceman/menu-calc + + answer=$(echo "$@" | ${pari}/bin/gp -q | ${gnused}/bin/sed '/\./ s/\.\{0,1\}0\{1,\}$//') + + action=$(printf "copy\nclear" | ${dmenu}/bin/dmenu -p "= $answer") + + case $action in + "clear") $0 ;; + "copy") printf %s "$answer" | ${xclip}/bin/xclip -selection clipboard;; + "") ;; + *) $0 "$answer $action" ;; + esac +'' diff --git a/packages/meteo.nix b/packages/meteo.nix new file mode 100644 index 0000000..12ad97c --- /dev/null +++ b/packages/meteo.nix @@ -0,0 +1,89 @@ +{ + writers, + lib, + jq, + curl, + xdotool, + nsxiv, + gnused, + defaultStation ? 103840, +}: +writers.writeDashBin "meteo" '' + # usage: meteo --list + # usage: meteo --update + # usage: meteo STATION + set -efu + + PATH=$PATH:${lib.makeBinPath [jq curl xdotool nsxiv gnused]} + + # TODO XDG + CONFIG_DIR=$HOME/.config/wetter + STATIONS_FILE=$CONFIG_DIR/stations.json + + case ''${1-} in + --list) + sed -n 's/^\s*\(--[^)]\+\))$/\1/p' "$0" + jq -r -n \ + --slurpfile stations_file "$STATIONS_FILE" \ + ' + $stations_file[0] as $known_stations | + + $known_stations | keys[] + ' + exit + ;; + --update) + mkdir -p "$(dirname "$STATIONS_FILE")" + exec >"$STATIONS_FILE" + + curl -fsSL http://wetterstationen.meteomedia.de/ | + jq -Rrs ' + def decodeHTML: + gsub("ä";"ä") | + gsub("ö";"ö") | + gsub("ü";"ü") | + gsub("Ä";"Ä") | + gsub("Ö";"Ö") | + gsub("Ü";"Ü") | + gsub("ß";"ß") + ; + [ + match(".*";"g") + .captures | + map({"\(.name)":(.string)}) | + add | + {"\(.name|decodeHTML)":(.station|tonumber)} + ] | + add + ' + exit + ;; + esac + + # set -x + + station=''${1-${toString defaultStation}} + station=$(jq -e -n \ + --arg station "$station" \ + --slurpfile stations_file "$STATIONS_FILE" \ + ' + $stations_file[0] as $known_stations | + + $station | + if test("^[0-9]+$") then + tonumber + else + $known_stations[.] + end + ') + cache="/tmp/''${LOGNAME}_wetter_$station.png" + curl -sSL \ + "http://wetterstationen.meteomedia.de/messnetz/vorhersagegrafik/$station.png" \ + -o "$cache" + + if window_id=$(xdotool search --name "^nsxiv - $cache$"); then + xdotool key --window "$window_id" r + else + nsxiv "$cache" & + fi +'' diff --git a/packages/mpv-radio.nix b/packages/mpv-radio.nix new file mode 100644 index 0000000..c01acf8 --- /dev/null +++ b/packages/mpv-radio.nix @@ -0,0 +1,29 @@ +{ + writeText, + lib, + writers, + mpv, + dmenu, + coreutils, + gnused, + di-fm-key-file, +}: let + streams = import ../lib/streams.nix { + di-fm-key = "%DI_FM_KEY%"; + }; + streams-tsv = writeText "streams.tsv" (lib.concatMapStringsSep "\n" ({ + desc ? "", + stream, + station, + ... + }: "${station}\t${desc}\t${stream}") + streams); +in + writers.writeDashBin "mpv-radio" '' + export DI_FM_KEY=$(cat "${di-fm-key-file}") + exec ${mpv}/bin/mpv --force-window=yes "$( + ${dmenu}/bin/dmenu -i -l 5 < ${streams-tsv} \ + | ${coreutils}/bin/cut -f3 \ + | ${gnused}/bin/sed s/%DI_FM_KEY%/"$DI_FM_KEY"/ + )" + '' diff --git a/packages/scripts/mpv-tv.nix b/packages/mpv-tv.nix similarity index 100% rename from packages/scripts/mpv-tv.nix rename to packages/mpv-tv.nix diff --git a/packages/mpv-visualizer.nix b/packages/mpv-visualizer.nix index 5019abc..cca7b87 100644 --- a/packages/mpv-visualizer.nix +++ b/packages/mpv-visualizer.nix @@ -30,7 +30,6 @@ stdenvNoCC.mkDerivation rec { meta = with lib; { description = "various audio visualization"; homepage = "https://github.com/mfcc64/mpv-scripts"; - license = licenses.unfree; platforms = platforms.all; maintainers = with maintainers; [kmein]; }; diff --git a/packages/new-mac.nix b/packages/new-mac.nix new file mode 100644 index 0000000..c6cb3f0 --- /dev/null +++ b/packages/new-mac.nix @@ -0,0 +1,23 @@ +{ + openssl, + writers, + gnused, + iproute2, + jq, +}: +writers.writeDashBin "new-mac" '' + random_mac() { + ${openssl}/bin/openssl rand -hex 6 | ${gnused}/bin/sed 's/\(..\)/\1:/g; s/.$//' + } + + change_mac() { + old_mac="$(${iproute2}/bin/ip -j link show "$interface" | ${jq}/bin/jq -r '.[].address')" + new_mac="$(random_mac)" + ${iproute2}/bin/ip link set "$interface" address "$new_mac" 2>/dev/null && echo "$old_mac -> $new_mac" + } + + interface="''${1:-wlp3s0}" + ${iproute2}/bin/ip link set "$interface" down + until change_mac; do :; done + ${iproute2}/bin/ip link set "$interface" up +'' diff --git a/packages/nix-git.nix b/packages/nix-git.nix new file mode 100644 index 0000000..efb1a0b --- /dev/null +++ b/packages/nix-git.nix @@ -0,0 +1,9 @@ +{ + writers, + nix-prefetch-git, + jq, +}: +writers.writeDashBin "nix-git" '' + ${nix-prefetch-git}/bin/nix-prefetch-git "$@" 2> /dev/null \ + | ${jq}/bin/jq -r '"rev = \"\(.rev)\";\nsha256 = \"\(.sha256)\";"' +'' diff --git a/packages/nix-index-update.nix b/packages/nix-index-update.nix new file mode 100644 index 0000000..29719cf --- /dev/null +++ b/packages/nix-index-update.nix @@ -0,0 +1,13 @@ +{ + writers, + wget, + system, +}: +writers.writeDashBin "nix-index-update" '' + filename="index-${system}" + mkdir -p ~/.cache/nix-index + cd ~/.cache/nix-index + # -N will only download a new version if there is an update. + ${wget}/bin/wget -q -N https://github.com/Mic92/nix-index-database/releases/latest/download/$filename + ln -f $filename files +'' diff --git a/packages/scripts/pls.nix b/packages/pls.nix old mode 100755 new mode 100644 similarity index 72% rename from packages/scripts/pls.nix rename to packages/pls.nix index f21ba58..d501504 --- a/packages/scripts/pls.nix +++ b/packages/pls.nix @@ -1,12 +1,15 @@ { - config, - pkgs, lib, + writers, + miller, + gnused, + curl, + nur, }: let playlistAPI = "https://radio.lassul.us"; - sendIRC = pkgs.writers.writeDash "send-irc" '' - ${config.nur.repos.mic92.ircsink}/bin/ircsink \ + sendIRC = writers.writeDash "send-irc" '' + ${nur.repos.mic92.ircsink}/bin/ircsink \ --nick musikkritiker \ --server irc.hackint.org \ --port 6697 \ @@ -48,14 +51,14 @@ "idk man" ]; in - pkgs.writers.writeDashBin "pls" '' + writers.writeDashBin "pls" '' case "$1" in good|like|cool|nice|noice|top|yup|yass|yes|+) - ${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/good" + ${curl}/bin/curl -sS -XPOST "${playlistAPI}/good" echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.good)} | shuf -n1 | ${sendIRC} ;; skip|next|bad|sucks|no|nope|flop|-) - ${pkgs.curl}/bin/curl -sS -XPOST "${playlistAPI}/skip" + ${curl}/bin/curl -sS -XPOST "${playlistAPI}/skip" echo ${lib.escapeShellArg (lib.concatStringsSep "\n" messages.bad)} | shuf -n1 | ${sendIRC} ;; 0|meh|neutral) @@ -66,12 +69,12 @@ in echo "$@" | ${sendIRC} ;; recent) - ${pkgs.curl}/bin/curl -sS -XGET "${playlistAPI}/recent" | tac | head + ${curl}/bin/curl -sS -XGET "${playlistAPI}/recent" | tac | head ;; *) - ${pkgs.curl}/bin/curl -sS -XGET "${playlistAPI}/current" \ - | ${pkgs.miller}/bin/mlr --ijson --oxtab cat \ - | ${pkgs.gnused}/bin/sed -n '/artist\|title\|youtube/p' + ${curl}/bin/curl -sS -XGET "${playlistAPI}/current" \ + | ${miller}/bin/mlr --ijson --oxtab cat \ + | ${gnused}/bin/sed -n '/artist\|title\|youtube/p' ;; esac wait diff --git a/packages/python3Packages/betacode/default.nix b/packages/python3Packages/betacode/default.nix deleted file mode 100644 index 9d6cb0c..0000000 --- a/packages/python3Packages/betacode/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - fetchPypi, - buildPythonPackage, - pygtrie, - ... -}: -buildPythonPackage rec { - pname = "betacode"; - version = "0.2"; - src = fetchPypi { - inherit pname version; - sha256 = "08fnjzjvnm9m6p4ddyr8qgfb9bs2nipv4ls50784v0xazgxx7siv"; - }; - preBuild = ''echo > README.rst''; - propagatedBuildInputs = [pygtrie]; - doCheck = false; -} diff --git a/packages/python3Packages/instaloader/default.nix b/packages/python3Packages/instaloader/default.nix deleted file mode 100644 index 6608916..0000000 --- a/packages/python3Packages/instaloader/default.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ - buildPythonApplication, - fetchPypi, - requests, -}: let -in - buildPythonApplication rec { - pname = "instaloader"; - version = "4.2.4"; - src = fetchPypi { - inherit pname version; - sha256 = "02zqb02idk2pzks7dv42vigcmmpjpfhfdyjp911yr0ix7dy3q0b9"; - }; - propagatedBuildInputs = [requests]; - doCheck = false; - } diff --git a/packages/python3Packages/pygtrie/default.nix b/packages/python3Packages/pygtrie/default.nix deleted file mode 100644 index 07f54ab..0000000 --- a/packages/python3Packages/pygtrie/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - fetchPypi, - buildPythonPackage, - ... -}: -buildPythonPackage rec { - pname = "pygtrie"; - version = "2.3"; - src = fetchPypi { - inherit pname version; - sha256 = "00x7q4p9r75zdnw3a8vd0d0w0i5l28w408g5bsfl787yv6b1h9i8"; - }; - doCheck = false; -} diff --git a/packages/python3Packages/spotify-cli-linux/default.nix b/packages/python3Packages/spotify-cli-linux/default.nix deleted file mode 100644 index 2d98612..0000000 --- a/packages/python3Packages/spotify-cli-linux/default.nix +++ /dev/null @@ -1,32 +0,0 @@ -{ - buildPythonPackage, - buildPythonApplication, - fetchPypi, - pytestrunner, - six, - beautifulsoup4, - requests, - dbus-python, -}: let - lyricwikia = buildPythonPackage rec { - pname = "lyricwikia"; - version = "0.1.9"; - src = fetchPypi { - inherit pname version; - sha256 = "0sa5wkbgp5bpgkl8hgn7byyz9zj0786647ikf2l0k8m4fimq623y"; - }; - buildInputs = [pytestrunner]; - propagatedBuildInputs = [six beautifulsoup4 requests]; - doCheck = false; - }; -in - buildPythonApplication rec { - pname = "spotify-cli-linux"; - version = "1.4.2"; - src = fetchPypi { - inherit pname version; - sha256 = "1gxich3v2i4lmh60abbw3mw15399afvvqflv8g6plvvbmvxmbgp0"; - }; - propagatedBuildInputs = [lyricwikia dbus-python]; - doCheck = false; - } diff --git a/packages/qrpaste.nix b/packages/qrpaste.nix new file mode 100644 index 0000000..d059b4e --- /dev/null +++ b/packages/qrpaste.nix @@ -0,0 +1,16 @@ +{ + writers, + mktemp, + qrencode, + xclip, + nsxiv, +}: +writers.writeDashBin "qrpaste" '' + file="$(${mktemp}/bin/mktemp --tmpdir)" + trap clean EXIT + clean() { + rm "$file" + } + ${qrencode}/bin/qrencode "$(${xclip}/bin/xclip -selection clipboard -out)" -o "$file" + ${nsxiv}/bin/nsxiv "$file" +'' diff --git a/packages/radioeins-album-der-woche.yaml b/packages/radioeins-album-der-woche.yaml deleted file mode 100644 index 7d8df3c..0000000 --- a/packages/radioeins-album-der-woche.yaml +++ /dev/null @@ -1,28 +0,0 @@ -regex: https://www.radioeins.de/musik/cd_der_woche/ -selectors: - httpsettings: - cookie: {} - header: {} - useragent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) - Chrome/90.0.4430.72 Safari/537.36 - insecure: false - feed: - title: .boxhead h2 - description: .manualteaserShortText - authorname: "" - authoremail: "" - item: - container: .doctyperezension - title: h2 a.rezension - link: a.rezension - linkattr: href - created: .manualteaserDateTime - createdformat: 02.01.2006 - description: .manualteaserShortText - content: "" - image: picture > img - imageattr: src - nextpage: "" - nextpageattr: href - nextpagecount: 0 - sort: "" diff --git a/packages/rfc.nix b/packages/rfc.nix new file mode 100644 index 0000000..ebd1ba3 --- /dev/null +++ b/packages/rfc.nix @@ -0,0 +1,23 @@ +{ + writers, + curl, + pup, + gawk, + gnused, + gnugrep, + less, + fzf, +}: +writers.writeDashBin "rfc" '' + set -efu + selection=$( + ${curl}/bin/curl -sSL https://www.rfc-editor.org/rfc-index.txt \ + | ${gawk}/bin/awk '/^$/{print;} /./{printf("%s ", $0);}' \ + | ${gnused}/bin/sed 's/\s\+/ /g' \ + | ${gnused}/bin/sed -n '/^[0-9]\+ /,$p' \ + | ${fzf}/bin/fzf \ + | ${gawk}/bin/awk '{print $1}' + ) + + ${curl}/bin/curl -sSL "https://www.rfc-editor.org/rfc/rfc$selection.txt" | ${less}/bin/less +'' diff --git a/packages/scanned.nix b/packages/scanned.nix new file mode 100644 index 0000000..4e9152b --- /dev/null +++ b/packages/scanned.nix @@ -0,0 +1,17 @@ +# ref https://tex.stackexchange.com/a/502542 +{ + writers, + imagemagick, +}: +writers.writeDashBin "scanned" '' + [ $# -eq 1 -a -f "$1" -a -r "$1" ] || exit 1 + + ${imagemagick}/bin/convert \ + -density 150 \ + "$1" \ + -rotate 0.5 \ + -attenuate 0.25 \ + +noise Multiplicative \ + -colorspace Gray \ + "scanned-$1" +'' diff --git a/packages/scripts/booksplit.sh b/packages/scripts/booksplit.sh deleted file mode 100755 index bce674d..0000000 --- a/packages/scripts/booksplit.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/booksplit - -# Requires ffmpeg (audio splitting) and my `tag` wrapper script. - -[ ! -f "$2" ] && printf "The first file should be the audio, the second should be the timecodes.\\n" && exit - -echo "Enter the album/book title:"; read -r booktitle - -echo "Enter the artist/author:"; read -r author - -echo "Enter the publication year:"; read -r year - -inputaudio="$1" - -# Get a safe file name from the book. -escbook="$(echo "$booktitle" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")" - -! mkdir -p "$escbook" && echo "Do you have write access in this directory?" && exit 1 - -# As long as the extension is in the tag script, it'll work. -ext="opus" -#ext="${1#*.}" - -# Get the total number of tracks from the number of lines. -total="$(wc -l < "$2")" - -while read -r x; -do - end="$(echo "$x" | cut -d' ' -f1)" - [ -n "$start" ] && - echo "From $start to $end; $track $title" - file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext" - [ -n "$start" ] && echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -to "$end" -vn "$file" && - echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file" - title="$(echo "$x" | cut -d' ' -f 2-)" - esctitle="$(echo "$title" | iconv -cf UTF-8 -t ASCII//TRANSLIT | tr -d '[:punct:]' | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | sed "s/-\+/-/g;s/\(^-\|-\$\)//g")" - track="$((track+1))" - start="$end" -done < "$2" -# The last track must be done outside the loop. -echo "From $start to the end: $title" -file="$escbook/$(printf "%.2d" "$track")-$esctitle.$ext" -echo "Splitting \"$title\"..." && ffmpeg -nostdin -y -loglevel -8 -i "$inputaudio" -ss "$start" -vn "$file" && - echo "Tagging \"$title\"..." && tag -a "$author" -A "$booktitle" -t "$title" -n "$track" -N "$total" -d "$year" "$file" diff --git a/packages/scripts/bvg.nix b/packages/scripts/bvg.nix deleted file mode 100644 index 1404a74..0000000 --- a/packages/scripts/bvg.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - ruby, - stdenv, - bundlerEnv, - fetchFromGitHub, -}: let - src = fetchFromGitHub { - owner = "kmein"; - repo = "bvg"; - rev = "bbfea2e0fdc91a37a34f581c4623704297275b47"; - sha256 = "1iyghksyiy4xkyjw10a7qhy796p88gm9ll6wr7iq55xg98w9mya4"; - }; - env = bundlerEnv { - name = "bvg-env"; - inherit ruby; - gemfile = "${src.out}/Gemfile"; - lockfile = "${src.out}/Gemfile.lock"; - gemset = "${src.out}/gemset.nix"; - }; -in - stdenv.mkDerivation { - name = "bvg"; - buildInputs = [env.wrappedRuby]; - script = "${src.out}/bvg.rb"; - buildCommand = '' - install -D -m755 $script $out/bin/bvg - patchShebangs $out/bin/bvg - ''; - } diff --git a/packages/scripts/daybook.nix b/packages/scripts/daybook.nix deleted file mode 100644 index 0b58fa3..0000000 --- a/packages/scripts/daybook.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - lib, - stdenv, - makeWrapper, - pandoc, - fetchFromGitHub, -}: -stdenv.mkDerivation { - name = "daybook"; - src = fetchFromGitHub { - owner = "kmein"; - repo = "daybook"; - rev = "cad1aef158b0df36861434eb04c953d99a122e80"; - sha256 = "07qippyry0yjf971pnqxm9i0xpvih8mvbhxwfwpwq980jik1hbl1"; - }; - nativeBuildInputs = [makeWrapper]; - buildInputs = [pandoc]; - buildPhase = '' - mkdir -p $out/man/man1 - pandoc --standalone --to man daybook.1.md -o $out/man/man1/daybook.1 - ''; - installPhase = '' - mkdir -p $out/bin - install daybook $out/bin - wrapProgram $out/bin/daybook --prefix PATH ":" ${pandoc}/bin ; - ''; - meta = with lib; { - homepage = "https://github.com/kmein/daybook"; - description = "A diary writing utility in sh"; - license = licenses.mit; - platforms = platforms.linux; - }; -} diff --git a/packages/scripts/default.nix b/packages/scripts/default.nix deleted file mode 100644 index 3ed102e..0000000 --- a/packages/scripts/default.nix +++ /dev/null @@ -1,459 +0,0 @@ -{ - pkgs, - lib, - config, - ... -}: let - kpaste = pkgs.callPackage {}; - opustags = pkgs.callPackage ../opustags.nix {}; - betacode = pkgs.callPackage ../python3Packages/betacode.nix {}; - wrapScript = { - packages ? [], - name, - script, - }: - pkgs.writers.writeDashBin name '' - PATH=$PATH:${ - lib.makeBinPath (packages ++ [pkgs.coreutils pkgs.findutils]) - } - ${script} "$@" - ''; - voidrice = pkgs.fetchFromGitHub { - owner = "LukeSmithxyz"; - repo = "voidrice"; - rev = "0582b495937117d899ce8ef715a89c6cc25a36cf"; - sha256 = "0c4hkny4zkknlimc9yi9ljss2cws4zn8lzd8ip9b8mfsm094dlfl"; - }; -in - rec { - auc = pkgs.callPackage ./auc.nix {}; - - instaget = wrapScript { - packages = [pkgs.jq pkgs.curl pkgs.gnugrep]; - script = ./instaget.sh; - name = "instaget"; - }; - - infschmv = pkgs.writers.writeDashBin "InfSchMV" '' - ${pkgs.curl}/bin/curl -sSL https://www.berlin.de/corona/massnahmen/verordnung/ \ - | ${pkgs.pup}/bin/pup .textile \ - | ${pkgs.pandoc}/bin/pandoc -f html -t man -s \ - | ${pkgs.man}/bin/man -l - - ''; - - trans = let - script = pkgs.fetchurl { - url = "https://raw.githubusercontent.com/soimort/translate-shell/gh-pages/trans.awk"; - sha256 = "178r8d27bry1mzd1g8x2svp4w469hwv7nnxnmnsinx974skjx0jb"; - }; - in - pkgs.writers.writeDashBin "trans" '' - ${pkgs.gawk}/bin/gawk -f ${script} -- "$@" - ''; - - dns-sledgehammer = pkgs.writers.writeDashBin "dns-sledgehammer" '' - ${pkgs.coreutils}/bin/printf '%s\n' 'nameserver 1.1.1.1' 'options edns0' > /etc/resolv.conf - ''; - - showkeys-toggle = pkgs.writers.writeDashBin "showkeys-toggle" '' - if ${pkgs.procps}/bin/pgrep screenkey; then - exec ${pkgs.procps}/bin/pkill screenkey - else - exec ${pkgs.screenkey}/bin/screenkey - fi - ''; - - qrpaste = pkgs.writers.writeDashBin "qrpaste" '' - file="$(${pkgs.mktemp}/bin/mktemp --tmpdir)" - trap clean EXIT - clean() { - rm "$file" - } - ${pkgs.qrencode}/bin/qrencode "$(${pkgs.xclip}/bin/xclip -selection clipboard -out)" -o "$file" - ${pkgs.nsxiv}/bin/nsxiv "$file" - ''; - - ttspaste = pkgs.writers.writeDashBin "ttspaste" '' - ${pkgs.xclip}/bin/xclip -selection clipboard -out | ${pkgs.curl}/bin/curl -G http://tts.r/api/tts --data-urlencode 'text@-' | ${pkgs.mpv}/bin/mpv - - ''; - - interdimensional-cable = let - nimaid-github-io = pkgs.fetchFromGitHub { - owner = "nimaid"; - repo = "nimaid.github.io"; - rev = "9cb4ede215be6bb01bd2df1ef3e9689cc8c4eb9e"; - sha256 = "1g47cj5an7xgmhpc09m7qim5j9rspqxvnzfy90cnlvz4pg8hil96"; - }; - in - pkgs.writeShellScriptBin "interdimensional-cable" '' - export PATH=${lib.makeBinPath [pkgs.mpv pkgs.jq pkgs.gnused]} - mpv --shuffle --playlist=<(jq -r '.videos[]' ${nimaid-github-io}/tv/interdimensional_database.json | sed 's#^#https://youtu.be/#') - ''; - - tag = wrapScript { - packages = [pkgs.vorbis-tools pkgs.python3Packages.eyeD3 opustags]; - script = "${voidrice}/.local/bin/tag"; - name = "tag"; - }; - - meteo = wrapScript { - packages = [pkgs.jq pkgs.curl pkgs.xdotool pkgs.nsxiv pkgs.gnused]; - script = ./meteo.sh; - name = "meteo"; - }; - - kirciuoklis = wrapScript { - packages = [pkgs.curl pkgs.jq]; - script = ./kirciuoklis.sh; - name = "kirciuoklis"; - }; - - booksplit = wrapScript { - packages = [pkgs.ffmpeg tag pkgs.glibc.bin]; - script = "${voidrice}/.local/bin/booksplit"; - name = "booksplit"; - }; - - n = wrapScript { - script = ./n.sh; - name = "n"; - }; - - dirmir = wrapScript { - name = "dirmir"; - script = ./dirmir.sh; - }; - - liddel-scott-jones = wrapScript { - name = "lsj"; - script = ./liddel-scott-jones.sh; - packages = [pkgs.curl pkgs.pup betacode pkgs.gnused pkgs.pandoc pkgs.man]; - }; - - sanskrit-dictionary = pkgs.writers.writeDashBin "sa" '' - set -efu - - usage() { - echo "usage: [OUTPUT=deva|roman] $0 mw|mwe|boet|bopp|apte|boro TERM" - exit 1 - } - - [ $# -eq 2 ] || usage - - case $1 in - mw) id=MWScan;; - mwe) id=MWEScan;; - bopp) id=BOPScan;; - boet) id=PWGScan;; - apte) id=AEScan;; - boro) id=BORScan;; - *) usage;; - esac - - shift - - input="$*" - - ${pkgs.curl}/bin/curl -sSL "https://www.sanskrit-lexicon.uni-koeln.de/scans/$id/2020/web/webtc/getword.php?key=$input&filter=''${OUTPUT-roman}&accent=yes&transLit=hk" \ - | ${pkgs.pandoc}/bin/pandoc --standalone --variable=title:"$input" --from=html --to=man \ - | ${pkgs.gnused}/bin/sed 's/\s\+\([:.,;]\)/\1/g;s/\s\+/ /g' \ - | ${pkgs.man}/bin/man --local-file --pager="${pkgs.bat}/bin/bat -p" - - ''; - - playlist = import ./pls.nix {inherit pkgs lib config;}; - - mpv-tv = import ./mpv-tv.nix {inherit pkgs lib;}; - - favicon = wrapScript { - packages = [pkgs.imagemagick]; - name = "favicon"; - script = ./favicon.sh; - }; - - closest = pkgs.writers.writeDashBin "closest" '' - ${ - pkgs.writers.writeHaskellBin "closest" { - libraries = with pkgs.haskellPackages; [parallel optparse-applicative edit-distance]; - ghcArgs = ["-O3" "-threaded"]; - } (builtins.readFile ./distance.hs) - }/bin/closest +RTS -N4 -RTS --dictionary ${ - pkgs.fetchurl { - url = "https://gist.github.com/MarvinJWendt/2f4f4154b8ae218600eb091a5706b5f4/raw/36b70dd6be330aa61cd4d4cdfda6234dcb0b8784/wordlist-german.txt"; - sha256 = "0vr4lmlckgvj4s8sk502sknq9pf3297rvasj5sqqm05zzbdgpppj"; - } - } "$@" - ''; - - horoscope = pkgs.callPackage ./horoscope {}; - - genius = wrapScript { - packages = [pkgs.curl pkgs.gnused pkgs.pandoc]; - name = "genius"; - script = ./genius.sh; - }; - - literature-quote = wrapScript { - packages = [pkgs.xsv pkgs.curl pkgs.gnused]; - name = "literature-quote"; - script = ./literature-quote.sh; - }; - - man-pdf = wrapScript { - packages = [pkgs.man pkgs.ghostscript]; - name = "man-pdf"; - script = ./man-pdf.sh; - }; - - odyssey = wrapScript { - packages = [pkgs.curl pkgs.xmlstarlet]; - name = "odyssey"; - script = ./odyssey.sh; - }; - - tolino-screensaver = wrapScript { - packages = [pkgs.imagemagick]; - name = "tolino-screensaver"; - script = ./tolino-screensaver.sh; - }; - - wttr = wrapScript { - packages = [pkgs.curl]; - name = "wttr"; - script = ./wttr.sh; - }; - - vg = wrapScript { - packages = [pkgs.ripgrep pkgs.fzf pkgs.gawk]; - name = "vg"; - script = ./vg.sh; - }; - - dmenurandr = wrapScript { - packages = [pkgs.dmenu pkgs.gnugrep pkgs.gnused pkgs.xorg.xrandr pkgs.gawk pkgs.libnotify pkgs.arandr]; - name = "dmenurandr"; - script = ./dmenurandr.sh; - }; - - dmenubluetooth = wrapScript { - packages = [pkgs.bluez5 pkgs.dmenu pkgs.libnotify]; - name = "dmenubluetooth"; - script = ./dmenubluetooth.sh; - }; - - fkill = wrapScript { - packages = [pkgs.procps pkgs.gawk pkgs.gnused pkgs.fzf pkgs.bash]; - script = ./fkill.sh; - name = "fkill"; - }; - - nix-git = wrapScript { - packages = [pkgs.nix-prefetch-git pkgs.jq]; - script = ./nix-git.sh; - name = "nix-git"; - }; - - mansplain = wrapScript { - packages = [pkgs.man pkgs.zathura pkgs.dmenu pkgs.gnused]; - script = ./mansplain.sh; - name = "mansplain"; - }; - - notetags = wrapScript { - script = ./notetags.sh; - name = "notetags"; - }; - - fzfmenu = wrapScript { - script = ./fzfmenu.sh; - name = "fzfmenu"; - packages = [pkgs.st pkgs.fzf pkgs.dash pkgs.bash]; - }; - - swallow = wrapScript { - script = ./swallow.sh; - name = "swallow"; - packages = [pkgs.xdo]; - }; - - ipa = wrapScript { - script = ./ipa.py; - name = "ipa"; - packages = [pkgs.python3]; - }; - - default-gateway = pkgs.writers.writeDashBin "default-gateway" '' - ${pkgs.iproute2}/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) - ''; - - devanagari = pkgs.callPackage ../devanagari {}; - - timer = pkgs.writers.writeDashBin "timer" '' - [ $# -eq 2 ] || { - echo "Usage: $0 TIME MESSAGE" 1>&2 - exit 1 - } - time=$(echo "$1" | ${pkgs.bc}/bin/bc) - echo "sleeping $time seconds, then saying: $2" - ${pkgs.coreutils}/bin/sleep "$time" && { - echo "$2" | ${pkgs.espeak}/bin/espeak -v german-mbrola-6 - } - ''; - - manual-sort = pkgs.writers.writeHaskellBin "manual-sort" {} '' - {-# LANGUAGE LambdaCase #-} - import Data.Char (toLower) - import System.Environment (getArgs) - import System.IO (BufferMode(NoBuffering), hSetBuffering, stdout) - - insertionSortM :: Monad f => (a -> a -> f Ordering) -> [a] -> f [a] - insertionSortM cmp = foldr ((=<<) . insertByM cmp) (pure []) - where - insertByM cmp x = \case - [] -> pure [x] - yys@(y : ys) -> cmp x y >>= \case - GT -> (y :) <$> insertByM cmp x ys - _ -> pure (x : yys) - - ask :: Show a => a -> a -> IO Ordering - ask a b = do - putStr (show a ++ " > " ++ show b ++ "? (y/n) ") - map toLower <$> getLine >>= \case - 'y' : _ -> return GT - _ -> return LT - - main :: IO () - main = do - hSetBuffering stdout NoBuffering - argv <- getArgs - sorted <- insertionSortM ask argv - mapM_ (\(place, thing) -> putStrLn (show place ++ ". " ++ show thing)) $ zip [1 ..] (reverse sorted) - ''; - - scrot-dmenu = wrapScript { - script = ./scrot-dmenu.sh; - name = "dmenu-scrot"; - packages = [pkgs.xclip pkgs.scrot kpaste pkgs.libnotify pkgs.dmenu]; - }; - - unicodmenu = pkgs.callPackage ./unicodmenu.nix {}; - - mpv-radio = let - streams = import ../../lib/streams.nix { - di-fm-key = "%DI_FM_KEY%"; # lib.strings.fileContents ; - }; - streams-tsv = pkgs.writeText "streams.tsv" (lib.concatMapStringsSep "\n" ({ - desc ? "", - stream, - station, - ... - }: "${station}\t${desc}\t${stream}") - streams); - in - pkgs.writers.writeDashBin "mpv-radio" '' - export DI_FM_KEY=$(cat "${config.age.secrets.di-fm-key.path}") - exec ${pkgs.mpv}/bin/mpv --force-window=yes "$( - ${pkgs.dmenu}/bin/dmenu -i -l 5 < ${streams-tsv} \ - | ${pkgs.coreutils}/bin/cut -f3 \ - | ${pkgs.gnused}/bin/sed s/%DI_FM_KEY%/"$DI_FM_KEY"/ - )" - ''; - - rfc = wrapScript { - script = ./rfc.sh; - name = "rfc"; - packages = [pkgs.curl pkgs.pup pkgs.gnused pkgs.gawk pkgs.gnugrep pkgs.fzf]; - }; - - new-mac = wrapScript { - script = ./new-mac.sh; - name = "new-mac"; - packages = [pkgs.gnused pkgs.openssl pkgs.jq pkgs.iproute2]; - }; - - bvg = pkgs.callPackage ./bvg.nix {}; - nav = pkgs.callPackage ./nav.nix {}; - k-lock = pkgs.callPackage ./k-lock.nix {}; - - menu-calc = pkgs.writers.writeDashBin "=" '' - # https://github.com/onespaceman/menu-calc - - answer=$(echo "$@" | ${pkgs.pari}/bin/gp -q | ${pkgs.gnused}/bin/sed '/\./ s/\.\{0,1\}0\{1,\}$//') - - action=$(printf "copy\nclear" | ${pkgs.dmenu}/bin/dmenu -p "= $answer") - - case $action in - "clear") $0 ;; - "copy") printf %s "$answer" | ${pkgs.xclip}/bin/xclip -selection clipboard;; - "") ;; - *) $0 "$answer $action" ;; - esac - ''; - - # ref https://tex.stackexchange.com/a/502542 - scanned = pkgs.writers.writeDashBin "scanned" '' - [ $# -eq 1 -a -f "$1" -a -r "$1" ] || exit 1 - - ${pkgs.imagemagick}/bin/convert -density 150 "$1" -rotate 0.5 -attenuate 0.25 +noise Multiplicative -colorspace Gray "scanned-$1" - ''; - - nix-index-update = pkgs.writers.writeDashBin "nix-index-update" '' - filename="index-x86_64-$(uname | tr A-Z a-z)" - mkdir -p ~/.cache/nix-index - cd ~/.cache/nix-index - # -N will only download a new version if there is an update. - ${pkgs.wget}/bin/wget -q -N https://github.com/Mic92/nix-index-database/releases/latest/download/$filename - ln -f $filename files - ''; - - heuretes = let - database = pkgs.fetchurl { - url = "http://c.krebsco.de/greek.csv"; - hash = "sha256-SYL10kerNI0HzExG6JXh765+CBBCHLO95B6OKErQ/sU="; - }; - in - pkgs.writers.writeDashBin "heuretes" '' - ${pkgs.xsv}/bin/xsv search -s simple "^$*$" ${database} | ${pkgs.xsv}/bin/xsv table - ''; - - # https://nitter.net/igor_chubin/status/1557793569104183298 - stackoverflow = pkgs.writers.writeDashBin "so" '' - IFS=+ - ${pkgs.curl}/bin/curl -sSL http://cht.sh/"$*" - ''; - - rofi-hass = pkgs.writers.writeBashBin "rofi-hass" '' - export PATH=${lib.makeBinPath [pkgs.home-assistant-cli pkgs.jq pkgs.util-linux pkgs.rofi pkgs.gnused pkgs.libnotify]} - json=$(hass-cli -o json state list 2>/dev/null) - idx=$(jq -r '.[] | [.entity_id, .state] | join(" ")' <<< "$json" | column -t | rofi -dmenu -i -markup-rows -format d) - item=$(jq -r '.[].entity_id' <<< "$json" | sed "''${idx}q;d") - itype=$(sed -r 's/\..+$//' <<< "$item") - - case "$itype" in - light) hass-cli state toggle "$item" &>/dev/null ;; - scene) hass-cli service call --arguments entity_id="$item" scene.turn_on &>/dev/null ;; - *) notify-send "Error" "Event type '$itype' not implemented yet. Do you have time to file an issue or write a PR?" ;; - esac - ''; - } - // { - devour = pkgs.callPackage ../devour.nix {}; - depp = pkgs.callPackage ../depp.nix {}; - text2pdf = pkgs.callPackage ../text2pdf.nix {}; - vimv = pkgs.callPackage ../vimv.nix {}; - when = pkgs.callPackage ../when.nix {}; - mahlzeit = pkgs.haskellPackages.callPackage ../mahlzeit.nix {}; - inherit opustags; - } diff --git a/packages/scripts/depp.nix b/packages/scripts/depp.nix deleted file mode 100644 index 8c830c4..0000000 --- a/packages/scripts/depp.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ - lib, - writeShellScriptBin, -}: let - aliasFlag = name: value: "-c alias.${name}=${lib.escapeShellArg value}"; - aliases = { - eroeffne = "init"; - machnach = "clone"; - zieh = "pull"; - fueghinzu = "add"; - drueck = "push"; - pfusch = "push --force"; - zweig = "branch"; - verzweige = "branch"; - uebergib = "commit"; - erde = "rebase"; - unterscheide = "diff"; - vereinige = "merge"; - bunkere = "stash"; - markiere = "tag"; - nimm = "checkout"; - tagebuch = "log"; - zustand = "status"; - }; -in - writeShellScriptBin "depp" '' - if [ $# -gt 0 ]; then - git ${ - lib.concatStringsSep " " (lib.attrsets.mapAttrsToList aliasFlag aliases) - } "$@" - else - printf "${ - lib.concatStringsSep "\n" - (lib.attrsets.mapAttrsToList (n: v: n + " " + v) aliases) - }\n" - fi - '' diff --git a/packages/scripts/dirmir.sh b/packages/scripts/dirmir.sh deleted file mode 100755 index 28b2832..0000000 --- a/packages/scripts/dirmir.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -SOURCE="$1" -TARGET="$2" - -if [ ! -d "$SOURCE" ] || [ $# -ne 2 ]; then - echo >/dev/stderr "Usage: dirmir SOURCE TARGET" - exit 1 -fi - -if [ -e "$TARGET" ]; then - echo >/dev/stderr "$TARGET" already exists. Please use a different name. - exit 1 -fi - -find "$SOURCE" | while read -r entry; do - if [ -d "$entry" ]; then - mkdir -p "$TARGET/$entry" - else - # create a file with the same permissions as $entry - install -m "$(stat -c %a "$entry")" /dev/null "$TARGET/$entry" - fi -done diff --git a/packages/scripts/dmenubluetooth.sh b/packages/scripts/dmenubluetooth.sh deleted file mode 100755 index a8535db..0000000 --- a/packages/scripts/dmenubluetooth.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# UI for connecting to bluetooth devices -set -efu - -bluetooth_notify() { - notify-send --app-name=" Bluetooth" "$@" -} - -chose_device() { - # the output from `bluetoothctl {paired-,}devices` has a first column which always contains `Device` followed by a MAC address and the device name - cut -d ' ' -f2- | dmenu -i -l 5 -p "Bluetooth device" -} - -bluetoothctl scan on & - -case "$(printf "pair\nconnect\ndisconnect" | dmenu -i)" in - pair) - chosen="$(bluetoothctl devices | chose_device)" - chosen_name="$(echo "$chosen" | cut -d ' ' -f2-)" - - bluetooth_notify "$chosen_name" "Pairing ..." - - if bluetoothctl pair "$(echo "$chosen" | cut -d ' ' -f1)"; then - bluetooth_notify "✔ $chosen_name" "Paired with device." - else - test "$chosen" && bluetooth_notify "❌ $chosen_name" "Failed to pair with device." - fi - ;; - - connect) - chosen="$(bluetoothctl paired-devices | chose_device)" - chosen_name="$(echo "$chosen" | cut -d ' ' -f2-)" - - bluetooth_notify "$chosen_name" "Trying to connect ..." - - if bluetoothctl connect "$(echo "$chosen" | cut -d ' ' -f1)"; then - bluetooth_notify "✔ $chosen_name" "Connected to device." - else # something was selected but it didn't work - test "$chosen" && bluetooth_notify "❌ $chosen_name" "Failed to connect to device." - fi - ;; - - disconnect) - chosen="$(bluetoothctl paired-devices | chose_device)" - chosen_name="$(echo "$chosen" | cut -d ' ' -f2-)" - - bluetooth_notify "$chosen_name" "Disconnecting ..." - - if bluetoothctl disconnect "$(echo "$chosen" | cut -d ' ' -f1)"; then - bluetooth_notify "✔ $chosen_name" "Disconnected from device." - else # something was selected but it didn't work - test "$chosen" && bluetooth_notify "❌ $chosen_name" "Failed to disconnect from device." - fi - ;; -esac diff --git a/packages/scripts/dmenurandr.sh b/packages/scripts/dmenurandr.sh deleted file mode 100755 index cb6a8c8..0000000 --- a/packages/scripts/dmenurandr.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh -# ref https://github.com/LukeSmithxyz/voidrice/blob/927a7c39c24272eeb6c7ca9e75a359314ad20025/.local/bin/displayselect - -# A UI for detecting and selecting all displays. Probes xrandr for connected -# displays and lets user select one to use. User may also select "manual -# selection" which opens arandr. - -query_direction() { - printf "left-of\\nright-of\\nabove\\nbelow" -} - -twoscreen() { # If multi-monitor is selected and there are two screens. - - mirror=$(printf "no\\nyes" | dmenu -i -p "Mirror displays?") - # Mirror displays using native resolution of external display and a scaled - # version for the internal display - if [ "$mirror" = "yes" ]; then - external=$(echo "$screens" | dmenu -i -p "Optimize resolution for") - internal=$(echo "$screens" | grep -v "$external") - - res_external=$(xrandr --query | sed -n "/^$external/,/\+/p" | \ - tail -n 1 | awk '{print $1}') - - res_internal=$(xrandr --query | sed -n "/^$internal/,/\+/p" | \ - tail -n 1 | awk '{print $1}') - - res_ext_x=$(echo "$res_external" | sed 's/x.*//') - res_ext_y=$(echo "$res_external" | sed 's/.*x//') - res_int_x=$(echo "$res_internal" | sed 's/x.*//') - res_int_y=$(echo "$res_internal" | sed 's/.*x//') - - scale_x=$(echo "$res_ext_x / $res_int_x" | bc -l) - scale_y=$(echo "$res_ext_y / $res_int_y" | bc -l) - - xrandr --output "$external" --auto --scale 1.0x1.0 \ - --output "$internal" --auto --same-as "$external" \ - --scale "$scale_x"x"$scale_y" - - else - - primary=$(echo "$screens" | dmenu -i -p "Select primary display") - secondary=$(echo "$screens" | grep -v "$primary") - direction=$(query_direction | dmenu -i -p "What side of $primary should $secondary be on?") - xrandr --output "$primary" --auto --scale 1.0x1.0 --output "$secondary" --"$direction" "$primary" --auto --scale 1.0x1.0 - fi -} - -# If multi-monitor is selected and there are more than two screens. -morescreen() { - primary=$(echo "$screens" | dmenu -i -p "Select primary display:") - secondary=$(echo "$screens" | grep -v "$primary" | dmenu -i -p "Select secondary display:") - direction=$(query_direction | dmenu -i -p "What side of $primary should $secondary be on?") - tertiary=$(echo "$screens" | grep -v "$primary" | grep -v "$secondary" | dmenu -i -p "Select third display:") - xrandr --output "$primary" --auto --output "$secondary" --"$direction" "$primary" --auto --output "$tertiary" --"$(query_direction | grep -v "$direction")" "$primary" --auto -} - -# Multi-monitor handler. -multimon() { - case "$(echo "$screens" | wc -l)" in - 2) twoscreen ;; - *) morescreen ;; - esac -} - -# If only one output available or chosen. -onescreen() { - xrandr --output "$1" --auto --primary --scale 1.0x1.0 $(echo "$allposs" | grep -v "$1" | awk '{print "--output", $1, "--off"}' | paste -sd ' ') -} - -# Get all possible displays -allposs=$(xrandr -q | grep "connected") - -# Get all connected screens. -screens=$(echo "$allposs" | awk '/ connected/ {print $1}') - -# If there's only one screen -[ "$(echo "$screens" | wc -l)" -lt 2 ] && { - onescreen "$screens" - notify-send "💻 Only one screen detected." "Using it in its optimal settings..." - exit -} - -# Get user choice including multi-monitor and manual selection: -chosen=$(printf "%s\\nmulti-monitor\\nmanual selection" "$screens" | dmenu -i -p "Select display arangement:") && - case "$chosen" in - "manual selection") arandr ; exit ;; - "multi-monitor") multimon ;; - *) onescreen "$chosen" ;; - esac diff --git a/packages/scripts/favicon.sh b/packages/scripts/favicon.sh deleted file mode 100755 index 032f3e7..0000000 --- a/packages/scripts/favicon.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -convert "$1" -define icon:auto-resize=64,48,32,16 "${2-favicon.ico}" diff --git a/packages/scripts/fkill.sh b/packages/scripts/fkill.sh deleted file mode 100755 index f42d495..0000000 --- a/packages/scripts/fkill.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -if [ "$UID" != "0" ]; then - pid=$(ps -f -u "$UID" | sed 1d | fzf -m | awk '{print $2}') -else - pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}') -fi - -if [ "x$pid" != "x" ] -then - echo "$pid" | xargs kill "-${1:-9}" -fi diff --git a/packages/scripts/fzfmenu.sh b/packages/scripts/fzfmenu.sh deleted file mode 100755 index 36ba08c..0000000 --- a/packages/scripts/fzfmenu.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash -# fzfmenu - fzf as dmenu replacement -# https://github.com/junegunn/fzf/wiki/Examples#fzf-as-dmenu-replacement -set -efu - -input=$(mktemp -u --suffix .fzfmenu.input) -output=$(mktemp -u --suffix .fzfmenu.output) -mkfifo "$input" -mkfifo "$output" -chmod 600 "$input" "$output" - -for i in "$@"; do - case $i in - -p) - PROMPT="$2" - shift - shift - break ;; - -l) - # no reason to filter number of lines - shift - shift - break ;; - -i) - # we do this anyway - shift - break ;; - *) - echo "Unknown option $1" >&2 - shift ;; - esac -done - -# it's better to use st here (starts a lot faster than pretty much everything else) -st -c fzfmenu -n fzfmenu -g 85x10 \ - -e dash \ - -c "cat $input | fzf --reverse --prompt='${PROMPT+> }' --print-query $* | tee $output" & disown - -# handle ctrl+c outside child terminal window -trap 'kill $! 2>/dev/null; rm -f $input $output' EXIT - -cat > "$input" -cat "$output" diff --git a/packages/scripts/genius.sh b/packages/scripts/genius.sh deleted file mode 100755 index 8efcd85..0000000 --- a/packages/scripts/genius.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -test "$#" -eq 2 || ( - echo "usage: $0 " - exit 1 -) - -normalize() { - tr -d -c '0-9A-Za-z ' | tr ' ' - | tr '[:upper:]' '[:lower:]' -} - -ARTIST=$(echo "$1" | normalize | sed 's/./\U&/') -TITLE=$(echo "$2" | normalize) -GENIUS_URL="https://genius.com/$ARTIST-$TITLE-lyrics" - -curl -s "$GENIUS_URL" \ - | sed -ne '/class="lyrics"/,/<\/p>/p' \ - | pandoc -f html -s -t plain \ - | sed 's/^_/\x1b[3m/g;s/_$/\x1b[0m/g;s/^\[/\n\x1b\[1m\[/g;s/\]$/\]\x1b[0m/g' - -printf "\n%s\n" "$GENIUS_URL" >/dev/stderr diff --git a/packages/scripts/horoscope/default.nix b/packages/scripts/horoscope/default.nix deleted file mode 100644 index 8e8efc5..0000000 --- a/packages/scripts/horoscope/default.nix +++ /dev/null @@ -1,4 +0,0 @@ -{poetry2nix}: -poetry2nix.mkPoetryApplication { - projectDir = ./.; -} diff --git a/packages/scripts/horoscope/horoscope.py b/packages/scripts/horoscope/horoscope.py deleted file mode 100644 index 34cfe81..0000000 --- a/packages/scripts/horoscope/horoscope.py +++ /dev/null @@ -1,54 +0,0 @@ -from datetime import datetime -import click -from flatlib.datetime import Datetime -from flatlib.geopos import GeoPos -from flatlib.chart import Chart -import flatlib.const - -sign_symbols = { - flatlib.const.ARIES: "♈", - flatlib.const.TAURUS: "♉", - flatlib.const.GEMINI: "♊", - flatlib.const.CANCER: "♋", - flatlib.const.LEO: "♌", - flatlib.const.VIRGO: "♍", - flatlib.const.LIBRA: "♎", - flatlib.const.SCORPIO: "♏", - flatlib.const.SAGITTARIUS: "♐", - flatlib.const.CAPRICORN: "♑", - flatlib.const.AQUARIUS: "♒", - flatlib.const.PISCES: "♓", -} - -planet_symbols = { - flatlib.const.SUN: "☉", - flatlib.const.MOON: "☽", - flatlib.const.MERCURY: "☿", - flatlib.const.VENUS: "♀", - flatlib.const.MARS: "♂", - flatlib.const.JUPITER: "♃", - flatlib.const.SATURN: "♄", -} - - -def convert_into_stupid_flatlib_format(dt): - return Datetime(dt.strftime("%Y/%m/%d"), dt.strftime("%H:%M")) - - -@click.command() -@click.option("--latitude", type=click.FLOAT, required=True) -@click.option("--longitude", type=click.FLOAT, required=True) -@click.option("--date", type=click.DateTime(), default=datetime.now()) -def main(latitude: float, longitude: float, date: datetime): - flatlib_datetime = convert_into_stupid_flatlib_format(date) - position = GeoPos(latitude, longitude) - chart = Chart(flatlib_datetime, position) - for planet in planet_symbols.keys(): - planet_position = chart.getObject(planet) - print( - planet_symbols[planet], - sign_symbols[planet_position.sign], - "℞" if planet_position.movement() == flatlib.const.RETROGRADE else "", - end="", - ) - print() diff --git a/packages/scripts/horoscope/poetry.lock b/packages/scripts/horoscope/poetry.lock deleted file mode 100644 index 633f369..0000000 --- a/packages/scripts/horoscope/poetry.lock +++ /dev/null @@ -1,81 +0,0 @@ -[[package]] -name = "click" -version = "8.1.3" -description = "Composable command line interface toolkit" -category = "main" -optional = false -python-versions = ">=3.7" - -[package.dependencies] -colorama = {version = "*", markers = "platform_system == \"Windows\""} - -[[package]] -name = "colorama" -version = "0.4.5" -description = "Cross-platform colored terminal text." -category = "main" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" - -[[package]] -name = "flatlib" -version = "0.2.3" -description = "Python library for Traditional Astrology" -category = "main" -optional = false -python-versions = "*" - -[package.dependencies] -pyswisseph = "2.08.00-1" - -[[package]] -name = "numpy" -version = "1.23.1" -description = "NumPy is the fundamental package for array computing with Python." -category = "main" -optional = false -python-versions = ">=3.8" - -[[package]] -name = "pyswisseph" -version = "2.08.00-1" -description = "Python extension to the Swiss Ephemeris" -category = "main" -optional = false -python-versions = "*" - -[[package]] -name = "pytz" -version = "2021.3" -description = "World timezone definitions, modern and historical" -category = "main" -optional = false -python-versions = "*" - -[[package]] -name = "timezonefinder" -version = "5.2.0" -description = "fast python package for finding the timezone of any point on earth (coordinates) offline" -category = "main" -optional = false -python-versions = ">=3.6" - -[package.dependencies] -numpy = ">=1.16" - -[package.extras] -numba = ["numba (>=0.48)"] - -[metadata] -lock-version = "1.1" -python-versions = "^3.8" -content-hash = "657742383232643f2fa13df5686de0cc79c624f9ae9bdb2f0fc96c7a94b5b8bf" - -[metadata.files] -click = [] -colorama = [] -flatlib = [] -numpy = [] -pyswisseph = [] -pytz = [] -timezonefinder = [] diff --git a/packages/scripts/horoscope/pyproject.toml b/packages/scripts/horoscope/pyproject.toml deleted file mode 100644 index 64ad6e4..0000000 --- a/packages/scripts/horoscope/pyproject.toml +++ /dev/null @@ -1,21 +0,0 @@ -[tool.poetry] -name = "horoscope" -version = "0.1.0" -description = "" -authors = ["Kierán Meinhardt "] - -[tool.poetry.dependencies] -python = "^3.8" -flatlib = "^0.2.3" -click = "^8.0.3" -timezonefinder = "^5.2.0" -pytz = "^2021.3" - -[tool.poetry.scripts] -horoscope = "horoscope:main" -transits-current = "transits:current" -transits-forecast = "transits:forecast" - -[build-system] -requires = ["poetry-core>=1.0.0"] -build-backend = "poetry.core.masonry.api" diff --git a/packages/scripts/horoscope/transits.py b/packages/scripts/horoscope/transits.py deleted file mode 100644 index 1e30387..0000000 --- a/packages/scripts/horoscope/transits.py +++ /dev/null @@ -1,181 +0,0 @@ -from flatlib import aspects, const -from flatlib.chart import Chart -from flatlib.datetime import Datetime -import pytz -from flatlib.geopos import GeoPos -import timezonefinder -import operator -import click -import itertools -from datetime import datetime, timedelta - -tf = timezonefinder.TimezoneFinder() - -planets = [ - const.SUN, - const.MOON, - const.MERCURY, - const.VENUS, - const.MARS, - const.JUPITER, - const.SATURN, - const.URANUS, - const.NEPTUNE, - const.PLUTO, -] - -planet_symbols = { - const.SUN: "☉", - const.MOON: "☽", - const.MERCURY: "☿", - const.VENUS: "♀", - const.MARS: "♂", - const.JUPITER: "♃", - const.SATURN: "♄", - const.URANUS: "♅", - const.NEPTUNE: "♆", - const.PLUTO: "⯓", -} - -aspect_symbols = { - const.NO_ASPECT: " ", - const.CONJUNCTION: "☌", - const.SEXTILE: "⚹", - const.SQUARE: "□", - const.TRINE: "△", - const.OPPOSITION: "☍", -} - - -def convert_into_stupid_flatlib_format(dt): - return Datetime( - dt.strftime("%Y/%m/%d"), - dt.strftime("%H:%M"), - dt.utcoffset().total_seconds() / 3600, - ) - - -here_latitude = 52.52 -here_longitude = 13.4 - - -def get_aspects(chart1, chart2, *, threshold): - for planet1 in chart1.objects: - for planet2 in chart2.objects: - aspect = aspects.getAspect(planet1, planet2, const.MAJOR_ASPECTS) - if aspect.exists() and aspect.orb <= threshold: - yield aspect - - -def get_chart(position, dt_naive): - timezone = pytz.timezone(tf.timezone_at(lat=position.lat, lng=position.lon)) - dt_aware = timezone.localize(dt_naive) - return Chart(convert_into_stupid_flatlib_format(dt_aware), position, IDs=planets) - - -def show_aspect(aspect): - return " ".join( - [ - planet_symbols[aspect.active.id], - aspect_symbols[aspect.type], - planet_symbols[aspect.passive.id], - ] - ) - - -@click.command() -@click.option("--natal-latitude", type=click.FLOAT, default=here_latitude) -@click.option("--natal-longitude", type=click.FLOAT, default=here_longitude) -@click.option("--natal-date", type=click.DateTime(), default=datetime.now()) -@click.option("--transit-latitude", type=click.FLOAT, default=here_latitude) -@click.option("--transit-longitude", type=click.FLOAT, default=here_longitude) -@click.option("--transit-date", type=click.DateTime(), default=datetime.now()) -@click.option("--threshold", type=click.FLOAT, default=5) -def forecast( - natal_latitude: float, - natal_longitude: float, - natal_date: datetime, - transit_latitude: float, - transit_longitude: float, - transit_date: datetime, - threshold: float, -): - transit_position = GeoPos(transit_latitude, transit_longitude) - natal_position = GeoPos(natal_latitude, natal_longitude) - natal_chart = get_chart(natal_position, natal_date) - transit_chart = get_chart(transit_position, transit_date) - - offset = 0 - previous_aspects = set( - show_aspect(a) - for a in get_aspects(natal_chart, transit_chart, threshold=threshold) - ) - while True: - then = transit_date + timedelta(minutes=offset) - current_chart = get_chart(transit_position, then) - current_aspects = set( - show_aspect(a) - for a in get_aspects(natal_chart, current_chart, threshold=threshold) - ) - entered = current_aspects - previous_aspects - exited = previous_aspects - current_aspects - if entered or exited: - print( - then.strftime("%Y-%m-%d %H:%M"), - "".join([" | +" + a for a in entered] + [" | -" + a for a in exited]), - sep="", - ) - previous_aspects = current_aspects - offset += 1 - - -@click.command() -@click.option("--natal-latitude", type=click.FLOAT, default=here_latitude) -@click.option("--natal-longitude", type=click.FLOAT, default=here_longitude) -@click.option("--natal-date", "-D", type=click.DateTime(), default=datetime.now()) -@click.option("--transit-latitude", type=click.FLOAT, default=here_latitude) -@click.option("--transit-longitude", type=click.FLOAT, default=here_longitude) -@click.option("--transit-date", "-d", type=click.DateTime(), default=datetime.now()) -@click.option("--threshold", "-t", type=click.FLOAT, default=5) -def current( - natal_latitude: float, - natal_longitude: float, - natal_date: datetime, - transit_latitude: float, - transit_longitude: float, - transit_date: datetime, - threshold: float, -): - transit_position = GeoPos(transit_latitude, transit_longitude) - natal_position = GeoPos(natal_latitude, natal_longitude) - natal_chart = get_chart(natal_position, natal_date) - transit_chart = get_chart(transit_position, transit_date) - - relevant_aspects = list( - get_aspects(natal_chart, transit_chart, threshold=threshold) - ) - - def aspect_switch_date(aspect, *, direction=1, threshold): - offset = 0 - while True: - then = transit_date + direction * timedelta(days=offset) - current_chart = get_chart(transit_position, then) - aspects = [ - show_aspect(a) - for a in get_aspects(natal_chart, current_chart, threshold=threshold) - ] - if aspect not in aspects: - return then.date() - offset += 1 - - for aspect in sorted(relevant_aspects, key=operator.attrgetter("orb")): - aspect_string = show_aspect(aspect) - print( - aspect_switch_date( - aspect_string, direction=-1, threshold=threshold - ).isoformat(), - aspect_switch_date( - aspect_string, direction=1, threshold=threshold - ).isoformat(), - aspect_string, - ) diff --git a/packages/scripts/instaget.nix b/packages/scripts/instaget.nix deleted file mode 100644 index 16a40f9..0000000 --- a/packages/scripts/instaget.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - writeShellScriptBin, - wget, - curl, - jq, -}: -writeShellScriptBin "instaget" '' - for url in "$@"; do - json="$(${curl}/bin/curl -s "$url" \ - | grep display_url \ - | grep -o '{.*}')" - - echo "$json" - | ${jq}/bin/jq -r ' - .entry_data.PostPage - | .[].graphql.shortcode_media.edge_sidecar_to_children.edges - | .[].node.display_url' \ - | xargs ${wget}/bin/wget - - echo "$json" - | ${jq}/bin/jq -r ' - .entry_data.PostPage - | .[].graphql.shortcode_media.display_url' \ - | xargs ${wget}/bin/wget - done -'' diff --git a/packages/scripts/instaget.sh b/packages/scripts/instaget.sh deleted file mode 100755 index 19a4ab1..0000000 --- a/packages/scripts/instaget.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -for url in "$@"; do - json="$(curl -s "$url" \ - | grep display_url \ - | grep -o '{.*}')" - - echo "$json" \ - | jq -r ' - .entry_data.PostPage - | .[].graphql.shortcode_media.edge_sidecar_to_children.edges - | .[].node.display_url' \ - | xargs wget - - echo "$json" \ - | jq -r ' - .entry_data.PostPage - | .[].graphql.shortcode_media.display_url' \ - | xargs wget -done diff --git a/packages/scripts/kirciuoklis.sh b/packages/scripts/kirciuoklis.sh deleted file mode 100755 index c6dcd01..0000000 --- a/packages/scripts/kirciuoklis.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -curl -sSL 'https://kalbu.vdu.lt/wp-admin/admin-ajax.php' -F action=text_accents -F body="$(cat)" \ - | jq -r .message \ - | if [ "$1" = "--json" ] - then jq .textParts - else jq -r ' - .textParts - | map(if has("accented") then .accented else .string end) - | join("") - ' - fi diff --git a/packages/scripts/liddel-scott-jones.sh b/packages/scripts/liddel-scott-jones.sh deleted file mode 100755 index f7eae67..0000000 --- a/packages/scripts/liddel-scott-jones.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -set -efu - -input="$*" - -if echo "$input" | grep '^\w\+$'; then - curl -sSL "https://lsj.gr/wiki/$input" | pup '#mw-content-text' -else - curl -sSL "https://lsj.gr/wiki/$(echo "$input" | betacode)" \ - | pup ':parent-of(#English_(LSJ)) + p' \ - | sed 's//

&/g' -fi \ - | pandoc --standalone --variable=title:"$input" --from=html --to=man \ - | sed 's/\s\+\([:.,;]\)/\1/g;s/\s\+/ /g' \ - | man --local-file --pager="bat -p" - diff --git a/packages/scripts/literature-quote.sh b/packages/scripts/literature-quote.sh deleted file mode 100755 index 8530255..0000000 --- a/packages/scripts/literature-quote.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -ROW=$(curl -Ls http://kmein.github.io/logotheca/quotes.csv | shuf -n1) - -( - printf '%s\n\n— %s: _%s_, %s\n' \ - "$(echo "$ROW" | xsv select 4)" \ - "$(echo "$ROW" | xsv select 1)" \ - "$(echo "$ROW" | xsv select 2)" \ - "$(echo "$ROW" | xsv select 3 | tr : ,)" -) | sed 's/ | /\n/g;s/ || /\n\n/g;s/"\(.*\)"/\1/' diff --git a/packages/scripts/man-pdf.sh b/packages/scripts/man-pdf.sh deleted file mode 100755 index 5992d4a..0000000 --- a/packages/scripts/man-pdf.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -if [ "$#" -eq 1 ]; then - man_entry="$1" -elif [ $# -eq 2 ]; then - man_page="$1" - man_entry="$2" -else - echo >/dev/stderr "Usage: $0 [MAN-PAGE] ENTRY" - exit 1 -fi - -man "${man_page:-}" "$man_entry" | ps2pdf - "$man_entry.pdf" diff --git a/packages/scripts/mansplain.sh b/packages/scripts/mansplain.sh deleted file mode 100755 index fd6e591..0000000 --- a/packages/scripts/mansplain.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# https://www.youtube.com/watch?v=8E8sUNHdzG8 -man -k . \ - | cut -d" " -f1,2 \ - | dmenu -l 5 \ - | sed 's/\(.*\) (\(.*\))/\2 \1/' \ - | xargs -r man -t \ - | zathura - diff --git a/packages/scripts/meteo.sh b/packages/scripts/meteo.sh deleted file mode 100755 index 4483a48..0000000 --- a/packages/scripts/meteo.sh +++ /dev/null @@ -1,76 +0,0 @@ -#! /bin/sh -# usage: meteo --list -# usage: meteo --update -# usage: meteo STATION -set -efu - -# TODO XDG -CONFIG_DIR=$HOME/.config/wetter -STATIONS_FILE=$CONFIG_DIR/stations.json - -case ${1-} in - --list) - sed -n 's/^\s*\(--[^)]\+\))$/\1/p' "$0" - jq -r -n \ - --slurpfile stations_file "$STATIONS_FILE" \ - ' - $stations_file[0] as $known_stations | - - $known_stations | keys[] - ' - exit - ;; - --update) - mkdir -p "$(dirname "$STATIONS_FILE")" - exec >"$STATIONS_FILE" - - curl -fsSL http://wetterstationen.meteomedia.de/ | - jq -Rrs ' - def decodeHTML: - gsub("ä";"ä") | - gsub("ö";"ö") | - gsub("ü";"ü") | - gsub("Ä";"Ä") | - gsub("Ö";"Ö") | - gsub("Ü";"Ü") | - gsub("ß";"ß") - ; - [ - match(".*";"g") - .captures | - map({"\(.name)":(.string)}) | - add | - {"\(.name|decodeHTML)":(.station|tonumber)} - ] | - add - ' - exit - ;; -esac - -# set -x - -station=${1-103840} -station=$(jq -e -n \ ---arg station "$station" \ ---slurpfile stations_file "$STATIONS_FILE" \ -' - $stations_file[0] as $known_stations | - - $station | - if test("^[0-9]+$") then - tonumber - else - $known_stations[.] - end -') -cache="/tmp/${LOGNAME}_wetter_$station.png" -curl -sSL \ - "http://wetterstationen.meteomedia.de/messnetz/vorhersagegrafik/$station.png" \ - -o "$cache" - -if window_id=$(xdotool search --name "^nsxiv - $cache$"); then - xdotool key --window "$window_id" r -else - nsxiv "$cache" & -fi diff --git a/packages/scripts/much-current-query.sh b/packages/scripts/much-current-query.sh deleted file mode 100755 index 81f28ba..0000000 --- a/packages/scripts/much-current-query.sh +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -set -efu -exec curl -fSs --unix-socket /tmp/much.api.sock http://localhost/current/query diff --git a/packages/scripts/n.sh b/packages/scripts/n.sh deleted file mode 100755 index 7353c31..0000000 --- a/packages/scripts/n.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -nix-shell -p "$1" --run "${2:-$1}" diff --git a/packages/scripts/nav.nix b/packages/scripts/nav.nix deleted file mode 100644 index b8529a3..0000000 --- a/packages/scripts/nav.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - lib, - fetchFromGitHub, - stdenv, - fzf, -}: -stdenv.mkDerivation rec { - name = "nav"; - version = "8da22b1"; - src = fetchFromGitHub { - owner = "huntrar"; - repo = name; - rev = version; - sha256 = "0aw10495901dagyfxn2pj6nh3nl1xgi5p57mwgkgn9g5hi66xa87"; - }; - installPhase = '' - mkdir -p $out/bin/ - install nav $out/bin/ - ''; - propagatedBuildInputs = [fzf]; - meta = { - maintainer = [lib.maintainers.kmein]; - description = "JSON data structure navigator"; - homepage = "https://github.com/huntrar/nav"; - }; -} diff --git a/packages/scripts/new-mac.sh b/packages/scripts/new-mac.sh deleted file mode 100755 index af2471f..0000000 --- a/packages/scripts/new-mac.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -random_mac() { - openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//' -} - -change_mac() { - old_mac="$(ip -j link show "$interface" | jq -r '.[].address')" - new_mac="$(random_mac)" - ip link set "$interface" address "$new_mac" 2>/dev/null && echo "$old_mac -> $new_mac" -} - -interface="${1:-wlp3s0}" -ip link set "$interface" down -until change_mac; do :; done -ip link set "$interface" up diff --git a/packages/scripts/nix-git.sh b/packages/scripts/nix-git.sh deleted file mode 100755 index 9c70b34..0000000 --- a/packages/scripts/nix-git.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -nix-prefetch-git "$@" 2> /dev/null \ - | jq -r '"rev = \"\(.rev)\";\nsha256 = \"\(.sha256)\";"' diff --git a/packages/scripts/odyssey.sh b/packages/scripts/odyssey.sh deleted file mode 100755 index 45c9e9e..0000000 --- a/packages/scripts/odyssey.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -if [ "$#" -eq 1 ] && (echo "$1" | grep -Eq '[0-9]+\.[0-9]+'); then - curl -Gs http://www.perseus.tufts.edu/hopper/CTS \ - -d request=GetPassage \ - -d "urn=urn:cts:greekLit:tlg0012.tlg002:$1" \ - | xmlstarlet sel -t -v 'cts:GetPassage//tei:div' -else - echo you must supply BOOK.VERSE -fi diff --git a/packages/scripts/rfc.sh b/packages/scripts/rfc.sh deleted file mode 100755 index 3d8d0bb..0000000 --- a/packages/scripts/rfc.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -set -efu - -cache_file=/tmp/rfc-index.txt - -fetch_index() { - if [ -f "$cache_file" ] - then cat "$cache_file" - else curl -sSL https://tools.ietf.org/rfc/index | tee "$cache_file" - fi -} - -rfc_list="$(fetch_index \ - | pup 'pre text{}' \ - | awk '$0 != "" {printf "%s",$0} $0 == "" {printf "\n"}' \ - | sed 's/\s\+/ /g' \ - | sed 'n;d' \ - | grep '^RFC[[:digit:]]' \ - | sed 's/RFC\([[:digit:]]\+\)/\1\t/;s/\. .*//' -)" - -selection="$(echo "$rfc_list" | fzf | awk '{print $1}')" - -curl -sSL "https://tools.ietf.org/rfc/rfc$selection.txt" | less diff --git a/packages/scripts/scrot-dmenu.sh b/packages/scripts/scrot-dmenu.sh deleted file mode 100755 index 8898bde..0000000 --- a/packages/scripts/scrot-dmenu.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# ref https://gitlab.com/dwt1/dotfiles/-/blob/master/.dmenu/dmenu-scrot.sh - -APP_NAME="📸 Scrot" -IMG_PATH="$HOME/Downloads/Screenshots" -TIME=3000 #Miliseconds notification should remain visible - -cmd=$(printf "fullscreen\nsection\nupload_fullscreen\nupload_section\n" | dmenu -p 'Screenshot') - -cd "$IMG_PATH" || exit -case ${cmd%% *} in - fullscreen) - scrot -d 1 \ - && notify-send -u low -t $TIME -a "$APP_NAME" 'Screenshot (full screen) saved.' - ;; - - section) - scrot -s \ - && notify-send -u low -t $TIME -a "$APP_NAME" 'Screenshot (section) saved.' - ;; - - upload_fullscreen) - scrot -d 1 -e "kpaste < \$f" | tail --lines=1 | xclip -selection clipboard -in \ - && notify-send -u low -t $TIME -a "$APP_NAME" "Screenshot (full screen) uploaded: $(xclip -selection clipboard -out)" - ;; - - upload_section) - scrot -s -e "kpaste < \$f" | tail --lines=1 | xclip -selection clipboard -in \ - && notify-send -u low -t $TIME -a "$APP_NAME" "Screenshot (section) uploaded: $(xclip -selection clipboard -out)" - ;; -esac diff --git a/packages/scripts/swallow.sh b/packages/scripts/swallow.sh deleted file mode 100755 index 7543c2f..0000000 --- a/packages/scripts/swallow.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# https://github.com/salman-abedin/devour/blob/master/devour.sh - -id=$(xdo id) -xdo hide -$("$@") > /dev/null 2>&1 -xdo show "$id" diff --git a/packages/scripts/tag.sh b/packages/scripts/tag.sh deleted file mode 100755 index 643681f..0000000 --- a/packages/scripts/tag.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/tag - -err() { echo "Usage: - tag [OPTIONS] file -Options: - -a: artist/author - -t: song/chapter title - -A: album/book title - -n: track/chapter number - -N: total number of tracks/chapters - -d: year of publication - -g: genre - -c: comment -You will be prompted for title, artist, album and track if not given." && exit 1 ;} - -while getopts "a:t:A:n:N:d:g:c:f:" o; do case "${o}" in - a) artist="${OPTARG}" ;; - t) title="${OPTARG}" ;; - A) album="${OPTARG}" ;; - n) track="${OPTARG}" ;; - N) total="${OPTARG}" ;; - d) date="${OPTARG}" ;; - g) genre="${OPTARG}" ;; - c) comment="${OPTARG}" ;; - f) file="${OPTARG}" ;; - *) printf "Invalid option: -%s\\n" "$OPTARG" && err ;; -esac done - -shift $((OPTIND - 1)) - -file="$1" - -[ ! -f "$file" ] && echo "Provide file to tag." && err - -[ -z "$title" ] && echo "Enter a title." && read -r title -[ -z "$artist" ] && echo "Enter an artist." && read -r artist -[ -z "$album" ] && echo "Enter an album." && read -r album -[ -z "$track" ] && echo "Enter a track number." && read -r track - -case "$file" in - *.ogg) echo "Title=$title -Artist=$artist -Album=$album -Track=$track -Total=$total -Date=$date -Genre=$genre -Comment=$comment" | vorbiscomment -w "$file" ;; - *.opus) echo "Title=$title -Artist=$artist -Album=$album -Track=$track -Total=$total -Date=$date -Genre=$genre -Comment=$comment" | opustags -i -S "$file" ;; - *.mp3) eyeD3 -Q --remove-all -a "$artist" -A "$album" -t "$title" -n "$track" -N "$total" -Y "$date" "$file" ;; - *) echo "File type not implemented yet." ;; -esac diff --git a/packages/scripts/tolino-screensaver.sh b/packages/scripts/tolino-screensaver.sh deleted file mode 100755 index fd89374..0000000 --- a/packages/scripts/tolino-screensaver.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -source_image="$1" - -if [ -e "$source_image" ]; then - convert -type Grayscale -resize 758x1024 "$source_image" "suspend.jpg" -else - echo >/dev/stderr "$1 must exist." - exit 1 -fi diff --git a/packages/scripts/vg.sh b/packages/scripts/vg.sh deleted file mode 100755 index 2f360ee..0000000 --- a/packages/scripts/vg.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -file="$(rg "$@" | fzf -0 -1 | awk -F: '{print $1}')" - -if [ -n "$file" ]; then - ${EDITOR:-vim} "$file" -fi diff --git a/packages/scripts/wttr.sh b/packages/scripts/wttr.sh deleted file mode 100755 index 9ea7084..0000000 --- a/packages/scripts/wttr.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -curl -s -H "Accept-Language: ${LANG%_*}" --compressed "wttr.in/${1-}?0" diff --git a/packages/sncli.nix b/packages/sncli.nix deleted file mode 100644 index 2b08299..0000000 --- a/packages/sncli.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - buildPythonPackage, - buildPythonApplication, - fetchPypi, - requests, - urwid, -}: let - Simperium3 = buildPythonPackage rec { - pname = "Simperium3"; - version = "0.1.3"; - src = fetchPypi { - inherit pname version; - sha256 = "1j1w4dji39v44l96qq9kbrxpcjkjmika8065gwy8bf847f9fa76p"; - }; - propagatedBuildInputs = [requests]; - }; -in - buildPythonApplication rec { - pname = "sncli"; - version = "0.3.0"; - - src = fetchPypi { - inherit pname version; - sha256 = "18s5a6s2z7k14cbiyfdf98kw92r2hf1xwaavx67dxhadxm18xr4v"; - }; - - propagatedBuildInputs = [requests urwid Simperium3]; - } diff --git a/packages/swallow.nix b/packages/swallow.nix new file mode 100644 index 0000000..6c6980e --- /dev/null +++ b/packages/swallow.nix @@ -0,0 +1,11 @@ +{ + writers, + xdo, +}: +# https://github.com/salman-abedin/devour/blob/master/devour.sh +writers.writeDashBin "swallow" '' + id=$(${xdo}/bin/xdo id) + ${xdo}/bin/xdo hide + $("$@") > /dev/null 2>&1 + ${xdo}/bin/xdo show "$id" +'' diff --git a/packages/timer.nix b/packages/timer.nix new file mode 100644 index 0000000..d743e56 --- /dev/null +++ b/packages/timer.nix @@ -0,0 +1,17 @@ +{ + writers, + bc, + coreutils, + espeak, +}: +writers.writeDashBin "timer" '' + [ $# -eq 2 ] || { + echo "Usage: $0 TIME MESSAGE" 1>&2 + exit 1 + } + time=$(echo "$1" | ${bc}/bin/bc) + echo "sleeping $time seconds, then saying: $2" + ${coreutils}/bin/sleep "$time" && { + echo "$2" | ${espeak}/bin/espeak -v german-mbrola-6 + } +'' diff --git a/packages/tocharian-font.nix b/packages/tocharian-font.nix index 44d975f..3d31c39 100644 --- a/packages/tocharian-font.nix +++ b/packages/tocharian-font.nix @@ -22,7 +22,6 @@ stdenv.mkDerivation { ''; meta = with lib; { description = "Tocharian font by Lee Wilson"; - license = licenses.unfree; platforms = platforms.all; maintainers = with maintainers; [kmein]; }; diff --git a/packages/trans.nix b/packages/trans.nix new file mode 100644 index 0000000..a145504 --- /dev/null +++ b/packages/trans.nix @@ -0,0 +1,13 @@ +{ + fetchurl, + writers, + gawk, +}: let + script = fetchurl { + url = "https://raw.githubusercontent.com/soimort/translate-shell/gh-pages/trans.awk"; + sha256 = "178r8d27bry1mzd1g8x2svp4w469hwv7nnxnmnsinx974skjx0jb"; + }; +in + writers.writeDashBin "trans" '' + exec ${gawk}/bin/gawk -f ${script} -- "$@" + '' diff --git a/packages/ttspaste.nix b/packages/ttspaste.nix new file mode 100644 index 0000000..6550675 --- /dev/null +++ b/packages/ttspaste.nix @@ -0,0 +1,9 @@ +{ + writers, + xclip, + curl, + mpv, +}: +writers.writeDashBin "ttspaste" '' + ${xclip}/bin/xclip -selection clipboard -out | ${curl}/bin/curl -G http://tts.r/api/tts --data-urlencode 'text@-' | ${mpv}/bin/mpv - +'' diff --git a/packages/scripts/unicodmenu.nix b/packages/unicodmenu.nix similarity index 100% rename from packages/scripts/unicodmenu.nix rename to packages/unicodmenu.nix diff --git a/packages/vg.nix b/packages/vg.nix new file mode 100644 index 0000000..2989d78 --- /dev/null +++ b/packages/vg.nix @@ -0,0 +1,13 @@ +{ + writers, + ripgrep, + fzf, + gawk, +}: +writers.writeDashBin "vg" '' + file="$(${ripgrep}/bin/rg "$@" | ${fzf}/bin/fzf -0 -1 | ${gawk}/bin/awk -F: '{print $1}')" + + if [ -n "$file" ]; then + ''${EDITOR:-vim} "$file" + fi +'' diff --git a/packages/when.nix b/packages/when.nix deleted file mode 100644 index 1b217e5..0000000 --- a/packages/when.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ - lib, - stdenv, - perl, - which, -}: -stdenv.mkDerivation { - name = "when"; - version = "1.1.40"; - - src = builtins.fetchTarball { - url = "http://www.lightandmatter.com/when/when.tar.gz"; - sha256 = "12d0zmvg66lwzr7q8zky0kz1x3w6q8dvyzm4x7lf1vy2z4pm4cvx"; - }; - - nativeBuildInputs = [which]; - buildInputs = [perl]; - - installFlags = ["prefix=$(out)"]; - - meta = with lib; { - homepage = "http://www.lightandmatter.com/when/when.html"; - description = "An extremely simple personal calendar program"; - longDescription = "When is an extremely simple personal calendar program, aimed at the Unix geek who wants something minimalistic."; - license = licenses.gpl2; - platforms = platforms.all; - }; -} diff --git a/packages/wttr.nix b/packages/wttr.nix new file mode 100644 index 0000000..4cba2c9 --- /dev/null +++ b/packages/wttr.nix @@ -0,0 +1,7 @@ +{ + writers, + curl, +}: +writers.writeDashBin "wttr" '' + ${curl}/bin/curl -s -H "Accept-Language: ''${LANG%_*}" --compressed "wttr.in/''${1-}?0" +'' diff --git a/systems/manakish/configuration.nix b/systems/manakish/configuration.nix index 8e39a28..f6feadc 100644 --- a/systems/manakish/configuration.nix +++ b/systems/manakish/configuration.nix @@ -17,7 +17,6 @@ in { age.secrets = { retiolum-rsa.file = ../../secrets/manakish-retiolum-privateKey-rsa.age; retiolum-ed25519.file = ../../secrets/manakish-retiolum-privateKey-ed25519.age; - restic.file = ../../secrets/restic.age; syncthing-cert.file = ../../secrets/manakish-syncthing-cert.age; syncthing-key.file = ../../secrets/manakish-syncthing-key.age; }; diff --git a/systems/zaatar/moodle-dl-meinhark.nix b/systems/zaatar/moodle-dl-meinhark.nix index f012893..b5a4e74 100644 --- a/systems/zaatar/moodle-dl-meinhark.nix +++ b/systems/zaatar/moodle-dl-meinhark.nix @@ -13,8 +13,18 @@ in { imports = [../../modules/moodle-dl.nix]; age.secrets = { - moodle-dl-tokens.file = ../../secrets/zaatar-moodle-dl-tokens.json.age; - moodle-dl-basicAuth.file = ../../secrets/zaatar-moodle-dl-basicAuth.age; + moodle-dl-tokens = { + file = ../../secrets/zaatar-moodle-dl-tokens.json.age; + owner = "moodle-dl"; + group = "moodle-dl"; + mode = "400"; + }; + moodle-dl-basicAuth = { + file = ../../secrets/zaatar-moodle-dl-basicAuth.age; + owner = "nginx"; + group = "nginx"; + mode = "400"; + }; }; services.moodle-dl = { diff --git a/systems/zaatar/mpd.nix b/systems/zaatar/mpd.nix index 7044781..78076c5 100644 --- a/systems/zaatar/mpd.nix +++ b/systems/zaatar/mpd.nix @@ -101,7 +101,12 @@ in { }; age.secrets = { - ympd-basicAuth.file = ../../secrets/zaatar-ympd-basicAuth.age; + ympd-basicAuth = { + file = ../../secrets/zaatar-ympd-basicAuth.age; + owner = "nginx"; + group = "nginx"; + mode = "400"; + }; syncthing-cert.file = ../../secrets/zaatar-syncthing-cert.age; syncthing-key.file = ../../secrets/zaatar-syncthing-key.age; di-fm-key.file = ../../secrets/di-fm-key.age;