summaryrefslogtreecommitdiffstats
path: root/pkgs/simple
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/simple')
-rw-r--r--pkgs/simple/alacritty-tv.nix56
-rw-r--r--pkgs/simple/dic.nix37
-rw-r--r--pkgs/simple/editor-input.nix2
-rw-r--r--pkgs/simple/fzmenu/default.nix12
-rw-r--r--pkgs/simple/hc.nix4
-rw-r--r--pkgs/simple/otherutils.nix15
-rw-r--r--pkgs/simple/pinentry-urxvt/default.nix2
-rw-r--r--pkgs/simple/q/default.nix6
-rw-r--r--pkgs/simple/viljetic-pages/index.html1
-rw-r--r--pkgs/simple/with-tmpdir.nix29
-rw-r--r--pkgs/simple/writePolkitRules.nix72
-rw-r--r--pkgs/simple/xextras.nix19
12 files changed, 225 insertions, 30 deletions
diff --git a/pkgs/simple/alacritty-tv.nix b/pkgs/simple/alacritty-tv.nix
index 0d2fe59..ebf609e 100644
--- a/pkgs/simple/alacritty-tv.nix
+++ b/pkgs/simple/alacritty-tv.nix
@@ -5,18 +5,33 @@ pkgs.symlinkJoin {
paths = [
(pkgs.writeDashBin "alacritty" ''
# usage:
- # alacritty [--profile=PROFILE] [--singleton] [ARGS...]
+ # alacritty [--dtach] [--profile=PROFILE] [--singleton] [COMMAND [ARGS...]]
# where
# PROFILE must have a corresponding file /etc/alacritty/PROFILE.toml
set -efu
+ dtach=
profile=default
- case ''${1-} in
- --profile=*)
- profile=''${1#--profile=}
- shift
- esac
+ singleton=
+ while :; do
+ case ''${1-} in
+ --dtach)
+ dtach=1
+ shift
+ ;;
+ --profile=*)
+ profile=''${1#--profile=}
+ shift
+ ;;
+ --singleton)
+ singleton=1
+ shift
+ ;;
+ *)
+ break
+ esac
+ done
config=/etc/alacritty/$profile.toml
@@ -31,17 +46,24 @@ pkgs.symlinkJoin {
${pkgs.jq}/bin/jq .device_scale_factor
)
- case ''${1-} in
- --singleton)
- shift
- if ! ${pkgs.alacritty}/bin/alacritty --config-file "$config" msg create-window "$@"; then
- ${pkgs.alacritty}/bin/alacritty --config-file "$config" "$@" &
- fi
- ;;
- *)
- exec ${pkgs.alacritty}/bin/alacritty --config-file "$config" "$@"
- ;;
- esac
+ if test "$dtach" = 1; then
+ if test $# = 0; then
+ _CURRENT_DESKTOP_NAME=''${_CURRENT_DESKTOP_NAME-$(${pkgs.xextras}/bin/net-current-desktop)}
+ SHELL=''${SHELL-${pkgs.bash}/bin/bash}
+ sock=$XDG_RUNTIME_DIR/Alacritty-$DISPLAY-dtach-$_CURRENT_DESKTOP_NAME-$$.sock
+ set -- -e ${pkgs.dtach}/bin/dtach -c "$sock" -r winch -z "$SHELL"
+ else
+ echo 'alacritty-tv: warning: option --dtach ignored: arguments provided' >&2
+ fi
+ fi
+
+ if test "$singleton" = 1; then
+ if ! ${pkgs.alacritty}/bin/alacritty --config-file "$config" msg create-window "$@"; then
+ ${pkgs.alacritty}/bin/alacritty --config-file "$config" "$@" &
+ fi
+ else
+ exec ${pkgs.alacritty}/bin/alacritty --config-file "$config" "$@"
+ fi
'')
pkgs.alacritty
];
diff --git a/pkgs/simple/dic.nix b/pkgs/simple/dic.nix
new file mode 100644
index 0000000..0875c73
--- /dev/null
+++ b/pkgs/simple/dic.nix
@@ -0,0 +1,37 @@
+{ lib, pkgs, stdenv }:
+
+stdenv.mkDerivation {
+ name = "dic";
+
+ src = pkgs.fetchgit {
+ url = https://cgit.ni.krebsco.de/dic;
+ rev = "refs/tags/v1.1.1";
+ sha256 = "1gbj967a5hj53fdkkxijqgwnl9hb8kskz0cmpjq7v65ffz3v6vag";
+ };
+
+ phases = [
+ "unpackPhase"
+ "installPhase"
+ ];
+
+ installPhase =
+ let
+ path = lib.makeBinPath [
+ pkgs.coreutils
+ pkgs.curl
+ pkgs.gnused
+ pkgs.gnugrep
+ pkgs.util-linux
+ ];
+ in
+ ''
+ mkdir -p $out/bin
+
+ sed \
+ 's,^main() {$,&\n PATH=${path}; export PATH,' \
+ < ./dic \
+ > $out/bin/dic
+
+ chmod +x $out/bin/dic
+ '';
+}
diff --git a/pkgs/simple/editor-input.nix b/pkgs/simple/editor-input.nix
index 536084d..0591f2f 100644
--- a/pkgs/simple/editor-input.nix
+++ b/pkgs/simple/editor-input.nix
@@ -1,7 +1,7 @@
{ pkgs }:
pkgs.writeDashBin "editor-input" ''
exec \
- ${pkgs.utillinux}/bin/setsid -f \
+ ${pkgs.util-linux}/bin/setsid -f \
${pkgs.with-tmpdir}/bin/with-tmpdir -t editor-input.XXXXXXXX \
${pkgs.writeDash "editor-input.sh" ''
f=$TMPDIR/input
diff --git a/pkgs/simple/fzmenu/default.nix b/pkgs/simple/fzmenu/default.nix
index e709d74..9a9bda6 100644
--- a/pkgs/simple/fzmenu/default.nix
+++ b/pkgs/simple/fzmenu/default.nix
@@ -17,8 +17,8 @@ pkgs.runCommand "fzmenu" {
cp -r ${./bin} $out/bin
substituteInPlace $out/bin/otpmenu \
- --replace '#! /bin/sh' '#! ${pkgs.dash}/bin/dash' \
- --replace '#PATH=' PATH=${lib.makeBinPath [
+ --replace-fail '#! /bin/sh' '#! ${pkgs.dash}/bin/dash' \
+ --replace-fail '#PATH=' PATH=${lib.makeBinPath [
pkgs.coreutils
pkgs.dash
pkgs.findutils
@@ -27,15 +27,15 @@ pkgs.runCommand "fzmenu" {
(pkgs.pass.withExtensions (ext: [
ext.pass-otp
]))
- pkgs.utillinux
+ pkgs.util-linux
pkgs.xsel
pkgs.xvkbd
terminal
]}
substituteInPlace $out/bin/passmenu \
- --replace '#! /bin/sh' '#! ${pkgs.dash}/bin/dash' \
- --replace '#PATH=' PATH=${lib.makeBinPath [
+ --replace-fail '#! /bin/sh' '#! ${pkgs.dash}/bin/dash' \
+ --replace-fail '#PATH=' PATH=${lib.makeBinPath [
pkgs.coreutils
pkgs.dash
pkgs.findutils
@@ -44,7 +44,7 @@ pkgs.runCommand "fzmenu" {
(pkgs.pass.withExtensions (ext: [
ext.pass-otp
]))
- pkgs.utillinux
+ pkgs.util-linux
pkgs.xsel
pkgs.xvkbd
terminal
diff --git a/pkgs/simple/hc.nix b/pkgs/simple/hc.nix
index 086445e..15550dc 100644
--- a/pkgs/simple/hc.nix
+++ b/pkgs/simple/hc.nix
@@ -1,5 +1,5 @@
{ fetchgit, lib, makeWrapper, stdenv
-, coreutils, findutils, gawk, gnugrep, qrencode, texlive, utillinux, zbar
+, coreutils, findutils, gawk, gnugrep, qrencode, texlive, util-linux, zbar
}:
stdenv.mkDerivation rec {
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
gnugrep
qrencode
texlive.combined.scheme-full
- utillinux
+ util-linux
zbar
]}
'';
diff --git a/pkgs/simple/otherutils.nix b/pkgs/simple/otherutils.nix
new file mode 100644
index 0000000..5c946d2
--- /dev/null
+++ b/pkgs/simple/otherutils.nix
@@ -0,0 +1,15 @@
+{ pkgs, stdenv }:
+
+stdenv.mkDerivation rec {
+ pname = "otherutils";
+ version = "1.1.0";
+ src = pkgs.fetchgit {
+ url = "https://cgit.krebsco.de/otherutils";
+ rev = "refs/tags/${version}";
+ hash = "sha256-eiMTIXTEsq+DGlOw+fcU2cgRkuPWTy5lm/L5heuhDxM=";
+ };
+ env = {
+ PREFIX = placeholder "out";
+ };
+}
+
diff --git a/pkgs/simple/pinentry-urxvt/default.nix b/pkgs/simple/pinentry-urxvt/default.nix
index 808d00a..e79b09f 100644
--- a/pkgs/simple/pinentry-urxvt/default.nix
+++ b/pkgs/simple/pinentry-urxvt/default.nix
@@ -51,7 +51,7 @@ in
trap cleanup EXIT
cleanup() {
- ${pkgs.utillinux}/bin/kill -- $(${pkgs.coreutils}/bin/cat "$displayers")
+ ${pkgs.util-linux}/bin/kill -- $(${pkgs.coreutils}/bin/cat "$displayers")
rm "$displayers"
rm "$screenshot"
}
diff --git a/pkgs/simple/q/default.nix b/pkgs/simple/q/default.nix
index ca4a466..5944dd9 100644
--- a/pkgs/simple/q/default.nix
+++ b/pkgs/simple/q/default.nix
@@ -17,11 +17,11 @@ let
in /* sh */ ''
cols=$(${pkgs.ncurses}/bin/tput cols)
if test $cols -ge ${toString (need_width 3)}; then
- ${pkgs.utillinux}/bin/cal --color=always -mw3
+ ${pkgs.util-linux}/bin/cal --color=always -mw3
elif test $cols -ge ${toString (need_width 2)}; then
- ${pkgs.utillinux}/bin/cal --color=always -mw -n 2
+ ${pkgs.util-linux}/bin/cal --color=always -mw -n 2
elif test $cols -ge ${toString (need_width 1)}; then
- ${pkgs.utillinux}/bin/cal --color=always -mw1
+ ${pkgs.util-linux}/bin/cal --color=always -mw1
else
:
fi |
diff --git a/pkgs/simple/viljetic-pages/index.html b/pkgs/simple/viljetic-pages/index.html
index c268cb9..9394cf7 100644
--- a/pkgs/simple/viljetic-pages/index.html
+++ b/pkgs/simple/viljetic-pages/index.html
@@ -4,6 +4,7 @@
<i>This page intentionally left blank.</i>
<!--
mailto:tomislav@viljetic.de
+ matrix:u/@tomislav:viljetic.de
https://github.com/4z3
irc://irc.hackint.org/tv,isnick
irc://irc.libera.chat/tv,isnick
diff --git a/pkgs/simple/with-tmpdir.nix b/pkgs/simple/with-tmpdir.nix
new file mode 100644
index 0000000..9862671
--- /dev/null
+++ b/pkgs/simple/with-tmpdir.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchgit, coreutils, dash, ... }:
+
+stdenv.mkDerivation {
+ name = "with-tmpdir-1";
+
+ src = fetchgit {
+ url = http://cgit.ni.krebsco.de/with-tmpdir;
+ rev = "3243c02ed8cd27a04c080bd39560204980f6c16a";
+ sha256 = "80ee6cafb2c337999ddcd1e41747d6256b7cfcea605358c2046eb7e3729555c6";
+ };
+
+ phases = [
+ "unpackPhase"
+ "installPhase"
+ ];
+
+ installPhase = ''
+ mkdir -p $out/bin
+
+ { echo '#! ${dash}/bin/dash'
+ echo 'OLDPATH=$PATH'
+ echo 'PATH=${coreutils}/bin'
+ sed '$s/^/#/' ./with-tmpdir
+ echo '(PATH=$OLDPATH; exec "$@")'
+ } > $out/bin/with-tmpdir
+
+ chmod +x $out/bin/with-tmpdir
+ '';
+}
diff --git a/pkgs/simple/writePolkitRules.nix b/pkgs/simple/writePolkitRules.nix
new file mode 100644
index 0000000..af4cb49
--- /dev/null
+++ b/pkgs/simple/writePolkitRules.nix
@@ -0,0 +1,72 @@
+{ lib, pkgs, ... }:
+
+name: text:
+
+pkgs.runCommand name {
+ nativeBuildInputs = [
+ pkgs.eslint
+ ];
+ eslintConfig = /* js */ ''
+ // ESLint flat config for Polkit rules (Duktape 2.7)
+ export default [
+ {
+ files: [${builtins.toJSON name}],
+ languageOptions: {
+ ecmaVersion: 2016,
+ sourceType: 'script',
+ globals: {
+ polkit: 'readonly',
+ },
+ },
+ linterOptions: {
+ reportUnusedDisableDirectives: true,
+ },
+ rules: {
+ 'no-unused-vars': 'warn',
+ 'no-undef': 'error',
+ 'no-console': 'off',
+ 'prefer-const': 'warn',
+ 'no-confusing-arrow': [
+ 'error',
+ { allowParens: true },
+ ],
+ 'no-constant-condition': 'warn',
+ 'no-restricted-syntax': [
+ 'error',
+ {
+ selector: 'AwaitExpression',
+ message: 'Async/await is not supported in Polkit rules.',
+ },
+ {
+ selector: 'ImportDeclaration',
+ message: 'Modules are not supported.',
+ },
+ {
+ selector: 'ExportNamedDeclaration',
+ message: 'Modules are not supported.',
+ },
+ {
+ selector: 'NewExpression[callee.name="Promise"]',
+ message: 'Promises are not supported in Duktape.',
+ },
+ {
+ selector: 'ClassDeclaration',
+ message: 'Class syntax may behave inconsistently in Duktape.',
+ },
+ ]
+ }
+ }
+ ];
+ '';
+ polkitRules = text;
+ passAsFile = [
+ "eslintConfig"
+ "polkitRules"
+ ];
+} /* sh */ ''
+ name=${lib.escapeShellArg name}
+ ln -s "$polkitRulesPath" "$name"
+ ln -s "$eslintConfigPath" eslint.config.js
+ eslint "$name"
+ cp -L "$name" "$out"
+''
diff --git a/pkgs/simple/xextras.nix b/pkgs/simple/xextras.nix
new file mode 100644
index 0000000..c9c0308
--- /dev/null
+++ b/pkgs/simple/xextras.nix
@@ -0,0 +1,19 @@
+{ pkgs }:
+
+pkgs.write "xextras" {
+ "/bin/net-current-desktop".link =
+ pkgs.writeDash "net-current-desktop" ''
+ # SYNOPSIS
+ # net-current-desktop
+ #
+ ${pkgs.xorg.xprop}/bin/xprop -notype -root 32i _NET_CURRENT_DESKTOP 8s _NET_DESKTOP_NAMES |
+ ${pkgs.jq}/bin/jq -Rrs '
+ split("\n") | map(select(.!="") | split(" = ") | { name: .[0], value: .[1] }) | from_entries |
+ {
+ _NET_CURRENT_DESKTOP: (._NET_CURRENT_DESKTOP | tonumber),
+ _NET_DESKTOP_NAMES: (._NET_DESKTOP_NAMES | "[\(ltrimstr("._NET_DESKTOP_NAMES = "))]" | fromjson)
+ } |
+ ._NET_DESKTOP_NAMES[._NET_CURRENT_DESKTOP]
+ '
+ '';
+}