diff --git a/flake.lock b/flake.lock index d424eaa..c32bfea 100644 --- a/flake.lock +++ b/flake.lock @@ -45,11 +45,11 @@ ] }, "locked": { - "lastModified": 1717770040, - "narHash": "sha256-eq9gP060TqWqRf2k4WO5FrG49rVq5Jy3Ptusg0CFdds=", + "lastModified": 1718242063, + "narHash": "sha256-n3AWItJ4a94GT0cray/eUV7tt3mulQ52L+lWJN9d1E8=", "owner": "nix-community", "repo": "disko", - "rev": "398acc470f7c2d68621db01900f053e6000129c4", + "rev": "832a9f2c81ff3485404bd63952eadc17bf7ccef2", "type": "github" }, "original": { @@ -219,11 +219,11 @@ ] }, "locked": { - "lastModified": 1717525419, - "narHash": "sha256-5z2422pzWnPXHgq2ms8lcCfttM0dz+hg+x1pCcNkAws=", + "lastModified": 1718243258, + "narHash": "sha256-abBpj2VU8p6qlRzTU8o22q68MmOaZ4v8zZ4UlYl5YRU=", "owner": "nix-community", "repo": "home-manager", - "rev": "a7117efb3725e6197dd95424136f79147aa35e5b", + "rev": "8d5e27b4807d25308dfe369d5a923d87e7dbfda3", "type": "github" }, "original": { @@ -240,11 +240,11 @@ ] }, "locked": { - "lastModified": 1717525419, - "narHash": "sha256-5z2422pzWnPXHgq2ms8lcCfttM0dz+hg+x1pCcNkAws=", + "lastModified": 1718141734, + "narHash": "sha256-cA+6l8ZCZ7MXGijVuY/1f55+wF/RT4PlTR9+g4bx86w=", "owner": "nix-community", "repo": "home-manager", - "rev": "a7117efb3725e6197dd95424136f79147aa35e5b", + "rev": "892f76bd0aa09a0f7f73eb41834b8a904b6d0fad", "type": "github" }, "original": { @@ -255,11 +255,11 @@ }, "impermanence": { "locked": { - "lastModified": 1708968331, - "narHash": "sha256-VUXLaPusCBvwM3zhGbRIJVeYluh2uWuqtj4WirQ1L9Y=", + "lastModified": 1717932370, + "narHash": "sha256-7C5lCpiWiyPoIACOcu2mukn/1JRtz6HC/1aEMhUdcw0=", "owner": "nix-community", "repo": "impermanence", - "rev": "a33ef102a02ce77d3e39c25197664b7a636f9c30", + "rev": "27979f1c3a0d3b9617a3563e2839114ba7d48d3f", "type": "github" }, "original": { @@ -295,11 +295,11 @@ ] }, "locked": { - "lastModified": 1716993688, - "narHash": "sha256-vo5k2wQekfeoq/2aleQkBN41dQiQHNTniZeVONWiWLs=", + "lastModified": 1717976995, + "narHash": "sha256-u3HBinyIyUvL1+N816bODpJmSQdgn0Mbb8BprFw7kqo=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "c0d5b8c54d6828516c97f6be9f2d00c63a363df4", + "rev": "315aa649ba307704db0b16c92f097a08a65ec955", "type": "github" }, "original": { @@ -375,11 +375,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1717265169, - "narHash": "sha256-IITcGd6xpNoyq9SZBigCkv4+qMHSqot0RDPR4xsZ2CA=", + "lastModified": 1717880976, + "narHash": "sha256-BRvSCsKtDUr83NEtbGfHLUOdDK0Cgbezj2PtcHnz+sQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3b1b4895b2c5f9f5544d02132896aeb9ceea77bc", + "rev": "4913a7c3d8b8d00cb9476a6bd730ff57777f740c", "type": "github" }, "original": { @@ -391,11 +391,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1717602782, - "narHash": "sha256-pL9jeus5QpX5R+9rsp3hhZ+uplVHscNJh8n8VpqscM0=", + "lastModified": 1718318537, + "narHash": "sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e8057b67ebf307f01bdcc8fba94d94f75039d1f6", + "rev": "e9ee548d90ff586a6471b4ae80ae9cfcbceb3420", "type": "github" }, "original": { @@ -407,11 +407,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1717839683, - "narHash": "sha256-kC0eyEsfpXbtQ2Ee5kgjmLFSVsLgnqpj10LjEi+fK+g=", + "lastModified": 1718376599, + "narHash": "sha256-cTFGqLYTrIxORc673fUUCecQVXiXHDj6Z8vFQ5K4SDg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3f3a01219b4a1b6ee63039a3aa63948fbf37c0dd", + "rev": "3bac01780f87646b70326db70920902bc4d49fab", "type": "github" }, "original": { @@ -435,11 +435,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1717861394, - "narHash": "sha256-U7E1Wg5PRKUYqfeL8H6KU/5VjFo8bkxbFzigN2grkQI=", + "lastModified": 1718376125, + "narHash": "sha256-NIJZxmY2CWsqJK/9BQCRSHfcCY9K6thjq/1XtJobxmU=", "owner": "nix-community", "repo": "nixvim", - "rev": "db32ebe205111af0b74d74684df64674ffcf3b36", + "rev": "7a2a25af02be25987aa43cd681312f4b5ba12317", "type": "github" }, "original": { @@ -450,11 +450,11 @@ }, "nur": { "locked": { - "lastModified": 1717872410, - "narHash": "sha256-kL4bugfx+R4ozR6t8MrGSdv3LVX7H9IkCxmvjaLAQ7o=", + "lastModified": 1718398470, + "narHash": "sha256-47JT0Za+js92ci0GhStCY21UiEB3MU4cBYoCVmpfudA=", "owner": "nix-community", "repo": "NUR", - "rev": "3b134079df522044c0da57f1b7785646a7b76518", + "rev": "c6325c8dee7dd1f58e1b4884672c670d6b541845", "type": "github" }, "original": { @@ -475,11 +475,11 @@ "treefmt-nix": "treefmt-nix_2" }, "locked": { - "lastModified": 1717774136, - "narHash": "sha256-comOhXDFUrbVba47gPenVBKy2foM3m3qOqpcP8umWDA=", + "lastModified": 1718285706, + "narHash": "sha256-DScsBM+kZvxOva7QegfdtleebMXh30XPxDQr/1IGKYo=", "owner": "nix-community", "repo": "poetry2nix", - "rev": "370da3b6fefc6c11367463b68d010f9950aaa80c", + "rev": "a5be1bbbe0af0266147a88e0ec43b18c722f2bb9", "type": "github" }, "original": { @@ -511,11 +511,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1717455931, - "narHash": "sha256-8Q6mKSsto8gaGczXd4G0lvawdAYLa5Dlh3/g4hl5CaM=", + "lastModified": 1718137936, + "narHash": "sha256-psA+1Q5fPaK6yI3vzlLINNtb6EeXj111zQWnZYyJS9c=", "owner": "mic92", "repo": "sops-nix", - "rev": "d4555e80d80d2fa77f0a44201ca299f9602492a0", + "rev": "c279dec105dd53df13a5e57525da97905cc0f0d6", "type": "github" }, "original": { @@ -613,11 +613,11 @@ ] }, "locked": { - "lastModified": 1717278143, - "narHash": "sha256-u10aDdYrpiGOLoxzY/mJ9llST9yO8Q7K/UlROoNxzDw=", + "lastModified": 1718139168, + "narHash": "sha256-1TZQcdETNdJMcfwwoshVeCjwWfrPtkSQ8y8wFX3it7k=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "3eb96ca1ae9edf792a8e0963cc92fddfa5a87706", + "rev": "1cb529bffa880746a1d0ec4e0f5076876af931f1", "type": "github" }, "original": { @@ -635,11 +635,11 @@ ] }, "locked": { - "lastModified": 1717278143, - "narHash": "sha256-u10aDdYrpiGOLoxzY/mJ9llST9yO8Q7K/UlROoNxzDw=", + "lastModified": 1717850719, + "narHash": "sha256-npYqVg+Wk4oxnWrnVG7416fpfrlRhp/lQ6wQ4DHI8YE=", "owner": "numtide", "repo": "treefmt-nix", - "rev": "3eb96ca1ae9edf792a8e0963cc92fddfa5a87706", + "rev": "4fc1c45a5f50169f9f29f6a98a438fb910b834ed", "type": "github" }, "original": { diff --git a/home/common/core/default.nix b/home/common/core/default.nix index 3de98b8..1c10ec6 100644 --- a/home/common/core/default.nix +++ b/home/common/core/default.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, ... }: +{ pkgs, inputs, outputs, ... }: { imports = [ inputs.nix-colors.homeManagerModules.default @@ -7,6 +7,11 @@ ./fonts.nix ]; + nixpkgs.overlays = [ + inputs.nur.overlay + outputs.overlays.additions + ]; + # Global home packages without config go here (for all hosts and users) home.packages = builtins.attrValues { inherit (pkgs) @@ -20,6 +25,7 @@ btop htop postgresql + libqalculate ; }; home.stateVersion = "23.11"; diff --git a/home/common/core/fonts.nix b/home/common/core/fonts.nix index 2ee9f38..373905e 100644 --- a/home/common/core/fonts.nix +++ b/home/common/core/fonts.nix @@ -1,10 +1,14 @@ { pkgs, ... }: { fonts.fontconfig.enable = true; - home.packages = [ - pkgs.noto-fonts - pkgs.nerdfonts # loads the complete collection. look into overide for FiraMono or potentially mononoki - pkgs.meslo-lgs-nf + home.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + hack-font + liberation_ttf + libertine + nerdfonts ]; } diff --git a/home/common/optional/desktop/cinnamon/autostart.nix b/home/common/optional/desktop/cinnamon/autostart.nix new file mode 100644 index 0000000..9230a70 --- /dev/null +++ b/home/common/optional/desktop/cinnamon/autostart.nix @@ -0,0 +1,16 @@ +{ + home.file.".config/autostart/feh-wallpaper-changer.desktop" = { + recursive = true; + text = '' + [ Desktop Entry ] + Type=Application + Exec=feh-wallpaper-changer + X-GNOME-Autostart-enabled=true + NoDisplay=false + Hidden=false + Name[en_GB]=feh-wallpaper-changer + Comment[en_GB]=Periodically changes the wallpaper using feh + X-GNOME-Autostart-Delay=0 + ''; + }; +} diff --git a/home/common/optional/desktop/cinnamon/default.nix b/home/common/optional/desktop/cinnamon/default.nix index b46cc7d..092d169 100644 --- a/home/common/optional/desktop/cinnamon/default.nix +++ b/home/common/optional/desktop/cinnamon/default.nix @@ -1,6 +1,8 @@ { imports = [ ../common + ../common/x11 + ./autostart.nix # This doesn't seem to work in Cinnamon #./cinnamon-monitors.nix ]; diff --git a/home/common/optional/desktop/common/default.nix b/home/common/optional/desktop/common/default.nix index 10be23e..b989fba 100644 --- a/home/common/optional/desktop/common/default.nix +++ b/home/common/optional/desktop/common/default.nix @@ -1,12 +1,9 @@ -{ pkgs, inputs, ... }: { +{ pkgs, ... }: { imports = [ ./firefox.nix ./alacritty.nix ./zotero.nix - ]; - - nixpkgs.overlays = [ - inputs.nur.overlay + ./fontconfig.nix ]; # Global packages for desktop environments diff --git a/home/common/optional/desktop/common/fontconfig.nix b/home/common/optional/desktop/common/fontconfig.nix new file mode 100644 index 0000000..805ad85 --- /dev/null +++ b/home/common/optional/desktop/common/fontconfig.nix @@ -0,0 +1,11 @@ +{ ... }: { + fonts = { + fontconfig = { + defaultFonts = { + serif = [ "NotoSans Nerd Font" "Noto Color Emoji" ]; + sansSerif = [ "Linux Biolinum O" "Noto Color Emoji" ]; + monospace = [ "Hack Nerd Font" "Noto Color Emoji" ]; + }; + }; + }; +} diff --git a/home/common/optional/desktop/wayland/default.nix b/home/common/optional/desktop/common/wayland/default.nix similarity index 100% rename from home/common/optional/desktop/wayland/default.nix rename to home/common/optional/desktop/common/wayland/default.nix diff --git a/home/common/optional/desktop/wayland/mako.nix b/home/common/optional/desktop/common/wayland/mako.nix similarity index 100% rename from home/common/optional/desktop/wayland/mako.nix rename to home/common/optional/desktop/common/wayland/mako.nix diff --git a/home/common/optional/desktop/wayland/swww-wallpaper-changer.nix b/home/common/optional/desktop/common/wayland/swww-wallpaper-changer.nix similarity index 100% rename from home/common/optional/desktop/wayland/swww-wallpaper-changer.nix rename to home/common/optional/desktop/common/wayland/swww-wallpaper-changer.nix diff --git a/home/common/optional/desktop/wayland/waybar.nix b/home/common/optional/desktop/common/wayland/waybar.nix similarity index 100% rename from home/common/optional/desktop/wayland/waybar.nix rename to home/common/optional/desktop/common/wayland/waybar.nix diff --git a/home/common/optional/desktop/common/x11/default.nix b/home/common/optional/desktop/common/x11/default.nix new file mode 100644 index 0000000..c59cb66 --- /dev/null +++ b/home/common/optional/desktop/common/x11/default.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: +{ + imports = [ + ./scripts/feh-wallpaper-changer.nix + ]; + + home.packages = [ + pkgs.flameshot + pkgs.st + pkgs.xclip + pkgs.feh + ]; + +} diff --git a/home/common/optional/desktop/common/x11/scripts/feh-wallpaper-changer.nix b/home/common/optional/desktop/common/x11/scripts/feh-wallpaper-changer.nix new file mode 100644 index 0000000..cfa8550 --- /dev/null +++ b/home/common/optional/desktop/common/x11/scripts/feh-wallpaper-changer.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "feh-wallpaper-changer" '' + wallpaper_dir="$HOME/.local/share/bg/" + if [ ! -d "$wallpaper_dir" ]; then + echo "No wallpapers in $wallpaper_dir, cloning from remote" + mkdir -p "$wallpaper_dir" + git clone https://git.bitlab21.com/sam/minimalistic-wallpaper-collection.git "$wallpaper_dir/minimalistic-wallpaper-collection" + [ $? != 0 ] && echo "cloning from gitea failed, exiting" && exit 1 + fi + pics_exist=$(find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \)) + if [ -z "$pics_exist" ]; then + git clone https://git.bitlab21.com/sam/minimalistic-wallpaper-collection.git "$wallpaper_dir/minimalistic-wallpaper-collection" + [ $? != 0 ] && echo "cloning from gitea failed, exiting" && exit 1 + fi + + while true; do + find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do + ${feh}/bin/feh --bg-fill "$file" + [ $? != 0 ] && echo "feh failed, exiting" && exit 1 + sleep 600 + done + done + '') + ]; +} diff --git a/home/common/optional/desktop/dwm/default.nix b/home/common/optional/desktop/dwm/default.nix new file mode 100644 index 0000000..c27b85d --- /dev/null +++ b/home/common/optional/desktop/dwm/default.nix @@ -0,0 +1,30 @@ +{ pkgs, ... }: +{ + + imports = [ + ../common + ../common/x11 + ./xinitrc.nix + ./sxhkdrc.nix + ./picom.nix + ./xresources.nix + + # Status bar scripts + ./scripts/sb-cpu-pct.nix + ./scripts/sb-mem-pct.nix + ./scripts/sb-volume.nix + ./scripts/sb-network-status.nix + ./scripts/sb-updates.nix + + # Notification scripts + ./scripts/dunstify-volume-notification.nix + ]; + + home.packages = [ + pkgs.dwmblocks + pkgs.dmenu + pkgs.dunst + pkgs.picom + pkgs.sxhkd + ]; +} diff --git a/home/common/optional/desktop/dwm/picom.nix b/home/common/optional/desktop/dwm/picom.nix new file mode 100644 index 0000000..e395d7b --- /dev/null +++ b/home/common/optional/desktop/dwm/picom.nix @@ -0,0 +1,17 @@ +{ + home.file.".config/picom/picom.conf" = { + recursive = true; + text = '' + vsync = true; + backend = "xrender"; + shadow = true; + shadow-radius = 10; + shadow-offset-x = -5; + shadow-offset-y = -5; + fading = true; + fade-in-step = 0.2; + fade-out-step = 0.2; + fade-delta = 50; + ''; + }; +} diff --git a/home/common/optional/desktop/dwm/scripts/dunstify-volume-notification.nix b/home/common/optional/desktop/dwm/scripts/dunstify-volume-notification.nix new file mode 100644 index 0000000..92b0905 --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/dunstify-volume-notification.nix @@ -0,0 +1,30 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "dunstify-volume-notification" '' + mute_test=$(${pamixer}/bin/pamixer --get-mute) + mic_mute_test=$(${pamixer}/bin/pamixer --default-source --get-mute) + + mute="" + if [ "$mute_test" == true ]; + then + mute="(Speakers Muted)" + fi + + if [ "$mic_mute_test" == true ]; + then + mute="(Mic Muted)" + fi + + if [ "$mute_test" == true ] && [ "$mic_mute_test" == true ]; + then + mute="(Speakers Muted & Mic Muted)" + fi + + volume=$(${pamixer}/bin/pamixer --get-volume) + + msgTag="volume-notify" + ${dunst}/bin/dunstify -a "changeVolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag "Volume" "''${volume} ''${mute}" -t 2000 + '') + ]; +} diff --git a/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix b/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix new file mode 100644 index 0000000..b2117a0 --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/sb-cpu-pct.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "sb-cpu-pct" '' + echo $(top -bn 1 |grep "Cpu(s)" | awk '{print $2+$6 "%"}' | sed "s/\..//g") + '') + ]; +} diff --git a/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix new file mode 100644 index 0000000..453e807 --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/sb-mem-pct.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "sb-mem-pct" '' + # Gets current ram percent utilisation + echo $(free | awk '/^Mem/ {print "100*" $3 " / " $2 }' | ${bc}/bin/bc | awk '{print $1"%"}') + '') + ]; +} diff --git a/home/common/optional/desktop/dwm/scripts/sb-network-status.nix b/home/common/optional/desktop/dwm/scripts/sb-network-status.nix new file mode 100644 index 0000000..9ce8a4a --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/sb-network-status.nix @@ -0,0 +1,52 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "sb-network-status" '' + # Nerd Font Symbols + wifi_symbol=" " + lan_symbol="󰌗 " + disconnected_symbol="󰲜 " + vpn_symbol="󰖂 " + internet="󰞉 " + internet_disconnected="󰪎 " + + # Get the network status + DEFAULT_INTERFACE=$(ip route | grep '^default' | awk '{print $5}' | uniq) + IP_ADDRESS=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p') + + if [ -z "$DEFAULT_INTERFACE" ]; then + network_symbol="$disconnected_symbol" + else + # Check if it is a wireless interface (wlan*) + if [[ $DEFAULT_INTERFACE == wl* ]]; then + network_symbol="$wifi_symbol" + else + network_symbol="$lan_symbol" + fi + fi + + # Check internet connectivity + if ! ping -c 1 8.8.8.8 &> /dev/null; + then + network_symbol="$network_symbol $internet_disconnected" + else + network_symbol="$network_symbol $internet" + fi + + if ip addr show tun0 > /dev/null 2>&1; then + network_symbol="$network_symbol $vpn_symbol" + else + network_symbol="$network_symbol" + fi + + if [ -z "$IP_ADDRESS" ]; + then + printf "$network_symbol" + else + printf "$network_symbol|$IP_ADDRESS" + fi + '') + ]; +} + + diff --git a/home/common/optional/desktop/dwm/scripts/sb-updates.nix b/home/common/optional/desktop/dwm/scripts/sb-updates.nix new file mode 100644 index 0000000..e20b521 --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/sb-updates.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "sb-updates" '' + # Gets number of flake inputs that are ready for update + # Checks every 60 minutes + inputs=$(cd /etc/nixos && + nix flake update --output-lock-file <(cat flake.nix) 2> /tmp/update && + cat /tmp/update | grep -c Update) + printf " $inputs" + '') + ]; +} + diff --git a/home/common/optional/desktop/dwm/scripts/sb-volume.nix b/home/common/optional/desktop/dwm/scripts/sb-volume.nix new file mode 100644 index 0000000..99e2e45 --- /dev/null +++ b/home/common/optional/desktop/dwm/scripts/sb-volume.nix @@ -0,0 +1,37 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + (writeShellScriptBin "sb-volume" '' + # Prints the current volume or 婢 if muted. + get_mic_status=$(${pamixer}/bin/pamixer --default-source --get-mute) + vol="$(${pamixer}/bin/pamixer --get-volume)" + + if [ $get_mic_status == false ]; then + mic_status="" + else + mic_status="" + fi + + if [ "$vol" -gt "90" ]; then + icon="" + elif [ "$vol" -gt "50" ]; then + icon="󰕾" + elif [ "$vol" -gt "30" ]; then + icon="" + elif [ "$vol" -gt "0" ]; then + icon="󰕿" + else + icon="󰝟" + fi + + if [ $(${pamixer}/bin/pamixer --get-mute) = true ]; then + icon="󰸈" + vol="0" + fi + + print_string="$mic_status $icon $vol%" + printf '%s' "''${print_string}" + '') + ]; +} + diff --git a/home/common/optional/desktop/dwm/sxhkdrc.nix b/home/common/optional/desktop/dwm/sxhkdrc.nix new file mode 100644 index 0000000..1b60de5 --- /dev/null +++ b/home/common/optional/desktop/dwm/sxhkdrc.nix @@ -0,0 +1,48 @@ +{ + home.file.".config/sxhkd/sxhkdrc" = { + recursive = true; + text = '' + XF86AudioRaiseVolume + pamixer --set-limit 150 --allow-boost -i 5 && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1 + + XF86AudioLowerVolume + pamixer --set-limit 150 --allow-boost -d 5 && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1 + + XF86AudioMute + pamixer --toggle-mute && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1 + + XF86AudioMicMute + pamixer --default-source --toggle-mute && dunstify-volume-notification && pkill -RTMIN+10 dwmblocks && exit 1 + + XF86MonBrightnessUp + light -A 5 && dunstify-brightness-notification + + XF86MonBrightnessDown + light -U 5 && dunstify-brightness-notification + + XF86Messenger + dunstify-battery-notification + + control + Home + bookmark-add + + control + Insert + bookmark-insert + + control + F12 + nsxiv-clipboard-copy /tmp/clipboard/images/ + + Print + flameshot gui + + control + F11 + dmenu-clipper + + control + F8 + dmenu-dict + + control + F7 + emoji-picker + ''; + }; +} diff --git a/home/common/optional/desktop/dwm/xinitrc.nix b/home/common/optional/desktop/dwm/xinitrc.nix new file mode 100644 index 0000000..51ee978 --- /dev/null +++ b/home/common/optional/desktop/dwm/xinitrc.nix @@ -0,0 +1,32 @@ +{ + # TODO configure x11 to look in .config/x11 + #home.file."${config.xdg.configHome}/x11/xinitrc" = { + home.file.".xinitrc" = { + recursive = true; + text = '' + + picom -b --config ~/.config/picom/picom.conf + xrdb ~/.Xresources + + autostart="dwmblocks feh-wallpaper-changer" + + for program in $autostart; do + pidof -sx "$program" || "$program" & + done >/dev/null 2>&1 + + + if test -z "$DBUS_SESSION_BUS_ADDRESS"; then + eval $(dbus-launch --exit-with-session --sh-syntax) + fi + systemctl --user import-environment DISPLAY XAUTHORITY + + if command -v dbus-update-activation-environment >/dev/null 2>&1; then + dbus-update-activation-environment DISPLAY XAUTHORITY + fi + + export XSESSION_PID="$$" + exec dwm + + ''; + }; +} diff --git a/home/common/optional/desktop/dwm/xresources.nix b/home/common/optional/desktop/dwm/xresources.nix new file mode 100644 index 0000000..df23d70 --- /dev/null +++ b/home/common/optional/desktop/dwm/xresources.nix @@ -0,0 +1,14 @@ +{ + home.file.".Xresources" = { + recursive = true; + text = '' + !st terminal + st.alpha: 0.8 + *.font: monospace:pixelsize=21:antialias=true:autohint=true; + *.font2: NotoColorEmoji:pixelsize=19:antialias=true:autohint=true; + + ! dwm + dwm.borderpx: 3 + ''; + }; +} diff --git a/home/common/optional/desktop/hyprland/default.nix b/home/common/optional/desktop/hyprland/default.nix index 563323c..dd0c11e 100644 --- a/home/common/optional/desktop/hyprland/default.nix +++ b/home/common/optional/desktop/hyprland/default.nix @@ -1,12 +1,11 @@ { lib , config -, pkgs , ... }: { imports = [ ../common - ../wayland + ../common/wayland ./pyprland.nix ]; wayland.windowManager.hyprland = { diff --git a/home/common/optional/git.nix b/home/common/optional/git.nix index a6e6ebf..0f719b2 100644 --- a/home/common/optional/git.nix +++ b/home/common/optional/git.nix @@ -1,4 +1,4 @@ -{ pkgs, lib, config, ... }: +{ pkgs, ... }: { programs.git = { enable = true; diff --git a/home/semita.nix b/home/semita.nix index c610e9b..29aa52c 100644 --- a/home/semita.nix +++ b/home/semita.nix @@ -11,27 +11,10 @@ ./common/optional/git.nix ./common/optional/sops.nix ./common/optional/syncthing.nix - ./common/optional/desktop/hyprland + ./common/optional/desktop/dwm ]; colorScheme = inputs.nix-colors.colorSchemes.kanagawa; - monitors = [ - { - name = "DP-1"; - width = 2560; - height = 1440; - refreshRate = 144; - x = 0; - primary = true; - } - { - name = "DP-2"; - width = 2560; - height = 1440; - refreshRate = 75; - x = 2560; - } - ]; } diff --git a/home/users/sam/default.nix b/home/users/sam/default.nix index beeb764..616fcb8 100644 --- a/home/users/sam/default.nix +++ b/home/users/sam/default.nix @@ -1,4 +1,4 @@ -{ pkgs, outputs, ... }: +{ pkgs, outputs, config, ... }: { home.username = "sam"; diff --git a/hosts/common/optional/dwm.nix b/hosts/common/optional/dwm.nix new file mode 100644 index 0000000..f2d1f6e --- /dev/null +++ b/hosts/common/optional/dwm.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: +{ + services = { + libinput.enable = true; + xserver = { + autoRepeatDelay = 250; + autoRepeatInterval = 30; + enable = true; + xkb.layout = "gb"; + displayManager.startx.enable = true; + autorun = false; + windowManager.dwm = { + enable = true; + package = pkgs.dwm.overrideAttrs { + src = pkgs.fetchFromGitea { + domain = "git.bitlab21.com"; + owner = "sam"; + repo = "dwm"; + rev = "52638a7cc6c886f6e85e850dea826e24bd963203"; + sha256 = "sha256-azIBPGY26g/gLwEPAQTCdBWl0Z/8q7msNNn9/mw0yHw="; + }; + }; + }; + }; + }; +} diff --git a/hosts/common/optional/pipewire.nix b/hosts/common/optional/pipewire.nix index 26948ee..70b8fe6 100644 --- a/hosts/common/optional/pipewire.nix +++ b/hosts/common/optional/pipewire.nix @@ -1,21 +1,21 @@ { pkgs, ... }: { sound.enable = true; - hardware.pulseaudio.enable = true; + #hardware.pulseaudio.enable = true; security.rtkit.enable = true; - hardware.pulseaudio.package = pkgs.pulseaudioFull; -# services.pipewire = { -# enable = true; -# alsa.enable = true; -# alsa.support32Bit = true; -# pulse.enable = true; -# wireplumber.enable = true; -# jack.enable = true; -# -# }; + #hardware.pulseaudio.package = pkgs.pulseaudioFull; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + wireplumber.enable = true; + jack.enable = true; -environment.systemPackages = [ - pkgs.pamixer - pkgs.pavucontrol + }; + + environment.systemPackages = [ + pkgs.pamixer + pkgs.pavucontrol ]; } diff --git a/hosts/common/optional/displayManager/sddm.nix b/hosts/common/optional/sddm.nix similarity index 100% rename from hosts/common/optional/displayManager/sddm.nix rename to hosts/common/optional/sddm.nix diff --git a/hosts/common/users/sam/default.nix b/hosts/common/users/sam/default.nix index 8c5c1f2..03591ff 100644 --- a/hosts/common/users/sam/default.nix +++ b/hosts/common/users/sam/default.nix @@ -35,13 +35,15 @@ in mode = "0644"; owner = "${username}"; }; - "passwords/postgres" = { }; + "software/postgres/btc_models/password" = { }; + "software/postgres/btc_models/ip" = { }; + "software/postgres/btc_models/username" = { }; "software/zotero/username" = { }; "software/zotero/password" = { }; "software/zotero/guid" = { }; }; - # Setup postgres connections for db_ui + # Setup software specific templates for user # Should be part of home-manager - waiting for templates functionality # See here https://github.com/Mic92/sops-nix/issues/423 and here https://github.com/Mic92/sops-nix/issues/498 # TODO migrate db_ui connection to home-manager when issue 423 and 498 are resolved in github:Mic92/sops-nix @@ -52,14 +54,48 @@ in content = '' [ { - "url": "postgresql://postgres:${config.sops.placeholder."passwords/postgres"}@10.0.10.100/btc_models", + "url": "postgresql://${config.sops.placeholder."software/postgres/btc_models/username"}:${config.sops.placeholder."software/postgres/btc_models/password"}@${config.sops.placeholder."software/postgres/btc_models/ip"}/btc_models", "name": "btc_models" + }, + { + "url": "postgresql://${config.sops.placeholder."software/postgres/btc_models/username"}:${config.sops.placeholder."software/postgres/btc_models/password"}@${config.sops.placeholder."software/postgres/btc_models/ip"}/dev_btc_models", + "name": "dev_btc_models" } ] ''; }; - # The containing folders are created as root and if this is the first entry when writing keys, + sops.templates."dbt_profiles.yml" = { + path = "/home/${username}/.config/dbt/profiles.yml"; + owner = "${username}"; + mode = "0600"; + content = '' + bitcoin: + target: dev + outputs: + dev: + dbname: dev_btc_models + host: ${config.sops.placeholder."software/postgres/btc_models/ip"} + pass: '${config.sops.placeholder."software/postgres/btc_models/password"}' + port: 5432 + schema: models + threads: 6 + type: postgres + user: ${config.sops.placeholder."software/postgres/btc_models/username"} + prod: + dbname: btc_models + host: ${config.sops.placeholder."software/postgres/btc_models/ip"} + pass: '${config.sops.placeholder."software/postgres/btc_models/password"}' + port: 5432 + schema: models + threads: 6 + type: postgres + user: ${config.sops.placeholder."software/postgres/btc_models/username"} + + ''; + }; + + # The containing folders are created as root and if this is the first entry when writing files, # the ownership is busted and home-manager can't target because it can't write to these dirs... # FIXME: We might not need this depending on how https://github.com/Mic92/sops-nix/issues/381 is fixed system.activationScripts.sopsSetOwnwership = diff --git a/hosts/semita/default.nix b/hosts/semita/default.nix index 1a5e1f9..95759b4 100644 --- a/hosts/semita/default.nix +++ b/hosts/semita/default.nix @@ -1,4 +1,4 @@ -{ inputs, config, lib, pkgs, outputs,... }: +{ inputs, config, lib, pkgs, outputs, ... }: let # Disko setup fsType = "btrfs"; # one of ext4 or btrfs. Use btrfs if using impermanence @@ -28,9 +28,8 @@ in # Import optional options ../common/optional/persistence.nix ../common/optional/pipewire.nix - ../common/optional/hyprland.nix - ../common/optional/displayManager/sddm.nix ../common/optional/openssh.nix + ../common/optional/dwm.nix ]; diff --git a/justfile b/justfile index 51f050b..2ba40f8 100644 --- a/justfile +++ b/justfile @@ -6,8 +6,8 @@ default: # fetches from remote and updates flake.lock with latest revisions of nix-secrets for next time a rebuild occurs update-flake-secrets: - (cd ../nix-secrets && git fetch && git rebase) || true nix flake lock --update-input nix-secrets + pkill -RTMIN+11 dwmblocks # full system rebuild from flake (stages changes and automatically detects host) rebuild-system: @@ -17,6 +17,7 @@ rebuild-system: # updates all flake inputs for system update-flake: nix flake update + pkill -RTMIN+11 dwmblocks # edit sops file edit-sops: diff --git a/overlays/default.nix b/overlays/default.nix index 7bfcb4c..a1f5ca6 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,5 +1,5 @@ # This file defines overlays -{inputs, ...}: { +{ inputs, ... }: { # This one brings our custom packages from the 'pkgs' directory additions = final: _prev: import ../pkgs final.pkgs; diff --git a/pkgs/default.nix b/pkgs/default.nix index 591d772..1ef4e77 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,5 +1,6 @@ -# Custom packages, that can be defined similarly to ones from nixpkgs -# You can build them using 'nix build .#example' pkgs: { sddm-theme = pkgs.callPackage ./sddm-theme { }; + st = pkgs.callPackage ./st { }; + dwmblocks = pkgs.callPackage ./dwmblocks { }; + dmenu = pkgs.callPackage ./dmenu { }; } diff --git a/pkgs/dmenu/default.nix b/pkgs/dmenu/default.nix new file mode 100644 index 0000000..f7ac6b4 --- /dev/null +++ b/pkgs/dmenu/default.nix @@ -0,0 +1,39 @@ +{ pkgs ? import { } +, fetchFromGitea ? pkgs.fetchFromGitea +, pkg-config ? pkgs.pkg-config +, libX11 ? pkgs.xorg.libX11 +, libXft ? pkgs.xorg.libXft +, libXinerama ? pkgs.xorg.libXinerama +}: +pkgs.stdenv.mkDerivation { + pname = "dmenu"; + name = "dmenu"; + + src = fetchFromGitea { + domain = "git.bitlab21.com"; + owner = "sam"; + repo = "dmenu"; + rev = "deb38655db2ddb340258381f3a0a59e2d19207f1"; + sha256 = "sha256-Wm5mIw4r3lPZDXlyO26Jr993Rq7dxMwBxeWnJ4UzQ1s="; + }; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + libX11 + libXft + libXinerama + ]; + + buildPhase = '' + make + ''; + + installPhase = '' + mkdir -p $out/bin + mv dmenu dmenu_run dmenu_path stest $out/bin + ''; + +} diff --git a/pkgs/dwmblocks/default.nix b/pkgs/dwmblocks/default.nix new file mode 100644 index 0000000..d118abe --- /dev/null +++ b/pkgs/dwmblocks/default.nix @@ -0,0 +1,37 @@ +{ pkgs ? import { } +, fetchFromGitea ? pkgs.fetchFromGitea +, pkg-config ? pkgs.pkg-config +, libX11 ? pkgs.xorg.libX11 +, libXft ? pkgs.xorg.libXft +}: +pkgs.stdenv.mkDerivation { + pname = "dwmblocks"; + name = "dwmblocks"; + + src = fetchFromGitea { + domain = "git.bitlab21.com"; + owner = "sam"; + repo = "dwmblocks"; + rev = "c4e7a9b1eb98123e239ba76bc551934721fd18ca"; + sha256 = "sha256-F1x8jOT+c2pPCF9qKq5boIWzegMBTCxwzKMVtmtMWGM="; + }; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + libX11 + libXft + ]; + + buildPhase = '' + make + ''; + + installPhase = '' + mkdir -p $out/bin + mv dwmblocks $out/bin + ''; + +} diff --git a/pkgs/sqlfmt/default.nix b/pkgs/sqlfmt/default.nix new file mode 100644 index 0000000..e2c0f92 --- /dev/null +++ b/pkgs/sqlfmt/default.nix @@ -0,0 +1,24 @@ +{ pkgs ? import { } +, ... +}: + +let + name = "hello_poetry2nix"; + rev = "4431812218e1963fd34f4d9d22dcd688a4c33fb4"; + hash = "sha256-iHqzA/HJ+vb7O5vpGpA1eR3BcoGDPE2QOqQQpOp0zFQ="; + + src = pkgs.fetchFromGitHub { + inherit rev hash; + + owner = "wilsonehusin"; + repo = "hello-poetry2nix"; + }; +in +pkgs.poetry2nix.mkPoetryApplication { + inherit name src; + + pname = name; + version = rev; + projectDir = src; +} + diff --git a/pkgs/st/default.nix b/pkgs/st/default.nix new file mode 100644 index 0000000..130016e --- /dev/null +++ b/pkgs/st/default.nix @@ -0,0 +1,37 @@ +{ pkgs ? import { } +, fetchFromGitea ? pkgs.fetchFromGitea +, pkg-config ? pkgs.pkg-config +, libX11 ? pkgs.xorg.libX11 +, libXft ? pkgs.xorg.libXft +}: +pkgs.stdenv.mkDerivation { + pname = "st"; + name = "st"; + + src = fetchFromGitea { + domain = "git.bitlab21.com"; + owner = "sam"; + repo = "st"; + rev = "31e0ba8cb2086fb12741afc5fc3dfd938ca1f59b"; + sha256 = "sha256-dbkXFbNr/lJveMeR7qXo7jGgF5+79S9vqKsLM7XM250="; + }; + + nativeBuildInputs = [ + pkg-config + ]; + + buildInputs = [ + libX11 + libXft + ]; + + buildPhase = '' + make + ''; + + installPhase = '' + mkdir -p $out/bin + mv st $out/bin + ''; + +}