commit 97f929cd1f9b12c6223e4f6089edf598bd9c44d2 Author: Evelyne Date: Sun Apr 9 12:56:40 2023 +0100 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..62d8881 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +result +*/result diff --git a/README.md b/README.md new file mode 100644 index 0000000..4de0c25 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Evie's NixFiles +A Nix flake for my system configuration - WIP. + +## Structure +- `./evelyne` - A folder for my home-manager configs (aka my user) + - `./evelyne/common` - Home configuration available on all systems +- `./systems` - A folder for my system-wide configs + - `./systems/pogmachine` - System configuration for my desktop (PogMachine) +- `overlays.nix` - A file for my nixpkgs overlays + +## Many thanks +- ❤️ Thanks to @SpyHoodle who helped me make this config diff --git a/evelyne/common/audio.nix b/evelyne/common/audio.nix new file mode 100644 index 0000000..846ae07 --- /dev/null +++ b/evelyne/common/audio.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + pulsemixer # TUI sound mixer + pamixer # CLI sound mixer + playerctl # Manages media players + cava # Music visualiser + ]; + + home.file.".local/bin/ytdlp-music" = { + source = ./audio/ytdlp-music.sh; + executable = true; + }; +} diff --git a/evelyne/common/audio/ytdlp-music.sh b/evelyne/common/audio/ytdlp-music.sh new file mode 100755 index 0000000..01a0933 --- /dev/null +++ b/evelyne/common/audio/ytdlp-music.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +echo "Name:" && read name +echo "URL:" && read url + +yt-dlp -x --no-playlist --embed-thumbnail --no-embed-metadata --audio-quality 0 --audio-format flac -o "$name" "$url" diff --git a/evelyne/common/bosskey.nix b/evelyne/common/bosskey.nix new file mode 100644 index 0000000..439baed --- /dev/null +++ b/evelyne/common/bosskey.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + slock + ]; + + home.file.".local/bin/bosskey" = { + source = ./bosskey/bosskey.sh; + executable = true; + }; +} diff --git a/evelyne/common/bosskey/bosskey.sh b/evelyne/common/bosskey/bosskey.sh new file mode 100755 index 0000000..fb0f46c --- /dev/null +++ b/evelyne/common/bosskey/bosskey.sh @@ -0,0 +1,50 @@ +#!/bin/sh + +# ____ _ +# | __ ) ___ ___ ___| | _____ _ _ +# | _ \ / _ \/ __/ __| |/ / _ \ | | | +# | |_) | (_) \__ \__ \ < __/ |_| | +# |____/ \___/|___/___/_|\_\___|\__, | +# |___/ v1.2 +# GitHub: https://github.com/SpyHoodle/bosskey + + +function refresh_statusbar() { + case $1 in + dwmblocks) + # Refresh dwmblocks as it only updates when told so + kill -35 $(pidof dwmblocks) + ;; + esac +} + + +while getopts "lmpur" options; do + case $options in + m) + # Mute the volume + pamixer --mute + ;; + + p) + # Pause any playing media + playerctl pause + ;; + + l) + # Lock the screen using slock(1) + slock + ;; + + u) + # Unmute the audio + pamixer --unmute + ;; + + r) + # Refresh a dwmblocks status bar + refresh_statusbar "dwmblocks" + ;; + + esac +done diff --git a/evelyne/common/browser.nix b/evelyne/common/browser.nix new file mode 100644 index 0000000..d4c5266 --- /dev/null +++ b/evelyne/common/browser.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + librewolf + amfora + lynx + ]; +} diff --git a/evelyne/common/btop.nix b/evelyne/common/btop.nix new file mode 100644 index 0000000..1ed623c --- /dev/null +++ b/evelyne/common/btop.nix @@ -0,0 +1,13 @@ +{ config, ... }: + +{ + programs.btop = { + enable = true; + settings = { + color_theme = "TTY"; + theme_background = false; + truecolor = true; + clock_format = "| /user@/host | /uptime | %y/%m/%d | %H:%M:%S |"; + }; + }; +} diff --git a/evelyne/common/calculator.nix b/evelyne/common/calculator.nix new file mode 100644 index 0000000..fb1cf64 --- /dev/null +++ b/evelyne/common/calculator.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + nodePackages.insect + ]; +} diff --git a/evelyne/common/chromium.nix b/evelyne/common/chromium.nix new file mode 100644 index 0000000..30bc36a --- /dev/null +++ b/evelyne/common/chromium.nix @@ -0,0 +1,29 @@ +{ config, ... }: + +{ + programs.chromium = { + enable = true; + commandLineArgs = [ + "--enable-logging=stderr" + "--ignore-gpu-blocklist" + ]; + extensions = [ + # Dark Reader + { id = "eimadpbcbfnmbkopoojfekhnkhdbieeh"; } + # uBlock Origin + { id = "cjpalhdlnbpafiamejdnhcphjbkeiagm"; } + # I still don't care about cookies + { id = "edibdbjcniadpccecjdfdjjppcpchdlm"; } + # NoScript + { id = "doojmbjmlfjjnbmnoijecmcbfeoakpjm"; } + # Reddit Enhancement Suite + { id = "kbmfpngjjgdllneeigpgjifpgocmfgmb"; } + # Old Reddit Redirect + { id = "dneaehbmnbhcippjikoajpoabadpodje"; } + # Return Youtube Dislike + { id = "gebbhagfogifgggkldgodflihgfeippi"; } + # Vimium + { id = "dbepggeogbaibhgnhhndojpepiihcmeb"; } + ]; + }; +} diff --git a/evelyne/common/code.nix b/evelyne/common/code.nix new file mode 100644 index 0000000..d4c3e95 --- /dev/null +++ b/evelyne/common/code.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + python3Full # Python + go # Go + ]; +} diff --git a/evelyne/common/dmenu.nix b/evelyne/common/dmenu.nix new file mode 100644 index 0000000..7b06b42 --- /dev/null +++ b/evelyne/common/dmenu.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + dmenu + ]; + + home.file.".local/bin/dmenu" = { + source = ./dmenu; + executable = true; + }; + + home.sessionPath = [ + "$HOME/.local/bin/dmenu" + ]; +} diff --git a/evelyne/common/dmenu/dmenu-bluetooth b/evelyne/common/dmenu/dmenu-bluetooth new file mode 100755 index 0000000..0eb5a07 --- /dev/null +++ b/evelyne/common/dmenu/dmenu-bluetooth @@ -0,0 +1,317 @@ +#!/bin/sh +# _ _ _ _ _ _ +# __| |_ __ ___ ___ _ __ _ _ | |__ | |_ _ ___| |_ ___ ___ | |_ | |__ +# / _` | '_ ` _ \ / _ \ '_ \| | | |_____| '_ \| | | | |/ _ \ __/ _ \ / _ \| __|| '_ \ +# | (_| | | | | | | __/ | | | |_| |_____| |_) | | |_| | __/ || (_) | (_) | |_ | | | | +# \__,_|_| |_| |_|\___|_| |_|\__,_| |_.__/|_|\__,_|\___|\__\___/ \___/ \__||_| |_| +# +# Author: Nick Clyde (clydedroid) +# dmenu support by: Layerex +# +# A script that generates a dmenu menu that uses bluetoothctl to +# connect to bluetooth devices and display status info. +# +# Inspired by networkmanager-dmenu (https://github.com/firecat53/networkmanager-dmenu) +# Thanks to x70b1 (https://github.com/polybar/polybar-scripts/tree/master/polybar-scripts/system-bluetooth-bluetoothctl) +# +# Depends on: +# Arch repositories: dmenu, bluez-utils (contains bluetoothctl) + +# Constants +divider="---------" +goback="Back" + +# Checks if bluetooth controller is powered on +power_on() { + if bluetoothctl show | grep -F -q "Powered: yes"; then + return 0 + else + return 1 + fi +} + +# Toggles power state +toggle_power() { + if power_on; then + bluetoothctl power off + show_menu + else + if rfkill list bluetooth | grep -F -q 'blocked: yes'; then + rfkill unblock bluetooth && sleep 3 + fi + bluetoothctl power on + show_menu + fi +} + +# Checks if controller is scanning for new devices +scan_on() { + if bluetoothctl show | grep -F -q "Discovering: yes"; then + echo "Scan: on" + return 0 + else + echo "Scan: off" + return 1 + fi +} + +# Toggles scanning state +toggle_scan() { + if scan_on; then + kill "$(pgrep -F -f "bluetoothctl scan on")" + bluetoothctl scan off + show_menu + else + bluetoothctl scan on & + echo "Scanning..." + sleep 5 + show_menu + fi +} + +# Checks if controller is able to pair to devices +pairable_on() { + if bluetoothctl show | grep -F -q "Pairable: yes"; then + echo "Pairable: on" + return 0 + else + echo "Pairable: off" + return 1 + fi +} + +# Toggles pairable state +toggle_pairable() { + if pairable_on; then + bluetoothctl pairable off + show_menu + else + bluetoothctl pairable on + show_menu + fi +} + +# Checks if controller is discoverable by other devices +discoverable_on() { + if bluetoothctl show | grep -F -q "Discoverable: yes"; then + echo "Discoverable: on" + return 0 + else + echo "Discoverable: off" + return 1 + fi +} + +# Toggles discoverable state +toggle_discoverable() { + if discoverable_on; then + bluetoothctl discoverable off + show_menu + else + bluetoothctl discoverable on + show_menu + fi +} + +# Checks if a device is connected +device_connected() { + device_info=$(bluetoothctl info "$1") + if echo "$device_info" | grep -F -q "Connected: yes"; then + return 0 + else + return 1 + fi +} + +# Toggles device connection +toggle_connection() { + if device_connected "$1"; then + bluetoothctl disconnect "$1" + # device_menu "$device" + else + bluetoothctl connect "$1" + # device_menu "$device" + fi +} + +# Checks if a device is paired +device_paired() { + device_info=$(bluetoothctl info "$1") + if echo "$device_info" | grep -F -q "Paired: yes"; then + echo "Paired: yes" + return 0 + else + echo "Paired: no" + return 1 + fi +} + +# Toggles device paired state +toggle_paired() { + if device_paired "$1"; then + bluetoothctl remove "$1" + device_menu "$device" + else + bluetoothctl pair "$1" + device_menu "$device" + fi +} + +# Checks if a device is trusted +device_trusted() { + device_info=$(bluetoothctl info "$1") + if echo "$device_info" | grep -F -q "Trusted: yes"; then + echo "Trusted: yes" + return 0 + else + echo "Trusted: no" + return 1 + fi +} + +# Toggles device connection +toggle_trust() { + if device_trusted "$1"; then + bluetoothctl untrust "$1" + device_menu "$device" + else + bluetoothctl trust "$1" + device_menu "$device" + fi +} + +# Prints a short string with the current bluetooth status +# Useful for status bars like polybar, etc. +print_status() { + if power_on; then + printf '' + + mapfile -t paired_devices < <(bluetoothctl paired-devices | grep -F Device | cut -d ' ' -f 2) + counter=0 + + for device in "${paired_devices[@]}"; do + if device_connected "$device"; then + device_alias="$(bluetoothctl info "$device" | grep -F "Alias" | cut -d ' ' -f 2-)" + + if [ $counter -gt 0 ]; then + printf ", %s" "$device_alias" + else + printf " %s" "$device_alias" + fi + + ((counter++)) + fi + done + printf "\n" + else + echo "" + fi +} + +# A submenu for a specific device that allows connecting, pairing, and trusting +device_menu() { + device=$1 + + # Get device name and mac address + device_name="$(echo "$device" | cut -d ' ' -f 3-)" + mac="$(echo "$device" | cut -d ' ' -f 2)" + + # Build options + if device_connected "$mac"; then + connected="Connected: yes" + else + connected="Connected: no" + fi + paired=$(device_paired "$mac") + trusted=$(device_trusted "$mac") + options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit" + + # Open dmenu menu, read chosen option + chosen="$(echo -e "$options" | run_dmenu "$device_name")" + + # Match chosen option to command + case $chosen in + "" | "$divider") + echo "No option chosen." + ;; + "$connected") + toggle_connection "$mac" + ;; + "$paired") + toggle_paired "$mac" + ;; + "$trusted") + toggle_trust "$mac" + ;; + "$goback") + show_menu + ;; + esac +} + +# Opens a dmenu menu with current bluetooth status and options to connect +show_menu() { + # Get menu options + if power_on; then + power="Power: on" + + # Human-readable names of devices, one per line + # If scan is off, will only list paired devices + devices=$(bluetoothctl devices | grep -F Device | cut -d ' ' -f 3-) + + # Get controller flags + scan=$(scan_on) + pairable=$(pairable_on) + discoverable=$(discoverable_on) + + # Options passed to dmenu + options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit" + else + power="Power: off" + options="$power\nExit" + fi + + # Open dmenu menu, read chosen option + chosen="$(echo -e "$options" | run_dmenu "Bluetooth")" + + # Match chosen option to command + case $chosen in + "" | "$divider") + echo "No option chosen." + ;; + "$power") + toggle_power + ;; + "$scan") + toggle_scan + ;; + "$discoverable") + toggle_discoverable + ;; + "$pairable") + toggle_pairable + ;; + *) + device=$(bluetoothctl devices | grep -F "$chosen") + # Open a submenu if a device is selected + if [[ $device ]]; then device_menu "$device"; fi + ;; + esac +} + +original_args=("$@") + +# dmenu command to pipe into. Extra arguments to dmenu-bluetooth are passed through to dmenu. This +# allows the user to set fonts, sizes, colours, etc. +run_dmenu() { + dmenu "${original_args[@]}" -i -p "$1" +} + +case "$1" in + --status) + print_status + ;; + *) + show_menu + ;; +esac diff --git a/evelyne/common/dmenu/dmenu-kdeconnect b/evelyne/common/dmenu/dmenu-kdeconnect new file mode 100755 index 0000000..092b7e5 --- /dev/null +++ b/evelyne/common/dmenu/dmenu-kdeconnect @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +NOTIFICATIONS_TITLE="KDE Connect" +NOTIFICATIONS_EXPIRE_TIME=1000 +notify-send "$NOTIFICATIONS_TITLE" "Getting devices..." --expire-time="$NOTIFICATIONS_EXPIRE_TIME" + +# Get available devices +devices="$(kdeconnect-cli -a)" +[ -z "$devices" ] && notify-send "$NOTIFICATIONS_TITLE" "No devices available" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1 + +# Let the user choose a device +device="$(echo "$devices" | sed 's/-\ //' | sed 's/:.*//' | dmenu -i -p "Devices:")" + +if [ $? -eq 0 ] +then + # Send files to a device + 📂File() { + file="$(zenity --file-selection)" + kdeconnect-cli -n "$device" --share "$file" + [ "$?" -eq 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📂 Shared file: $file" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" + [ "$?" -ne 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📂 Failed to share file: $file" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1 + } + + # Ping a device + 📳Ping() { + kdeconnect-cli -n "$device" --ping + [ "$?" -eq 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📳 Pinged device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" + [ "$?" -ne 0 ] && notify-send "$NOTIFICATIONS_TITLE" "📳 Unable to ping device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1 + } + + # Make a device ring + ☎️Ring() { + kdeconnect-cli -n "$device" --ring + [ "$?" -eq 0 ] && notify-send "$NOTIFICATIONS_TITLE" "☎️ Ringed device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" + [ "$?" -ne 0 ] && notify-send "$NOTIFICATIONS_TITLE" "☎️ Unable to ring device: $device" --expire-time="$NOTIFICATIONS_EXPIRE_TIME" && exit 1 + } + + # Show functions in dmenu and run the chosen function + func="$(declare -F | awk '{print $3}' | dmenu -i -p "$device":)" + [ -z "$func" ] || "$func" +fi diff --git a/evelyne/common/dmenu/dmenu-mount b/evelyne/common/dmenu/dmenu-mount new file mode 100755 index 0000000..3cb1f81 --- /dev/null +++ b/evelyne/common/dmenu/dmenu-mount @@ -0,0 +1,67 @@ +#!/bin/sh + +# Gives a dmenu prompt to mount unmounted drives and Android phones. If +# they're in /etc/fstab, they'll be mounted automatically. Otherwise, you'll +# be prompted to give a mountpoint from already existsing directories. If you +# input a novel directory, it will prompt you to create that directory. + +getmount() { \ + [ -z "$chosen" ] && exit 1 + # shellcheck disable=SC2086 + mp="$(find $1 2>/dev/null | dmenu -i -p "Type in mount point.")" || exit 1 + test -z "$mp" && exit 1 + if [ ! -d "$mp" ]; then + mkdiryn=$(printf "No\\nYes" | dmenu -i -p "$mp does not exist. Create it?") || exit 1 + [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo -A mkdir -p "$mp") + fi + } + +mountusb() { \ + chosen="$(echo "$usbdrives" | dmenu -i -p "Mount which drive?")" || exit 1 + chosen="$(echo "$chosen" | awk '{print $1}')" + sudo -A mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 + alreadymounted=$(lsblk -nrpo "name,type,mountpoint" | awk '$3!~/\/boot|\/home$|SWAP/&&length($3)>1{printf "-not ( -path *%s -prune ) ",$3}') + getmount "/mnt /media /mount /home -maxdepth 5 -type d $alreadymounted" + partitiontype="$(lsblk -no "fstype" "$chosen")" + case "$partitiontype" in + "vfat") sudo -A mount -t vfat "$chosen" "$mp" -o rw,umask=0000;; + "exfat") sudo -A mount "$chosen" "$mp" -o uid="$(id -u)",gid="$(id -g)";; + *) sudo -A mount "$chosen" "$mp"; user="$(whoami)"; ug="$(groups | awk '{print $1}')"; sudo -A chown "$user":"$ug" "$mp";; + esac + notify-send "💻 USB mounting" "$chosen mounted to $mp." + } + +mountandroid() { \ + chosen="$(echo "$anddrives" | dmenu -i -p "Which Android device?")" || exit 1 + chosen="$(echo "$chosen" | cut -d : -f 1)" + getmount "$HOME -maxdepth 3 -type d" + simple-mtpfs --device "$chosen" "$mp" + echo "OK" | dmenu -i -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 + simple-mtpfs --device "$chosen" "$mp" + notify-send "🤖 Android Mounting" "Android device mounted to $mp." + } + +asktype() { \ + choice="$(printf "USB\\nAndroid" | dmenu -i -p "Mount a USB drive or Android device?")" || exit 1 + case $choice in + USB) mountusb ;; + Android) mountandroid ;; + esac + } + +anddrives=$(simple-mtpfs -l 2>/dev/null) +usbdrives="$(lsblk -rpo "name,type,size,mountpoint" | grep 'part\|rom' | awk '$4==""{printf "%s (%s)\n",$1,$3}')" + +if [ -z "$usbdrives" ]; then + [ -z "$anddrives" ] && echo "No USB drive or Android device detected" && exit + echo "Android device(s) detected." + mountandroid +else + if [ -z "$anddrives" ]; then + echo "USB drive(s) detected." + mountusb + else + echo "Mountable USB drive(s) and Android device(s) detected." + asktype + fi +fi diff --git a/evelyne/common/dmenu/dmenu-mpc b/evelyne/common/dmenu/dmenu-mpc new file mode 100755 index 0000000..5b7b3e9 --- /dev/null +++ b/evelyne/common/dmenu/dmenu-mpc @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +playing=$(mpc current) +[ -z "$playing" ] && playing="Stopped" + +▶️play() { mpc play ;} +⏸️pause() { mpc pause ;} +⏭️next() { mpc next ;} +⏮️prev() { mpc prev ;} +⏹️stop() { mpc stop ;} +🔄update() { mpc update ;} + +func="$(declare -F | awk '{print $3}' | dmenu -i -p "$playing":)" +[ -z "$func" ] || "$func" diff --git a/evelyne/common/dmenu/dmenu-pass b/evelyne/common/dmenu/dmenu-pass new file mode 100755 index 0000000..76d92ab --- /dev/null +++ b/evelyne/common/dmenu/dmenu-pass @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +shopt -s nullglob globstar + +typeit=0 +if [[ $1 == "--type" ]]; then + typeit=1 + shift +fi + +if [[ -n $WAYLAND_DISPLAY ]]; then + dmenu=dmenu-wl + xdotool="ydotool type --file -" +elif [[ -n $DISPLAY ]]; then + dmenu=dmenu + xdotool="xdotool type --clearmodifiers --file -" +else + echo "Error: No Wayland or X11 display detected" >&2 + exit 1 +fi + +prefix=${PASSWORD_STORE_DIR-~/.password-store} +password_files=( "$prefix"/**/*.gpg ) +password_files=( "${password_files[@]#"$prefix"/}" ) +password_files=( "${password_files[@]%.gpg}" ) + +password=$(printf '%s\n' "${password_files[@]}" | "$dmenu" "$@") + +[[ -n $password ]] || exit + +if [[ $typeit -eq 0 ]]; then + pass show -c "$password" 2>/dev/null +else + pass show "$password" | { IFS= read -r pass; printf %s "$pass"; } | $xdotool +fi diff --git a/evelyne/common/dmenu/dmenu-power b/evelyne/common/dmenu/dmenu-power new file mode 100755 index 0000000..64e3bdf --- /dev/null +++ b/evelyne/common/dmenu/dmenu-power @@ -0,0 +1,9 @@ +#!/bin/sh + +poweroff() { systemctl shutdown ;} +restart() { killall -HUP dwm ;} +reboot() { system reboot ;} +lock() { bosskey ;} + +func="$(declare -F | awk '{print $3}' | dmenu -i -p "Power:")" +[ -z "$func" ] || "$func" diff --git a/evelyne/common/dmenu/dmenu-unicode b/evelyne/common/dmenu/dmenu-unicode new file mode 100755 index 0000000..18ee0a5 --- /dev/null +++ b/evelyne/common/dmenu/dmenu-unicode @@ -0,0 +1,18 @@ +#!/bin/sh + +# The famous "get a menu of emojis to copy" script. + +# Get user selection via dmenu from emoji file. +chosen=$(cut -d ';' -f1 ~/.local/share/emoji-list | dmenu -i -l 30 | sed "s/ .*//") + +# Exit if none chosen. +[ -z "$chosen" ] && exit + +# If you run this command with an argument, it will automatically insert the +# character. Otherwise, show a message that the emoji has been copied. +if [ -n "$1" ]; then + xdotool type "$chosen" +else + printf "$chosen" | xclip -selection clipboard + notify-send "'$chosen' copied to clipboard." & +fi diff --git a/evelyne/common/dunst.nix b/evelyne/common/dunst.nix new file mode 100644 index 0000000..05198be --- /dev/null +++ b/evelyne/common/dunst.nix @@ -0,0 +1,44 @@ +{ config, pkgs, ... }: + +{ + services.dunst = { + enable = true; + settings = { + global = { + # Style + format = "%s\n%b"; + font = "Iosevka 10"; + width = 370; + height = 370; + offset = "0x50"; + padding = 5; + frame_width = 2; + + # Location + monitor = 0; + origin = "bottom-center"; + }; + + urgency_low = { + background = "#121317"; + foreground = "#D6DEEB"; + frame_color = "#2C323D"; + timeout = 3; + }; + + urgency_normal = { + background = "#121317"; + foreground = "#D6DEEB"; + frame_color = "#2C323D"; + timeout = 5; + }; + + urgency_critical = { + background = "#121317"; + foreground = "#D6DEEB"; + frame_color = "#E06C75"; + timeout = 10; + }; + }; + }; +} diff --git a/evelyne/common/dwm.nix b/evelyne/common/dwm.nix new file mode 100644 index 0000000..305b7cf --- /dev/null +++ b/evelyne/common/dwm.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + dwm # Suckless dynamic window manager + ]; +} diff --git a/evelyne/common/editor.nix b/evelyne/common/editor.nix new file mode 100644 index 0000000..0a254b8 --- /dev/null +++ b/evelyne/common/editor.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + # Misc editors + home.packages = with pkgs; [ + helix + vis + ]; +} diff --git a/evelyne/common/exa.nix b/evelyne/common/exa.nix new file mode 100644 index 0000000..d1661e5 --- /dev/null +++ b/evelyne/common/exa.nix @@ -0,0 +1,15 @@ +{ config, ... }: + +{ + programs.exa = { + enable = true; + enableAliases = true; + extraOptions = [ + "--group-directories-first" + "--time-style=long-iso" + "--git" + "-h" + ]; + icons = true; + }; +} diff --git a/evelyne/common/fetch.nix b/evelyne/common/fetch.nix new file mode 100644 index 0000000..b32cf64 --- /dev/null +++ b/evelyne/common/fetch.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + pridefetch # System stats with pride flags + neofetch # Generic system stats + pfetch # Simple system stats + ]; +} diff --git a/evelyne/common/files.nix b/evelyne/common/files.nix new file mode 100644 index 0000000..cff192e --- /dev/null +++ b/evelyne/common/files.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + ncdu_2 # Disk space manager + clifm # TUI file manager + ]; +} diff --git a/evelyne/common/games.nix b/evelyne/common/games.nix new file mode 100644 index 0000000..a5f6f14 --- /dev/null +++ b/evelyne/common/games.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + gzdoom # Modern doom runner + pcsx2 # PS2 Emulator + ]; +} diff --git a/evelyne/common/git.nix b/evelyne/common/git.nix new file mode 100644 index 0000000..38a2f83 --- /dev/null +++ b/evelyne/common/git.nix @@ -0,0 +1,49 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + gh + ]; + + home.file.".local/bin/git-sync" = { + source = ./git/git-sync.sh; + executable = true; + }; + + programs.git = { + enable = true; + lfs.enable = true; + + userName = "Evelyne"; + userEmail = "retroevelyne@outlook.com"; + signing = { + key = "C4F179337DB0D43A2ABE8EC900FC03E8D01EA976"; + signByDefault = true; + gpgPath = "gpg2"; + }; + + aliases = { + graph = "log --graph --oneline --decorate"; + unstage = "reset HEAD --"; + co = "checkout"; + br = "branch"; + ci = "commit"; + st = "status"; + ps = "push"; + }; + + extraConfig = { + init.defaultBranch = "development"; + pull.rebase = "merges"; + }; + + ignores = [ + "**/.DS_Store" + "**/._.DS_Store" + ".DS_Store" + "._.DS_Store" + "**/*.swp" + "*.swp" + ]; + }; +} diff --git a/evelyne/common/git/git-sync.sh b/evelyne/common/git/git-sync.sh new file mode 100644 index 0000000..b012d63 --- /dev/null +++ b/evelyne/common/git/git-sync.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env sh + +git add . +git commit -am "$(date --iso-8601)" +git pull +git push diff --git a/evelyne/common/gtk.nix b/evelyne/common/gtk.nix new file mode 100644 index 0000000..93eb9dd --- /dev/null +++ b/evelyne/common/gtk.nix @@ -0,0 +1,24 @@ +{ config, pkgs, ... }: + +{ + gtk = { + enable = true; + font = { + package = pkgs.iosevka; + name = "Iosevka"; + size = 10; + }; + theme = { + package = pkgs.catppuccin-gtk; + name = "Catppuccin-Frappe-Standard-Blue-Dark"; + }; + iconTheme = { + package = pkgs.zafiro-icons; + name = "Zafiro-icons-Dark"; + }; + }; + + home.packages = with pkgs; [ + gnome.zenity + ]; +} diff --git a/evelyne/common/home.nix b/evelyne/common/home.nix new file mode 100644 index 0000000..c70266e --- /dev/null +++ b/evelyne/common/home.nix @@ -0,0 +1,10 @@ +{ config, username, ... }: + +{ + programs.home-manager.enable = true; + home = { + inherit username; + homeDirectory = "/home/${username}"; + stateVersion = "22.11"; + }; +} diff --git a/evelyne/common/htop.nix b/evelyne/common/htop.nix new file mode 100644 index 0000000..729222c --- /dev/null +++ b/evelyne/common/htop.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: + +{ + programs.htop = { + enable = true; + package = pkgs.htop-vim; + settings = { + hide_kernel_threads = 1; + hide_userland_threads = 1; + highlight_base_name = 1; + show_cpu_usage = 1; + show_cpu_frequency = 1; + show_cpu_temperature = 1; + degree_fahrenheit = 0; + enable_mouse = 1; + tree_view = 1; + }; + }; +} diff --git a/evelyne/common/jetbrains.nix b/evelyne/common/jetbrains.nix new file mode 100644 index 0000000..e153807 --- /dev/null +++ b/evelyne/common/jetbrains.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + jetbrains.clion + jetbrains.goland + jetbrains.webstorm + jetbrains.pycharm-professional + ]; +} diff --git a/evelyne/common/kakoune.nix b/evelyne/common/kakoune.nix new file mode 100644 index 0000000..5e487d0 --- /dev/null +++ b/evelyne/common/kakoune.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + programs.kakoune = { + enable = true; + config = { + numberLines = { + enable = true; + relative = true; + }; + scrollOff.lines = 3; + showWhitespace.enable = true; + tabStop = 4; + ui = { + assistant = "cat"; + enableMouse = true; + }; + }; + plugins = with pkgs.kakounePlugins; [ + kakoune-rainbow + powerline-kak + auto-pairs-kak + ]; + }; +} diff --git a/evelyne/common/kdeconnect.nix b/evelyne/common/kdeconnect.nix new file mode 100644 index 0000000..51b90f5 --- /dev/null +++ b/evelyne/common/kdeconnect.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +{ + services.kdeconnect.enable = true; + + home.file.".xinitrc".text = '' + # Start kdeconnect when entering a graphical session + systemctl restart --user kdeconnect & + ''; +} diff --git a/evelyne/common/kdenlive.nix b/evelyne/common/kdenlive.nix new file mode 100644 index 0000000..09fe3e1 --- /dev/null +++ b/evelyne/common/kdenlive.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + kdenlive + ]; +} diff --git a/evelyne/common/lf.nix b/evelyne/common/lf.nix new file mode 100644 index 0000000..79bb0ee --- /dev/null +++ b/evelyne/common/lf.nix @@ -0,0 +1,26 @@ +{ config, pkgs, ... }: + +{ + programs.lf = { + enable = true; + previewer.source = ./lf/scope; + settings = { + relativenumber = true; + number = true; + hidden = false; + preview = true; + icons = true; + }; + }; + + xdg.configFile = { + "lf/icons" = { + source = ./lf/icons; + }; + }; + + home.packages = with pkgs; [ + ueberzug + file + ]; +} diff --git a/evelyne/common/lf/icons b/evelyne/common/lf/icons new file mode 100644 index 0000000..82bcd50 --- /dev/null +++ b/evelyne/common/lf/icons @@ -0,0 +1,93 @@ +di  +fi  +tw  +ow  +ln  +or  +ex  +*.txt  +*.mom  +*.me  +*.ms  +*.avif  +*.png  +*.webp  +*.ico  +*.gif  +*.tif  +*.tiff  +*.jpg  +*.jpe  +*.jpeg  +*.heif  +*.svg  +*.xcf  +*.gpg  +*.pdf  +*.djvu  +*.epub  +*.csv  +*.xlsx  +*.tex  +*.md  +*.mp3  +*.opus  +*.ogg  +*.m4a  +*.flac  +*.wav  +*.mkv  +*.mp4  +*.webm  +*.mpeg  +*.avi  +*.mov  +*.mpg  +*.wmv  +*.m4b  +*.flv  +*.zip  +*.rar  +*.7z  +*.tar  +*.gz  +*.z64 󰺷 +*.v64 󰺷 +*.n64 󰺷 +*.gdi 󰺷 +*.gba 󱎓 +*.nes 󰺶 +*.exe  +*.1  +*.nfo  +*.info  +*.log  +*.iso  +*.img  +*.bib  +*.part 󰋮 +*.torrent  +*.gitignore  +*.jar  +*.java  +*.r  +*.R  +*.rmd  +*.Rmd  +*.m  +*.rs  +*.go  +*.c  +*.cpp  +*.h  +*.py  +*.js  +*.json  +*.ts 󰛦 +*.sh  +*.html  +*.css  +*.xml  +*.php  +*.nix  +*.vim  diff --git a/evelyne/common/lf/scope b/evelyne/common/lf/scope new file mode 100755 index 0000000..c648d66 --- /dev/null +++ b/evelyne/common/lf/scope @@ -0,0 +1,52 @@ +#!/usr/bin/env sh + +# File preview handler for lf. + +set -C -f +IFS="$(printf '%b_' '\n')"; IFS="${IFS%_}" + +image() { + if [ -f "$1" ] && [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1; then + printf '{"action": "add", "identifier": "PREVIEW", "x": "%s", "y": "%s", "width": "%s", "height": "%s", "scaler": "contain", "path": "%s"}\n' "$4" "$5" "$(($2-1))" "$(($3-1))" "$1" > "$FIFO_UEBERZUG" + else + mediainfo "$6" + fi +} + +ifub() { + [ -n "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -V ueberzug >/dev/null 2>&1 +} + +# Note that the cache file name is a function of file information, meaning if +# an image appears in multiple places across the machine, it will not have to +# be regenerated once seen. + +case "$(file --dereference --brief --mime-type -- "$1")" in + image/avif) CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && convert "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" ;; + image/*) image "$1" "$2" "$3" "$4" "$5" "$1" ;; + text/html) lynx -width="$4" -display_charset=utf-8 -dump "$1" ;; + text/troff) man ./ "$1" | col -b ;; + text/* | */xml | application/json) bat --terminal-width "$(($4-2))" -f "$1" ;; + audio/* | application/octet-stream) mediainfo "$1" || exit 1 ;; + video/* ) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE" ] && ffmpegthumbnailer -i "$1" -o "$CACHE" -s 0 + image "$CACHE" "$2" "$3" "$4" "$5" "$1" + ;; + */pdf) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE.jpg" ] && pdftoppm -jpeg -f 1 -singlefile "$1" "$CACHE" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; + */epub+zip|*/mobi*) + CACHE="${XDG_CACHE_HOME:-$HOME/.cache}/lf/thumb.$(stat --printf '%n\0%i\0%F\0%s\0%W\0%Y' -- "$(readlink -f "$1")" | sha256sum | cut -d' ' -f1)" + [ ! -f "$CACHE.jpg" ] && gnome-epub-thumbnailer "$1" "$CACHE.jpg" + image "$CACHE.jpg" "$2" "$3" "$4" "$5" "$1" + ;; + application/*zip) atool --list -- "$1" ;; + *opendocument*) odt2txt "$1" ;; + application/pgp-encrypted) gpg -d -- "$1" ;; +esac +exit 1 diff --git a/evelyne/common/librewolf.nix b/evelyne/common/librewolf.nix new file mode 100644 index 0000000..b0d8d2b --- /dev/null +++ b/evelyne/common/librewolf.nix @@ -0,0 +1,12 @@ +{ config, ... }: + +{ + programs.librewolf = { + enable = true; + settings = { + "browser.uidensity" = 1; + "webgl.disabled" = false; + "privacy.resistFingerprinting" = false; + }; + }; +} diff --git a/evelyne/common/media.nix b/evelyne/common/media.nix new file mode 100644 index 0000000..9ce7a54 --- /dev/null +++ b/evelyne/common/media.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + libheif # Manage .heif files from phones + gcolor2 # Color viewer and eyedropper + ffmpeg # Video manipulator + ]; +} diff --git a/evelyne/common/messaging.nix b/evelyne/common/messaging.nix new file mode 100644 index 0000000..a75e89c --- /dev/null +++ b/evelyne/common/messaging.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + element-desktop # Matrix client + signal-desktop # Signal client + discord-canary # Discord client + ripcord # Better discord client + nheko # Better matrix client + ]; +} diff --git a/evelyne/common/minecraft.nix b/evelyne/common/minecraft.nix new file mode 100644 index 0000000..b92549e --- /dev/null +++ b/evelyne/common/minecraft.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + prismlauncher # Minecraft launcher + minecraft # Actual minecraft + jdk # Needed for running minecraft servers + ]; +} diff --git a/evelyne/common/mommy.nix b/evelyne/common/mommy.nix new file mode 100644 index 0000000..d78da2a --- /dev/null +++ b/evelyne/common/mommy.nix @@ -0,0 +1,12 @@ +{ config, ... }: + +{ + programs.zsh.initExtra = '' + precmd() { [ $? -ne 0 ] && $HOME/.local/bin/mommy -n } + ''; + + home.file.".local/bin/mommy" = { + source = ./mommy/shell-mommy.sh; + executable = true; + }; +} diff --git a/evelyne/common/mommy/shell-mommy.sh b/evelyne/common/mommy/shell-mommy.sh new file mode 100755 index 0000000..ac215eb --- /dev/null +++ b/evelyne/common/mommy/shell-mommy.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env sh + +usage() { printf "usage: $0 [-pn]\n -p: positive response\n -n: negative response\n"; } +[ $# -eq 0 ] && usage && exit 0; + +[ -z "$MOMMYS_LITTLE" ] && MOMMYS_LITTLE="girl" +[ -z "$MOMMYS_PRONOUN" ] && MOMMYS_PRONOUN="her" +[ -z "$MOMMYS_ROLE" ] && MOMMYS_ROLE="mommy" +[ -z "$MOMMY_COLOR" ] && MOMMY_COLOR='\e[38;5;217m' +COLOR_RESET='\e[0m' + +negative() { + RESPONSES=( + "do you need $MOMMYS_ROLE's help~? ❤️" + "don't give up, my love~ ❤️" + "don't worry, $MOMMYS_ROLE is here to help you~ ❤️" + "I believe in you, my sweet $MOMMYS_LITTLE~ ❤️" + "it's okay to make mistakes, my dear~ ❤️" + "just a little further, sweetie~ ❤️" + "let's try again together, okay~? ❤️" + "$MOMMYS_ROLE believes in you, and knows you can overcome this~ ❤️" + "$MOMMYS_ROLE believes in you~ ❤️" + "$MOMMYS_ROLE is always here for you, no matter what~ ❤️" + "$MOMMYS_ROLE is here to help you through it~ ❤️" + "$MOMMYS_ROLE is proud of you for trying, no matter what the outcome~ ❤️" + "$MOMMYS_ROLE knows it's tough, but you can do it~ ❤️" + "$MOMMYS_ROLE knows $MOMMYS_PRONOUN little $MOMMYS_LITTLE can do better~ ❤️" + "$MOMMYS_ROLE knows you can do it, even if it's tough~ ❤️" + "$MOMMYS_ROLE knows you're feeling down, but you'll get through it~ ❤️" + "$MOMMYS_ROLE knows you're trying your best~ ❤️" + "$MOMMYS_ROLE loves you, and is here to support you~ ❤️" + "$MOMMYS_ROLE still loves you no matter what~ ❤️" + "you're doing your best, and that's all that matters to $MOMMYS_ROLE~ ❤️" + "$MOMMYS_ROLE is always here to encourage you~ ❤️" + ) +} + +positive() { + RESPONSES=( + "*pats your head*" + "awe, what a good $MOMMYS_LITTLE~\n$MOMMYS_ROLE knew you could do it~ ❤️" + "good $MOMMYS_LITTLE~\n$MOMMYS_ROLE's so proud of you~ ❤️" + "keep up the good work, my love~ ❤️" + "$MOMMYS_ROLE is proud of the progress you've made~ ❤️" + "$MOMMYS_ROLE is so grateful to have you as $MOMMYS_PRONOUN little $MOMMYS_LITTLE~ ❤️" + "I'm so proud of you, my love~ ❤️" + "$MOMMYS_ROLE is so proud of you~ ❤️" + "$MOMMYS_ROLE loves seeing $MOMMYS_PRONOUN little $MOMMYS_LITTLE succeed~ ❤️" + "$MOMMYS_ROLE thinks $MOMMYS_PRONOUN little $MOMMYS_LITTLE earned a big hug~ ❤️" + "that's a good $MOMMYS_LITTLE~ ❤️" + "you did an amazing job, my dear~ ❤️" + "you're such a smart cookie~ ❤️" + ) +} + +mommy_says() { + says=$1 + printf "$MOMMY_COLOR$says$COLOR_RESET\n" +} + +random() { + [ $1 == "positive" ] && positive + [ $1 == "negative" ] && negative + + index=$(($RANDOM % ${#RESPONSES[@]})) + response="${RESPONSES[$index]}" + + mommy_says "$response" +} + +while getopts "pn" options; do + case $options in + p) random "positive" ;; + n) random "negative" ;; + *) usage; exit 1 ;; + esac +done diff --git a/evelyne/common/mpd.nix b/evelyne/common/mpd.nix new file mode 100644 index 0000000..af1fff6 --- /dev/null +++ b/evelyne/common/mpd.nix @@ -0,0 +1,35 @@ +{ config, pkgs, username, ... }: + +{ + services.mpd = { + enable = true; + musicDirectory = "${config.home.homeDirectory}/Music"; + extraConfig = '' + auto_update "yes" + + audio_output { + type "pipewire" + name "PipeWire Sound Server" + } + + audio_output { + type "fifo" + name "Visualizer feed" + path "/tmp/mpd.fifo" + format "44100:16:2" + } + ''; + }; + + home.packages = with pkgs; [ + mpc_cli + ]; + + programs.ncmpcpp = { + enable = true; + settings = { + ncmpcpp_directory = "${config.home.homeDirectory}/.local/share/ncmpcpp"; + lyrics_directory = "${config.home.homeDirectory}/.local/share/lyrics"; + }; + }; +} diff --git a/evelyne/common/mpv.nix b/evelyne/common/mpv.nix new file mode 100644 index 0000000..9841efd --- /dev/null +++ b/evelyne/common/mpv.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +{ + programs.mpv = { + enable = true; + config = { + loop-file = "inf"; + }; + }; +} diff --git a/evelyne/common/neovim.nix b/evelyne/common/neovim.nix new file mode 100644 index 0000000..e9164ca --- /dev/null +++ b/evelyne/common/neovim.nix @@ -0,0 +1,27 @@ +{ config, pkgs, lib, ... }: + +{ + programs.neovim = { + enable = true; + defaultEditor = true; + extraPackages = with pkgs; [ + nodejs + sumneko-lua-language-server + nodePackages.bash-language-server + nodePackages.vim-language-server + nodePackages.pyright + rust-analyzer + rnix-lsp + universal-ctags + ]; + }; + + home.packages = with pkgs; [ + neovide + ]; + + xdg.configFile."nvim" = { + source = ./neovim; + recursive = true; + }; +} diff --git a/evelyne/common/neovim/.gitignore b/evelyne/common/neovim/.gitignore new file mode 100644 index 0000000..8cb205e --- /dev/null +++ b/evelyne/common/neovim/.gitignore @@ -0,0 +1 @@ +plugin diff --git a/evelyne/common/neovim/LICENSE b/evelyne/common/neovim/LICENSE new file mode 100644 index 0000000..f608636 --- /dev/null +++ b/evelyne/common/neovim/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 SpyHoodle + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/evelyne/common/neovim/README.md b/evelyne/common/neovim/README.md new file mode 100644 index 0000000..e509bf7 --- /dev/null +++ b/evelyne/common/neovim/README.md @@ -0,0 +1,22 @@ +# Maddie's NeoVim config +A clean, fast, feature-rich IDE layer for my needs in [NeoVim](https://neovim.io/).
+Written in Lua, designed for NeoVim v0.7.0 or higher. + +## Some highlights + - Written entirely in Lua, making it clean and modern for NeoVim + - Uses [impatient.nvim](https://github.com/lewis6991/impatient.nvim) which greatly improves startup performance + - Uses the latest NeoVim LSP features & tree-sitter for highlighting + - Neat, small and structured files that are easy to read with some commenting + - Helpful features for programming such as highlighting indents & whitespaces + - Features for writing prose and taking notes, such as [vimwiki](https://github.com/vimwiki/vimwiki) and [orgmode](https://github.com/nvim-orgmode/orgmode) + - Extensible Lua written NeoVim specific package manager from [packer.nvim](https://github.com/wbthomason/packer.nvim) + - Modern standard Lua plugins such as [lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) and [nvim-tree](https://github.com/kyazdani42/nvim-tree.lua) + - Fixed scrolling in terminals like st with patches and smooth scrolling + - Extra configuration for [Neovide](https://github.com/neovide/neovide), a graphical NeoVim client + - Shortcuts for tabs & splits with the leader key as space + - System clipboard, mouse and scrolling support + +## Work in progress! +I'm constantly updating and changing this configuration, by adding new plugins and settings.
+I likely won't make changes to make the config more acceptable and general to the public.
+Made with ❤️ and 🏳️‍⚧️. diff --git a/evelyne/common/neovim/init.lua b/evelyne/common/neovim/init.lua new file mode 100644 index 0000000..68daca1 --- /dev/null +++ b/evelyne/common/neovim/init.lua @@ -0,0 +1,253 @@ +-- Basic vim config +require('basics') +require('keymaps') +require('colours') + +-- Packages +return require('packer').startup(function(use) + -- Neovim package manager + use 'wbthomason/packer.nvim' + + -- Atom's One Dark theme + use 'navarasu/onedark.nvim' + + -- Gruvbox theme + use 'ellisonleao/gruvbox.nvim' + + -- VSCode theme + use 'Mofiqul/vscode.nvim' + + -- Everforest theme + use 'sainnhe/everforest' + + -- Smooth scrolling + use 'psliwka/vim-smoothie' + + -- Comments in any language + use 'tpope/vim-commentary' + + -- Surrounding + use 'tpope/vim-surround' + + -- Repeating + use 'tpope/vim-repeat' + + -- Vim-wiki + use 'vimwiki/vimwiki' + + -- Rainbow brackets + use 'p00f/nvim-ts-rainbow' + + -- Git bindings + use 'tpope/vim-fugitive' + + -- Latex + use 'lervag/vimtex' + + -- Easy alignment + use 'junegunn/vim-easy-align' + + + -- Transparent background + use { + 'xiyaowong/nvim-transparent', + config = function() + vim.g.transparent_enabled = false + end + } + + -- Zen mode + use { + "folke/zen-mode.nvim", + config = function() + require('zen-mode').setup() + end + } + + -- Autosaving + use { + 'pocco81/auto-save.nvim', + config = function() + require('auto-save').setup({ + enabled = true, + execution_message = { + message = function() + return ('>w< autosaved at ' .. vim.fn.strftime('%H:%M:%S')) + end, + cleaning_interval = 1250 + }, + trigger_events = { 'InsertLeave', 'TextChanged' } + }) + end + } + + -- Git signs + use { + 'lewis6991/gitsigns.nvim', + config = function() + require('gitsigns').setup() + end + } + + -- Github Copilot + use { + 'zbirenbaum/copilot.lua', + event = { 'VimEnter' }, + config = function() + vim.defer_fn(function() + require('copilot').setup() + end, 100) + end + } + + -- Liveshare + use { + 'jbyuki/instant.nvim', + config = function() + vim.g.instant_username = "Maddie" + end + } + + -- Fuzzy finder + use { + 'nvim-telescope/telescope.nvim', + requires = { 'nvim-lua/plenary.nvim' } + } + + -- Auto-pairs + use { + 'windwp/nvim-autopairs', + config = function() + require('nvim-autopairs').setup() + end + } + + -- Highlight whitespaces + use { + 'ntpeters/vim-better-whitespace', + config = function() + vim.g.better_whitespace_filetypes_blacklist = { 'startify' } + end + } + + -- Highlight indents + use { + 'nathanaelkane/vim-indent-guides', + config = function() + vim.g.indent_guides_enable_on_vim_startup = 1 + vim.g.indent_guides_exclude_filetypes = { 'help', 'NvimTree', 'startify' } + end + } + + -- Color hex codes + use { + 'norcalli/nvim-colorizer.lua', + config = function() + require('colorizer').setup() + end + } + + -- Statusbar line + use { + 'nvim-lualine/lualine.nvim', + requires = { 'kyazdani42/nvim-web-devicons', opt = true }, + config = function() + require('lualine').setup() + end + } + + -- File browser + use { + 'kyazdani42/nvim-tree.lua', + requires = { 'kyazdani42/nvim-web-devicons' }, + config = function() + require('nvim-tree').setup() + end + } + + -- Org-mode + use { + 'nvim-orgmode/orgmode', + config = function() + require('orgmode').setup() + require('orgmode').setup_ts_grammar() + end + } + + -- Speedup neovim startup + use { + 'lewis6991/impatient.nvim', + config = function() + require('impatient') + end + } + + -- Rust tools + use 'neovim/nvim-lspconfig' + use { + 'simrat39/rust-tools.nvim', + config = function() + require('rust-tools').setup() + end + } + + + -- -- Language Server Protocol + -- use { + -- 'neovim/nvim-lspconfig', + -- config = function() + -- require('lspconfig').pyright.setup{} + -- require('lspconfig').rnix.setup{} + -- require('lspconfig').bashls.setup{} + -- require('lspconfig').vimls.setup{} + -- require('lspconfig').sumneko_lua.setup { + -- settings = { + -- Lua = { + -- diagnostics = { + -- globals = { 'vim' } + -- } + -- } + -- } + -- } + -- end + -- } + + -- Code completion + use 'L3MON4D3/LuaSnip' + use 'rafamadriz/friendly-snippets' + use 'zbirenbaum/copilot-cmp' + use 'hrsh7th/cmp-nvim-lsp' + use 'hrsh7th/cmp-nvim-lua' + use 'hrsh7th/cmp-buffer' + use 'hrsh7th/cmp-path' + use 'hrsh7th/cmp-cmdline' + use { + 'hrsh7th/nvim-cmp', + requires = { 'kyazdani42/nvim-web-devicons' }, + config = function() + require('plugins.cmp') + end + } + + -- Treesitter for highlighting + use { + 'nvim-treesitter/nvim-treesitter', + config = function() + require('nvim-treesitter.configs').setup { + ensure_installed = { 'cpp', 'lua', 'go', 'rust', 'python', 'nix', 'vim', 'markdown', 'html', 'css' }, + sync_install = true, + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + rainbow = { + enable = true, + extended_mode = true + }, + indent = { + enable = true; + } + } + end + } +end) diff --git a/evelyne/common/neovim/lua/basics.lua b/evelyne/common/neovim/lua/basics.lua new file mode 100644 index 0000000..56e9f2b --- /dev/null +++ b/evelyne/common/neovim/lua/basics.lua @@ -0,0 +1,36 @@ +-- Vim settings +vim.g.mapleader = ' ' +vim.o.encoding = 'utf8' +vim.o.background = 'dark' +vim.o.relativenumber = true +vim.o.number = true +vim.o.wrap = false +vim.o.expandtab = true +vim.o.incsearch = true +vim.o.scrolloff = 5 +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 +vim.o.cursorline = true +vim.o.ignorecase = true +vim.o.swapfile = false +vim.o.undofile = true +vim.o.splitbelow = true +vim.o.splitright = true +vim.o.errorbells = false +vim.o.termguicolors = true +vim.o.showmode = false +vim.o.showtabline = 1 +vim.o.signcolumn = 'auto' +vim.o.clipboard = 'unnamedplus' +vim.o.mouse = 'a' +vim.o.go = 'a' + +-- Netrw +vim.g["netrw_banner"] = 0 +vim.g["netrw_liststyle"] = 3 +vim.g["netrw_winsize"] = 25 + +-- Neovide +vim.o.guifont = 'JetBrainsMono Nerd Font:h12' +vim.g.neovide_cursor_vfx_mode = 'railgun' +vim.g.neovide_remember_window_size = true diff --git a/evelyne/common/neovim/lua/colours.lua b/evelyne/common/neovim/lua/colours.lua new file mode 100644 index 0000000..344eaf8 --- /dev/null +++ b/evelyne/common/neovim/lua/colours.lua @@ -0,0 +1 @@ +vim.cmd([[colorscheme onedark]]) diff --git a/evelyne/common/neovim/lua/keymaps.lua b/evelyne/common/neovim/lua/keymaps.lua new file mode 100644 index 0000000..745fc15 --- /dev/null +++ b/evelyne/common/neovim/lua/keymaps.lua @@ -0,0 +1,59 @@ +-- Neat variables +local opts = { noremap = true, silent = true } +local term_opts = { silent = true } +local keymap = vim.api.nvim_set_keymap + +-- Custom/special keymaps +keymap('n', 'c', ':sp :term :resize 20N i', term_opts) +keymap('n', 'r', ':luafile %:PackerSync', term_opts) +keymap('n', 'h', ':nohl', term_opts) +keymap('n', 'z', ':ZenMode:set wrap:set linebreak', term_opts) +keymap('n', 'Z', ':ZenMode:set nowrap:set nolinebreak', term_opts) +keymap('n', '', ':Telescope colorscheme', term_opts) +keymap('n', '', ':wqa', term_opts) +keymap('n', '', ':w', term_opts) +keymap('n', 'U', ':redo', term_opts) + +-- Window management +keymap('n', 'vs', ':vs', opts) +keymap('n', 'hs', ':sp', opts) +keymap('n', 'tn', ':tabnew', opts) +keymap('n', 'th', ':tabprev', opts) +keymap('n', 'tj', ':tabprev', opts) +keymap('n', 'tk', ':tabnext', opts) +keymap('n', 'tl', ':tabnext', opts) +keymap('n', 'to', ':tabo', opts) +keymap('n', 'tc', ':tabc', opts) + +-- Window navigation +keymap('n', '', 'w', opts) +keymap('n', '', 'h', opts) +keymap('n', '', 'j', opts) +keymap('n', '', 'k', opts) +keymap('n', '', 'l', opts) + +-- Buffer navigation +keymap('n', '', ':bnext', opts) +keymap('n', '', ':bprevious', opts) + +-- Stay in visual mode when indenting +keymap('v', '<', '', '>gv', opts) + +-- When moving up or down, move physical lines not file lines +keymap('n', 'j', 'gj', opts) +keymap('n', 'k', 'gk', opts) + +-- NvimTree +keymap('n', '', ':NvimTreeToggle', term_opts) + +-- Telescope +keymap('n', '', 'lua require("telescope.builtin").find_files()', opts) +keymap('n', 'ff', 'lua require("telescope.builtin").find_files()', opts) +keymap('n', 'fg', 'lua require("telescope.builtin").live_grep()', opts) +keymap('n', 'fb', 'lua require("telescope.builtin").buffers()', opts) +keymap('n', 'fh', 'lua require("telescope.builtin").help_tags()', opts) + +-- Easy alignment +keymap('n', 'ga', ':EasyAlign', opts) +keymap('v', 'ga', ':EasyAlign', opts) diff --git a/evelyne/common/neovim/lua/plugins/cmp.lua b/evelyne/common/neovim/lua/plugins/cmp.lua new file mode 100644 index 0000000..224eccb --- /dev/null +++ b/evelyne/common/neovim/lua/plugins/cmp.lua @@ -0,0 +1,117 @@ +local cmp = require('cmp') +local luasnip = require('luasnip') +require('luasnip.loaders.from_vscode').lazy_load() + +local check_backspace = function() + local col = vim.fn.col "." - 1 + return col == 0 or vim.fn.getline("."):sub(col, col):match "%s" +end + +local kind_icons = { + Text = "", + Method = "m", + Function = "", + Constructor = "", + Field = "", + Variable = "", + Class = "", + Interface = "", + Module = "", + Property = "", + Unit = "", + Value = "", + Enum = "", + Keyword = "", + Snippet = "", + Color = "", + File = "", + Reference = "", + Folder = "", + EnumMember = "", + Constant = "", + Struct = "", + Event = "", + Operator = "", + TypeParameter = "", +} + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.config.disable, + [""] = cmp.mapping { + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }, + [""] = cmp.mapping.confirm { select = true }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif check_backspace() then + fallback() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { + "i", + "s", + }), + }, + formatting = { + fields = { "kind", "abbr", "menu" }, + format = function(entry, vim_item) + vim_item.kind = string.format("%s", kind_icons[vim_item.kind]) + vim_item.menu = ({ + nvim_lsp = "[LSP]", + nvim_lua = "[NVIM_LUA]", + copilot = "[Copilot]", + luasnip = "[Snippet]", + buffer = "[Buffer]", + path = "[Path]", + })[entry.source.name] + return vim_item + end, + }, + sources = { + { name = "nvim_lsp" }, + { name = "nvim_lua" }, + { name = "copilot" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }, + confirm_opts = { + behavior = cmp.ConfirmBehavior.Replace, + select = false, + }, + experimental = { + ghost_text = false, + native_menu = false, + }, + cmp.config.window.bordered() +} diff --git a/evelyne/common/neovim/spell/en.utf-8.add b/evelyne/common/neovim/spell/en.utf-8.add new file mode 100644 index 0000000..6f1ee5d --- /dev/null +++ b/evelyne/common/neovim/spell/en.utf-8.add @@ -0,0 +1,6 @@ +macOS +JS +add evelyne +evelyne +camhs +Vernova diff --git a/evelyne/common/neovim/spell/en.utf-8.add.spl b/evelyne/common/neovim/spell/en.utf-8.add.spl new file mode 100644 index 0000000..44abfca Binary files /dev/null and b/evelyne/common/neovim/spell/en.utf-8.add.spl differ diff --git a/evelyne/common/nsxiv.nix b/evelyne/common/nsxiv.nix new file mode 100644 index 0000000..8b538c9 --- /dev/null +++ b/evelyne/common/nsxiv.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + nsxiv + ]; + xdg.configFile."nsxiv" = { + source = ./nsxiv; + }; + xresources.properties = { + "Nsxiv.window.foreground" = "#D6DEEB"; + "Nsxiv.window.background" = "#1E2127"; + "Nsxiv.bar.background" = "#2C323D"; + "Nsxiv.bar.foreground" = "#D6DEEB"; + }; +} diff --git a/evelyne/common/nsxiv/exec/key-handler b/evelyne/common/nsxiv/exec/key-handler new file mode 100755 index 0000000..70c7593 --- /dev/null +++ b/evelyne/common/nsxiv/exec/key-handler @@ -0,0 +1,14 @@ +#!/bin/sh +while read file +do + case "$1" in + "d") + rm -rf $file ;; + "r") + convert -rotate 90 "$file" "$file" ;; + "y") + echo -n "$file" | xclip -selection clipboard ;; + "w") + xwallpaper --zoom "$file" && kill $(pidof nsxiv);; + esac +done diff --git a/evelyne/common/obs-studio.nix b/evelyne/common/obs-studio.nix new file mode 100644 index 0000000..07f8a87 --- /dev/null +++ b/evelyne/common/obs-studio.nix @@ -0,0 +1,5 @@ +{ config, ... }: + +{ + programs.obs-studio.enable = true; +} diff --git a/evelyne/common/office.nix b/evelyne/common/office.nix new file mode 100644 index 0000000..892c7b1 --- /dev/null +++ b/evelyne/common/office.nix @@ -0,0 +1,12 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + texlive.combined.scheme-full # LaTeX + libreoffice # Documents suite + thunderbird # Email client + obsidian # Notes app + sc-im # TUI spreadsheet + anki # Flashcard app + ]; +} diff --git a/evelyne/common/passwords.nix b/evelyne/common/passwords.nix new file mode 100644 index 0000000..c43e87d --- /dev/null +++ b/evelyne/common/passwords.nix @@ -0,0 +1,14 @@ +{ config, ... }: + +{ + programs.password-store = { + enable = true; + settings = { + PASSWORD_STORE_DIR = "${config.xdg.dataHome}/password-store"; + }; + }; + + home.sessionVariables = { + PASSWORD_STORE_DIR = "${config.xdg.dataHome}/password-store"; + }; +} diff --git a/evelyne/common/pcmanfm.nix b/evelyne/common/pcmanfm.nix new file mode 100644 index 0000000..e235e38 --- /dev/null +++ b/evelyne/common/pcmanfm.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + pcmanfm + ]; + + xdg.configFile."pcmanfm" = { + source = ./pcmanfm; + }; +} diff --git a/evelyne/common/pcmanfm/default/pcmanfm.conf b/evelyne/common/pcmanfm/default/pcmanfm.conf new file mode 100644 index 0000000..79dfed0 --- /dev/null +++ b/evelyne/common/pcmanfm/default/pcmanfm.conf @@ -0,0 +1,26 @@ +[config] +bm_open_method=0 + +[volume] +mount_on_startup=1 +mount_removable=1 +autorun=1 + +[ui] +always_show_tabs=0 +max_tab_chars=32 +win_width=1000 +win_height=696 +splitter_pos=189 +media_in_new_tab=0 +desktop_folder_new_win=0 +change_tab_on_drop=1 +close_on_unmount=1 +focus_previous=0 +side_pane_mode=places +view_mode=list +show_hidden=0 +sort=name;descending; +toolbar=newtab;navigation;home; +show_statusbar=1 +pathbar_mode_buttons=0 diff --git a/evelyne/common/picom.nix b/evelyne/common/picom.nix new file mode 100644 index 0000000..eb5f048 --- /dev/null +++ b/evelyne/common/picom.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: + +{ + home.file.".xinitrc".text = '' + # Import xorg environment into systemd for the picom service to work + systemctl --user import-environment XAUTHORITY DISPLAY & + + # Restart picom after importing the xorg environment + systemctl --user restart picom & + ''; + services.picom = { + enable = true; + fade = true; + fadeSteps = [ + 0.1 + 0.1 + ]; + opacityRules = [ + "90:class_g = 'st-256color'" + "90:class_g = 'tabbed-trans'" + ]; + shadow = true; + vSync = true; + }; +} diff --git a/evelyne/common/processes.nix b/evelyne/common/processes.nix new file mode 100644 index 0000000..8ef33c9 --- /dev/null +++ b/evelyne/common/processes.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + xorg.xkill # Kill X11 programs with mouse + killall # Kill programs + ]; +} diff --git a/evelyne/common/qt.nix b/evelyne/common/qt.nix new file mode 100644 index 0000000..a0f7efc --- /dev/null +++ b/evelyne/common/qt.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + qt = { + enable = true; + style = { + package = pkgs.adwaita-qt; + name = "adwaita-dark"; + }; + }; +} diff --git a/evelyne/common/rust.nix b/evelyne/common/rust.nix new file mode 100644 index 0000000..e31bc39 --- /dev/null +++ b/evelyne/common/rust.nix @@ -0,0 +1,15 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + rustup + ]; + + home = { + sessionVariables = { + CARGO_HOME = "${config.xdg.dataHome}/cargo"; + RUSTUP_HOME = "${config.xdg.dataHome}/rustup"; + }; + sessionPath = [ "${config.home.sessionVariables.CARGO_HOME}/bin" ]; + }; +} diff --git a/evelyne/common/screenshot.nix b/evelyne/common/screenshot.nix new file mode 100644 index 0000000..31e3134 --- /dev/null +++ b/evelyne/common/screenshot.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + tesseract5 # Gets text from images + maim # X11 screenshot tool + ]; + + home.file.".local/bin/sss" = { + source = ./screenshot/sss.sh; + executable = true; + }; +} diff --git a/evelyne/common/screenshot/sss.sh b/evelyne/common/screenshot/sss.sh new file mode 100644 index 0000000..efe43ee --- /dev/null +++ b/evelyne/common/screenshot/sss.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env sh + +# Configuration variables +SST_PIC_DIR="$HOME/Pictures/Screenshots" + +while getopts "sctd:" options; do + case $options in + s) + echo "sswm: save mode" + name=$(date --iso-8601=minutes) + maim -s -u -f png > $SST_PIC_DIR/$name.png + echo "sswm: imaged saved as $SST_PIC_DIR/$name.png" + ;; + c) + echo "sswm: copy mode" + maim -s -u -f png | xclip -selection clipboard -t image/png + echo "sswm: image copied to clipboard" + ;; + t) + echo "sswm: text mode" + maim -s -u -f png "$IMAGE" + [ $? -ne 0 ] && exit 1 + + tesseract "$IMAGE" "${TEXT//\.txt/}" 2> /dev/null + sed -i 's/\x0c//' "$TEXT" + + if [ $(wc -l < $TEXT) -eq 0 ]; then + echo "sswm: no text detected" + else + truncate -s -1 $TEXT + xclip -selection clipboard < "$TEXT" + echo "sswm: text copied to clipboard" + fi + ;; + d) + echo "sswm: delay "$OPTARG"s..." + sleep $OPTARG + ;; + esac +done diff --git a/evelyne/common/secrets.nix b/evelyne/common/secrets.nix new file mode 100644 index 0000000..6049af2 --- /dev/null +++ b/evelyne/common/secrets.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + services.pass-secret-service = { + enable = true; + storePath = "${config.xdg.dataHome}/password-store"; + }; +} diff --git a/evelyne/common/shell.nix b/evelyne/common/shell.nix new file mode 100644 index 0000000..5543933 --- /dev/null +++ b/evelyne/common/shell.nix @@ -0,0 +1,61 @@ +{ config, ... }: + +{ + home = { + # Aliases + shellAliases = { + # Core Programs + cp = "cp -iv"; + mv = "mv -iv"; + rm = "rm -vI"; + mkd = "mkdir -pv"; + c = "clear"; + e = "exit"; + + # CLI Shortcuts + v = "nvim"; + vi = "nvim"; + ka = "killall"; + xw = "xwallpaper"; + nf = "neofetch"; + tf = "pridefetch -f trans"; + pf = "pfetch"; + i = "inertia"; + + # System shortcuts + heif-convert-dir = "for file in *.heic; do heif-convert -q 100 $file \${file/%.heic/.jpg}; done"; + unfuck-wifi = "doas systemctl restart wpa_supplicant.service"; + cdt = "cd $(mktemp -d)"; + sx = "startx ~/.config/x11/xinitrc"; + sdn = "doas shutdown -h now"; + kys = "kill $(pidof '$@')"; + + # Nix system shortucts + nix-system-update = "nix flake update $NIXFILES && doas nixos-rebuild switch --flake $NIXFILES"; + + # For colour + btop = "btop --utf-force"; + grep = "grep --color=auto"; + diff = "diff --color=auto"; + }; + + # Environment variables + sessionVariables = { + # Locale + LANG = "en_GB.UTF-8"; + LC_ALL = "en_GB.UTF-8"; + + # Define nixfiles location + NIXFILES = "$HOME/Development/Personal/NixFiles"; + + # Java windows + _JAVA_AWT_WM_NONREPARENTING = 1; + }; + + # Default $PATH + sessionPath = [ + # Add ~/.local/bin to $PATH + "$HOME/.local/bin" + ]; + }; +} diff --git a/evelyne/common/slstatus.nix b/evelyne/common/slstatus.nix new file mode 100644 index 0000000..e990e5a --- /dev/null +++ b/evelyne/common/slstatus.nix @@ -0,0 +1,21 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + slstatus + ]; + + home.file.".xinitrc".text = '' + # Start slstatus + ${pkgs.slstatus}/bin/slstatus & + ''; + + home.file.".local/bin/statusbar" = { + source = ./statusbar; + executable = true; + }; + + home.sessionPath = [ + "$HOME/.local/bin/statusbar" + ]; +} diff --git a/evelyne/common/ssh.nix b/evelyne/common/ssh.nix new file mode 100644 index 0000000..80bcebc --- /dev/null +++ b/evelyne/common/ssh.nix @@ -0,0 +1,15 @@ +{ config, pkgs, username, ... }: + +{ + # SSH + programs.ssh = { + enable = true; + matchBlocks = { + lambda = { + identityFile = "~/.ssh/id_ed25519"; + hostname = "home.spyhoodle.me"; + user = "evelyne"; + }; + }; + }; +} diff --git a/evelyne/common/ssh/id_ed25519.pub b/evelyne/common/ssh/id_ed25519.pub new file mode 100644 index 0000000..c1477f5 --- /dev/null +++ b/evelyne/common/ssh/id_ed25519.pub @@ -0,0 +1 @@ +ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFMeYbc+IeL0nvIO98Ajlo8W73uDHv8t+SlIjbFqF1+Z retro@PogMachine diff --git a/evelyne/common/statusbar/sb-clock b/evelyne/common/statusbar/sb-clock new file mode 100755 index 0000000..d39f8db --- /dev/null +++ b/evelyne/common/statusbar/sb-clock @@ -0,0 +1,3 @@ +#!/bin/sh + +echo " $(date "+%a %d %b")  $(date "+%I:%M:%S%p")" diff --git a/evelyne/common/statusbar/sb-cpu b/evelyne/common/statusbar/sb-cpu new file mode 100755 index 0000000..0e63fbb --- /dev/null +++ b/evelyne/common/statusbar/sb-cpu @@ -0,0 +1,6 @@ +#!/bin/sh + +cpu=$(top -b -n2 -p 1 | fgrep "Cpu(s)" | tail -1 | awk -F'id,' '{ split($1, vs, ","); v=vs[length(vs)]; sub("%", "", v); printf "%s%.1f\n", prefix, 100 - v }' | awk '{print int($0)}') +icon="" + +echo "$icon $cpu%" diff --git a/evelyne/common/statusbar/sb-disk b/evelyne/common/statusbar/sb-disk new file mode 100755 index 0000000..9ae903d --- /dev/null +++ b/evelyne/common/statusbar/sb-disk @@ -0,0 +1,7 @@ +#!/bin/sh + +disk=$(df -h "/" | awk ' /[0-9]/ {print $3 "/" $2}') +percent=$(df -h "/" | egrep -o '[0-9]+%' | awk '{print int($0)}') +icon="" + +echo "$icon $disk" diff --git a/evelyne/common/statusbar/sb-forecast b/evelyne/common/statusbar/sb-forecast new file mode 100755 index 0000000..685be80 --- /dev/null +++ b/evelyne/common/statusbar/sb-forecast @@ -0,0 +1,35 @@ +#!/bin/sh + +# Displays todays precipication chance (☔) and daily low (🥶) and high (🌞). +# Usually intended for the statusbar. + +# If we have internet, get a weather report from wttr.in and store it locally. +# You could set up a shell alias to view the full file in a pager in the +# terminal if desired. This function will only be run once a day when needed. +weatherreport="${XDG_DATA_HOME:-$HOME/.local/share}/weatherreport" +getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;} + +# Some very particular and terse stream manipulation. We get the maximum +# precipitation chance and the daily high and low from the downloaded file and +# display them with coresponding emojis. +showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" | + grep -wo "[0-9]*%" | sort -rn | sed "s/^/☔/g;1q" | tr -d '\n')" +sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " 🥶" $1 "°","🌞" $2 "°"}' ;} + +case BLOCK_BUTTON in + 1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;; + 2) getforecast && showweather ;; + 3) notify-send "🌈 Weather module" "\- Left click for full forecast. +- Middle click to update forecast. +☔: Chance of rain/snow +🥶: Daily low +🌞: Daily high" ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +# The test if our forcecast is updated to the day. If it isn't download a new +# weather report from wttr.in with the above function. +[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] || + getforecast + +showweather diff --git a/evelyne/common/statusbar/sb-iplocate b/evelyne/common/statusbar/sb-iplocate new file mode 100755 index 0000000..02adab8 --- /dev/null +++ b/evelyne/common/statusbar/sb-iplocate @@ -0,0 +1,10 @@ +#!/bin/sh + +# Gets your public ip address checks which country you are in and +# displays that information in the statusbar +# +# https://www.maketecheasier.com/ip-address-geolocation-lookups-linux/ + +ifinstalled "geoip" || exit +addr="$(curl ifconfig.me 2>/dev/null)" || exit +grep "flag: " "${XDG_DATA_HOME:-$HOME/.local/share}/larbs/emoji" | grep "$(geoiplookup "$addr" | sed 's/.*, //')" | sed "s/flag: //;s/;.*//" diff --git a/evelyne/common/statusbar/sb-kernel b/evelyne/common/statusbar/sb-kernel new file mode 100755 index 0000000..6619a05 --- /dev/null +++ b/evelyne/common/statusbar/sb-kernel @@ -0,0 +1,5 @@ +#!/bin/sh + +kernel=$(uname -r) +icon="" +echo "$icon $kernel" diff --git a/evelyne/common/statusbar/sb-memory b/evelyne/common/statusbar/sb-memory new file mode 100755 index 0000000..2ff0c4e --- /dev/null +++ b/evelyne/common/statusbar/sb-memory @@ -0,0 +1,7 @@ +#!/bin/sh + +mem=$(free --mebi | sed -n '2{p;q}' | awk '{printf ("%2.2f/%2.2f", ( $3 / 1024), ($2 / 1024))}') +percent=$(free -m | awk 'NR==2{printf "%.2f%%\t\t", $3*100/$2 }' | awk '{print int($0)}') +icon="" + +echo "$icon $mem""GB" diff --git a/evelyne/common/statusbar/sb-temp b/evelyne/common/statusbar/sb-temp new file mode 100755 index 0000000..bbbd63d --- /dev/null +++ b/evelyne/common/statusbar/sb-temp @@ -0,0 +1,13 @@ +#!/bin/sh + +temp=$(sensors | awk '/Core 0/ {print $3}' | awk '{print int($0)}') + +if [ $temp -ge 70 ]; then + icon="" +elif [ $temp -ge 50 ]; then + icon="" +elif [ $temp -ge 0 ]; then + icon="" +fi + +echo "$icon $temp°C" diff --git a/evelyne/common/statusbar/sb-uptime b/evelyne/common/statusbar/sb-uptime new file mode 100755 index 0000000..28046d5 --- /dev/null +++ b/evelyne/common/statusbar/sb-uptime @@ -0,0 +1,6 @@ +#!/bin/sh + +uptime=$(uptime | awk '{print $3}' | sed 's/,//') +icon="" + +echo "$icon $uptime" diff --git a/evelyne/common/statusbar/sb-volume b/evelyne/common/statusbar/sb-volume new file mode 100755 index 0000000..f75b83d --- /dev/null +++ b/evelyne/common/statusbar/sb-volume @@ -0,0 +1,15 @@ +#!/bin/sh + +vol="$(pamixer --get-volume)" + +if [ $(pamixer --get-mute) = true ]; then + icon="" +elif [ "$vol" -ge "50" ]; then + icon="" +elif [ "$vol" -gt "0" ]; then + icon="" +elif [ "$vol" -eq "0" ]; then + icon="" +fi + +echo "$icon $vol%" diff --git a/evelyne/common/steam.nix b/evelyne/common/steam.nix new file mode 100644 index 0000000..0594128 --- /dev/null +++ b/evelyne/common/steam.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + steam + steam-run + ]; + + home.file.".local/bin/steam-killer" = { + source = ./steam/steam-killer.sh; + executable = true; + }; +} diff --git a/evelyne/common/steam/steam-killer.sh b/evelyne/common/steam/steam-killer.sh new file mode 100755 index 0000000..93b501b --- /dev/null +++ b/evelyne/common/steam/steam-killer.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +while true +do + echo "[sk] killing steamwebhelper" + { kill $(pidof steamwebhelper) && echo "[fhs] killed!"; } || echo "[fhs] failed!" + echo "[sk] waiting 0.5 seconds..." + sleep 0.5 +done diff --git a/evelyne/common/tabbed.nix b/evelyne/common/tabbed.nix new file mode 100644 index 0000000..fc0f1fc --- /dev/null +++ b/evelyne/common/tabbed.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + tabbed + ]; + + home.file.".local/bin/tabbed" = { + source = ./tabbed; + executable = true; + }; + + home.sessionPath = [ + "$HOME/.local/bin/tabbed" + ]; +} diff --git a/evelyne/common/tabbed/tabbed-st b/evelyne/common/tabbed/tabbed-st new file mode 100755 index 0000000..0a751c8 --- /dev/null +++ b/evelyne/common/tabbed/tabbed-st @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +picom-trans -w $(tabbed $@ -d -n "tabbed-trans" -r 2 st -w '') -o 90 diff --git a/evelyne/common/terminal.nix b/evelyne/common/terminal.nix new file mode 100644 index 0000000..aaa4690 --- /dev/null +++ b/evelyne/common/terminal.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + cool-retro-term # Retro-style terminal + kitty # Used for testing + st # Suckless terminal + ]; +} diff --git a/evelyne/common/tmux.nix b/evelyne/common/tmux.nix new file mode 100644 index 0000000..5324f76 --- /dev/null +++ b/evelyne/common/tmux.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +{ + programs.tmux = { + enable = true; + clock24 = true; + mouse = true; + terminal = "screen-256color"; + }; +} diff --git a/evelyne/common/tor.nix b/evelyne/common/tor.nix new file mode 100644 index 0000000..e2a7d4c --- /dev/null +++ b/evelyne/common/tor.nix @@ -0,0 +1,7 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + tor-browser-bundle-bin + ]; +} diff --git a/evelyne/common/wezterm.nix b/evelyne/common/wezterm.nix new file mode 100644 index 0000000..fcb9406 --- /dev/null +++ b/evelyne/common/wezterm.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: + +{ + programs.wezterm = { + enable = true; + extraConfig = '' + return { + color_scheme = 'OneDark (base16)', + hide_tab_bar_if_only_one_tab = true, + window_close_confirmation = 'NeverPrompt' + } + ''; + }; +} diff --git a/evelyne/common/xdg.nix b/evelyne/common/xdg.nix new file mode 100644 index 0000000..08a1993 --- /dev/null +++ b/evelyne/common/xdg.nix @@ -0,0 +1,73 @@ +{ config, pkgs, ... }: + +{ + home.packages = with pkgs; [ + xdg-utils + xdg-user-dirs + ]; + + xdg = { + enable = true; + userDirs.enable = true; + desktopEntries = { + "browser" = { + name = "Web Browser"; + type = "Application"; + exec = "${pkgs.librewolf}/bin/librewolf %f"; + }; + "image" = { + name = "Image Viewer"; + type = "Application"; + exec = "${pkgs.nsxiv}/bin/nsxiv -a %f"; + }; + "text" = { + name = "Text Editor"; + type = "Application"; + exec = "${pkgs.st}/bin/st -e ${pkgs.neovim}/bin/nvim %u"; + }; + "pdf" = { + name = "PDF Reader"; + type = "Application"; + exec = "${pkgs.zathura}/bin/zathura %u"; + }; + }; + mimeApps = { + enable = true; + defaultApplications = { + "application/pdf" = "pdf.desktop"; + "x-scheme-handler/http" = "browser.desktop"; + "x-scheme-handler/https" = "browser.desktop"; + "image/png" = "image.desktop"; + "image/jpeg" = "image.desktop"; + "image/jpg" = "image.desktop"; + "image/gif" = "image.desktop"; + "video/mp4" = "mpv.desktop"; + "text/plain" = "text.desktop"; + "text/html" = "browser.desktop"; + }; + }; + }; + + home = { + sessionVariables = { + # Force use of XDG Dir Spec + CUDA_CACHE_PATH = "${config.xdg.cacheHome}/nv"; + LESSHISTFILE = "${config.xdg.configHome}/less/history"; + LESSKEY = "${config.xdg.configHome}/less/keys"; + WINEPREFIX = "${config.xdg.dataHome}/wine"; + _JAVA_OPTIONS = "-Djava.util.prefs.userRoot=${config.xdg.configHome}/java"; + + # Default programs + EDITOR = "nvim"; + TERMINAL = "st"; + BROWSER = "librewolf"; + }; + + shellAliases = { + # Force use of XDG Dir Spec + wget = "wget --hsts-file='${config.xdg.dataHome}/wget-hsts'"; + rxrdb = "xrdb -load '${config.xdg.configHome}/.config/X11/xresources'"; + nvidia-settings = "nvidia-settings --config='${config.xdg.configHome}'/nvidia/settings"; + }; + }; +} diff --git a/evelyne/common/xorg.nix b/evelyne/common/xorg.nix new file mode 100644 index 0000000..3ab0509 --- /dev/null +++ b/evelyne/common/xorg.nix @@ -0,0 +1,66 @@ +{ config, pkgs, ... }: + +{ + # Run startx on tty1 + programs.zsh.profileExtra = '' + # If on /dev/tty1 then run startx automatically + if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then + exec ${pkgs.xorg.xinit}/bin/startx + fi + ''; + + # Attempt to set keyboard layout + home.keyboard = { + layout = "gb"; + options = [ + "caps:escape" + ]; + }; + + # Attempt to set cursor + home.pointerCursor = { + gtk.enable = true; + x11.enable = true; + package = pkgs.phinger-cursors; + name = "phinger-cursors"; + size = 24; + }; + + # Force use of XDG Dir Spec + home.sessionVariables = { + /* XAUTHORITY = "${config.xdg.runtimeDir}/Xauthority"; */ + XCOMPOSECACHE = "${config.xdg.cacheHome}/x11/xcompose"; + }; + + # Install notify-send + home.packages = with pkgs; [ + libnotify + ]; + + # Configure ~/.xinitrc + programs.feh.enable = true; + home.file.".xinitrc".text = '' + # Monitor configuration + ${pkgs.xorg.xrandr}/bin/xrandr --output DP-0 --primary --mode 2560x1440 --pos 0x560 + ${pkgs.xorg.xrandr}/bin/xrandr --output HDMI-0 --noprimary --mode 2560x1440 --pos 2560x0 --rotate right + + # Apply wallpaper + ${pkgs.feh}/bin/feh --no-fehbg --bg-fill "$HOME/Pictures/Wallpapers/hearts.png" + + # Refresh xresources + ${pkgs.xorg.xrdb}/bin/xrdb "$HOME/.Xresources" + + # Speed up repeated keypresses + ${pkgs.xorg.xset}/bin/xset r rate 300 50 + + # Set keyboard map and remap caps to escape + ${pkgs.xorg.setxkbmap}/bin/setxkbmap -layout gb --option caps:escape + + # Start the window manager + ${pkgs.openssh}/bin/ssh-agent ${pkgs.dwm}/bin/dwm + ''; + + xresources.properties = { + "*.font" = "Iosevka:pixelsize=14:antialias=true:autohint=true"; + }; +} diff --git a/evelyne/common/zathura.nix b/evelyne/common/zathura.nix new file mode 100644 index 0000000..6430428 --- /dev/null +++ b/evelyne/common/zathura.nix @@ -0,0 +1,5 @@ +{ config, ... }: + +{ + programs.zathura.enable = true; +} diff --git a/evelyne/common/zsh.nix b/evelyne/common/zsh.nix new file mode 100644 index 0000000..434cbae --- /dev/null +++ b/evelyne/common/zsh.nix @@ -0,0 +1,123 @@ +{ config, pkgs, lib, ... }: + +{ + programs.zsh = { + # Use the zsh shell + enable = true; + + # Basic config settings + enableAutosuggestions = true; + enableCompletion = true; + enableSyntaxHighlighting = true; + autocd = true; + /* defaultKeymap = "vicmd"; */ + dotDir = ".config/zsh"; + history = { + size = 9999999; + expireDuplicatesFirst = true; + extended = true; + path = "${config.xdg.cacheHome}/zsh/history"; + }; + + # Zsh init extras + initExtra = '' + # Disable Ctrl-S to freeze terminal + stty stop undef + + # Tab completion + zstyle ':completion:*' menu select # Use a menu + _comp_options+=(globdots) # Include hidden files + + # Change cursor shape for different vi modes + export KEYTIMEOUT=1 + function zle-keymap-select () { + case $KEYMAP in + vicmd) echo -ne '\e[1 q';; # block + viins|main) echo -ne '\e[5 q';; # beam + esac + } + zle -N zle-keymap-select + zle-line-init() { + zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere) + echo -ne "\e[5 q" + } + zle -N zle-line-init + echo -ne '\e[5 q' # Use beam shape cursor on startup. + preexec() { echo -ne '\e[5 q' ;} # Use beam shape cursor for each new prompt. + ''; + }; + + programs.starship = { + # Use the starship prompt + enable = true; + enableZshIntegration = true; + + settings = { + format = lib.concatStrings [ + # Directory + "$directory" + + # VCS + "$git_branch" + "$git_commit" + "$git_state" + "$git_metrics" + "$git_status" + "$hg_branch" + + # Languages + "$package" + "$c" + "$rust" + "$golang" + "$haskell" + "$python" + "$java" + "$kotlin" + "$lua" + "$dart" + "$nim" + "$nodejs" + "$swift" + "$zig" + "$nix_shell" + "$conda" + "$spack" + + # Prompt line + "$line_break" + "$username" + "$hostname" + "$localip" + "$cmd_duration" + "$memory_usage" + "$jobs" + "$character" + ]; + + # Prompt character + character = { + success_symbol = "-> [λ](bold purple)"; + error_symbol = "-> [λ](bold red)"; + vimcmd_symbol = "-> [λ](bold green)"; + }; + + # When in a deep directory or git repo + directory.truncation_symbol = ".../"; + + # Git widgets + git_metrics.disabled = false; + git_status = { + ahead = "->"; + behind = "<-"; + diverged = "<->"; + renamed = ">>"; + deleted = "x"; + }; + + # Enable other starship widgets + memory_usage.disabled = false; + localip.disabled = false; + }; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..471748a --- /dev/null +++ b/flake.lock @@ -0,0 +1,62 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "utils": "utils" + }, + "locked": { + "lastModified": 1679480702, + "narHash": "sha256-npuRD61YmxUPitI1TqKwlxLrU6iGl5E+BPT196LgUDo=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "363c46b2480f1b73ec37cf68caac61f5daa82a2e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1679614379, + "narHash": "sha256-2KddLHHmcIlJu0PuS/vISLKxihTyICUwKWGn0R//028=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "994e2ef9e9c70b4dd7257f73452a94e871723685", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + }, + "utils": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4ce927b --- /dev/null +++ b/flake.nix @@ -0,0 +1,40 @@ +{ + description = "Evelyne's NixOS configurations"; + + inputs = { + # Home manager + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { self, nixpkgs, home-manager }: + let + username = "retro"; + utils = import ./utils nixpkgs; + + nixpkgs_x86_64 = import nixpkgs { + config.allowUnfree = true; + config.allowUnsupportedSystem = false; + config.allowBroken = false; + overlays = import ./overlays.nix; + system = "x86_64-linux"; + }; + in + { + nixosConfigurations."PogMachine" = nixpkgs.lib.nixosSystem { + specialArgs = { inherit username; }; + pkgs = nixpkgs_x86_64; + system = "x86_64-linux"; + modules = [ + home-manager.nixosModules.home-manager + { + home-manager.users.${username}.imports = utils.nixFilesIn ./evelyne/common; + home-manager.extraSpecialArgs = { inherit username; pkgs = nixpkgs_x86_64; }; + } + ] ++ utils.nixFilesIn ./systems/pogmachine; + }; + + formatter.x86_64-linux = nixpkgs_x86_64.legacyPackages.x86_64-linux.nixpkgs-fmt; + }; +} + diff --git a/overlays.nix b/overlays.nix new file mode 100644 index 0000000..20d81d9 --- /dev/null +++ b/overlays.nix @@ -0,0 +1,62 @@ +[ + # My build of suckless dwm + (final: prev: { + dwm = prev.dwm.overrideAttrs (oldAttrs: { + src = final.fetchFromGitHub { + owner = "RetroEvelyne"; + repo = "dwm"; + rev = "0409fc4967bbe2b15dd8dc83e8e5c2d1bff41c1d"; + sha256 = "sha256-EqzueCxJ+yCzKp5INV5Op/znoZYWmqMbcpcVuo8ddnQ="; + }; + }); + st = prev.st.overrideAttrs (oldAttrs: { + src = final.fetchFromGitHub { + owner = "RetroEvelyne"; + repo = "st"; + rev = "45efc73331df1c5877e3c6e75a879780bb84504e"; + sha256 = "sha256-D0YmbURDyTW5qzNZjIIwlWOHr5j8kenggSQ8GxhuLKo="; + }; + buildInputs = oldAttrs.buildInputs ++ [ final.harfbuzz ]; + }); + dmenu = prev.dmenu.overrideAttrs (oldAttrs: { + src = final.fetchFromGitHub { + owner = "RetroEvelyne"; + repo = "dickmenu"; + rev = "34073a1a7de2b6f23909154d4425355a04a63f16"; + sha256 = "sha256-JqM6fecuV6ObsPPQQub3WY2dZp2rWcX9u3EqYmhG8WI="; + }; + }); + slstatus = prev.slstatus.overrideAttrs (oldAttrs: { + src = final.fetchFromGitHub { + owner = "SpyHoodle"; + repo = "slstatus"; + rev = "b22f3d8ec8e2d67bbd32f02721d9d8157a46edd4"; + sha256 = "sha256-OhssKVQArcQAgCavkFaCRvxUM3689t1v3YCv9IW7osU="; + }; + }); + slock = prev.slock.overrideAttrs (oldAttrs: { + src = final.fetchFromGitHub { + owner = "SpyHoodle"; + repo = "slock"; + rev = "8c5d321b641961237f747d3e68f52b163d673634"; + sha256 = "sha256-y+6VU3jXbUOyhUcyPC7CDGjyWLSJcCkhYiHscVib7j4="; + }; + buildInputs = oldAttrs.buildInputs ++ [ final.xorg.libXpm ]; + }); + tabbed = prev.tabbed.overrideAttrs (oldAttrs: { + src = final.fetchFromGitHub { + owner = "SpyHoodle"; + repo = "tabbed"; + rev = "1001f193fd076cba12bd1ec9f113c144b37d8689"; + sha256 = "sha256-M5LrFplGfzCdhLTutsPNmox69brvAm2BlXnyza9kGxQ="; + }; + }); + ncmpcpp = prev.ncmpcpp.override { + visualizerSupport = true; + clockSupport = false; + }; + nerdfonts = prev.nerdfonts.override { + fonts = [ "Iosevka" "JetBrainsMono" "Terminus" ]; + }; + }) +] diff --git a/systems/pogmachine/android.nix b/systems/pogmachine/android.nix new file mode 100644 index 0000000..b9fd5f2 --- /dev/null +++ b/systems/pogmachine/android.nix @@ -0,0 +1,5 @@ +{ config, ... }: + +{ + programs.adb.enable = true; +} diff --git a/systems/pogmachine/audio.nix b/systems/pogmachine/audio.nix new file mode 100644 index 0000000..329fa97 --- /dev/null +++ b/systems/pogmachine/audio.nix @@ -0,0 +1,14 @@ +{ config, ... }: + +{ + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + }; +} diff --git a/systems/pogmachine/bluetooth.nix b/systems/pogmachine/bluetooth.nix new file mode 100644 index 0000000..fae0e1d --- /dev/null +++ b/systems/pogmachine/bluetooth.nix @@ -0,0 +1,6 @@ +{ config, ... }: + +{ + hardware.bluetooth.enable = true; + services.blueman.enable = true; +} diff --git a/systems/pogmachine/boot.nix b/systems/pogmachine/boot.nix new file mode 100644 index 0000000..c69d1c3 --- /dev/null +++ b/systems/pogmachine/boot.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + # Set up bootloader + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + + # Use the linux-zen kernel + boot.kernelPackages = pkgs.linuxPackages_zen; +} diff --git a/systems/pogmachine/doas.nix b/systems/pogmachine/doas.nix new file mode 100644 index 0000000..6aa5f72 --- /dev/null +++ b/systems/pogmachine/doas.nix @@ -0,0 +1,13 @@ +{ config, username, ... }: + +{ + security.sudo.enable = false; + security.doas = { + enable = true; + extraRules = [{ + users = [ "${username}" ]; + keepEnv = true; + persist = true; + }]; + }; +} diff --git a/systems/pogmachine/firewall.nix b/systems/pogmachine/firewall.nix new file mode 100644 index 0000000..1abda33 --- /dev/null +++ b/systems/pogmachine/firewall.nix @@ -0,0 +1,6 @@ +{ config, ... }: + +{ + # Disable the firewall altogether + networking.firewall.enable = false; +} diff --git a/systems/pogmachine/fonts.nix b/systems/pogmachine/fonts.nix new file mode 100644 index 0000000..692832b --- /dev/null +++ b/systems/pogmachine/fonts.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + fonts.fonts = with pkgs; [ + nerdfonts + font-awesome + source-han-sans + source-han-serif + source-han-code-jp + ]; +} diff --git a/systems/pogmachine/gpg.nix b/systems/pogmachine/gpg.nix new file mode 100644 index 0000000..8ce0a92 --- /dev/null +++ b/systems/pogmachine/gpg.nix @@ -0,0 +1,9 @@ +{ config, ... }: + +{ + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + pinentryFlavor = "gtk2"; + }; +} diff --git a/systems/pogmachine/hardware.nix b/systems/pogmachine/hardware.nix new file mode 100644 index 0000000..051b9c8 --- /dev/null +++ b/systems/pogmachine/hardware.nix @@ -0,0 +1,38 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/ba9f6b67-88cd-443a-a0eb-efba15bdfd1b"; + fsType = "ext4"; + }; + + fileSystems."/boot/efi" = + { device = "/dev/disk/by-uuid/C047-1A92"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp6s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/systems/pogmachine/locale.nix b/systems/pogmachine/locale.nix new file mode 100644 index 0000000..1c7fd22 --- /dev/null +++ b/systems/pogmachine/locale.nix @@ -0,0 +1,13 @@ +{ config, ... }: + +{ + # Time zone + time.timeZone = "Europe/London"; + + # Internationalisation properties + i18n.defaultLocale = "en_GB.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "uk"; + }; +} diff --git a/systems/pogmachine/man.nix b/systems/pogmachine/man.nix new file mode 100644 index 0000000..464213e --- /dev/null +++ b/systems/pogmachine/man.nix @@ -0,0 +1,6 @@ +{ config, ... }: + +{ + # Enable man caches + documentation.man.generateCaches = true; +} diff --git a/systems/pogmachine/networking.nix b/systems/pogmachine/networking.nix new file mode 100644 index 0000000..c58c128 --- /dev/null +++ b/systems/pogmachine/networking.nix @@ -0,0 +1,27 @@ +{ config, lib, ... }: + +{ + # DHCP + networking.useDHCP = lib.mkDefault true; + + # Hostname + networking.hostName = "PogMachine"; + + # Enable wireless support & configuration + networking.wireless.enable = true; + networking.wireless.networks = { + # Home router + "VM4321342" = { + psk = "eabRnUdfrsw7mxdd"; + }; + # Mum's phone + "HUAWEI P smart 2019" = { + psk = "aaaaaaaa"; + }; + # Personal phone + "PogPhone" = { + psk = "password"; + }; + }; +} + diff --git a/systems/pogmachine/nix.nix b/systems/pogmachine/nix.nix new file mode 100644 index 0000000..533f7e9 --- /dev/null +++ b/systems/pogmachine/nix.nix @@ -0,0 +1,16 @@ +{ config, pkgs, ... }: + +{ + # Enable flakes and nix-command + nix = { + package = pkgs.nixVersions.stable; + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + gc = { + automatic = true; + options = "--delete-older-than 7d"; + }; + }; +} diff --git a/systems/pogmachine/nixos.nix b/systems/pogmachine/nixos.nix new file mode 100644 index 0000000..5a803d6 --- /dev/null +++ b/systems/pogmachine/nixos.nix @@ -0,0 +1,6 @@ +{ config, lib, ... }: + +{ + system.stateVersion = "22.05"; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/systems/pogmachine/opengl.nix b/systems/pogmachine/opengl.nix new file mode 100644 index 0000000..d4f5b8d --- /dev/null +++ b/systems/pogmachine/opengl.nix @@ -0,0 +1,6 @@ +{ config, ... }: + +{ + hardware.opengl.enable = true; + hardware.opengl.driSupport32Bit = true; +} diff --git a/systems/pogmachine/opentabletdriver.nix b/systems/pogmachine/opentabletdriver.nix new file mode 100644 index 0000000..9e5ed2d --- /dev/null +++ b/systems/pogmachine/opentabletdriver.nix @@ -0,0 +1,7 @@ +{ config, ... }: + +{ + # Enable opentabletdriver + hardware.opentabletdriver.enable = true; + hardware.opentabletdriver.daemon.enable = true; +} diff --git a/systems/pogmachine/packages.nix b/systems/pogmachine/packages.nix new file mode 100644 index 0000000..23c9665 --- /dev/null +++ b/systems/pogmachine/packages.nix @@ -0,0 +1,47 @@ +{ config, pkgs, ... }: + +{ + # System-wide packages + # I want these available for all users at all times + environment.systemPackages = with pkgs; [ + # Xorg packages + xorg.xinit + xorg.xkill + xorg.xprop + xorg.xwininfo + xorg.xrandr + xdotool + xclip + + # Processes + killall + appimage-run + + # Filesystems + dosfstools + btrfs-progs + ntfs3g + exfatprogs + libimobiledevice + ifuse + + # Archives + zip + unrar + unzip + p7zip + + # Cli tools + ripgrep + wget + fzf + bat + + # XDG + xdg-utils + xdg-user-dirs + + # Git + git + ]; +} diff --git a/systems/pogmachine/security.nix b/systems/pogmachine/security.nix new file mode 100644 index 0000000..65a4e9a --- /dev/null +++ b/systems/pogmachine/security.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: + +{ + programs.slock.enable = true; + security.wrappers.slock.source = "${pkgs.slock.out}/bin/slock"; +} diff --git a/systems/pogmachine/ssh.nix b/systems/pogmachine/ssh.nix new file mode 100644 index 0000000..613102e --- /dev/null +++ b/systems/pogmachine/ssh.nix @@ -0,0 +1,13 @@ +{ config, ... }: + +{ + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + }; + }; + programs.ssh.hostKeyAlgorithms = [ "sk-ssh-ed25519@openssh.com" "ssh-ed25519" ]; +} diff --git a/systems/pogmachine/systemd.nix b/systems/pogmachine/systemd.nix new file mode 100644 index 0000000..93db17e --- /dev/null +++ b/systems/pogmachine/systemd.nix @@ -0,0 +1,8 @@ +{ config, ... }: + +{ + # Stop systemd from hanging for ages + systemd.extraConfig = '' + DefaultTimeoutStopSec=10s + ''; +} diff --git a/systems/pogmachine/users.nix b/systems/pogmachine/users.nix new file mode 100644 index 0000000..603dd3b --- /dev/null +++ b/systems/pogmachine/users.nix @@ -0,0 +1,11 @@ +{ config, pkgs, username, ... }: + +{ + users.users.${username} = { + isNormalUser = true; + shell = pkgs.zsh; + description = "Evelyne"; + extraGroups = [ "adbusers" "dialout" "libvirtd" "plugdev" ]; + openssh.authorizedKeys.keyFiles = [ ../../evelyne/common/ssh/id_ed25519.pub ]; + }; +} diff --git a/systems/pogmachine/virtualisation.nix b/systems/pogmachine/virtualisation.nix new file mode 100644 index 0000000..dad25d2 --- /dev/null +++ b/systems/pogmachine/virtualisation.nix @@ -0,0 +1,6 @@ +{ config, ... }: + +{ + virtualisation.libvirtd.enable = true; + programs.dconf.enable = true; +} diff --git a/systems/pogmachine/xorg.nix b/systems/pogmachine/xorg.nix new file mode 100644 index 0000000..f8389c2 --- /dev/null +++ b/systems/pogmachine/xorg.nix @@ -0,0 +1,17 @@ +{ config, pkgs, ... }: + +{ + services.xserver = { + # Enable X11 windowing system + enable = true; + + # Set gb X11 keymap + layout = "gb"; + xkbOptions = "eurosign:e"; + + # Use startx for starting window managers + displayManager = { + startx.enable = true; + }; + }; +} diff --git a/systems/pogmachine/zsh.nix b/systems/pogmachine/zsh.nix new file mode 100644 index 0000000..3aab6fb --- /dev/null +++ b/systems/pogmachine/zsh.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: + +{ + programs.zsh = { + enable = true; + autosuggestions.enable = true; + syntaxHighlighting.enable = true; + }; + users.defaultUserShell = pkgs.zsh; +} diff --git a/utils/default.nix b/utils/default.nix new file mode 100644 index 0000000..04a7376 --- /dev/null +++ b/utils/default.nix @@ -0,0 +1,28 @@ +pkgs_or_lib: +let + is_pkgs = pkgs_or_lib ? lib; + lib = if is_pkgs then pkgs_or_lib.lib else pkgs_or_lib; + utils = lib.pipe ./. [ + (import ./nixFilesInWithName.nix lib) + (builtins.map (file: rec { + name = lib.removeSuffix ".nix" file.name; + func = import file.path; + accepts_pkgs = builtins.hasAttr "pkgs" (builtins.functionArgs func); + value = + if accepts_pkgs then + func + (builtins.intersectAttrs (builtins.functionArgs func) { + inherit + lib utils; pkgs = pkgs_or_lib; + }) + else if is_pkgs + then func lib + else + func pkgs_or_lib; + include = file.name != "default.nix" && (!accepts_pkgs || is_pkgs); + })) + (builtins.filter (utility: utility.include)) + builtins.listToAttrs + ]; +in +utils diff --git a/utils/nixFilesIn.nix b/utils/nixFilesIn.nix new file mode 100644 index 0000000..e85fa1c --- /dev/null +++ b/utils/nixFilesIn.nix @@ -0,0 +1,2 @@ +# Modified from http://chriswarbo.net/projects/nixos/useful_hacks.html +lib: dir: map (name: dir + "/${name}") (lib.attrNames (lib.filterAttrs (name: type: type == "regular" && lib.hasSuffix ".nix" name) (builtins.readDir dir))) diff --git a/utils/nixFilesInWithName.nix b/utils/nixFilesInWithName.nix new file mode 100644 index 0000000..760b7cf --- /dev/null +++ b/utils/nixFilesInWithName.nix @@ -0,0 +1,8 @@ +# Modified from http://chriswarbo.net/projects/nixos/useful_hacks.html +lib: dir: +map + (name: { + inherit name; + path = dir + "/${name}"; + }) + (lib.attrNames (lib.filterAttrs (name: type: lib.hasSuffix ".nix" name && type == "regular") (builtins.readDir dir)))