diff options
Diffstat (limited to 'krebs/5pkgs/simple')
46 files changed, 576 insertions, 798 deletions
diff --git a/krebs/5pkgs/simple/K_belwagen.nix b/krebs/5pkgs/simple/K_belwagen.nix index 80d377b0c..2f64bb09d 100644 --- a/krebs/5pkgs/simple/K_belwagen.nix +++ b/krebs/5pkgs/simple/K_belwagen.nix @@ -9,7 +9,7 @@ stdenv.mkDerivation { buildInputs = [ pkgs.jack1 - pkgs.pkgconfig + pkgs.pkg-config ]; patchPhase = '' diff --git a/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh b/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh index c21dc8776..6978e38c6 100755 --- a/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh +++ b/krebs/5pkgs/simple/Reaktor/scripts/tell-on_join.sh @@ -1,7 +1,7 @@ #! /bin/sh set -euf -# require flock from util-linux (pkgs.utillinux) +# require flock from util-linux (pkgs.util-linux) if test "${FLOCK-}" != "$state_file"; then exec env FLOCK="$state_file" flock "$state_file" "$0" "$@" fi diff --git a/krebs/5pkgs/simple/brain/default.nix b/krebs/5pkgs/simple/brain/default.nix index 9b125862b..d7e36a527 100644 --- a/krebs/5pkgs/simple/brain/default.nix +++ b/krebs/5pkgs/simple/brain/default.nix @@ -1,12 +1,28 @@ -{ pass, write, writeDash, ... }: +{ pkgs }: -write "brain" { - "/bin/brain".link = writeDash "brain" '' +let + pass = pkgs.pass.withExtensions (ext: [ + ext.pass-otp + ]); +in + +pkgs.write "brain" { + "/bin/brain".link = pkgs.writeDash "brain" '' PASSWORD_STORE_DIR=$HOME/brain \ - exec ${pass}/bin/pass $@ + exec ${pass}/bin/pass "$@" ''; - "/bin/brainmenu".link = writeDash "brainmenu" '' + "/bin/brainmenu".link = pkgs.writeDash "brainmenu" '' PASSWORD_STORE_DIR=$HOME/brain \ - exec ${pass}/bin/passmenu $@ + exec ${pass}/bin/passmenu "$@" ''; + "/share/bash-completion/completions/brain".link = + pkgs.runCommand "brain-completions" { + } /* sh */ '' + sed -r ' + s/\<_pass?(_|\>)/_brain\1/g + s/\<__password_store/_brain/g + s/\<pass\>/brain/ + s/\$HOME\/\.password-store/$HOME\/brain/ + ' < ${pass}/share/bash-completion/completions/pass > $out + ''; } diff --git a/krebs/5pkgs/simple/cabal-read.nix b/krebs/5pkgs/simple/cabal-read.nix deleted file mode 100644 index 03b42ef2c..000000000 --- a/krebs/5pkgs/simple/cabal-read.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ writeHaskellPackage }: - -# Because `sed -n 's/.*\<ghc-options:\s\+\(.*\)/\1/p'` is too simple. -writeHaskellPackage "cabal-read" { - executables.ghc-options = { - extra-depends = ["Cabal"]; - text = /* haskell */ '' - {-# LANGUAGE CPP #-} - module Main (main) where - import Data.List - import Data.Maybe - import Distribution.Compiler - import Distribution.PackageDescription.Parsec - import Distribution.Types.BuildInfo - import Distribution.Types.CondTree - import Distribution.Types.Executable - import Distribution.Types.GenericPackageDescription - import Distribution.Types.UnqualComponentName - import Distribution.Verbosity - import System.Environment - main :: IO () - main = do - [path, name] <- getArgs - - desc <- readGenericPackageDescription normal path - - case lookup (mkUnqualComponentName name) (condExecutables desc) of - Just exe -> - putStrLn . intercalate " " . fromMaybe [] . lookup GHC - #if MIN_VERSION_Cabal(3,0,0) - . perCompilerFlavorToList - #endif - . options . buildInfo . condTreeData $ exe - - Nothing -> - error ("executable " <> name <> " not found in " <> path) - ''; - }; -} diff --git a/krebs/5pkgs/simple/cac-api/default.nix b/krebs/5pkgs/simple/cac-api/default.nix index 5f37f6682..59cd36cde 100644 --- a/krebs/5pkgs/simple/cac-api/default.nix +++ b/krebs/5pkgs/simple/cac-api/default.nix @@ -1,5 +1,5 @@ { fetchgit, lib, stdenv -, bc, cac-cert, coreutils, curl, dash, gnugrep, gnused, inotifyTools, jq, ncurses, openssh, sshpass +, bc, cac-cert, coreutils, curl, dash, gnugrep, gnused, inotify-tools, jq, ncurses, openssh, sshpass }: stdenv.mkDerivation { @@ -26,7 +26,7 @@ stdenv.mkDerivation { curl gnugrep gnused - inotifyTools + inotify-tools jq ncurses openssh diff --git a/krebs/5pkgs/simple/certaids.nix b/krebs/5pkgs/simple/certaids.nix new file mode 100644 index 000000000..34f4c3e14 --- /dev/null +++ b/krebs/5pkgs/simple/certaids.nix @@ -0,0 +1,109 @@ +{ pkgs }: + +pkgs.write "certaids" { + "/bin/cert2json".link = pkgs.writeDash "cert2json" '' + # usage: cert2json < CERT > JSON + set -efu + + ${pkgs.openssl}/bin/openssl crl2pkcs7 -nocrl -certfile /dev/stdin | + ${pkgs.openssl}/bin/openssl pkcs7 -print_certs -text | + ${pkgs.gawk}/bin/awk -F, -f ${pkgs.writeText "cert2json.awk" '' + function abort(msg) { + print(msg) > "/dev/stderr" + exit 1 + } + + function toJSON(x, type, ret) { + type = typeof(x) + switch (type) { + case "array": + if (isArray(x)) return arrayToJSON(x) + if (isObject(x)) return objectToJSON(x) + abort("cannot render array to JSON", x) + case "number": + return numberToJSON(x) + case "string": + return stringToJSON(x) + case "strnum": + case "unassigned": + case "regexp": + case "untyped": + default: + abort("cannot render type: " type) + } + } + + function isArray(x, i, k) { + i = 1 + for (k in x) { + if (k != i++) return 0 + i++ + } + return 1 + } + + function isObject(x, k) { + for (k in x) { + if (typeof(k) != "string") return 0 + } + return 1 + } + + function arrayToJSON(x, k, ret) { + ret = "[" + for (k in x) { + ret=ret toJSON(x[k]) "," + } + sub(/,$/,"",ret) + ret=ret "]" + return ret + } + + function objectToJSON(x, k,ret) { + ret = "{" + for (k in x) { + ret = ret toJSON(k) ":" toJSON(x[k]) "," + } + sub(/,$/, "", ret) + ret = ret "}" + return ret + } + + function numberToJSON(x) { + return x + } + + function stringToJSON(x) { + gsub(/\\/, "&&",x) + gsub(/\n/, "\\n", x) + return "\"" x "\"" + } + + $1 ~ /^ *(Subject|Issuer):/ { + sub(/^ */, "") + sub(/: */, ",") + key=tolower($1) + sub(/[^,]*,/, "") + + # Normalize separators between relative distinguished names. + # [1]: RFC2253, 3. Parsing a String back to a Distinguished Name + # TODO support any distinguished name + gsub(/ *[;,] */, ",") + + for(i = 0; i <= NF; i++) { + split($i, a, "=") + cache[key][a[1]] = a[2] + } + } + + /BEGIN CERTIFICATE/,/END CERTIFICATE/{ + cache["certificate"] = cache["certificate"] $0 "\n" + } + + /END CERTIFICATE/{ + print toJSON(cache) + delete cache + } + ''} + ''; +} diff --git a/krebs/5pkgs/simple/cunicu.nix b/krebs/5pkgs/simple/cunicu.nix new file mode 100644 index 000000000..4375a760c --- /dev/null +++ b/krebs/5pkgs/simple/cunicu.nix @@ -0,0 +1,22 @@ +{ lib, pkgs }: + +pkgs.buildGo120Module rec { + pname = "cunicu"; + version = "g${lib.substring 0 7 src.rev}"; + + buildInputs = [ + pkgs.libpcap + ]; + + # XXX tries to access https://relay.cunicu.li + doCheck = false; + + src = pkgs.fetchFromGitHub { + owner = "stv0g"; + repo = "cunicu"; + rev = "3ed8109bef97a10a438e5658c41823b7f812db8e"; + hash = "sha256-FpOJ6/jmnbpufc+kgKwlLtFhOcc2CTe+FvqeV8WEGMc="; + }; + + vendorHash = "sha256-eAawhJK9K8/7FCQiYMI9XCPePYsCVF045Di7SpRZvL4="; +} diff --git a/krebs/5pkgs/simple/dic/default.nix b/krebs/5pkgs/simple/dic/default.nix index 1825e4ee7..39402c012 100644 --- a/krebs/5pkgs/simple/dic/default.nix +++ b/krebs/5pkgs/simple/dic/default.nix @@ -1,5 +1,5 @@ { fetchgit, lib, stdenv -, coreutils, curl, gnugrep, gnused, utillinux +, coreutils, curl, gnugrep, gnused, util-linux }: stdenv.mkDerivation { @@ -23,7 +23,7 @@ stdenv.mkDerivation { curl gnused gnugrep - utillinux + util-linux ]; in '' diff --git a/krebs/5pkgs/simple/ergo/default.nix b/krebs/5pkgs/simple/ergo/default.nix deleted file mode 100644 index 2c9223eed..000000000 --- a/krebs/5pkgs/simple/ergo/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -{ buildGo117Module , fetchFromGitHub, lib }: - -buildGo117Module rec { - pname = "ergo"; - version = "2.9.1"; - - src = fetchFromGitHub { - owner = "ergochat"; - repo = "ergo"; - rev = "v${version}"; - sha256 = "sha256-RxsmkTfHymferS/FRW0sLnstKfvGXkW6cEb/JbeS4lc="; - }; - - vendorSha256 = null; - - meta = { - description = "A modern IRC server (daemon/ircd) written in Go"; - homepage = "https://github.com/ergochat/ergo"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ lassulus tv ]; - platforms = lib.platforms.linux; - }; -} diff --git a/krebs/5pkgs/simple/flameshot-once/default.nix b/krebs/5pkgs/simple/flameshot-once/default.nix deleted file mode 100644 index 0524c2cfa..000000000 --- a/krebs/5pkgs/simple/flameshot-once/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ pkgs, stockholm, ... }@args: -with stockholm.lib; - -let - # config cannot be declared in the input attribute set because that would - # cause callPackage to inject the wrong config. Instead, get it from ... - # via args. - config = args.config or {}; -in - - pkgs.symlinkJoin { - name = "flameshot-once-wrapper"; - paths = [ - (pkgs.writeDashBin "flameshot-once" '' - export PATH=${makeBinPath [ - pkgs.flameshot - pkgs.qt5.qtbase - pkgs.xclip - pkgs.xwaitforwindow - ]} - ${optionalString (config != null) /* sh */ '' - . ${import ./profile.nix { inherit config pkgs; }} - ''} - exec ${pkgs.haskellPackages.flameshot-once}/bin/flameshot-once "$@" - '') - pkgs.haskellPackages.flameshot-once - ]; - } diff --git a/krebs/5pkgs/simple/flameshot-once/profile.nix b/krebs/5pkgs/simple/flameshot-once/profile.nix deleted file mode 100644 index 269f13a66..000000000 --- a/krebs/5pkgs/simple/flameshot-once/profile.nix +++ /dev/null @@ -1,235 +0,0 @@ -{ config, pkgs }: -with pkgs.stockholm.lib; -with generators; -let - - # Refs https://github.com/lupoDharkael/flameshot/blob/master/src/widgets/capture/capturebutton.h - ButtonType = { - PENCIL = 0; - DRAWER = 1; - ARROW = 2; - SELECTION = 3; - RECTANGLE = 4; - CIRCLE = 5; - MARKER = 6; - SELECTIONINDICATOR = 7; - MOVESELECTION = 8; - UNDO = 9; - COPY = 10; - SAVE = 11; - EXIT = 12; - IMAGEUPLOADER = 13; - OPEN_APP = 14; - BLUR = 15; - REDO = 16; - PIN = 17; - TEXT = 18; - CIRCLECOUNT = 19; - }; - - cfg = eval.config; - - eval = evalModules { - modules = singleton { - _file = toString ./profile.nix; - imports = singleton config; - options = { - buttons = mkOption { - apply = map (name: ButtonType.${name}); - default = [ - "PENCIL" - "DRAWER" - "ARROW" - "SELECTION" - "RECTANGLE" - "CIRCLE" - "MARKER" - "SELECTIONINDICATOR" - "MOVESELECTION" - "UNDO" - "SAVE" - "EXIT" - "BLUR" - "CIRCLECOUNT" - ] - ++ optional cfg.imgur.enable "IMAGEUPLOADER" - ; - type = types.listOf (types.enum (attrNames ButtonType)); - }; - copyAndCloseAfterUpload = mkOption { - default = false; - type = types.bool; - }; - disabledTrayIcon = mkOption { - default = true; - type = types.bool; - }; - drawColor = mkOption { - default = "#ff0000"; - type = - types.addCheck types.str (test "#[0-9A-Fa-f]{6}"); - }; - drawThickness = mkOption { - default = 8; - type = types.positive; - }; - filenamePattern = mkOption { - default = "%FT%T%z_flameshot"; - type = - # This is types.filename extended by [%:][%:+]* - types.addCheck types.str (test "[%:0-9A-Za-z._][%:+0-9A-Za-z._-]*"); - }; - imgur = mkOption { - default = {}; - type = types.submodule { - options = { - enable = mkEnableOption "imgur"; - createUrl = mkOption { - example = "http://p.r/image"; - type = types.str; - }; - deleteUrl = mkOption { - example = "http://p.r/image/delete/%1"; - type = types.str; - }; - xdg-open = mkOption { - default = {}; - type = types.submodule { - options = { - enable = mkEnableOption "imgur.xdg-open" // { - default = true; - }; - browser = mkOption { - default = "${pkgs.coreutils}/bin/false"; - type = types.str; - }; - createPrefix = mkOption { - default = cfg.imgur.createUrl; - type = types.str; - }; - deletePrefix = mkOption { - default = removeSuffix "/%1" cfg.imgur.deleteUrl; - type = types.str; - }; - }; - }; - }; - }; - }; - }; - savePath = mkOption { - default = "/tmp"; - type = types.absolute-pathname; - }; - showDesktopNotification = mkOption { - default = false; - type = types.bool; - }; - showHelp = mkOption { - default = false; - type = types.bool; - }; - showSidePanelButton = mkOption { - default = false; - type = types.bool; - }; - showStartupLaunchMessage = mkOption { - default = false; - type = types.bool; - }; - timeout = mkOption { - default = 200; - description = '' - Maximum time in milliseconds allowed for the flameshot daemon to - react. - ''; - type = types.positive; - }; - }; - }; - }; - - hexchars = stringToCharacters "0123456789abcdef"; - - # Encode integer to C-escaped string of bytes, little endian / LSB 0 - le = rec { - x1 = i: let - i0 = mod i 16; - i1 = i / 16; - in - "\\x${elemAt hexchars i1}${elemAt hexchars i0}"; - - x2 = i: let - i0 = mod i 256; - i1 = i / 256; - in - "${x1 i0}${x1 i1}"; - - x4 = i: let - i0 = mod i 65536; - i1 = i / 65536; - in - "${x2 i0}${x2 i1}"; - }; - - toQList = t: xs: - assert t == "int"; - "QList<${t}>${le.x4 0}${le.x4 (length xs)}${concatMapStrings le.x4 xs}"; - - XDG_CONFIG_HOME = pkgs.write "flameshot-config" { - "/flameshot/flameshot.ini".text = - toINI {} { - General = { - buttons = ''@Variant(\0\0\0\x7f\0\0\0\v${toQList "int" cfg.buttons})''; - disabledTrayIcon = cfg.disabledTrayIcon; - checkForUpdates = false; - copyAndCloseAfterUpload = cfg.copyAndCloseAfterUpload; - drawColor = cfg.drawColor; - drawThickness = cfg.drawThickness; - filenamePattern = cfg.filenamePattern; - savePath = cfg.savePath; - showDesktopNotification = cfg.showDesktopNotification; - showHelp = cfg.showHelp; - showSidePanelButton = cfg.showSidePanelButton; - showStartupLaunchMessage = cfg.showStartupLaunchMessage; - startupLaunch = false; - }; - Shortcuts = { - TYPE_COPY = "Return"; - }; - }; - }; - -in - - pkgs.writeDash "flameshot.profile" '' - export FLAMESHOT_CAPTURE_PATH=${cfg.savePath} - export FLAMESHOT_ONCE_TIMEOUT=${toString cfg.timeout} - export XDG_CONFIG_HOME=${XDG_CONFIG_HOME} - ${optionalString cfg.imgur.enable /* sh */ '' - export IMGUR_CREATE_URL=${shell.escape cfg.imgur.createUrl} - export IMGUR_DELETE_URL=${shell.escape cfg.imgur.deleteUrl} - ${optionalString cfg.imgur.xdg-open.enable /* sh */ '' - PATH=$PATH:${makeBinPath [ - (pkgs.writeDashBin "xdg-open" '' - set -efu - uri=$1 - prefix=$(${pkgs.coreutils}/bin/dirname "$uri") - case $prefix in - (${shell.escape cfg.imgur.xdg-open.createPrefix}) - echo "opening image in browser: $uri" >&2 - exec ${config.imgur.xdg-open.browser} "$uri" - ;; - (${shell.escape cfg.imgur.xdg-open.deletePrefix}) - echo "deleting image: $uri" >&2 - exec ${pkgs.curl}/bin/curl -fsS -X DELETE "$uri" - ;; - (*) - echo "don't know how to open URI: $uri" >&2 - exit 1 - esac - '') - ]} - ''} - ''} - '' diff --git a/krebs/5pkgs/simple/fzfmenu/default.nix b/krebs/5pkgs/simple/fzfmenu/default.nix index f208f6a3e..030c1b1b1 100644 --- a/krebs/5pkgs/simple/fzfmenu/default.nix +++ b/krebs/5pkgs/simple/fzfmenu/default.nix @@ -39,19 +39,20 @@ let }; in -pkgs.writeDashBin "fzfmenu" '' +pkgs.writers.writeDashBin "fzfmenu" '' set -efu # Spawn terminal if called without one, like e.g. from a window manager. - if [ -z ''${TERM+x} ]; then + if [ -z ''${TERM+x} ] || [ $TERM = dumb ]; then exec 3<&0 exec 4>&1 export FZFMENU_INPUT_FD=3 export FZFMENU_OUTPUT_FD=4 - exec ${pkgs.rxvt_unicode}/bin/urxvt \ - -name ${cfg.appName} \ - -title ${shell.escape cfg.windowTitle} \ - -e "$0" "$@" + exec ${pkgs.alacritty}/bin/alacritty \ + --config-file /var/theme/config/alacritty.yaml \ + --class ${cfg.appName} \ + --title ${shell.escape cfg.windowTitle} \ + --command "$0" "$@" else exec 0<&''${FZFMENU_INPUT_FD-0} exec 1>&''${FZFMENU_OUTPUT_FD-1} diff --git a/krebs/5pkgs/simple/generate-secrets/default.nix b/krebs/5pkgs/simple/generate-secrets/default.nix index f9a7450f7..8522b5dda 100644 --- a/krebs/5pkgs/simple/generate-secrets/default.nix +++ b/krebs/5pkgs/simple/generate-secrets/default.nix @@ -23,7 +23,6 @@ pkgs.writers.writeDashBin "generate-secrets" '' cat <<EOF $HOSTNAME = { - cores = 1; owner = config.krebs.users.krebs; nets = { retiolum = { @@ -40,7 +39,7 @@ pkgs.writers.writeDashBin "generate-secrets" '' }; }; }; - ssh.privkey.path = <secrets/ssh.id_ed25519>; + ssh.privkey.path = "\''${config.krebs.secret.directory}/ssh.id_ed25519"; ssh.pubkey = "$(cat $TMPDIR/ssh.id_ed25519.pub)"; }; EOF diff --git a/krebs/5pkgs/simple/git-assembler.nix b/krebs/5pkgs/simple/git-assembler.nix new file mode 100644 index 000000000..095dddf0f --- /dev/null +++ b/krebs/5pkgs/simple/git-assembler.nix @@ -0,0 +1,24 @@ +{ pkgs, stdenv }: + +stdenv.mkDerivation rec { + pname = "git-assembler"; + version = "1.3"; + + src = pkgs.fetchFromGitLab { + owner = "wavexx"; + repo = "git-assembler"; + rev = "v${version}"; + hash = "sha256-A+ygt6Fxiu6EkVoQU5L1rhxu2e1HU0nbqJFzLzXzHBo="; + }; + + buildInputs = [ + pkgs.python3 + ]; + + buildPhase = ":"; + + installPhase = '' + mkdir -p $out/bin + cp git-assembler $out/bin + ''; +} diff --git a/krebs/5pkgs/simple/hashPassword/default.nix b/krebs/5pkgs/simple/hashPassword/default.nix index 3c604be80..8d3ba2525 100644 --- a/krebs/5pkgs/simple/hashPassword/default.nix +++ b/krebs/5pkgs/simple/hashPassword/default.nix @@ -1,6 +1,6 @@ { lib, pkgs, ... }: -pkgs.writeDashBin "hashPassword" '' +pkgs.writers.writeDashBin "hashPassword" '' # usage: hashPassword [...] set -euf diff --git a/krebs/5pkgs/simple/htgen-cyberlocker/default.nix b/krebs/5pkgs/simple/htgen-cyberlocker/default.nix index c7d7ebfd8..c4f37131d 100644 --- a/krebs/5pkgs/simple/htgen-cyberlocker/default.nix +++ b/krebs/5pkgs/simple/htgen-cyberlocker/default.nix @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { pkgs.gnugrep pkgs.jq pkgs.nix - pkgs.utillinux + pkgs.util-linux ]} echo STATEDIR=${shell.escape "\${STATEDIR-$HOME}"} cat $src/htgen-cyberlocker diff --git a/krebs/5pkgs/simple/htgen-imgur/default.nix b/krebs/5pkgs/simple/htgen-imgur/default.nix index f429ff7a6..379150a85 100644 --- a/krebs/5pkgs/simple/htgen-imgur/default.nix +++ b/krebs/5pkgs/simple/htgen-imgur/default.nix @@ -1,7 +1,7 @@ -{ attr, coreutils, exiv2, findutils, gnugrep, jq, nix, stockholm, utillinux, stdenv }: +{ attr, coreutils, exiv2, findutils, gnugrep, jq, nix, stockholm, util-linux, stdenv }: stdenv.mkDerivation rec { pname = "htgen-imgur"; - version = "1.0.0"; + version = "1.2 |