make schemes work nicely, move packages to pkgs

This commit is contained in:
Gabriel Fontes
2021-10-03 15:36:11 -03:00
parent 10d9fc45fe
commit 7aef57a5a8
19 changed files with 443 additions and 347 deletions
+44
View File
@@ -0,0 +1,44 @@
{ lib, stdenv
, writeShellScriptBin
, nix-index, gnugrep
}:
with lib;
stdenv.mkDerivation {
name = "comma";
version = "1.0";
src = writeShellScriptBin "comma" ''
if [ -z "$1" ]; then
echo "You must specify a command" > /dev/stderr
exit 1
else
command="$1"
shift
fi
packages=$(${nix-index}/bin/nix-locate -r "bin/$command(-wrapped)?$") || { >&2 echo "No package found"; exit 2;}
package_line=$(${gnugrep}/bin/grep -G "^coreutils.out " <<< "$packages" || \
${gnugrep}/bin/grep -G "^''${command}-wrapper.out " <<< "$packages" || \
${gnugrep}/bin/grep -G "^''${command}.out " <<< "$packages" || head -1 <<< "$packages")
package=$(echo "$package_line" | cut -d ' ' -f1)
>&2 printf "\033[0;32mUsing package\033[0m: ''${package}\n"
nix shell nixpkgs#"$package" --command "$command" $@
'';
dontBuild = true;
dontConfigure = true;
installPhase = "install -Dm 0755 $src/bin/comma $out/bin/,";
meta = {
description = "Automatically shell into whatever package provides a command you asked for";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ misterio77 ];
};
}
+39
View File
@@ -0,0 +1,39 @@
{ lib, stdenv
, fetchFromGitHub, makeWrapper
, cava, gnused
}:
with lib;
stdenv.mkDerivation {
pname = "minicava";
version = "0.1";
src = fetchFromGitHub {
owner = "Misterio77";
repo = "minicava";
rev = "cabb143e0f83706022f653c1566f3a8c3ce133bb";
sha256 = "sha256-yJctepZrtxszfq+U5mrsTlzIW0R5ZAdjkCgQxukfUeo=";
};
dontBuild = true;
dontConfigure = true;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
install -Dm 0755 minicava.sh $out/bin/minicava
wrapProgram $out/bin/minicava --set PATH \
"${makeBinPath [
cava
gnused
]}"
'';
meta = {
description = "A miniature cava sound visualizer";
homepage = "https://github.com/Misterio77/minicava";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ misterio77 ];
};
}
+45
View File
@@ -0,0 +1,45 @@
{ lib, stdenv, fetchFromGitHub, makeWrapper
, pass, jq, wofi, libnotify, qutebrowser, sway, wl-clipboard, findutils, gnused
}:
with lib;
stdenv.mkDerivation {
name = "pass-wofi";
version = "1.0";
src = fetchFromGitHub {
owner = "Misterio77";
repo = "pass-wofi";
rev = "269918667672ac11cff850b50aeaf53315e97e38";
sha256 = "sha256-IFGuL2UQHJ46Be5ZCXn3zKoYpxr62X+eYyNVYLKRf38=";
};
nativeBuildInputs = [ makeWrapper ];
dontBuild = true;
dontConfigure = true;
installPhase = ''
install -Dm 0755 pass-wofi.sh $out/bin/pass-wofi
wrapProgram $out/bin/pass-wofi --set PATH \
"${makeBinPath [
pass
jq
wofi
libnotify
qutebrowser
sway
wl-clipboard
findutils
gnused
]}"
'';
meta = {
description = "A wofi graphical menu for pass";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ misterio77 ];
};
}
+29
View File
@@ -0,0 +1,29 @@
{ lib, stdenv, writeShellScriptBin
, playerctl }:
with lib;
stdenv.mkDerivation {
name = "preferredplayer";
version = "1.0";
src = writeShellScriptBin "preferredplayer" ''
if [[ -z "$1" ]]; then
players=$(${playerctl}/bin/playerctl --list-all 2>/dev/null | \
grep "$(cat $XDG_RUNTIME_DIR/currentplayer 2> /dev/null || echo '.*')") && \
echo "$players" | head -1
else
echo "$1" > $XDG_RUNTIME_DIR/currentplayer
fi
'';
dontBuild = true;
dontConfigure = true;
installPhase = "install -Dm 0755 $src/bin/preferredplayer $out/bin/preferredplayer";
meta = {
description = "A script for setting a preferred player";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ misterio77 ];
};
}
+46
View File
@@ -0,0 +1,46 @@
{ lib, stdenv, fetchFromGitHub, makeWrapper
, findutils, gnugrep, procps, gawk, coreutils, openrgb, pastel, pulseaudio, playerctl, preferredplayer, sway}:
with lib;
stdenv.mkDerivation {
name = "rgbdaemon";
version = "0.1";
src = fetchFromGitHub {
owner = "Misterio77";
repo = "rgbdaemon";
rev = "068dcad606267a84f15c3decabaaac835feac2d1";
sha256 = "sha256-Ek0MaUR0SO+zWukdXhKto/bWtN/Yd7CO/MoXzHj+E0A=";
};
nativeBuildInputs = [ makeWrapper ];
dontBuild = true;
dontConfigure = true;
installPhase = ''
install -Dm 0755 rgbdaemon.sh $out/bin/rgbdaemon
wrapProgram $out/bin/rgbdaemon --set PATH \
"${makeBinPath [
findutils
gnugrep
procps
gawk
coreutils
openrgb
pastel
pulseaudio
playerctl
preferredplayer
sway
]}"
'';
meta = {
description = "A daemon that interacts with ckb-next and openrgb";
homepage = "https://github.com/Misterio77/rgbdaemon";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ misterio77 ];
};
}
+26
View File
@@ -0,0 +1,26 @@
{ lib, pkgs, stdenv, writeShellScriptBin
, setscheme, wofi, zenity }:
with lib;
stdenv.mkDerivation {
name = "setscheme-wofi";
version = "1.0";
src = writeShellScriptBin "setscheme-wofi" ''
set -o pipefail
chosen=$(${setscheme}/bi/setscheme -L | ${wofi}/bin/wofi -S dmenu) && \
${setscheme}/bin/setscheme $chosen --show-trace --verbose 2>&1 | \
stdbuf -oL -eL awk '/^ / { print int(+$2) ; next } $0 { print "# " $0 }' | \
${zenity}/bin/setscheme --progress --pulsate --auto-close --auto-kill --title "Change color scheme"
'';
dontBuild = true;
dontConfigure = true;
installPhase = "install -Dm 0755 $src/bin/setscheme-wofi $out/bin/setscheme-wofi";
meta = {
description = "A wofi graphical menu for setscheme";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ misterio77 ];
};
}
+44
View File
@@ -0,0 +1,44 @@
{ lib, stdenv, writeShellScriptBin, installShellFiles, coreutils }:
with lib;
stdenv.mkDerivation {
name = "setscheme";
version = "1.0";
src = writeShellScriptBin "setscheme" ''
if [ "$1" == "-L" ]; then
nix eval --raw nix-colors#colorSchemes --apply 's: builtins.concatStringsSep "\n" (builtins.attrNames s)' 2> /dev/null
exit 0
elif [ "$1" == "-R" ]; then
scheme=$(setscheme -L | ${coreutils}/bin/shuf -n 1)
echo $scheme
else
scheme=$1
fi
if [ "$scheme" == "generate" ]; then
content="null"
else
content="\"$scheme\""
fi
echo "$content" > /dotfiles/users/$USER/current-scheme.nix && \
home-manager switch --flake /dotfiles ''${@:2}
'';
dontBuild = true;
dontConfigure = true;
nativeBuildInputs = [ installShellFiles ];
installPhase = ''
install -Dm 0755 $src/bin/setscheme $out/bin/setscheme
installShellCompletion --cmd setscheme \
--fish <(echo 'complete -c setscheme -d "Which scheme to set" -r -f -a "(setscheme -L)"')
'';
meta = {
description = "Script for setting colorscheme on my hm setup";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ misterio77 ];
};
}
+25
View File
@@ -0,0 +1,25 @@
{ lib, stdenv, fetchFromGitHub, python3 }:
stdenv.mkDerivation {
name = "swayfader";
version = "master";
src = fetchFromGitHub {
owner = "Misterio77";
repo = "swayfader";
rev = "2be57f2e0685e52d1141c57fb62efebed6e276b3";
sha256 = "sha256-foMu5Qxx4PD5YI67TuEe+sydP+pERUjB3MyoGOhHrjw=";
};
buildInputs = [ (python3.withPackages (ps: [ ps.i3ipc ])) ];
installPhase = "install -Dm 0755 $src/swayfader.py $out/bin/swayfader";
meta = with lib; {
description = "Window fading script for swaywm";
homepage = "https://github.com/jake-stewart/swayfader";
maintainers = with maintainers; [ misterio77 ];
license = licenses.mit;
platforms = platforms.all;
};
}