diff --git a/home-manager/backup-home.nix b/home-manager/backup-home.nix new file mode 100644 index 0000000..3486098 --- /dev/null +++ b/home-manager/backup-home.nix @@ -0,0 +1,668 @@ +{config, pkgs, lib, ... }: +let + # Theme/Mode + THEME = "solarized"; + MODE = "dark"; + + # Colours + inherit (import ./themes/${THEME}_${MODE}.nix) BG FG GRAY DARK_GRAY RED DARK_RED GREEN DARK_GREEN YELLOW DARK_YELLOW BLUE DARK_BLUE PURPLE DARK_PURPLE CYAN DARK_CYAN GTK_THEME GTK_THEME_NAME GTK_ICONS GTK_CURSOR; + ACCENT = "${CYAN}"; + SECOND_ACCENT = "${PURPLE}"; + ACTIVE_BORDER_COLOR = "${ACCENT}"; + INACTIVE_BORDER_COLOR = "${FG}"; + SHADOW_COLOR = "000000"; + + # Programs + MENU = "fuzzel"; + TERMINAL = "kitty"; + BROWSER = "firefox"; + + # Numbers + GAPS_IN = "30"; + GAPS_OUT = "60"; + BORDER_WIDTH = "2"; + CORNER_RADIUS = "0"; + WAYBAR_CORNER_RADIUS = "0"; + TERMINAL_OPACITY = "1"; + SCREEN_HEIGHT = 1080; + SCREEN_WIDTH = 1920; + FUZZEL_WIDTH = "25"; + FUZZEL_HEIGHT = "15"; + FUZZEL_OPACITY = "ff"; + + # Other + HOME = "/home/deadvey"; + WALLPAPER = "wallpaper.png"; + WALLPAPER_PATH = "${HOME}/.config/home-manager/themes/${WALLPAPER}"; + FONT = "VictorMono Nerd Font Mono"; + FONT_PACKAGE = "victor-mono"; + FUZZEL_PROMPT = " >> "; + DUNST_ORIGIN = "top-center"; +in +{ + # Home Manager needs a bit of information about you and the paths it should + # manage. + + home = { + username = "deadvey"; + homeDirectory = "/home/deadvey"; + enableNixpkgsReleaseCheck = false; + stateVersion = "24.11"; + packages = with pkgs; [ + anki + claws-mail + dunst + entr + fastfetch + firefox + fractal + fuzzel + gimp + hyprland + hyprpaper + hyprpicker + hyprlock + hypridle + iamb + imagemagick + keepassxc + killall + kitty + libreoffice + minetest + mpv + pavucontrol + tmux + tor-browser + transmission_4-gtk + waybar + weather + wttrbar + unzip + w3m + wl-clipboard + vimb + ]; + # Required for Hyprpicker to work + pointerCursor = { + gtk.enable = true; + package = pkgs.gnome.adwaita-icon-theme; + name = "Adwaita"; + size = 16; + }; + file = { + ".config/hypr/wallpaper-watcher.sh" = { + text = '' + file="" + while [ 1 == 1 ]; do + new_file=$(cat $HOME/scripts/wallpaper-updater.sh) + if [[ "$new_file" != "$file" ]]; then + bash $HOME/scripts/wallpaper-updater.sh + fi + file=$new_file + done + ''; + executable = true; + }; + "scripts/wallpaper-updater.sh" = { + text = '' + magick ${WALLPAPER_PATH} -fuzz 10% -fill "#${BG}" -opaque "$(convert ${WALLPAPER_PATH} -format "%[pixel:u.p{0,0}]" info:-)" ${WALLPAPER_PATH} + magick ${WALLPAPER_PATH} -fuzz 10% -fill "#${ACCENT}" -opaque "$(convert ${WALLPAPER_PATH} -format "%[pixel:u.p{3475,1627}]" info:-)" ${WALLPAPER_PATH} + kill -9 $(pgrep hyprpaper) + sleep 1 + hyprpaper & + ''; + executable = true; + }; + }; + }; + gtk = { + enable = true; + font = { + name = "${FONT}"; + package = pkgs.${FONT_PACKAGE}; + }; + iconTheme = { + name = "${GTK_ICONS}"; + package = pkgs.${GTK_ICONS}; + }; + theme = { + name = "${GTK_THEME_NAME}"; + package = pkgs.${GTK_THEME}; + }; + }; + programs = { + nheko = { + settings = { + user = { + theme = "dark"; + }; + }; + }; + neovim = { + defaultEditor = true; + enable = true; + vimAlias = true; + extraConfig = '' + set clipboard=unnamedplus + set relativenumber + ''; + plugins = with pkgs.vimPlugins; [ + chadtree + ]; + }; + bash = { + enable = true; + shellAliases = { + ls="ls -l"; + ssh="kitten ssh"; + }; + bashrcExtra='' + PS1="[\[\033[32m\]\w]\[\033[0m\]\n\[\033[1;36m\]\u\[\033[1;33m\] => \[\033[0m\]" + ''; + }; + git = { + enable = true; + userName = "deadvey"; + userEmail = "deadvey@nixos"; + }; + kitty = { + enable = true; + settings = { + confirm_os_window_close = 0; + background_opacity = "${TERMINAL_OPACITY}"; + foreground = "#${FG}"; + background = "#${BG}"; + selection_foreground = "#${BG}"; + selection_background = "#${FG}"; + color0 = "#${GRAY}"; + color8 = "#${BG}"; + color1 = "#${RED}"; + color9 = "#${DARK_RED}"; + color2 = "#${GREEN}"; + color10 = "#${DARK_GREEN}"; + color3 = "#${YELLOW}"; + color11 = "#${DARK_YELLOW}"; + color4 = "#${BLUE}"; + color12 = "#${DARK_BLUE}"; + color5 = "#${PURPLE}"; + color13 = "#${DARK_PURPLE}"; + color6 = "#${BLUE}"; + color14 = "#${DARK_BLUE}"; + color7 = "#${GRAY}"; + color15 = "#${DARK_GRAY}"; + }; + font = { + name = "VictorMono Nerd Font Mono"; + package = pkgs.${FONT_PACKAGE}; + size = 8; + }; + }; + hyprlock = { + enable = true; + settings = { + general = { + disable_loading_bar = true; + grace = 1; + no_fade_in = false; + }; + background = [ + { + path = "${WALLPAPER_PATH}"; + } + ]; + input-field = [ + { + rounding = "${CORNER_RADIUS}"; + size = "200, 50"; + position = "0, 0"; + dots_rounding = "${CORNER_RADIUS}"; + dots_center = true; + fade_on_empty = true; + font_color = "${FG}"; + inner_color = "${FG}"; + outer_color = "${ACCENT}"; + outline_thickness = "${BORDER_WIDTH}"; + placeholder_text = "Password..."; + fail_text = "😬 Oooooh that was wrong mate!⚠️"; + } + ]; + }; + }; + fuzzel = { + enable = true; + settings = { + main = { + prompt = "${FUZZEL_PROMPT}"; + width = "${FUZZEL_WIDTH}"; + lines = "${FUZZEL_HEIGHT}"; + icons-enabled = "no"; + font = "${FONT}"; + }; + colors = { + background = "${BG}${FUZZEL_OPACITY}"; + border = "${ACCENT}ff"; + match = "${RED}ff"; + selection = "${FG}ff"; + selection-text = "${BG}ff"; + text = "${FG}ff"; + prompt = "${FG}ff"; + input = "${FG}ff"; + }; + border = { + width = "${BORDER_WIDTH}"; + radius = "${CORNER_RADIUS}"; + }; + }; + }; + waybar = { + enable = true; + settings = { + screenBorder = { + mode = "overlay"; + layer = "bottom"; + name = "screenBorder"; + position = "top"; + height = SCREEN_HEIGHT; + width = SCREEN_WIDTH; + modules-center = ["custom/empty"]; + "custom/empty" = { + format = " "; + interval = 1; + }; + }; + top = { + exclusive = false; + layer = "top"; + name = "top"; + position = "top"; + height = 20; + width = SCREEN_WIDTH - 10; + modules-left = [ "cpu" "memory" "disk" ]; + modules-center = ["custom/clock"]; + modules-right = ["custom/caway"]; + "custom/clock" = { + format = " {}  "; + exec = "bash /home/deadvey/Code/git/time-to-metrictime-converter/time.sh --hex"; + interval = 1; + }; + "custom/caway" = { + format = "{}"; + exec = "ssh max@media bash /home/max/caway.sh"; + }; + "cpu" = { + format = "{}%  "; + }; + "memory" = { + format = "{}%  "; + }; + "disk" = { + format = "{}%  /"; + }; + }; + + right = { + exclusive = false; + layer = "top"; + name = "right"; + position = "right"; + modules-center = [ "hyprland/workspaces" ]; + }; + left = { + exclusive = false; + layer = "top"; + name = "right"; + position = "left"; + modules-center = [ "custom/browser" "custom/terminal" "custom/website" "custom/anki" "custom/keepassxc" "custom/gimp" "custom/writer" "custom/luanti" "custom/nixpkgs"]; + "custom/browser" = { + format = ""; + on-click = "${BROWSER}"; + }; + "custom/terminal" = { + format = ""; + on-click = "${TERMINAL} --hold fastfetch"; + }; + "custom/website" = { + format = ""; + on-click = "${BROWSER} https://deadvey.com"; + }; + "custom/anki" = { + format = "?"; + on-click = "anki"; + }; + "custom/keepassxc" = { + format = ""; + on-click = "keepassxc"; + }; + "custom/gimp" = { + format = ""; + on-click = "gimp"; + }; + "custom/writer" = { + format = ""; + on-click = "swriter"; + }; + "custom/luanti" = { + format = ""; + on-click = "minetest"; + }; + "custom/nixpkgs" = { + format = ""; + on-click = "${BROWSER} https://search.nixos.org/packages"; + }; + }; + bottom = { + exclusive = false; + layer = "top"; + name = "bottom"; + position = "bottom"; + height = 20; + width = SCREEN_WIDTH - 10; + modules-left = [ "network" ]; + modules-right = [ "pulseaudio" ]; + modules-center = ["custom/weather"]; + "network" = { + interface = "enp42s0"; + interval = 10; + family = "ipv4"; + format-ethernet = "{ifname}: {ipaddr} "; + format-disconnected = "No Connection... "; + }; + "custom/weather" = { + format = "{}°"; + tooltip = true; + interval = 3600; + exec = "wttrbar --ampm --location egbb"; + return-type = "json"; + on-click = "${TERMINAL} --hold curl wttr.in"; + }; + "pulseaudio" = { + format = "{icon} {volume}%"; + format-muted = "X"; + format-icons = { + default = [ "" "" "" ]; + }; + on-click = "pavucontrol"; + on-scroll-up = "pactl set-sink-volume @DEFAULT_SINK@ +10% && ssh max@media pactl set-sink-volume @DEFAULT_SINK@ +10%"; + on-scroll-down = "pactl set-sink-volume @DEFAULT_SINK@ -10% && ssh max@media pactl set-sink-volume @DEFAULT_SINK@ -10%"; + on-click-right = "pactl set-sink-volume @DEFAULT_SINK@ 0% && ssh max@media pactl set-sink-volume @DEFAULT_SINK@ 0%"; + scroll-step = 1; + }; + }; + }; + style = '' + window#waybar.screenBorder { + border: ${BORDER_WIDTH}px solid #${ACCENT}; + background-color: transparent; + box-shadow: 0px 0px 0px 60px black, 0px 0px 0px 0.5px #${FG}; + border-radius: ${WAYBAR_CORNER_RADIUS}px; + margin: 20px; + } + window#waybar.top, + window#waybar.bottom, + window#waybar.right, + window#waybar.left { + background-color: transparent; + } + #workspaces button { + color: #${FG}; + background: #${BG}; + } + #workspaces button:hover { + color: #${ACCENT}; + } + #workspaces button.active { + color: #${SECOND_ACCENT}; + } + #workspaces button.focuced { + color: #${BG}; + background: #${FG}; + } + #workspaces { + border: ${BORDER_WIDTH}px solid #${ACCENT}; + border-radius: ${WAYBAR_CORNER_RADIUS}; + box-shadow: 12px 12px 0px 2px #${SHADOW_COLOR}; + padding: 0px; + margin: 6px; + padding: 0px 5px 0px 5px; + background: #${BG}; + } + #custom-caway { + color: #${FG}; + background: transparent; + border: ${BORDER_WIDTH}px solid #${ACCENT}; + border-radius: ${WAYBAR_CORNER_RADIUS}; + box-shadow: 12px 12px 0px 2px #${SHADOW_COLOR}; + margin: 6px; + } + #custom-clock, + #network, + #custom-weather, + #custom-browser, + #custom-terminal, + #custom-anki, + #custom-keepassxc, + #custom-gimp, + #custom-writer, + #custom-luanti, + #custom-nixpkgs, + #disk, + #memory, + #cpu, + #custom-website, + #pulseaudio { + color: #${FG}; + background: #${BG}; + border: ${BORDER_WIDTH}px solid #${ACCENT}; + border-radius: ${WAYBAR_CORNER_RADIUS}; + box-shadow: 12px 12px 0px 2px #${SHADOW_COLOR}; + padding: 3px; + margin: 6px; + } + ''; + }; + }; + services = { + hyprpaper = { + enable = true; + settings = { + ipc = "on"; + preload = [ "${WALLPAPER_PATH}" ]; + wallpaper = [ "HDMI-A-1,${WALLPAPER_PATH}" ]; + }; + }; + hypridle = { + enable = true; + settings = { + listener = [ + { + timeout = 10000; + on-timeout = "hyprlock"; + } + ]; + }; + }; + dunst = { + enable = true; + settings = { + global = { + width = 300; + height = 300; + offset = "${GAPS_OUT}x${GAPS_OUT}"; + origin = "${DUNST_ORIGIN}"; + font = "${FONT}"; + corner_radius = "${CORNER_RADIUS}"; + foreground = "#${FG}"; + frame_color = "#${ACCENT}"; + frame_width = "${BORDER_WIDTH}"; + }; + urgency_low = { + background = "#${GREEN}"; + timeout=3; + }; + urgency_normal = { + background = "#${BLUE}"; + timeout=6; + }; + urgency_critical = { + background = "#${RED}"; + timeout=12; + }; + }; + }; + }; + wayland = { + windowManager = { + hyprland = { + enable = true; + plugins = with pkgs; [ + #hyprlandPlugins.hyprbars + hyprlandPlugins.hyprexpo + ]; + extraConfig = '' + exec-once="waybar"; + exec-once="dunst"; + exec-once="/home/deadvey/.config/hypr/wallpaper-watcher.sh"; + exec-once="dunst"; + ''; + settings = { + "$mod" = "SUPER"; + plugin = { + hyprexpo = { + columns = 3; + gap_size = 5; + bg_col = "rgb(${BG})"; + workspace_method = "center current"; + }; + hyprbars = { + bar_height = 25; + bar_color = "rgb(${BG})"; + "col.text" = "rgb(${FG})"; + hyprbars-button = "rgb(${RED}), 10, X, hyprctl dispatch killactive"; + }; + }; + general = { + gaps_in = "${GAPS_IN}"; + gaps_out = "${GAPS_OUT}"; + border_size = "${BORDER_WIDTH}"; + "col.active_border" = "rgb(${ACCENT})"; + "col.inactive_border" = "rgb(${INACTIVE_BORDER_COLOR})"; + resize_on_border = false; + layout = "dwindle"; + }; + decoration = { + rounding="${CORNER_RADIUS}"; + + drop_shadow = true; + "col.shadow" = "rgb(${SHADOW_COLOR})"; + shadow_offset = "12 12"; + shadow_range = "0"; + }; + dwindle = { + pseudotile = "yes"; + preserve_split = "yes"; + }; + animations = { + "bezier" = "easeInOutBack, 0.68, -0.55, 0.265, 1.55"; + animation = [ + "workspaces, 1, 7, easeInOutBack" + "windowsOut, 1, 7, easeInOutBack" + ]; + }; + input = { + kb_layout = "gb"; + kb_options = "caps:escape"; + }; + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + bind = [ + "$mod, Space, exec, ${MENU}" + "$mod, Q, exec, ${TERMINAL} --hold fastfetch" + "$mod, B, exec, ${BROWSER}" + "$mod ALT, up, exec, pactl set-sink-volume 0 +5%" + "$mod ALT, down, exec, pactl set-sink-volume 0 -5%" + "$mod, grave, hyprexpo:expo, toggle" + "$mod, P, exec, grimshot copy area" + "$mod, L, exec, hyprlock" + "$mod, C, killactive" + "$mod, O, exec, hyprpicker -a" + "$mod, M, fullscreen, 1" + "$mod SHIFT, E, exit" + "$mod, J, togglesplit," + "$mod, V, toggleFloating," + "$mod, U, pseudo," + "$mod SHIFT, Q, exit" + "$mod, left, movefocus, l" + "$mod, right, movefocus, r" + "$mod, up, movefocus, u" + "$mod, down, movefocus, d" + "$mod SHIFT, left, movewindow, l" + "$mod SHIFT, right, movewindow, r" + "$mod SHIFT, up, movewindow, u" + "$mod SHIFT, down, movewindow, d" + "$mod, 1, workspace, 1" + "$mod, 2, workspace, 2" + "$mod, 3, workspace, 3" + "$mod, 4, workspace, 4" + "$mod, 5, workspace, 5" + "$mod, 6, workspace, 6" + "$mod, 7, workspace, 7" + "$mod, 8, workspace, 8" + "$mod, 9, workspace, 9" + "$mod, 0, workspace, 10" + "$mod SHIFT, 1, movetoworkspace, 1" + "$mod SHIFT, 2, movetoworkspace, 2" + "$mod SHIFT, 3, movetoworkspace, 3" + "$mod SHIFT, 4, movetoworkspace, 4" + "$mod SHIFT, 5, movetoworkspace, 5" + "$mod SHIFT, 6, movetoworkspace, 6" + "$mod SHIFT, 7, movetoworkspace, 7" + "$mod SHIFT, 8, movetoworkspace, 8" + "$mod SHIFT, 9, movetoworkspace, 9" + "$mod SHIFT, 0, movetoworkspace, 10" + ]; + + }; + }; + }; + }; + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. These will be explicitly sourced when using a + # shell provided by Home Manager. If you don't want to manage your shell + # through Home Manager then you have to manually source 'hm-session-vars.sh' + # located at either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/deadvey/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/home-manager/home.nix b/home-manager/home.nix index a92b0ce..7a5839e 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -44,11 +44,6 @@ in # manage. home = { - activation = { - postBuild = lib.hm.dag.entryAfter ["writeBoundary"] '' - bash $HOME/scripts/wallpaper-updater.sh & - ''; - }; username = "deadvey"; homeDirectory = "/home/deadvey"; enableNixpkgsReleaseCheck = false; @@ -96,7 +91,7 @@ in size = 16; }; file = { - ".config/hypr/wallpaper-watcher.sh" = { + "scripts/wallpaper-watcher.sh" = { text = '' file="" while [ 1 == 1 ]; do @@ -119,6 +114,35 @@ in ''; executable = true; }; + "scripts/mode-switcher-based-on-sunlight.sh" = { + text = '' + #!/bin/bash + # Set your latitude and longitude + LATITUDE="52.489471" + LONGITUDE="-1.898575" + + # Get current time in the format hh:mm + current_time=$(date +%H:%M) + + # Calculate the sunrise and sunset times for today using sunwait + sunrise_time=$(sunwait rise $LATITUDE $LONGITUDE | awk '{print $2}') + sunset_time=$(sunwait set $LATITUDE $LONGITUDE | awk '{print $2}') + + # Compare current time with sunrise and sunset times + if [[ "$current_time" > "$sunrise_time" && "$current_time" < "$sunset_time" ]]; then + # It's daylight, run the "daytime" command + echo "It's daylight. Running daytime command..." + # Replace the following line with the command you want to run during the day + /path/to/daytime_command + else + # It's night, run the "nighttime" command + echo "It's night. Running nighttime command..." + # Replace the following line with the command you want to run during the night + /path/to/nighttime_command + fi + ''; + executable = true; + }; }; }; gtk = { @@ -527,7 +551,7 @@ in extraConfig = '' exec-once="waybar"; exec-once="dunst"; - exec-once="/home/deadvey/.config/hypr/wallpaper-watcher.sh"; + exec-once="/home/deadvey/scripts/wallpaper-watcher.sh"; exec-once="dunst"; ''; settings = { diff --git a/home-manager/themes/wallpaper.png b/home-manager/themes/wallpaper.png index 1ba8b3e..6236c2c 100644 Binary files a/home-manager/themes/wallpaper.png and b/home-manager/themes/wallpaper.png differ