···1010I also declare configuration as packages/wrappers that you can try with `nix run
1111github:Ladas552/Flake-Ocean#app`, replace `app` with:
12121313-- [nvf](https://github.com/NotAShelf/nvf) - Nix declared Neovim
1313+- [nvf](https://github.com/NotAShelf/nvf) - Nix declared Neovim (current daily driver)
1414- [nixvim](https://github.com/nix-community/nixvim) - another Nix declared Neovim
1515- rofi-powermenu - power menu made of Rofi with a [nice theme](https://github.com/adi1090x/rofi)
1616- all the other scripts in [pkgs directory](./pkgs/default.nix)
···11+{
22+ # I download songs with yt-dlp, and it embeds the url of the media into `comments` or `purl` tag, so i use ffmpeg to get the data to clipboard and share the media.
33+44+ perSystem =
55+ { pkgs, ... }:
66+ {
77+ packages.musnow =
88+ pkgs.writers.writeFishBin "musnow.sh" { } # fish
99+ ''
1010+ #Dependencis
1111+ #fish,ffmpeg,mpd,mpc
1212+ #get current's song url into 'crtl+v' clipboard
1313+ ffprobe -loglevel error -show_entries format_tags=purl -of default=noprint_wrappers=1:nokey=1 ~/Music/(mpc -f %file% current) | wl-copy
1414+ '';
1515+ };
1616+}
+38
modules/wrappers/scripts/restore.nix
···11+{
22+ # I have this nasty bug that corrupts my /boot, I need to fix it
33+ # but here is a script I use to not do it manually everytime
44+ # Do this all in sudo tho
55+66+ perSystem =
77+ { pkgs, ... }:
88+ {
99+ packages.restore =
1010+ pkgs.writeShellScriptBin "restore.sh" # bash
1111+ ''
1212+ mkfs.vfat /dev/nvme0n1p5 -n NIXBOOT
1313+ zpool import zroot -f
1414+ # Need so that install doesn't run out of memory
1515+ zfs create -o mountpoint=legacy zroot/root
1616+ mount -t zfs zroot/root /mnt
1717+ mount --mkdir /dev/nvme0n1p5 /mnt/boot
1818+ mount --mkdir -t zfs zroot/nix /mnt/nix
1919+ mount --mkdir -t zfs zroot/tmp /mnt/tmp
2020+ mount --mkdir -t zfs zroot/cache /mnt/cache
2121+ mount --mkdir -t zfs zroot/persist /mnt/persist
2222+ nixos-install --no-root-password --flake "github:Ladas552/Flake-Ocean#NixPort"
2323+ # unmount the system, and remount it to correctly link the build
2424+ umount /mnt/boot
2525+ umount /mnt/nix
2626+ umount /mnt/cache
2727+ umount /mnt/tmp
2828+ umount /mnt/persist
2929+ umount /mnt
3030+ mount --mkdir /dev/nvme0n1p5 /mnt/boot
3131+ mount --mkdir -t zfs zroot/nix /mnt/nix
3232+ mount --mkdir -t zfs zroot/tmp /mnt/tmp
3333+ mount --mkdir -t zfs zroot/cache /mnt/cache
3434+ mount --mkdir -t zfs zroot/persist /mnt/persist
3535+ nixos-install --no-root-password --flake "github:Ladas552/Flake-Ocean#NixPort"
3636+ '';
3737+ };
3838+}
···11+{
22+ # It was a test script, never worked tbh. Suppose to replace nm-applet with Rofi
33+44+ perSystem =
55+ { pkgs, lib, ... }:
66+ {
77+ packages.rofi-wifi =
88+ pkgs.writeShellScriptBin "wifiMenu" # bash
99+ ''
1010+ ${lib.getExe pkgs.libnotify} "Getting list of available Wi-Fi networks..."
1111+ # Get a list of available wifi connections and morph it into a nice-looking list
1212+ wifi_list=$(nmcli --fields "SECURITY,SSID" device wifi list | sed 1d | sed 's/ */ /g' | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/ //g" | sed "/--/d")
1313+1414+ connected=$(nmcli -fields WIFI g)
1515+ if [[ "$connected" =~ "enabled" ]]; then
1616+ toggle=" Disable Wi-Fi"
1717+ elif [[ "$connected" =~ "disabled" ]]; then
1818+ toggle=" Enable Wi-Fi"
1919+ fi
2020+2121+ # Use rofi to select wifi network
2222+ chosen_network=$(echo -e "$toggle\n$wifi_list" | uniq -u | rofi -dmenu -i -selected-row 1 -p "Wi-Fi SSID: " )
2323+ # Get name of connection
2424+ read -r chosen_id <<< "''${chosen_network:3}"
2525+2626+ if [ "$chosen_network" = "" ]; then
2727+ exit
2828+ elif [ "$chosen_network" = " Enable Wi-Fi" ]; then
2929+ nmcli radio wifi on
3030+ elif [ "$chosen_network" = " Disable Wi-Fi" ]; then
3131+ nmcli radio wifi off
3232+ else
3333+ # Message to show when connection is activated successfully
3434+ success_message="You are now connected to the Wi-Fi network \"$chosen_id\"."
3535+ # Get saved connections
3636+ nmcli -g NAME connection
3737+ if [[ $(echo "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then
3838+ nmcli connection up id "$chosen_id" | grep "successfully" && ${lib.getExe pkgs.libnotify} "Connection Established" "$success_message"
3939+ else
4040+ if [[ "$chosen_network" =~ "" ]]; then
4141+ wifi_password=$(rofi -dmenu -p "Password: " )
4242+ fi
4343+ nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && ${lib.getExe pkgs.libnotify} "Connection Established" "$success_message"
4444+ fi
4545+ fi
4646+ '';
4747+ };
4848+}
+45
modules/wrappers/scripts/word-lookup.nix
···11+{
22+ # This script looks up a word in the dictionary from mouse selected word
33+ # Script is stolen from Reddit
44+55+ perSystem =
66+ { pkgs, lib, ... }:
77+ {
88+ packages.word-lookup =
99+ pkgs.writeShellScriptBin "word-lookup.sh" # bash
1010+ ''
1111+ usage(){
1212+ echo "Usage: $(basename "$0") [-h]
1313+ Looks up the definition of currently selected word.
1414+ -w: Use the wayland clipboard (instead of X11) "
1515+1616+ }
1717+1818+ USEWAYLAND=true
1919+2020+ while getopts 'hw' c
2121+ do
2222+ case $c in
2323+ h) usage; exit ;;
2424+ w) USEWAYLAND=true ;;
2525+ *) usage; exit 1 ;;
2626+ esac
2727+ done
2828+2929+ shift $((OPTIND-1))
3030+3131+ if [ $USEWAYLAND = true ]
3232+ then
3333+ word=$(wl-paste -p)
3434+ else
3535+ word=$(xclip -o)
3636+ fi
3737+3838+ res=$(curl -s "https://api.dictionaryapi.dev/api/v2/entries/en_US/$word")
3939+ regex=$'"definition":"\K(.*?)(?=")'
4040+ definitions=$(echo "$res" | grep -Po "$regex")
4141+ separatedDefinition=$(sed ':a;N;$!ba;s/\n/\n\n/g' <<< "$definitions")
4242+ ${lib.getExe pkgs.libnotify} --urgency=critical -a "word-lookup" "$word" "$separatedDefinition"
4343+ '';
4444+ };
4545+}
+13
modules/wrappers/scripts/wpick.nix
···11+{
22+ # It is a one liner to replace xpick on Wayland. Compatible with Wlroots. Doesn't need dependencies outside of ImageMagick that already declared in host
33+44+ perSystem =
55+ { pkgs, lib, ... }:
66+ {
77+ packages.wpick =
88+ pkgs.writeShellScriptBin "wpick" # bash
99+ ''
1010+ ${lib.meta.getExe' pkgs.grim "grim"} -g "$(${lib.meta.getExe' pkgs.slurp "slurp"} -p)" -t ppm - | ${lib.meta.getExe' pkgs.imagemagick "magick"} - -format '%[pixel:p{0,0}]' txt:-
1111+ '';
1212+ };
1313+}
-11
pkgs/Subtitlenator.nix
···11-{ pkgs, lib }:
22-# Adds `ass` subtitle files to mkv files and creates subdirectory for copied mkv files. Subtitles aren't burned into mkv, just added to the pool. Nice if you don't have subtitle fuzzy find in your Media Player
33-pkgs.writeShellScriptBin "Subtitlenator.sh" ''
44- ${lib.meta.getExe' pkgs.coreutils "mkdir"} Subbed_"$(${lib.meta.getExe' pkgs.coreutils "basename"} "$PWD")"
55-66- for i in *.mkv
77- do
88- file="$(${lib.meta.getExe' pkgs.coreutils "basename"} "$i" .mkv)"
99- (ffmpeg -i "$file.mkv" -i "$file.ass" -map 0 -map 1 -c copy Subbed_"$(${lib.meta.getExe' pkgs.coreutils "basename"} "$PWD")/$file.mkv")
1010- done
1111-''
···11-{ pkgs }:
22-# I download songs with yt-dlp, and it embeds the url of the media into `comments` or `purl` tag, so i use ffmpeg to get the data to clipboard and share the media.
33-pkgs.writers.writeFishBin "musnow.sh" { } # fish
44- ''
55- #Dependencis
66- #fish,ffmpeg,mpd,mpc
77- #get current's song url into 'crtl+v' clipboard
88- ffprobe -loglevel error -show_entries format_tags=purl -of default=noprint_wrappers=1:nokey=1 ~/Music/(mpc -f %file% current) | wl-copy
99- ''
1010-1111-# X11 version
1212-#ffprobe -loglevel error -show_entries format_tags=purl -of default=noprint_wrappers=1:nokey=1 ~/Music/(mpc -f %file% current) | xclip -selection clipboard
-31
pkgs/restore.nix
···11-{ pkgs, lib }:
22-# I have this nasty bug that corrupts my /boot, I need to fix it
33-# but here is a script I use to not do it manually everytime
44-# Do this all in sudo tho
55-pkgs.writeShellScriptBin "restore.sh" # bash
66- ''
77- mkfs.vfat /dev/nvme0n1p5 -n NIXBOOT
88- zpool import zroot -f
99- # Need so that install doesn't run out of memory
1010- zfs create -o mountpoint=legacy zroot/root
1111- mount -t zfs zroot/root /mnt
1212- mount --mkdir /dev/nvme0n1p5 /mnt/boot
1313- mount --mkdir -t zfs zroot/nix /mnt/nix
1414- mount --mkdir -t zfs zroot/tmp /mnt/tmp
1515- mount --mkdir -t zfs zroot/cache /mnt/cache
1616- mount --mkdir -t zfs zroot/persist /mnt/persist
1717- nixos-install --no-root-password --flake "github:Ladas552/Flake-Ocean#NixPort"
1818- # unmount the system, and remount it to correctly link the build
1919- umount /mnt/boot
2020- umount /mnt/nix
2121- umount /mnt/cache
2222- umount /mnt/tmp
2323- umount /mnt/persist
2424- umount /mnt
2525- mount --mkdir /dev/nvme0n1p5 /mnt/boot
2626- mount --mkdir -t zfs zroot/nix /mnt/nix
2727- mount --mkdir -t zfs zroot/tmp /mnt/tmp
2828- mount --mkdir -t zfs zroot/cache /mnt/cache
2929- mount --mkdir -t zfs zroot/persist /mnt/persist
3030- nixos-install --no-root-password --flake "github:Ladas552/Flake-Ocean#NixPort"
3131- ''
···11-{ pkgs, lib }:
22-# It was a test script, never worked tbh. Suppose to replace nm-applet with Rofi
33-pkgs.writeShellScriptBin "wifiMenu" # bash
44- ''
55- ${lib.getExe pkgs.libnotify} "Getting list of available Wi-Fi networks..."
66- # Get a list of available wifi connections and morph it into a nice-looking list
77- wifi_list=$(nmcli --fields "SECURITY,SSID" device wifi list | sed 1d | sed 's/ */ /g' | sed -E "s/WPA*.?\S/ /g" | sed "s/^--/ /g" | sed "s/ //g" | sed "/--/d")
88-99- connected=$(nmcli -fields WIFI g)
1010- if [[ "$connected" =~ "enabled" ]]; then
1111- toggle=" Disable Wi-Fi"
1212- elif [[ "$connected" =~ "disabled" ]]; then
1313- toggle=" Enable Wi-Fi"
1414- fi
1515-1616- # Use rofi to select wifi network
1717- chosen_network=$(echo -e "$toggle\n$wifi_list" | uniq -u | rofi -dmenu -i -selected-row 1 -p "Wi-Fi SSID: " )
1818- # Get name of connection
1919- read -r chosen_id <<< "''${chosen_network:3}"
2020-2121- if [ "$chosen_network" = "" ]; then
2222- exit
2323- elif [ "$chosen_network" = " Enable Wi-Fi" ]; then
2424- nmcli radio wifi on
2525- elif [ "$chosen_network" = " Disable Wi-Fi" ]; then
2626- nmcli radio wifi off
2727- else
2828- # Message to show when connection is activated successfully
2929- success_message="You are now connected to the Wi-Fi network \"$chosen_id\"."
3030- # Get saved connections
3131- saved_connections=$(nmcli -g NAME connection)
3232- if [[ $(echo "$saved_connections" | grep -w "$chosen_id") = "$chosen_id" ]]; then
3333- nmcli connection up id "$chosen_id" | grep "successfully" && ${lib.getExe pkgs.libnotify} "Connection Established" "$success_message"
3434- else
3535- if [[ "$chosen_network" =~ "" ]]; then
3636- wifi_password=$(rofi -dmenu -p "Password: " )
3737- fi
3838- nmcli device wifi connect "$chosen_id" password "$wifi_password" | grep "successfully" && ${lib.getExe pkgs.libnotify} "Connection Established" "$success_message"
3939- fi
4040- fi
4141- ''
-38
pkgs/word-lookup.nix
···11-{ pkgs, lib }:
22-# This script looks up a word in the dictionary from mouse selected word
33-# Script is stolen from Reddit
44-pkgs.writeShellScriptBin "word-lookup.sh" # bash
55- ''
66- usage(){
77- echo "Usage: $(basename "$0") [-h]
88- Looks up the definition of currently selected word.
99- -w: Use the wayland clipboard (instead of X11) "
1010-1111- }
1212-1313- USEWAYLAND=true
1414-1515- while getopts 'hw' c
1616- do
1717- case $c in
1818- h) usage; exit ;;
1919- w) USEWAYLAND=true ;;
2020- *) usage; exit 1 ;;
2121- esac
2222- done
2323-2424- shift $((OPTIND-1))
2525-2626- if [ $USEWAYLAND = true ]
2727- then
2828- word=$(wl-paste -p)
2929- else
3030- word=$(xclip -o)
3131- fi
3232-3333- res=$(curl -s "https://api.dictionaryapi.dev/api/v2/entries/en_US/$word")
3434- regex=$'"definition":"\K(.*?)(?=")'
3535- definitions=$(echo "$res" | grep -Po "$regex")
3636- separatedDefinition=$(sed ':a;N;$!ba;s/\n/\n\n/g' <<< "$definitions")
3737- ${lib.getExe pkgs.libnotify} --urgency=critical -a "word-lookup" "$word" "$separatedDefinition"
3838- ''
-6
pkgs/wpick.nix
···11-{ pkgs, lib }:
22-# It is a one liner to replace xpick on Wayland. Compatible with Wlroots. Doesn't need dependencies outside of ImageMagick that already declared in host
33-pkgs.writeShellScriptBin "wpick" # bash
44- ''
55- ${lib.meta.getExe' pkgs.grim "grim"} -g "$(${lib.meta.getExe' pkgs.slurp "slurp"} -p)" -t ppm - | ${lib.meta.getExe' pkgs.imagemagick "magick"} - -format '%[pixel:p{0,0}]' txt:-
66- ''