🧹 restructure layout
This commit is contained in:
parent
40c2a5fb29
commit
268374ad58
115 changed files with 2641 additions and 2085 deletions
24
modules/config/bin/cycleSinks.nix
Normal file
24
modules/config/bin/cycleSinks.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{ pkgs }:
|
||||
pkgs.writeShellApplication {
|
||||
name = "cycle_sinks";
|
||||
|
||||
runtimeInputs = with pkgs; [ pulseaudio ];
|
||||
text = ''
|
||||
# get the default sink
|
||||
default_sink="$(pactl info | grep -e "Default Sink:" | awk '{print $3}')"
|
||||
echo "current default: $default_sink"
|
||||
|
||||
# get the sinks
|
||||
sinks="$(pactl list sinks short | awk '{print $2}')"
|
||||
|
||||
# filter out the default sink
|
||||
not_active="$(echo "$sinks" | grep -v -e "$default_sink")"
|
||||
|
||||
# get the sink after the dafault one
|
||||
next_sink="$(echo -e "$sinks\n$not_active" | grep -e "$default_sink" -A 1 | tail -n 1 )"
|
||||
|
||||
# set the new default-sink
|
||||
pactl set-default-sink "$next_sink"
|
||||
echo "new default: $next_sink"
|
||||
'';
|
||||
}
|
||||
34
modules/config/bin/default.nix
Normal file
34
modules/config/bin/default.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, ...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.bin;
|
||||
cycleSinks = import ./cycleSinks.nix { inherit pkgs; };
|
||||
protonge = import ./protonge.nix { inherit pkgs; };
|
||||
randomWallpaper = import ./randomWallpaper.nix { inherit pkgs; };
|
||||
share = import ./share.nix { inherit pkgs; };
|
||||
sxhkdHelp = import ./sxhkdHelp.nix { inherit pkgs; };
|
||||
in
|
||||
{
|
||||
options.my.bin = {
|
||||
enable = mkOption {
|
||||
default = true;
|
||||
type = types.bool;
|
||||
example = false;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
cycleSinks
|
||||
protonge
|
||||
randomWallpaper
|
||||
share
|
||||
sxhkdHelp
|
||||
];
|
||||
};
|
||||
}
|
||||
126
modules/config/bin/protonge.nix
Normal file
126
modules/config/bin/protonge.nix
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
{ pkgs }:
|
||||
pkgs.writeShellApplication {
|
||||
name = "protonge";
|
||||
runtimeInputs = with pkgs; [ curl ];
|
||||
text = ''
|
||||
baseuri="https://github.com/GloriousEggroll/proton-ge-custom/releases/download"
|
||||
latesturi="https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases/latest"
|
||||
installComplete=false;
|
||||
dstpath="$HOME/.steam/root/compatibilitytools.d" #### Destinationforlder of the Proton installations
|
||||
restartSteam=2
|
||||
autoInstall=false
|
||||
#### Set restartSteam=0 to not restart steam after installing Proton (Keep process untouched)
|
||||
#### Set restartSteam=1 to autorestart steam after installing Proton
|
||||
#### Set restartSteam=2 to to get a y/n prompt asking if you want to restart Steam after each installation.
|
||||
|
||||
#### Set autoInstall=true to skip the installation prompt and install the latest not-installed, or any forced Proton GE builds
|
||||
#### Set autoInstall=false to display a installation-confirmation prompt when installing a Proton GE build
|
||||
|
||||
# ########################################## CProton - Custom Proton Installscript 0.2.2 ##########################################
|
||||
# Disclaimer: Subversions like the MCC versions of Proton 4.21-GE-1, will install as it's main version and not install separately.
|
||||
# For now, this may result in false "not installed"-detections or errors while force installing a specific subversion.
|
||||
|
||||
PrintReleases() {
|
||||
echo "----------Description----------"
|
||||
echo ""
|
||||
echo "Run './cproton.sh [VersionName]'"
|
||||
echo "to download specific versions."
|
||||
echo ""
|
||||
echo "------------Releases------------"
|
||||
curl -s https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases | grep -H "tag_name" | cut -d \" -f4
|
||||
echo "--------------------------------"
|
||||
}
|
||||
|
||||
InstallProtonGE() {
|
||||
rsp="$(curl -sI "$url" | head -1)"
|
||||
echo "$rsp" | grep -q 302 || {
|
||||
echo "$rsp"
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -d "$dstpath" ] || {
|
||||
mkdir "$dstpath"
|
||||
echo [Info] Created "$dstpath"
|
||||
}
|
||||
curl -sL "$url" > "$dstpath/Proton-$version.tar.gz" # Download archive first
|
||||
if [ -n "$sha512url" ]; then # If there is no sha512 the sha512url is empty
|
||||
if [ "$(sha512sum "$dstpath/Proton-$version.tar.gz" | cut -b -128)" == "$(curl -sL "$sha512url"| cut -b -128)" ]; then # Only the first 128 bytes are significant
|
||||
tar xfzv "$dstpath/Proton-$version.tar.gz" -C "$dstpath"
|
||||
installComplete=true
|
||||
else
|
||||
echo "sha512sum did not match! Stopping installation."
|
||||
installComplete=false
|
||||
fi
|
||||
else
|
||||
tar xfzv "$dstpath/Proton-$version.tar.gz" -C "$dstpath"
|
||||
installComplete=true
|
||||
fi
|
||||
rm "$dstpath/Proton-$version.tar.gz"
|
||||
}
|
||||
|
||||
RestartSteam() {
|
||||
if [ "$( pgrep steam )" != "" ]; then
|
||||
echo "Restarting Steam"
|
||||
pkill -TERM steam #restarting Steam
|
||||
sleep 5s
|
||||
nohup steam </dev/null &>/dev/null &
|
||||
fi
|
||||
}
|
||||
|
||||
RestartSteamCheck() {
|
||||
if [ "$( pgrep steam )" != "" ] && [ "$installComplete" = true ]; then
|
||||
if [ $restartSteam == 2 ]; then
|
||||
read -r -p "Do you want to restart Steam? <y/N> " prompt
|
||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||
RestartSteam
|
||||
else
|
||||
exit 2
|
||||
fi
|
||||
elif [ $restartSteam == 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
RestartSteam
|
||||
fi
|
||||
}
|
||||
|
||||
InstallationPrompt() {
|
||||
if [ "$autoInstall" = true ]; then
|
||||
if [ ! -d "$dstpath"/Proton-"$version" ]; then
|
||||
InstallProtonGE
|
||||
fi
|
||||
else
|
||||
read -r -p "Do you want to try to download and (re)install this release? <y/N> " prompt
|
||||
if [[ $prompt == "y" || $prompt == "Y" || $prompt == "yes" || $prompt == "Yes" ]]; then
|
||||
InstallProtonGE
|
||||
else
|
||||
echo "Operation canceled"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ "$#" -eq 0 ]]; then
|
||||
version="$(curl -s $latesturi | grep -E -m1 "tag_name" | cut -d \" -f4)"
|
||||
url="$(curl -s $latesturi | grep -E -m1 "browser_download_url.*.tar.gz" | cut -d \" -f4)"
|
||||
sha512url="$(curl -s $latesturi | grep -E -m1 "browser_download_url.*.sha512sum" | cut -d \" -f4)"
|
||||
if [ -d "$dstpath"/Proton-"$version" ]; then
|
||||
echo "Proton $version is the latest version and is already installed."
|
||||
else
|
||||
echo "Proton $version is the latest version and is not installed yet."
|
||||
fi
|
||||
InstallationPrompt
|
||||
RestartSteamCheck
|
||||
elif [ "''${1}" == "-l" ]; then
|
||||
PrintReleases
|
||||
else
|
||||
url=$baseuri/"''${1}"/Proton-"''${1}".tar.gz
|
||||
if [ -d "$dstpath"/Proton-"''${1}" ]; then
|
||||
echo "Proton ''${1} is already installed."
|
||||
else
|
||||
echo "Proton ''${1} is not installed yet."
|
||||
fi
|
||||
InstallationPrompt
|
||||
RestartSteamCheck
|
||||
fi
|
||||
'';
|
||||
}
|
||||
11
modules/config/bin/randomWallpaper.nix
Normal file
11
modules/config/bin/randomWallpaper.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
{ pkgs }:
|
||||
pkgs.writeShellApplication {
|
||||
name = "randomWallpaper";
|
||||
|
||||
runtimeInputs = with pkgs; [ findutils coreutils feh ];
|
||||
|
||||
text = ''
|
||||
wallpaper="$(find ~/.config/wallpapers/ -type f,l | shuf -n 1)"
|
||||
feh --bg-fill "$wallpaper"
|
||||
'';
|
||||
}
|
||||
22
modules/config/bin/share.nix
Normal file
22
modules/config/bin/share.nix
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
{ pkgs }:
|
||||
pkgs.writeShellApplication {
|
||||
name = "share";
|
||||
|
||||
runtimeInputs = with pkgs; [ curl coreutils rofi p7zip xclip ];
|
||||
|
||||
text = ''
|
||||
files="$(find "$PWD" -maxdepth 10 -type 'f' -not -path '*/.*' | rofi -dmenu -d 15 -p 'File to share')"
|
||||
password="$(rofi -dmenu -p 'Password for encryption')"
|
||||
zipname="$HOME/Downloads/share-$(date +"%Y-%m-%d").zip"
|
||||
if [[ $password == "" ]]; then
|
||||
args=""
|
||||
else
|
||||
args="-p""$password"""
|
||||
fi
|
||||
7z a "$zipname" "$files" "$args" -mx9 > /dev/null
|
||||
link="$(curl -s -F"file=@$zipname" 0x0.st)"
|
||||
echo "$link"
|
||||
echo "$link" | xclip -sel c
|
||||
rm "$zipname"
|
||||
'';
|
||||
}
|
||||
10
modules/config/bin/sxhkdHelp.nix
Normal file
10
modules/config/bin/sxhkdHelp.nix
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{ pkgs }:
|
||||
pkgs.writeShellApplication {
|
||||
name = "sxhkd-help";
|
||||
runtimeInputs = with pkgs; [ rofi ];
|
||||
text = ''
|
||||
awk '/^[a-z]/ && last {print "<small>",$0,"\t",last,"</small>"} {last=""} /^#/{last=$0}' ~/.config/sxhkd/sxhkdrc |
|
||||
column -t -s $'\t' |
|
||||
rofi -dmenu -i -markup-rows -no-show-icons -width 1000 -lines 15 -yoffset 40
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue