diff --git a/README.md b/README.md index ebf2086..5219ef7 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ - [X] Hyprlock - [X] Hypridle - [X] Swaync (Notification Center) -- [X] Hyprpaper (Wallpaper) +- [X] Swww (Wallpaper) - [X] Ghostty (Terminal) - [X] SDDM (Display Manager) - [X] Fish (shell) diff --git a/flake.lock b/flake.lock index 042941d..3322c95 100644 --- a/flake.lock +++ b/flake.lock @@ -222,6 +222,22 @@ "type": "github" } }, + "flake-compat_8": { + "flake": false, + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -1290,6 +1306,22 @@ } }, "nixpkgs_7": { + "locked": { + "lastModified": 1753934836, + "narHash": "sha256-G06FmIBj0I5bMW1Q8hAEIl5N7IHMK7+Ta4KA+BmneDA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "8679b16e11becd487b45d568358ddf9d5640d860", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_8": { "locked": { "lastModified": 1752596105, "narHash": "sha256-lFNVsu/mHLq3q11MuGkMhUUoSXEdQjCHvpReaGP1S2k=", @@ -1374,6 +1406,7 @@ "nix-tmodloader": "nix-tmodloader", "nixpkgs": "nixpkgs_5", "sops-nix": "sops-nix", + "swww": "swww", "yazi": "yazi" } }, @@ -1399,6 +1432,27 @@ } }, "rust-overlay_2": { + "inputs": { + "nixpkgs": [ + "swww", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1753930086, + "narHash": "sha256-Os6Ta5zamfAllmQNlvkbGZLHn06zJy3hVXRk+Dy2yMo=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "17b672c10c1798696a516cb879edbc2ebd0f58a4", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_3": { "inputs": { "nixpkgs": [ "yazi", @@ -1437,6 +1491,26 @@ "type": "github" } }, + "swww": { + "inputs": { + "flake-compat": "flake-compat_8", + "nixpkgs": "nixpkgs_7", + "rust-overlay": "rust-overlay_2" + }, + "locked": { + "lastModified": 1754041947, + "narHash": "sha256-KzuedC2yJU56sRBeMlndPuXK6UWHxSUtgAmJ/+Gww6I=", + "owner": "LGFae", + "repo": "swww", + "rev": "63d71f2b8c6d1533b5fef748dfc490dd461e343c", + "type": "github" + }, + "original": { + "owner": "LGFae", + "repo": "swww", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1689347949, @@ -1622,8 +1696,8 @@ "yazi": { "inputs": { "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs_7", - "rust-overlay": "rust-overlay_2" + "nixpkgs": "nixpkgs_8", + "rust-overlay": "rust-overlay_3" }, "locked": { "lastModified": 1753281791, diff --git a/flake.nix b/flake.nix index f78f4b8..7cae897 100644 --- a/flake.nix +++ b/flake.nix @@ -81,6 +81,10 @@ url = "github:hyprwm/hyprlock"; inputs.nixpkgs.follows = "nixpkgs"; }; + + swww = { + url = "github:LGFae/swww"; + }; }; outputs = @@ -111,70 +115,25 @@ }; }; + # Declaring All Devices devices = { + # Home Computer dn-pre7780 = { - settings = { - personal = { - hostname = "dn-pre7780"; - domain = "net.dn"; - username = "danny"; - git = { - username = "DACHXY"; - email = "Danny10132024@gmail.com"; - }; - }; - - hyprland = { - # Leave empty if you only have one monitor - # This is for assign workspace to a specific monitor - # e.g. 1, 3, 5 for the first one; 2, 4, 6 for the second one - monitors = [ - "desc:ASUSTek COMPUTER INC ASUS VG32VQ1B 0x00002271" - "desc:Acer Technologies XV272U V3 1322131231233" - ]; - cursor-size = 32; - xcursor-size = 24; - }; - - # Optional - nvidia = { - # Choose from offload, sync, rsync - mode = "offload"; - - # Only needed when using GPU hybrid mode - intel-bus-id = "PCI:0:2:0"; - nvidia-bus-id = "PCI:1:0:0"; - }; - }; + hostname = "dn-pre7780"; + domain = "net.dn"; + username = "danny"; extra-modules = [ lanzaboote.nixosModules.lanzaboote ./system/dev/dn-pre7780 ]; - overlays = [ - - ]; + overlays = [ ]; }; + # Laptop dn-lap = { - settings = { - personal = { - hostname = "dn-lap"; - username = "danny"; - git = { - username = "DACHXY"; - email = "Danny10132024@gmail.com"; - }; - }; - - hyprland = { - # Leave empty if you only have one monitor - # This is for assign workspace to a specific monitor - # e.g. 1, 3, 5 for the first one; 2, 4, 6 for the second one - monitors = [ ]; - cursor-size = 32; - xcursor-size = 24; - }; - }; + hostname = "dn-lap"; + username = "danny"; + domain = "net.dn"; extra-modules = [ lanzaboote.nixosModules.lanzaboote ./system/dev/dn-lap @@ -184,36 +143,11 @@ ]; }; + # Server dn-server = { - settings = { - personal = { - hostname = "dn-server"; - username = "danny"; - git = { - username = "DACHXY"; - email = "Danny10132024@gmail.com"; - }; - }; - - hyprland = { - # Leave empty if you only have one monitor - # This is for assign workspace to a specific monitor - # e.g. 1, 3, 5 for the first one; 2, 4, 6 for the second one - monitors = [ ]; - cursor-size = 32; - xcursor-size = 24; - }; - - # Optional - nvidia = { - # Choose from offload, sync, rsync - mode = "offload"; - - # Only needed when using GPU hybrid mode - intel-bus-id = "PCI:0:2:0"; - nvidia-bus-id = "PCI:1:0:0"; - }; - }; + hostname = "dn-server"; + username = "danny"; + domain = "net.dn"; extra-modules = [ inputs.nix-minecraft.nixosModules.minecraft-servers inputs.nix-tmodloader.nixosModules.tmodloader @@ -230,9 +164,7 @@ nixosConfigurations = builtins.mapAttrs ( dev: conf: let - settings = conf.settings; - username = settings.personal.username; - hostname = settings.personal.hostname; + inherit (conf) username hostname domain; in nixpkgs.lib.nixosSystem { modules = [ @@ -247,8 +179,8 @@ inputs system nix-version - settings devices + username ; }; users."${username}" = { @@ -265,7 +197,10 @@ ]; }; }; - networking.hostName = hostname; + networking = { + inherit domain; + hostName = hostname; + }; nixpkgs.hostPlatform = system; nixpkgs.config.allowUnfree = true; nixpkgs.overlays = ((import ./pkgs/overlays) ++ conf.overlays); @@ -274,7 +209,7 @@ ++ common-settings.modules ++ conf.extra-modules; specialArgs = { - inherit settings; + inherit username; } // common-settings.args; } diff --git a/home/config/waybar/config.nix b/home/config/waybar/config.nix index 8116418..c493ba9 100644 --- a/home/config/waybar/config.nix +++ b/home/config/waybar/config.nix @@ -2,6 +2,7 @@ terminal, osConfig, wallRand, + rofiWall, pkgs, lib, }: @@ -11,6 +12,7 @@ let terminal osConfig wallRand + rofiWall pkgs lib ; @@ -19,7 +21,7 @@ in map (dev: dev // modulesConfig) [ # Monitor 1 { - output = "DP-6"; + output = "DP-5"; layer = "top"; exclusive = true; passthrough = false; @@ -67,7 +69,7 @@ map (dev: dev // modulesConfig) [ } # Monitor 2 { - output = "DP-5"; + output = "DP-6"; layer = "top"; exclusive = true; height = 54; diff --git a/home/config/waybar/modules.nix b/home/config/waybar/modules.nix index 766b104..946ce99 100644 --- a/home/config/waybar/modules.nix +++ b/home/config/waybar/modules.nix @@ -3,6 +3,7 @@ osConfig, wallRand, pkgs, + rofiWall, lib, }: let @@ -268,7 +269,8 @@ in }; "custom/wallRand" = { format = ""; - on-click = "${wallRand}/bin/wallRand"; + on-click = "${rofiWall}"; + on-click-right = "${wallRand}"; }; "custom/airplay" = let diff --git a/home/presets/basic.nix b/home/presets/basic.nix index 8094c03..b110e53 100644 --- a/home/presets/basic.nix +++ b/home/presets/basic.nix @@ -5,9 +5,7 @@ ../user/desktops.nix ../user/direnv.nix ../user/environment.nix - ../user/git.nix ../user/gtk.nix - ../user/hyprland.nix # ../user/music-production.nix ../user/nvim.nix ../user/packages.nix diff --git a/home/user/git.nix b/home/user/git.nix index 41fcfe6..c4d1f63 100644 --- a/home/user/git.nix +++ b/home/user/git.nix @@ -1,9 +1,13 @@ -{ settings, ... }: +{ + username, + email, +}: +{ ... }: { programs.git = { enable = true; - userName = settings.personal.git.username; - userEmail = settings.personal.git.email; + userName = username; + userEmail = email; extraConfig = { safe.directory = [ "/etc/nixos" ]; init.defaultBranch = "main"; diff --git a/home/user/gtk.nix b/home/user/gtk.nix index 62cdcf6..1afac68 100644 --- a/home/user/gtk.nix +++ b/home/user/gtk.nix @@ -1,12 +1,10 @@ { pkgs, - settings, ... }: let cursorName = "catppuccin-macchiato-lavender-cursors"; themeName = "catppuccin-macchiato-lavender-compact"; - cursorSize = settings.hyprland.xcursor-size; in { gtk = { @@ -15,7 +13,6 @@ in cursorTheme = { name = cursorName; package = pkgs.catppuccin-cursors.macchiatoLavender; - size = cursorSize; }; theme = { diff --git a/home/user/hypr/bind.nix b/home/user/hypr/bind.nix index 0da2d81..5c28fab 100644 --- a/home/user/hypr/bind.nix +++ b/home/user/hypr/bind.nix @@ -1,8 +1,9 @@ { - settings, mainMod, nvidia-offload-enabled, pkgs, + rofiWall, + monitors ? [ ], }: with builtins; let @@ -11,9 +12,7 @@ let browser = "${prefix} ${firefox}"; terminal = "ghostty"; filemanager = "${terminal} -e yazi"; - scripts = "~/.config/scripts"; - freezeShot = ""; screenshotFolder = "--output-folder ~/Pictures/Screenshots"; clipboardOnly = "${screenshotFolder}"; @@ -27,20 +26,9 @@ let fi ''; - toggleRofi = pkgs.writeShellScriptBin "toggle" '' - GDK_PIXBUF_MODULE_FILE="${pkgs.librsvg}/lib/gdk-pixbuf-2.0/${pkgs.librsvg.version}/loaders.cache" # Make rofi load svg - - if ${pkgs.busybox}/bin/pgrep rofi > /dev/null; then - ${pkgs.busybox}/bin/pkill rofi - else - rofi "$@" - fi - ''; - scrollStep = let - monitorsNum = length settings.hyprland.monitors; - + monitorsNum = length monitors; in toString (if (monitorsNum == 0) then 1 else monitorsNum); in @@ -53,19 +41,20 @@ in ''${mainMod}, M, exec, ${toggleWlogout}/bin/toggle'' ''${mainMod}, E, exec, ${filemanager}'' ''${mainMod}, V, togglefloating, '' - ''ALT, SPACE, exec, ${toggleRofi}/bin/toggle -config ~/.config/rofi/apps.rasi -show drun'' + ''ALT, SPACE, exec, rofi -config ~/.config/rofi/apps.rasi -show drun'' + ''${mainMod}, W, exec, ${rofiWall}'' ''${mainMod}, P, pseudo, # dwindle'' ''${mainMod}, S, togglesplit, # dwindle'' ''CTRL ${mainMod} SHIFT, L, exec, hyprlock'' # Screenshot - ''${mainMod} SHIFT, s, exec, hyprshot -m region ${clipboardOnly} ${freezeShot}'' - ''CTRL SHIFT, s, exec, hyprshot -m window ${clipboardOnly} ${freezeShot}'' - ''CTRL SHIFT ${mainMod}, s, exec, hyprshot -m output ${clipboardOnly} ${freezeShot}'' - ''CTRL ALT, s, exec, hyprshot -m active -m window ${clipboardOnly} ${freezeShot}'' + ''${mainMod} SHIFT, s, exec, hyprshot -m region ${clipboardOnly}'' + ''CTRL SHIFT, s, exec, hyprshot -m window ${clipboardOnly}'' + ''CTRL SHIFT ${mainMod}, s, exec, hyprshot -m output ${clipboardOnly}'' + ''CTRL ALT, s, exec, hyprshot -m active -m window ${clipboardOnly}'' - ''${mainMod}, PERIOD, exec, ${toggleRofi}/bin/toggle -modi emoji -show emoji'' - ''CTRL ${mainMod}, c, exec, ${toggleRofi}/bin/toggle -show calc -modi calc -no-show-match -no-sort'' + ''${mainMod}, PERIOD, exec, rofi -modi emoji -show emoji'' + ''CTRL ${mainMod}, c, exec, rofi -show calc -modi calc -no-show-match -no-sort'' ''${mainMod}, X, exec, sleep 0.1 && swaync-client -t -sw'' ''${mainMod} SHIFT, C, centerwindow'' '',F11, fullscreen'' @@ -102,10 +91,6 @@ in ''${mainMod}, G, workspace, ${toString gamingWorkspace}'' ''${mainMod} SHIFT, G, movetoworkspace, ${toString gamingWorkspace}'' - # ==== Plugins ==== # - # Overview - # ''${mainMod}, o, hyprtasking:toggle, cursor'' - # ''${mainMod}, TAB, hyprtasking:toggle, all'' ] ++ ( # workspaces diff --git a/home/user/hypr/binde.nix b/home/user/hypr/binde.nix deleted file mode 100644 index e6b8a1b..0000000 --- a/home/user/hypr/binde.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ mainMod }: -let - resizeStep = builtins.toString 20; - brightnessStep = builtins.toString 10; - volumeStep = builtins.toString 2; -in -[ - '',XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_SINK@ 0 && wpctl set-volume @DEFAULT_SINK@ ${volumeStep}%+'' - '',XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_SINK@ 0 && wpctl set-volume @DEFAULT_SINK@ ${volumeStep}%-'' - '',XF86MonBrightnessDown, exec, brightnessctl set ${brightnessStep}%-'' - '',XF86MonBrightnessUp, exec, brightnessctl set ${brightnessStep}%+'' - ''${mainMod} CTRL, l, resizeactive, ${resizeStep} 0'' - ''${mainMod} CTRL, h, resizeactive, -${resizeStep} 0'' - ''${mainMod} CTRL, k, resizeactive, 0 -${resizeStep}'' - ''${mainMod} CTRL, j, resizeactive, 0 ${resizeStep}'' -] diff --git a/home/user/hypr/bindm.nix b/home/user/hypr/bindm.nix deleted file mode 100644 index 7c477ad..0000000 --- a/home/user/hypr/bindm.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ mainMod }: -[ - # Move/resize windows with mainMod + LMB/RMB and dragging - ''${mainMod}, mouse:272, movewindow'' - ''${mainMod}, mouse:273, resizewindow'' -] diff --git a/home/user/hypr/exec.nix b/home/user/hypr/exec.nix deleted file mode 100644 index 17d3133..0000000 --- a/home/user/hypr/exec.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - pkgs, - terminal, - xcursor-size, - ... -}: -let - startupScript = pkgs.writeShellScriptBin "start" '' - # Fix nemo open in terminal - dconf write /org/cinnamon/desktop/applications/terminal/exec "''\'${terminal}''\'" & - dconf write /org/cinnamon/desktop/applications/terminal/exec-arg "''\'''\'" & - dconf write /org/gnome/desktop/interface/cursor-size ${builtins.toString xcursor-size} & - - systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME & - ''; -in -''${startupScript}/bin/start'' diff --git a/home/user/hypr/input.nix b/home/user/hypr/input.nix index 437381b..0444f7a 100644 --- a/home/user/hypr/input.nix +++ b/home/user/hypr/input.nix @@ -9,7 +9,7 @@ follow_mouse = 1; accel_profile = "flat"; - kb_options = [ "caps:swapescape" ]; + kb_options = [ "caps:escape" ]; touchpad = { natural_scroll = true; diff --git a/home/user/hypr/monitor.nix b/home/user/hypr/monitor.nix deleted file mode 100644 index 501e328..0000000 --- a/home/user/hypr/monitor.nix +++ /dev/null @@ -1,5 +0,0 @@ -[ - ''desc:ASUSTek COMPUTER INC ASUS VG32VQ1B 0x00002271, 2560x1440@165, 0x0, 1'' - ''desc:Acer Technologies XV272U V3 1322131231233, 2560x1440@180, -1440x-600, 1, transform, 1'' - ''desc:LG Display 0x0665, preferred, 0x0, 1.25'' -] diff --git a/home/user/hypr/plugin.nix b/home/user/hypr/plugin.nix deleted file mode 100644 index 698bdac..0000000 --- a/home/user/hypr/plugin.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - # hyprtasking = { - # layout = "grid"; - # bg_color = "0xffebdbb2"; - # - # gap_size = 20; - # - # gestures = { - # enabled = true; - # open_fingers = 3; - # open_distance = 300; - # open_positive = true; - # }; - # - # linear = { - # height = 400; - # scroll_speed = 1.1; - # blur = 0; - # }; - # }; - - hyprwinrap = { - class = "kitty-bg"; - }; - - touch_gestures = { - sensitivity = 4.0; - workspace_swipe_fingers = 3; - workspace_swipe_edge = "d"; - long_press_delay = 400; - resize_on_border_long_press = true; - edge_margin = 10; - emulate_touchpad_swipe = false; - }; -} diff --git a/home/user/hypr/windowrule.nix b/home/user/hypr/windowrule.nix index 704f36c..3ee2615 100644 --- a/home/user/hypr/windowrule.nix +++ b/home/user/hypr/windowrule.nix @@ -1,7 +1,3 @@ -{ lib, settings }: -let - inherit (lib) optionalString; -in { windowrule = [ "pseudo, class:fcitx" @@ -42,38 +38,21 @@ in "float, class: ^(org.pulseaudio.pavucontrol)$" "pin, class: ^(org.pulseaudio.pavucontrol)$" "animation slide top 20%, class: ^(org.pulseaudio.pavucontrol)$" - (optionalString ( - settings.personal.hostname == "dn-pre7780" - ) "move 1680 59, class: ^(org.pulseaudio.pavucontrol)$") - (optionalString ( - settings.personal.hostname == "dn-pre7780" - ) "size 868 561, class: ^(org.pulseaudio.pavucontrol)$") # Local Send (File Sharing) "float, class: ^(localsend_app)$" "pin, class: ^(localsend_app)$" "animation slide right 20%, class: ^(localsend_app)$" - (optionalString ( - settings.personal.hostname == "dn-pre7780" - ) "size 523 1372, class: ^(localsend_app)$") - (optionalString ( - settings.personal.hostname == "dn-pre7780" - ) "move 2024 56, class: ^(localsend_app)$") # Airplay - "pseudo, class: ^(GStreamer)$" + "pin, class: ^(GStreamer)$" + "float, class: ^(GStreamer)$" "opacity 1.0, class: ^(GStreamer)$" - (optionalString (settings.personal.hostname == "dn-pre7780") "size 487 1055, class: ^(GStreamer)$") + "animation slide right 20%, class: ^(GStreamer)$" # Bluetooth "float, class: ^(blueberry.py)$" "pin, class: ^(blueberry.py)$" - (optionalString ( - settings.personal.hostname == "dn-pre7780" - ) "move 1943 59, class: ^(blueberry.py)$") - (optionalString ( - settings.personal.hostname == "dn-pre7780" - ) "size 605 763, class: ^(blueberry.py)$") "animation slide top 20%, class: ^(blueberry.py)$" # Steam @@ -90,8 +69,11 @@ in # VLC "workspace: 3, initialClass: ^(vlc), floating: 0" - # vesktop - "workspace: 4 silent, initialClass: ^(vesktop), floating: 0" + # discord + "workspace: 4 silent, initialClass: ^(discord), floating: 0" + + # Davinci resolve + "center 1, initialClass: ^(resolve), floating: 1" ]; layerrule = [ diff --git a/home/user/hypr/workspace.nix b/home/user/hypr/workspace.nix index 51fa387..728ca67 100644 --- a/home/user/hypr/workspace.nix +++ b/home/user/hypr/workspace.nix @@ -1,14 +1,20 @@ { monitors }: let - monitorNum = builtins.length monitors; + inherit (builtins) + length + genList + toString + elemAt + ; + monitorNum = length monitors; workspaceNum = 10; - workspaceList = builtins.genList ( + workspaceList = genList ( index: let currentNum = index - (monitorNum * (index / monitorNum)); default = if index < monitorNum then "true" else "false"; in - "${builtins.toString (index + 1)}, monitor:${builtins.elemAt monitors currentNum}, default:${default}" + "${toString (index + 1)}, monitor:${elemAt monitors currentNum}, default:${default}" ) workspaceNum; in if (monitorNum > 0) then workspaceList else [ ] diff --git a/home/user/hyprland.nix b/home/user/hyprland.nix index 6b696ea..7762da2 100644 --- a/home/user/hyprland.nix +++ b/home/user/hyprland.nix @@ -1,83 +1,81 @@ +{ + monitors ? [ ], +}: { pkgs, lib, inputs, config, system, + username, osConfig, - settings, ... }: let terminal = "ghostty"; - startScript = import ./hypr/exec.nix { - inherit - pkgs - terminal - ; - xcursor-size = settings.hyprland.xcursor-size; - }; - mainMod = "SUPER"; - window = import ./hypr/window.nix; - windowrule = import ./hypr/windowrule.nix { inherit lib settings; }; - input = import ./hypr/input.nix; - plugins = import ./hypr/plugin.nix; - cursorName = "catppuccin-macchiato-lavender-cursors"; - getCurrentSong = pkgs.writeShellScriptBin "getSong" '' + execOnceScript = pkgs.writeShellScript "hyprlandExecOnce" '' + # Fix nemo open in terminal + dconf write /org/cinnamon/desktop/applications/terminal/exec "''\'${terminal}''\'" & + dconf write /org/cinnamon/desktop/applications/terminal/exec-arg "''\'''\'" & + + systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP QT_QPA_PLATFORMTHEME & + ''; + + mainMod = "SUPER"; + + getCurrentSong = pkgs.writeShellScript "getSong" '' song_info=$(playerctl metadata --format '{{title}} 󰎆 {{artist}}') echo "$song_info" ''; - wallpapers = [ - (pkgs.fetchurl { - url = "https://files.net.dn/dennis-yu-fVadSuPPE8M-unsplash.jpg"; - hash = "sha256-YCusefLnTntOZAh2fIoWuJbm1+iE+RNeWTbn22UDjSU="; - }) - (pkgs.fetchurl { - url = "https://files.net.dn/karsten-winegeart-LZRZJam4Avg-unsplash.jpg"; - hash = "sha256-NpJhRJRiFCFmdDP/8FDmzIBellSdJ1Y6Pz63QJzkPMk="; - }) - (pkgs.fetchurl { - url = "https://files.net.dn/nick-design-q3s4a7FZgjY-unsplash.jpg"; - hash = "sha256-kJajqRuf+ZMTaORKKK4A+8MNzGd2SHjMcRYnq9T8LmA="; - }) - (pkgs.fetchurl { - url = "https://files.net.dn/oleg-demakov-zEIApnww3fU-unsplash.jpg"; - hash = "sha256-79JRnxJdCZOh2u8+5LcUDGjzwE1mMM2ZHrKLn36wd40="; - }) - "$HOME/.config/wallpapers/wall.png" - ]; + mkWall = pkgs.writeShellScriptBin "setWall" '' + url="$1" + filepath="/tmp/wall_cache/$(echo -n "$url" | base64 | tr -d '\n')" + + if [[ ! -f "$filepath" ]]; then + curl -sL "$url" -o "$filepath" + fi + + ${config.services.swww.package}/bin/swww img "$filepath" \ + --transition-fps 45 \ + --transition-duration 1 \ + --transition-type random + ''; + + rofiWall = pkgs.writeShellScript "rofiWall" '' + url=$(rofi -i -dmenu -config ~/.config/rofi/config.rasi -p "URL") + ${mkWall}/bin/setWall "$url" + ''; # Change Wallpaper - wallRand = pkgs.writeShellScriptBin "wallRand" ( - with builtins; - let - pathString = concatStringsSep " " (map (w: "\"" + w + "\"") wallpapers); - in - '' - wallpapers=( - ${pathString} - ) + wallRand = pkgs.writeShellScript "wallRand" '' + mapfile -t wallpapers < <(find /tmp/wall_cache -type f) - count="''${#wallpapers[@]}" - random_index=$(( RANDOM % count )) - selected="''${wallpapers[$random_index]}" + count="''${#wallpapers[@]}" - if [ ! -f "$selected" ]; then - echo "File not exist: $selected" - exit 1 - fi + random_index=$(( RANDOM % count )) + selected="''${wallpapers[$random_index]}" - ${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ",$selected" - '' - ); + if [ ! -f "$selected" ]; then + echo "File not exist: $selected" + exit 1 + fi + + ${config.services.swww.package}/bin/swww img $selected --transition-fps 45 --transition-duration 1 --transition-type random + ''; in { + # For wallpapers + systemd.user.tmpfiles.rules = [ + "d /tmp/wall_cache 700 ${username} -" + ]; + home.packages = with pkgs; [ mpvpaper # Video Wallpaper hyprcursor libnotify + mkWall ]; wayland.windowManager.hyprland = { @@ -102,30 +100,72 @@ in debug = { disable_logs = true; }; + bind = import ./hypr/bind.nix { - inherit settings; - inherit mainMod; - inherit pkgs; + inherit + mainMod + pkgs + monitors + rofiWall + ; nvidia-offload-enabled = osConfig.hardware.nvidia.prime.offload.enableOffloadCmd; }; - bindm = import ./hypr/bindm.nix { inherit mainMod; }; - binde = import ./hypr/binde.nix { inherit mainMod; }; - monitor = import ./hypr/monitor.nix; - plugin = plugins; - exec-once = [ ''${startScript}'' ]; + + bindm = [ + # Move/resize windows with mainMod + LMB/RMB and dragging + ''${mainMod}, mouse:272, movewindow'' + ''${mainMod}, mouse:273, resizewindow'' + ]; + + binde = + let + resizeStep = builtins.toString 20; + brightnessStep = builtins.toString 10; + volumeStep = builtins.toString 2; + in + [ + '',XF86AudioRaiseVolume, exec, wpctl set-mute @DEFAULT_SINK@ 0 && wpctl set-volume @DEFAULT_SINK@ ${volumeStep}%+'' + '',XF86AudioLowerVolume, exec, wpctl set-mute @DEFAULT_SINK@ 0 && wpctl set-volume @DEFAULT_SINK@ ${volumeStep}%-'' + '',XF86MonBrightnessDown, exec, brightnessctl set ${brightnessStep}%-'' + '',XF86MonBrightnessUp, exec, brightnessctl set ${brightnessStep}%+'' + ''${mainMod} CTRL, l, resizeactive, ${resizeStep} 0'' + ''${mainMod} CTRL, h, resizeactive, -${resizeStep} 0'' + ''${mainMod} CTRL, k, resizeactive, 0 -${resizeStep}'' + ''${mainMod} CTRL, j, resizeactive, 0 ${resizeStep}'' + ]; + + monitor = [ + ", prefered, 0x0, 1" + ]; + + plugin = { + hyprwinrap = { + class = "kitty-bg"; + }; + + touch_gestures = { + sensitivity = 4.0; + workspace_swipe_fingers = 3; + workspace_swipe_edge = "d"; + long_press_delay = 400; + resize_on_border_long_press = true; + edge_margin = 10; + emulate_touchpad_swipe = false; + }; + }; + + exec-once = [ "${execOnceScript}" ]; + env = [ - ''HYPRCURSOR_THEME, ${cursorName}'' - ''HYPRCURSOR_SIZE, ${builtins.toString settings.hyprland.cursor-size}'' - ''XCURSOR_THEME, ${cursorName}'' - ''XCURSOR_SIZE, ${builtins.toString settings.hyprland.xcursor-size}'' ''XDG_CURRENT_DESKTOP, Hyprland'' ''XDG_SESSION_DESKTOP, Hyprland'' ]; - workspace = import ./hypr/workspace.nix { monitors = settings.hyprland.monitors; }; + + workspace = (import ./hypr/workspace.nix { inherit monitors; }); } - // window - // windowrule - // input; + // (import ./hypr/window.nix) + // (import ./hypr/windowrule.nix) + // (import ./hypr/input.nix); }; # === gamemode === # @@ -135,11 +175,17 @@ in }; }; + # === Swww === # + services.swww = { + enable = true; + package = inputs.swww.packages.${system}.swww; + }; + # === hyprpaper === # services.hyprpaper = { - enable = true; + enable = false; settings = { - preload = wallpapers; + # preload = wallpapers; wallpaper = [ ", ~/.config/wallpapers/wall.png" ]; splash = false; ipc = "on"; @@ -161,11 +207,7 @@ in let font = "CaskaydiaCove Nerd Font"; font2 = "SF Pro Display Bold"; - mainMonitor = - if ((builtins.length settings.hyprland.monitors) > 0) then - builtins.elemAt settings.hyprland.monitors 0 - else - ""; + mainMonitor = if ((builtins.length monitors) > 0) then builtins.elemAt monitors 0 else ""; in { background = { @@ -226,7 +268,7 @@ in # Current Song { monitor = "${mainMonitor}"; - text = ''cmd[update:1000] echo "$(${getCurrentSong}/bin/getSong)"''; + text = ''cmd[update:1000] echo "$(${getCurrentSong})"''; color = "rgba(235, 219, 178, .75)"; font_size = 16; font_family = "${font}, ${font2}"; @@ -358,6 +400,7 @@ in terminal osConfig wallRand + rofiWall pkgs lib ; diff --git a/home/user/nvim.nix b/home/user/nvim.nix index 8d0951d..8da9fbb 100644 --- a/home/user/nvim.nix +++ b/home/user/nvim.nix @@ -1,7 +1,6 @@ { lib, pkgs, - settings, inputs, ... }: @@ -307,14 +306,6 @@ formatting = { command = { "nixfmt" }, }, - -- options = { - -- nixos = { - -- expr = '(builtins.getFlake ("git+file://" + toString ./.)).nixosConfigurations.${settings.personal.hostname}.options', - -- }, - -- home_manager = { - -- expr = '(builtins.getFlake ("git+file://" + toString ./.)).homeConfigurations."${settings.personal.username}@${settings.personal.hostname}".options', - -- } - -- } } } } diff --git a/home/user/packages.nix b/home/user/packages.nix index 2aa927c..38cbf59 100644 --- a/home/user/packages.nix +++ b/home/user/packages.nix @@ -52,7 +52,8 @@ in obsidian # Discord - vesktop + # vesktop + discord # Dev stuff (python3.withPackages (python-pkgs: [ diff --git a/home/user/shell.nix b/home/user/shell.nix index af621fe..ac4bf7f 100644 --- a/home/user/shell.nix +++ b/home/user/shell.nix @@ -1,6 +1,6 @@ -{ pkgs, settings, ... }: +{ osConfig, pkgs, ... }: let - shellAlias = import ./shellAlias.nix { hostname = settings.personal.hostname; }; + shellAlias = import ./shellAlias.nix { hostname = osConfig.networking.hostName; }; in { home.packages = with pkgs; [ diff --git a/pkgs/overlays/vesktop.nix b/pkgs/overlays/vesktop.nix index 781e3a0..fd93155 100644 --- a/pkgs/overlays/vesktop.nix +++ b/pkgs/overlays/vesktop.nix @@ -2,6 +2,11 @@ final: prev: let discordIcon = prev.lib.readFile ../../pkgs/assets/discord.svg; discordSplash = prev.lib.readFile ../../pkgs/assets/peepoLeave.gif.base64; + + hideChannels = prev.pkgs.fetchurl { + url = "https://raw.githubusercontent.com/Farcrada/DiscordPlugins/cf906b358eddfe75edba215e33020c234be514b7/Hide-Channels/HideChannels.plugin.js"; + hash = "sha256-JdwKnGHMtJU1hKRlx1TXSHWUA2hT5D6vw1Ez46Hhe5c="; + }; in { vesktop = prev.vesktop.overrideAttrs (oldAttrs: { @@ -12,6 +17,12 @@ in } ); + postPatch = '' + # Add plugins + mkdir -p src/userplugins + cp ${hideChannels} src/userplugins/hideChannels.js + ''; + patches = oldAttrs.patches ++ [ ../../pkgs/patches/splash.patch ]; diff --git a/system/dev/dn-lap/default.nix b/system/dev/dn-lap/default.nix index ce93bf6..d274f5a 100644 --- a/system/dev/dn-lap/default.nix +++ b/system/dev/dn-lap/default.nix @@ -1,7 +1,12 @@ { - settings, + username, ... }: +let + monitors = [ + ''desc:LG Display 0x0665'' + ]; +in { imports = [ ./hardware-configuration.nix @@ -17,18 +22,54 @@ ]; home-manager = { - users."${settings.personal.username}" = { + users."${username}" = { imports = [ ../../../home/presets/basic.nix (import ../../../home/user/bitwarden.nix { email = "danny@dn-server.net.dn"; baseUrl = "https://bitwarden.net.dn"; }) + + # Hyprland + (import ../../../home/user/hyprland.nix { inherit monitors; }) + { + wayland.windowManager.hyprland = { + settings = { + windowrulev2 = [ + # Meidia control + "move 1680 59, class: ^(org.pulseaudio.pavucontrol)$" + "size 868 561, class: ^(org.pulseaudio.pavucontrol)$" + + # Local Send (File Sharing) + "size 523 1372, class: ^(localsend_app)$" + "move 2024 56, class: ^(localsend_app)$" + + # Airplay + "size 487 1055, class: ^(GStreamer)$" + + # Bluetooth + "move 1943 59, class: ^(blueberry.py)$" + "size 605 763, class: ^(blueberry.py)$" + ]; + + monitors = [ + ''desc:LG Display 0x0665, preferred, 0x0, 1.25'' + ]; + }; + }; + + } + + # Git + (import ../../../home/user/git.nix { + inherit username; + email = "danny10132024@gmail.com"; + }) ]; }; }; - users.users."${settings.personal.username}".openssh.authorizedKeys.keys = [ + users.users."${username}".openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILSHkPa6vmr5WBPXAazY16+Ph1Mqv9E24uLIf32oC2oH danny@phone.dn" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJSAOufpee7f8D8ONIIGU3qsN+8+DGO7BfZnEOTYqtQ5 danny@pre7780.dn" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMj/LeB3i/vca3YwGNpAjf922FgiY2svro48fUSQAjOv Shortcuts on :D" diff --git a/system/dev/dn-pre7780/default.nix b/system/dev/dn-pre7780/default.nix index 4e030d9..9be60f9 100644 --- a/system/dev/dn-pre7780/default.nix +++ b/system/dev/dn-pre7780/default.nix @@ -1,22 +1,42 @@ { pkgs, - settings, + username, + config, + lib, ... }: +let + monitors = [ + "desc:ASUSTek COMPUTER INC ASUS VG32VQ1B 0x00002271" + "desc:Acer Technologies XV272U V3 1322131231233" + ]; +in { + networking.firewall.allowedTCPPortRanges = [ + { + from = 8000; + to = 8100; + } + ]; + + hardware.nvidia.package = lib.mkForce config.boot.kernelPackages.nvidiaPackages.stable; + imports = [ - (import ../../modules/nvidia.nix { - nvidia-mode = settings.nvidia.mode; - intel-bus-id = settings.nvidia.intel-bus-id; - nvidia-bus-id = settings.nvidia.nvidia-bus-id; - }) ./hardware-configuration.nix - ./boot.nix - ./sops-conf.nix ../../modules/presets/basic.nix + + # Nvidia GPU Driver + (import ../../modules/nvidia.nix { + nvidia-mode = "offload"; + intel-bus-id = "PCI:0:2:0"; + nvidia-bus-id = "PCI:1:0:0"; + }) + + ./boot.nix # Extra Boot Options + ./sops-conf.nix # Secret ../../modules/gaming.nix # ../../modules/secure-boot.nix - ../../modules/virtualization.nix + (import ../../modules/virtualization.nix { inherit username; }) ../../modules/wine.nix ../../modules/wireguard.nix ../../modules/localsend.nix @@ -27,16 +47,24 @@ "192.168.0.0/24" ]; }) + + ../../modules/davinci-resolve.nix + ../../modules/webcam.nix + ./nginx.nix ]; home-manager = { - users."${settings.personal.username}" = { + users."${username}" = { imports = [ ../../../home/presets/basic.nix + + # Bitwarden client (import ../../../home/user/bitwarden.nix { email = "danny@net.dn"; baseUrl = "https://bitwarden.net.dn"; }) + + # Proton GE { home.file.".steam/root/compatibilitytools.d/GE-Proton10-10" = { source = fetchTarball { @@ -45,16 +73,55 @@ }; }; } + + # Hyprland + (import ../../../home/user/hyprland.nix { inherit monitors; }) + { + wayland.windowManager.hyprland = { + settings = { + windowrulev2 = [ + # Meidia control + "move 1680 59, class: ^(org.pulseaudio.pavucontrol)$" + "size 868 561, class: ^(org.pulseaudio.pavucontrol)$" + + # Local Send (File Sharing) + "size 523 1372, class: ^(localsend_app)$" + "move 2024 56, class: ^(localsend_app)$" + + # Airplay + "size 487 1055, class: ^(GStreamer)$" + "move 2061 203, class: ^(GStreamer)$" + + # Bluetooth + "move 1943 59, class: ^(blueberry.py)$" + "size 605 763, class: ^(blueberry.py)$" + ]; + + monitor = [ + ''desc:ASUSTek COMPUTER INC ASUS VG32VQ1B 0x00002271, 2560x1440@165, 0x0, 1'' + ''desc:Acer Technologies XV272U V3 1322131231233, 2560x1440@180, -1440x-600, 1, transform, 1'' + ]; + }; + }; + } + + # Git + (import ../../../home/user/git.nix { + inherit username; + email = "danny10132024@gmail.com"; + }) + ]; }; }; environment.systemPackages = with pkgs; [ rustdesk + blender ]; users.users = { - "${settings.personal.username}" = { + ${username} = { openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJFQA42R3fZmjb9QnUgzzOTIXQBC+D2ravE/ZLvdjoOQ danny@lap.dn" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILSHkPa6vmr5WBPXAazY16+Ph1Mqv9E24uLIf32oC2oH danny@phone.dn" diff --git a/system/dev/dn-pre7780/nginx.nix b/system/dev/dn-pre7780/nginx.nix new file mode 100644 index 0000000..40a87bd --- /dev/null +++ b/system/dev/dn-pre7780/nginx.nix @@ -0,0 +1,24 @@ +{ ... }: +{ + security.acme = { + acceptTerms = true; + defaults = { + validMinDays = 2; + server = "https://10.0.0.1:${toString 8443}/acme/acme/directory"; + renewInterval = "daily"; + email = "danny@net.dn"; + webroot = "/var/lib/acme/acme-challenge"; + }; + }; + + users.users.nginx.extraGroups = [ "acme" ]; + + services.nginx = { + enable = true; + enableReload = true; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedTlsSettings = true; + recommendedProxySettings = true; + }; +} diff --git a/system/dev/dn-server/default.nix b/system/dev/dn-server/default.nix index c75e737..5cb7704 100644 --- a/system/dev/dn-server/default.nix +++ b/system/dev/dn-server/default.nix @@ -1,15 +1,15 @@ { pkgs, inputs, - settings, + username, ... }: { imports = [ (import ../../modules/nvidia.nix { - nvidia-mode = settings.nvidia.mode; - intel-bus-id = settings.nvidia.intel-bus-id; - nvidia-bus-id = settings.nvidia.nvidia-bus-id; + nvidia-mode = "offload"; + intel-bus-id = "PCI:0:2:0"; + nvidia-bus-id = "PCI:1:0:0"; }) ./sops-conf.nix ./boot.nix @@ -41,7 +41,7 @@ ]; home-manager = { - users."${settings.personal.username}" = { + users."${username}" = { imports = [ ../../../home/user/config.nix ../../../home/user/direnv.nix @@ -61,6 +61,12 @@ )) ]; } + + # Git + (import ../../../home/user/git.nix { + inherit username; + email = "danny10132024@gmail.com"; + }) ]; }; }; diff --git a/system/dev/dn-server/services.nix b/system/dev/dn-server/services.nix index be0b632..86bf322 100644 --- a/system/dev/dn-server/services.nix +++ b/system/dev/dn-server/services.nix @@ -1,13 +1,14 @@ { - settings, config, pkgs, lib, + username, ... }: let - username = settings.personal.username; + inherit username; + ethInterface = "enp0s31f6"; sshPorts = [ 30072 ]; sshPortsString = builtins.concatStringsSep ", " (builtins.map (p: builtins.toString p) sshPorts); diff --git a/system/modules/airplay.nix b/system/modules/airplay.nix index 30dc3e6..ede4755 100644 --- a/system/modules/airplay.nix +++ b/system/modules/airplay.nix @@ -29,7 +29,7 @@ in after = [ "networking-online.target" ]; serviceConfig = { ExecStart = "${pkgs.uxplay}/bin/uxplay ${ - optionalString (hostname != null) "-n ${hostname} -nh -hls 3" + optionalString (hostname != null) "-n ${hostname} -fs -fps 60 -nh" } -p"; }; }; diff --git a/system/modules/davinci-resolve.nix b/system/modules/davinci-resolve.nix new file mode 100644 index 0000000..2d7f618 --- /dev/null +++ b/system/modules/davinci-resolve.nix @@ -0,0 +1,31 @@ +{ + pkgs, + username, + ... +}: +let + scriptBin = pkgs.writeShellScriptBin "davinci-resolve" '' + ROC_ENABLE_PRE_VEGA=1 RUSTICL_ENABLE=amdgpu,amdgpu-pro,radv,radeon DRI_PRIME=1 QT_QPA_PLATFORM=xcb ${pkgs.davinci-resolve}/bin/davinci-resolve + ''; +in +{ + environment.systemPackages = [ + scriptBin + ]; + + home-manager.users."${username}" = { + xdg.desktopEntries."davindi-resolve" = { + name = "Davinci Resolve"; + genericName = "Video Editor"; + exec = "${scriptBin}/bin/davinci-resolve"; + icon = "${pkgs.davinci-resolve}/share/icons/hicolor/128x128/apps/davinci-resolve.png"; + comment = "Professional video editing, color, effects and audio post-processing"; + categories = [ + "AudioVideo" + "AudioVideoEditing" + "Video" + "Graphics" + ]; + }; + }; +} diff --git a/system/modules/obs-studio.nix b/system/modules/obs-studio.nix index 8882348..69abbf0 100644 --- a/system/modules/obs-studio.nix +++ b/system/modules/obs-studio.nix @@ -3,7 +3,7 @@ programs = { obs-studio = { enable = true; - enableVirtualCamera = true; + enableVirtualCamera = false; # Handled by webcam.nix plugins = with pkgs.obs-studio-plugins; [ wlrobs obs-backgroundremoval diff --git a/system/modules/presets/minimal.nix b/system/modules/presets/minimal.nix index 677efc6..c41a8f1 100644 --- a/system/modules/presets/minimal.nix +++ b/system/modules/presets/minimal.nix @@ -17,5 +17,6 @@ ../tmux.nix ../ca.nix ../sops-nix.nix + ../gc.nix ]; } diff --git a/system/modules/services.nix b/system/modules/services.nix index d54b72d..cd7ab9d 100644 --- a/system/modules/services.nix +++ b/system/modules/services.nix @@ -1,7 +1,7 @@ { - settings, lib, pkgs, + username, ... }: @@ -19,12 +19,13 @@ enable = true; packages = [ pkgs.gcr ]; }; + openssh = { enable = true; ports = [ 22 ]; settings = { PasswordAuthentication = lib.mkDefault false; - AllowUsers = lib.mkDefault [ settings.personal.username ]; + AllowUsers = lib.mkDefault [ username ]; UseDns = lib.mkDefault true; PermitRootLogin = lib.mkDefault "no"; }; diff --git a/system/modules/users.nix b/system/modules/users.nix index b8d0ec1..a84e211 100644 --- a/system/modules/users.nix +++ b/system/modules/users.nix @@ -1,13 +1,12 @@ { - settings, pkgs, - lib, config, + username, ... }: { - users.users.${settings.personal.username} = { + users.users.${username} = { isNormalUser = true; shell = pkgs.bash; # Actually fish extraGroups = ( diff --git a/system/modules/virtualization.nix b/system/modules/virtualization.nix index 845a6e8..26159ee 100644 --- a/system/modules/virtualization.nix +++ b/system/modules/virtualization.nix @@ -1,5 +1,5 @@ +{ username }: { - settings, pkgs, config, ... @@ -7,7 +7,7 @@ { programs.virt-manager.enable = true; - users.groups.libvirtd.members = [ settings.personal.username ]; + users.groups.libvirtd.members = [ username ]; virtualisation = { docker.enable = true; diff --git a/system/modules/webcam.nix b/system/modules/webcam.nix new file mode 100644 index 0000000..3387026 --- /dev/null +++ b/system/modules/webcam.nix @@ -0,0 +1,17 @@ +# Use WebRTC to stream +{ pkgs, config, ... }: +{ + environment.systemPackages = with pkgs; [ + ffmpeg + v4l-utils + ]; + + boot = { + kernelModules = [ "v4l2loopback" ]; + extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ]; + }; + + boot.extraModprobeConfig = '' + options v4l2loopback devices=2 video_nr=1,2 card_label="OBS Cam","phone webRTC cam" exclusive_caps=1,1 + ''; +}