From 2defd19b2d5436387dad3977a3129427be1afa90 Mon Sep 17 00:00:00 2001 From: Nydragon Date: Sun, 15 Dec 2024 15:39:25 +0100 Subject: [PATCH] chore: stuff --- home/graphical/cliphist.nix | 25 --- home/graphical/default.nix | 1 - home/graphical/swww.nix | 2 +- home/rofi/default.nix | 62 +++--- home/sway/default.nix | 413 ++++++++++++++++++------------------ hosts/marr/default.nix | 5 + options/default.nix | 1 + options/fs.nix | 22 ++ 8 files changed, 267 insertions(+), 264 deletions(-) delete mode 100644 home/graphical/cliphist.nix create mode 100644 options/fs.nix diff --git a/home/graphical/cliphist.nix b/home/graphical/cliphist.nix deleted file mode 100644 index 4e173da..0000000 --- a/home/graphical/cliphist.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - pkgs, - lib, - osConfig, - ... -}: -let - cfg = osConfig.modules.services.cliphist; - exec = pkgs.writers.writeBash "rofi-cliphist" { - makeWrapperArgs = [ - "--prefix" - "PATH" - ":" - "${lib.makeBinPath [ pkgs.cliphist ]}" - ]; - } "cliphist-rofi-img"; -in -{ - config = lib.mkIf cfg.enable { - programs.rofi = { - enable = true; - extraConfig.modes = [ "clipboard:${exec}" ]; - }; - }; -} diff --git a/home/graphical/default.nix b/home/graphical/default.nix index a2ca96f..6c9b64e 100644 --- a/home/graphical/default.nix +++ b/home/graphical/default.nix @@ -7,7 +7,6 @@ ./gammastep.nix # default because I need to protect my peepers ./swww.nix ./keepassxc.nix - ./cliphist.nix ./swayidle.nix ./swaylock.nix ]; diff --git a/home/graphical/swww.nix b/home/graphical/swww.nix index 65c38a5..86a7218 100644 --- a/home/graphical/swww.nix +++ b/home/graphical/swww.nix @@ -21,8 +21,8 @@ } -t wipe --transition-fps 144"; Restart = "on-failure"; - ProtectHome = "readonly"; BindPaths = "/run/user /home/${config.home.username}/.cache/swww"; + TemporaryFileSystem = "/home /run/user /root"; ProtectProc = "noaccess"; RestrictNamespaces = true; CapabilityBoundingSet = ""; diff --git a/home/rofi/default.nix b/home/rofi/default.nix index 8073a36..6356354 100644 --- a/home/rofi/default.nix +++ b/home/rofi/default.nix @@ -5,39 +5,35 @@ osConfig, ... }: +let + conf = "${config.home.homeDirectory}/.config/rofi"; +in lib.mkIf config.programs.rofi.enable { - programs.rofi = - let - conf = "${config.home.homeDirectory}/.config/rofi"; - in - rec { - package = pkgs.rofi-wayland.override { inherit plugins; }; - plugins = [ pkgs.rofi-calc ]; - theme = "${conf}/themes/rounded-gray-dark.rasi"; - terminal = lib.my.getExe osConfig.modules.system.roles.desktop.terminal; - extraConfig = { - modes = [ - "combi" - "filebrowser" - "ssh" - "drun" - "run" - # WARNING: ABI version mismatch - # "calc" - "clipboard:${lib.my.getExe' pkgs.cliphist "cliphist-rofi-img"}" - ]; - matching = "fuzzy"; - sort = true; - sorting-method = "fzf"; - show-icons = true; - steal-focus = true; - drun-use-desktop-cache = true; - drun-reload-desktop-cache = true; - combi-modes = [ - "window" - "drun" - "obsidian" - ]; - }; + programs.rofi = { + package = pkgs.rofi-wayland; + theme = "${conf}/themes/rounded-gray-dark.rasi"; + terminal = lib.my.getExe osConfig.modules.system.roles.desktop.terminal; + extraConfig = { + modes = [ + "combi" + "filebrowser" + "ssh" + "drun" + "run" + "clipboard:${lib.my.getExe' pkgs.cliphist "cliphist-rofi-img"}" + ]; + matching = "fuzzy"; + sort = true; + sorting-method = "fzf"; + show-icons = true; + steal-focus = true; + drun-use-desktop-cache = true; + drun-reload-desktop-cache = true; + combi-modes = [ + "window" + "drun" + "obsidian" + ]; }; + }; } diff --git a/home/sway/default.nix b/home/sway/default.nix index bbe500f..00d6485 100644 --- a/home/sway/default.nix +++ b/home/sway/default.nix @@ -7,221 +7,226 @@ ... }: let - inherit (lib) mapAttrs; + inherit (lib) mapAttrs mkIf; + inherit (lib.my) getExe getExe'; + desktop = osConfig.modules.system.roles.desktop; term = lib.my.getExe desktop.terminal; filemanager = lib.my.getExe desktop.filemanager; + cliphistEnabled = osConfig.modules.services.cliphist.enable; + + colors = { + lavender = "#babbf1"; + black = "#000000"; + }; + + inputs = { + kb = { + builtin = "1:1:AT_Translated_Set_2_keyboard"; + keychron = "1452:591:Keychron_K4_Keychron_K4"; + keychron_bt = "1452:591:Keychron_K4"; + }; + }; + + mkRegexList = list: "^(${(lib.strings.concatStringsSep "|" list)})$"; in lib.mkIf osConfig.programs.sway.enable { - services.swayidle.enable = true; programs.hyprlock.enable = true; - wayland.windowManager.sway = - let - colors = { - lavender = "#babbf1"; - black = "#000000"; - }; - inputs = { - kb = { - builtin = "1:1:AT_Translated_Set_2_keyboard"; - keychron = "1452:591:Keychron_K4_Keychron_K4"; - keychron_bt = "1452:591:Keychron_K4"; - }; - }; - mkRegexList = list: "^(${(lib.strings.concatStringsSep "|" list)})$"; - in - { - enable = true; - xwayland = true; - wrapperFeatures.gtk = true; - extraConfigEarly = '' - exec systemctl --user import-environment PATH && systemctl --user restart xdg-desktop-portal.service - ''; - extraConfig = '' - titlebar_padding 1 - floating_modifier Mod4 normal - bindgesture { - swipe:right workspace prev - swipe:left workspace next - swipe:up focus up - swipe:down focus down - } - workspace 1 - font pango:monospace 0.001 - ''; - config = { - modifier = "Mod4"; - bars = [ ]; - #: Keybindings {{{ - keybindings = - let - mod = config.wayland.windowManager.sway.config.modifier; - in - lib.mkOptionDefault { - "${mod}+p" = "exec ${pkgs.hyprlock}/bin/hyprlock"; + wayland.windowManager.sway = { + enable = true; + xwayland = true; + wrapperFeatures.gtk = true; + extraConfigEarly = '' + exec systemctl --user import-environment PATH && systemctl --user restart xdg-desktop-portal.service + ''; + extraConfig = '' + titlebar_padding 1 + floating_modifier Mod4 normal + bindgesture { + swipe:right workspace prev + swipe:left workspace next + swipe:up focus up + swipe:down focus down + } + workspace 1 + font pango:monospace 0.001 + ''; + config = { + modifier = "Mod4"; + bars = [ ]; + #: Keybindings {{{ + keybindings = + let + mod = config.wayland.windowManager.sway.config.modifier; + in + lib.mkOptionDefault { + "${mod}+p" = "exec ${pkgs.hyprlock}/bin/hyprlock"; - "${mod}+Shift+p" = "exec rofi -show p -modi p:${pkgs.rofi-power-menu}/bin/rofi-power-menu"; - # Reload the config file - "${mod}+Shift+c" = "reload"; - # Kill the focused window - "${mod}+Shift+q" = "kill"; - # Make focused window fullscreen - "${mod}+f" = "fullscreen"; - # Start launcher - "${mod}+d" = "exec ${pkgs.fuzzel}/bin/fuzzel"; - "${mod}+s" = "exec rofi -show clipboard -show-icons"; - # Toggle the current focus between tiling and floating mode - "${mod}+Shift+space" = "floating toggle"; - "${mod}+Return" = "exec ${term}"; - "${mod}+e" = "exec ${filemanager}"; - "${mod}+x" = "layout toggle tabbed split"; - "${mod}+Control+Left" = "workspace prev"; - "${mod}+Control+Right" = "workspace next"; - "${mod}+n" = "exec nysh msg dash toggle"; - "--locked XF86MonBrightnessUp" = - "exec --no-startup-id ${pkgs.brightnessctl}/bin/brightnessctl s +10%"; - "--locked XF86MonBrightnessDown" = - "exec --no-startup-id ${pkgs.brightnessctl}/bin/brightnessctl s 10%-"; - "--locked XF86AudioRaiseVolume" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -i 5"; - "--locked XF86AudioLowerVolume" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -d 5"; - "--locked XF86AudioMicMute" = - "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer --default-source -m"; - "--locked XF86AudioMute" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t"; - "--locked XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; - "--locked XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; - "--locked XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; - "--locked XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; - "${mod}+u" = - "exec ${pkgs.hyprshot}/bin/hyprshot -o ${config.xdg.userDirs.pictures}/screenshots -m region"; - "${mod}+Shift+u" = - "exec ${pkgs.hyprshot}/bin/hyprshot --raw -m region | ${pkgs.satty}/bin/satty -f - --fullscreen"; + "${mod}+Shift+p" = "exec rofi -show p -modi p:${pkgs.rofi-power-menu}/bin/rofi-power-menu"; + # Reload the config file + "${mod}+Shift+c" = "reload"; + # Kill the focused window + "${mod}+Shift+q" = "kill"; + # Make focused window fullscreen + "${mod}+f" = "fullscreen"; + # Start launcher + "${mod}+d" = "exec ${pkgs.fuzzel}/bin/fuzzel"; + "${mod}+s" = + let + cliphist = getExe pkgs.cliphist; + fuzzel = getExe pkgs.fuzzel; + copy = getExe' pkgs.wl-clipboard "wl-copy"; + in + mkIf cliphistEnabled "exec ${cliphist} list | ${fuzzel} --dmenu | ${cliphist} decode | ${copy}"; + # Toggle the current focus between tiling and floating mode + "${mod}+Shift+space" = "floating toggle"; + "${mod}+Return" = "exec ${term}"; + "${mod}+e" = "exec ${filemanager}"; + "${mod}+x" = "layout toggle tabbed split"; + "${mod}+Control+Left" = "workspace prev"; + "${mod}+Control+Right" = "workspace next"; + "${mod}+n" = "exec nysh msg dash toggle"; + "--locked XF86MonBrightnessUp" = "exec --no-startup-id ${getExe pkgs.brightnessctl} s +10%"; + "--locked XF86MonBrightnessDown" = "exec --no-startup-id ${getExe pkgs.brightnessctl} s 10%-"; + "--locked XF86AudioRaiseVolume" = "exec --no-startup-id ${getExe pkgs.pamixer} -i 5"; + "--locked XF86AudioLowerVolume" = "exec --no-startup-id ${getExe pkgs.pamixer} -d 5"; + "--locked XF86AudioMicMute" = "exec --no-startup-id ${getExe pkgs.pamixer} --default-source -m"; + "--locked XF86AudioMute" = "exec --no-startup-id ${pkgs.pamixer}/bin/pamixer -t"; + "--locked XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + "--locked XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; + "--locked XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; + "--locked XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; + "${mod}+u" = + "exec ${getExe pkgs.hyprshot} -o ${config.xdg.userDirs.pictures}/screenshots -m region"; + "${mod}+Shift+u" = + "exec ${getExe pkgs.hyprshot} --raw -m region | ${getExe pkgs.satty} -f - --fullscreen"; - #: Workspace movement {{{ - "--input-device=${inputs.kb.builtin} ${mod}+ampersand" = "workspace number 1"; - "--input-device=${inputs.kb.builtin} ${mod}+eacute" = "workspace number 2"; - "--input-device=${inputs.kb.builtin} ${mod}+quotedbl" = "workspace number 3"; - "--input-device=${inputs.kb.builtin} ${mod}+apostrophe" = "workspace number 4"; - "--input-device=${inputs.kb.builtin} ${mod}+parenleft" = "workspace number 5"; - "--input-device=${inputs.kb.builtin} ${mod}+minus" = "workspace number 6"; - "--input-device=${inputs.kb.builtin} ${mod}+egrave" = "workspace number 7"; - "--input-device=${inputs.kb.builtin} ${mod}+underscore" = "workspace number 8"; - "--input-device=${inputs.kb.builtin} ${mod}+ccedilla" = "workspace number 9"; - "--input-device=${inputs.kb.builtin} ${mod}+agrave" = "workspace number 10"; - "--input-device=${inputs.kb.builtin} ${mod}+Shift+ampersand" = - "move container to workspace number 1"; - "--input-device=${inputs.kb.builtin} ${mod}+Shift+eacute" = "move container to workspace number 2"; - "--input-device=${inputs.kb.builtin} ${mod}+Shift+quotedbl" = - "move container to workspace number 3"; - "--input-device=${inputs.kb.builtin} ${mod}+Shift+apostrophe" = - "move container to workspace number 4"; - "--input-device=${inputs.kb.builtin} ${mod}+Shift+parenleft" = - "move container to workspace number 5"; - "--input-device=${inputs.kb.builtin} ${mod}+Shift+minus" = "move container to workspace number 6"; - "--input-device=${inputs.kb.builtin} ${mod}+Shift+egrave" = "move container to workspace number 7"; - "--input-device=${inputs.kb.builtin} ${mod}+Shift+underscore" = - "move container to workspace number 8"; - "--input-device=${inputs.kb.builtin} ${mod}+Shift+ccedilla" = - "move container to workspace number 9"; - "--input-device=${inputs.kb.builtin} ${mod}+Shift+agrave" = "move container to workspace number 10"; - #: }}} - }; - #: }}} - assigns = { - "2" = [ { app_id = "firefox"; } ]; - "3" = [ { app_id = "obsidian"; } ]; - "4" = [ - { class = "discord"; } - { app_id = "com.discordapp.Discord"; } - ]; - "5" = [ { app_id = "lollypop"; } ]; + #: Workspace movement {{{ + "--input-device=${inputs.kb.builtin} ${mod}+ampersand" = "workspace number 1"; + "--input-device=${inputs.kb.builtin} ${mod}+eacute" = "workspace number 2"; + "--input-device=${inputs.kb.builtin} ${mod}+quotedbl" = "workspace number 3"; + "--input-device=${inputs.kb.builtin} ${mod}+apostrophe" = "workspace number 4"; + "--input-device=${inputs.kb.builtin} ${mod}+parenleft" = "workspace number 5"; + "--input-device=${inputs.kb.builtin} ${mod}+minus" = "workspace number 6"; + "--input-device=${inputs.kb.builtin} ${mod}+egrave" = "workspace number 7"; + "--input-device=${inputs.kb.builtin} ${mod}+underscore" = "workspace number 8"; + "--input-device=${inputs.kb.builtin} ${mod}+ccedilla" = "workspace number 9"; + "--input-device=${inputs.kb.builtin} ${mod}+agrave" = "workspace number 10"; + "--input-device=${inputs.kb.builtin} ${mod}+Shift+ampersand" = + "move container to workspace number 1"; + "--input-device=${inputs.kb.builtin} ${mod}+Shift+eacute" = "move container to workspace number 2"; + "--input-device=${inputs.kb.builtin} ${mod}+Shift+quotedbl" = + "move container to workspace number 3"; + "--input-device=${inputs.kb.builtin} ${mod}+Shift+apostrophe" = + "move container to workspace number 4"; + "--input-device=${inputs.kb.builtin} ${mod}+Shift+parenleft" = + "move container to workspace number 5"; + "--input-device=${inputs.kb.builtin} ${mod}+Shift+minus" = "move container to workspace number 6"; + "--input-device=${inputs.kb.builtin} ${mod}+Shift+egrave" = "move container to workspace number 7"; + "--input-device=${inputs.kb.builtin} ${mod}+Shift+underscore" = + "move container to workspace number 8"; + "--input-device=${inputs.kb.builtin} ${mod}+Shift+ccedilla" = + "move container to workspace number 9"; + "--input-device=${inputs.kb.builtin} ${mod}+Shift+agrave" = "move container to workspace number 10"; + #: }}} }; - seat = { - "*" = { - xcursor_theme = "${config.home.pointerCursor.name} ${toString config.home.pointerCursor.size}"; - keyboard_grouping = "none"; - }; - }; - window = { - border = 3; - commands = [ - { - command = "inhibit_idle fullscreen"; - criteria = { - class = "^.*$"; - app_id = "^.*$"; - }; - } - { - command = "floating enable"; - criteria.app_id = mkRegexList [ - "org.keepassxc.KeePassXC" - "xdg-desktop-portal-gtk" - "org.kde.polkit-kde-authentication-agent-1" - "com.nextcloud.desktopclient.nextcloud" - "org.kde.kdeconnect.daemon" - ]; - } - { - # Make it clear which window runs using xwayland - command = ''title_format "[XWayland] %title"''; - criteria.shell = "xwayland"; - } - { - # Nextcloud closes when its not focused, thus moving the mouse over any other window will close it - command = "move position mouse"; - criteria.app_id = "com.nextcloud.desktopclient.nextcloud"; - } - ]; - }; - terminal = "${term}"; - colors = with colors; { - focused = { - border = lavender; - background = lavender; - text = black; - indicator = "#00d4ff"; - childBorder = lavender; - }; - }; - gaps = { - inner = 5; - }; - #: Input {{{ - input = { - "*" = { - xkb_layout = "fr,us"; - xkb_options = "grp:alt_shift_toggle,compose:caps"; - xkb_numlock = "enabled"; - }; - "${inputs.kb.builtin}" = { - xkb_layout = "fr"; - }; - "${inputs.kb.keychron}" = { - xkb_layout = "us"; - }; - "${inputs.kb.keychron_bt}" = { - xkb_layout = "us"; - }; - "7504:24926:ZMK_Project_TOTEM_Keyboard" = { - xkb_layout = "us"; - }; - "type:touchpad" = { - tap = "enabled"; - natural_scroll = "enabled"; - click_method = "clickfinger"; - }; - }; - #: }}} - #: Output {{{ - output = mapAttrs (name: value: { - scale = toString value.scale; - pos = "${toString value.posX} ${toString value.posY}"; - res = "${toString value.resX}x${toString value.resY}"; - adaptive_sync = "on"; - }) osConfig.modules.system.outputs; - #: }}} + #: }}} + assigns = { + "2" = [ { app_id = "firefox"; } ]; + "3" = [ { app_id = "obsidian"; } ]; + "4" = [ + { class = "discord"; } + { app_id = "com.discordapp.Discord"; } + ]; + "5" = [ { app_id = "lollypop"; } ]; }; + seat = { + "*" = { + xcursor_theme = "${config.home.pointerCursor.name} ${toString config.home.pointerCursor.size}"; + keyboard_grouping = "none"; + }; + }; + window = { + border = 3; + commands = [ + { + command = "inhibit_idle fullscreen"; + criteria = { + class = "^.*$"; + app_id = "^.*$"; + }; + } + { + command = "floating enable"; + criteria.app_id = mkRegexList [ + "org.keepassxc.KeePassXC" + "xdg-desktop-portal-gtk" + "org.kde.polkit-kde-authentication-agent-1" + "com.nextcloud.desktopclient.nextcloud" + "org.kde.kdeconnect.daemon" + ]; + } + { + # Make it clear which window runs using xwayland + command = ''title_format "[XWayland] %title"''; + criteria.shell = "xwayland"; + } + { + # Nextcloud closes when its not focused, thus moving the mouse over any other window will close it + command = "move position mouse"; + criteria.app_id = "com.nextcloud.desktopclient.nextcloud"; + } + ]; + }; + terminal = "${term}"; + colors = with colors; { + focused = { + border = lavender; + background = lavender; + text = black; + indicator = "#00d4ff"; + childBorder = lavender; + }; + }; + gaps = { + inner = 5; + }; + #: Input {{{ + input = { + "*" = { + xkb_layout = "fr,us"; + xkb_options = "grp:alt_shift_toggle,compose:caps"; + xkb_numlock = "enabled"; + }; + "${inputs.kb.builtin}" = { + xkb_layout = "fr"; + }; + "${inputs.kb.keychron}" = { + xkb_layout = "us"; + }; + "${inputs.kb.keychron_bt}" = { + xkb_layout = "us"; + }; + "7504:24926:ZMK_Project_TOTEM_Keyboard" = { + xkb_layout = "us"; + }; + "type:touchpad" = { + tap = "enabled"; + natural_scroll = "enabled"; + click_method = "clickfinger"; + }; + }; + #: }}} + #: Output {{{ + output = mapAttrs (name: value: { + scale = toString value.scale; + pos = "${toString value.posX} ${toString value.posY}"; + res = "${toString value.resX}x${toString value.resY}"; + adaptive_sync = "on"; + }) osConfig.modules.system.outputs; + #: }}} }; + }; } diff --git a/hosts/marr/default.nix b/hosts/marr/default.nix index d321217..8d6cd5e 100644 --- a/hosts/marr/default.nix +++ b/hosts/marr/default.nix @@ -15,6 +15,7 @@ modules = { media.enableAll = true; + fs.nfsEnable = true; system = { roles.desktop.enable = true; @@ -179,6 +180,10 @@ xdg-utils brightnessctl pop-icon-theme + + bottles + wine64 + ghidra ]; system.stateVersion = "24.11"; diff --git a/options/default.nix b/options/default.nix index b445ed7..d8ad863 100644 --- a/options/default.nix +++ b/options/default.nix @@ -1,6 +1,7 @@ { imports = [ ./media.nix + ./fs.nix ./services ./system diff --git a/options/fs.nix b/options/fs.nix new file mode 100644 index 0000000..8b40229 --- /dev/null +++ b/options/fs.nix @@ -0,0 +1,22 @@ +{ + config, + pkgs, + lib, + ... +}: +let + inherit (lib) mkIf mkEnableOption optional; + + cfg = config.modules.fs; +in +{ + options.modules.fs = { + nfsEnable = mkEnableOption "nfs"; + }; + + config = { + services.rpcbind.enable = mkIf cfg.nfsEnable true; + + environment.systemPackages = optional cfg.nfsEnable pkgs.nfs-utils; + }; +}