diff --git a/modules/applications/gtk/home.nix b/modules/applications/gtk/home.nix new file mode 100644 index 0000000..d93373f --- /dev/null +++ b/modules/applications/gtk/home.nix @@ -0,0 +1,18 @@ +{ pkgs, ... }: +{ + gtk = { + enable = true; + theme = { + name = "Dracula"; + package = pkgs.dracula-theme; + }; + cursorTheme = { + package = pkgs.adwaita-icon-theme; + name = "Adwaita"; + }; + iconTheme = { + package = pkgs.papirus-icon-theme; + name = "Papirus-Dark"; + }; + }; +} diff --git a/modules/applications/gtk/nixos.nix b/modules/applications/gtk/nixos.nix new file mode 100644 index 0000000..e89ea5e --- /dev/null +++ b/modules/applications/gtk/nixos.nix @@ -0,0 +1,5 @@ +{ + programs.dconf.enable = true; + programs.seahorse.enable = true; + services.gnome.gnome-keyring.enable = true; +} diff --git a/modules/applications/niri/home.nix b/modules/applications/niri/home.nix new file mode 100644 index 0000000..c2b145e --- /dev/null +++ b/modules/applications/niri/home.nix @@ -0,0 +1,189 @@ +{ lib, pkgs, ... }: +let + keybindings = import ./keybindings.nix; +in +{ + programs.niri.settings = { + input = { + touchpad = { + natural-scroll = true; + scroll-factor = 4.0; + scroll-method = "two-finger"; + click-method = "clickfinger"; + drag = true; + drag-lock = true; + }; + + keyboard.xkb = { + layout = "jp"; + options = "ctrl:nocaps"; + }; + + mouse = { + accel-profile = "flat"; + accel-speed = -0.1; + }; + + warp-mouse-to-focus.enable = true; + focus-follows-mouse = { + enable = true; + max-scroll-amount = "0%"; + }; + }; + + cursor.size = 16; + + layout = { + focus-ring = { + active.color = "#bd93f9"; + inactive.color = "#6272a4"; + }; + border = { + active.color = "#ffc87f"; + inactive.color = "#505050"; + urgent.color = "#9b0000"; + }; + shadow.color = "#0007"; + background-color = "transparent"; + }; + + binds = keybindings // { + "Mod+T" = { + action.spawn = "ghostty"; + hotkey-overlay.title = "Open a Terminal: ghostty"; + }; + "Mod+D" = { + action.spawn = [ + "vicinae" + "toggle" + ]; + hotkey-overlay.title = "Run an Application: vicinae"; + }; + "Mod+E" = { + action.spawn = [ + "nautilus" + "--new-window" + ]; + hotkey-overlay.title = "Open File Manager: nautilus"; + }; + "Mod+L" = { + action.spawn = [ + (lib.getExe' pkgs.systemd "loginctl") + "lock-session" + ]; + hotkey-overlay.title = "Lock the Screen"; + }; + "Mod+V" = { + action.spawn = [ + "vicinae" + "vicinae://launch/clipboard/history?toggle=true" + ]; + hotkey-overlay.title = "Clipboard History"; + }; + "Mod+Space" = { + action.spawn = [ + "ghostty" + "+toggle-quick-terminal" + ]; + hotkey-overlay.title = "Toggle Quick Terminal: ghostty"; + }; + + "Mod+Shift+Left" = { + action.focus-monitor-left = [ ]; + hotkey-overlay.title = "Focus Monitor Left"; + }; + "Mod+Shift+Right" = { + action.focus-monitor-right = [ ]; + hotkey-overlay.title = "Focus Monitor Right"; + }; + "Mod+Shift+Up" = { + action.focus-monitor-up = [ ]; + hotkey-overlay.title = "Focus Monitor Up"; + }; + "Mod+Shift+Down" = { + action.focus-monitor-down = [ ]; + hotkey-overlay.title = "Focus Monitor Down"; + }; + + "Mod+Shift+Ctrl+Left" = { + action.move-window-to-monitor-left = [ ]; + hotkey-overlay.title = "Move Window to Monitor Left"; + }; + "Mod+Shift+Ctrl+Right" = { + action.move-window-to-monitor-right = [ ]; + hotkey-overlay.title = "Move Window to Monitor Right"; + }; + "Mod+Shift+Ctrl+Up" = { + action.move-window-to-monitor-up = [ ]; + hotkey-overlay.title = "Move Window to Monitor Up"; + }; + "Mod+Shift+Ctrl+Down" = { + action.move-window-to-monitor-down = [ ]; + hotkey-overlay.title = "Move Window to Monitor Down"; + }; + + "XF86AudioRaiseVolume".action.spawn = [ + "noctalia" + "msg" + "volume-up" + ]; + "XF86AudioLowerVolume".action.spawn = [ + "noctalia" + "msg" + "volume-down" + ]; + "XF86AudioMute".action.spawn = [ + "noctalia" + "msg" + "volume-mute" + ]; + "XF86AudioMicMute".action.spawn = [ + "noctalia" + "msg" + "mic-mute" + ]; + "XF86MonBrightnessUp".action.spawn = [ + "noctalia" + "msg" + "brightness-up" + ]; + "XF86MonBrightnessDown".action.spawn = [ + "noctalia" + "msg" + "brightness-down" + ]; + "XF86Favorites".action.spawn = [ + "noctalia" + "msg" + "caffeine-toggle" + ]; + }; + + window-rules = [ + { + geometry-corner-radius = { + top-left = 20.0; + top-right = 20.0; + bottom-left = 20.0; + bottom-right = 20.0; + }; + clip-to-geometry = true; + } + { + matches = [ { app-id = "^dev\\.noctalia\\.Noctalia$"; } ]; + open-floating = true; + default-column-width.fixed = 1080; + default-window-height.fixed = 920; + } + ]; + + layer-rules = [ + { + matches = [ { namespace = "^noctalia-wallpaper"; } ]; + place-within-backdrop = true; + } + ]; + + overview.workspace-shadow.enable = false; + }; +} diff --git a/modules/applications/niri/keybindings.nix b/modules/applications/niri/keybindings.nix new file mode 100644 index 0000000..c74378e --- /dev/null +++ b/modules/applications/niri/keybindings.nix @@ -0,0 +1,160 @@ +{ + "Mod+Shift+Slash".action.show-hotkey-overlay = { }; + + "XF86AudioRaiseVolume" = { + allow-when-locked = true; + action.spawn = [ + "wpctl" + "set-volume" + "@DEFAULT_AUDIO_SINK@" + "0.1+" + ]; + }; + "XF86AudioLowerVolume" = { + allow-when-locked = true; + action.spawn = [ + "wpctl" + "set-volume" + "@DEFAULT_AUDIO_SINK@" + "0.1-" + ]; + }; + "XF86AudioMute" = { + allow-when-locked = true; + action.spawn = [ + "wpctl" + "set-mute" + "@DEFAULT_AUDIO_SINK@" + "toggle" + ]; + }; + "XF86AudioMicMute" = { + allow-when-locked = true; + action.spawn = [ + "wpctl" + "set-mute" + "@DEFAULT_AUDIO_SOURCE@" + "toggle" + ]; + }; + + "Mod+Q".action.close-window = { }; + + "Mod+Left".action.focus-column-left = { }; + "Mod+Down".action.focus-window-down = { }; + "Mod+Up".action.focus-window-up = { }; + "Mod+Right".action.focus-column-right = { }; + "Mod+H".action.focus-column-left = { }; + "Mod+J".action.focus-window-down = { }; + "Mod+K".action.focus-window-up = { }; + "Mod+L".action.focus-column-right = { }; + + "Mod+Ctrl+Left".action.move-column-left = { }; + "Mod+Ctrl+Down".action.move-window-down = { }; + "Mod+Ctrl+Up".action.move-window-up = { }; + "Mod+Ctrl+Right".action.move-column-right = { }; + "Mod+Ctrl+H".action.move-column-left = { }; + "Mod+Ctrl+J".action.move-window-down = { }; + "Mod+Ctrl+K".action.move-window-up = { }; + "Mod+Ctrl+L".action.move-column-right = { }; + + "Mod+Home".action.focus-column-first = { }; + "Mod+End".action.focus-column-last = { }; + "Mod+Ctrl+Home".action.move-column-to-first = { }; + "Mod+Ctrl+End".action.move-column-to-last = { }; + + "Mod+Shift+Left".action.focus-monitor-left = { }; + "Mod+Shift+Down".action.focus-monitor-down = { }; + "Mod+Shift+Up".action.focus-monitor-up = { }; + "Mod+Shift+Right".action.focus-monitor-right = { }; + "Mod+Shift+H".action.focus-monitor-left = { }; + "Mod+Shift+J".action.focus-monitor-down = { }; + "Mod+Shift+K".action.focus-monitor-up = { }; + "Mod+Shift+L".action.focus-monitor-right = { }; + + "Mod+Shift+Ctrl+Left".action.move-column-to-monitor-left = { }; + "Mod+Shift+Ctrl+Down".action.move-column-to-monitor-down = { }; + "Mod+Shift+Ctrl+Up".action.move-column-to-monitor-up = { }; + "Mod+Shift+Ctrl+Right".action.move-column-to-monitor-right = { }; + "Mod+Shift+Ctrl+H".action.move-column-to-monitor-left = { }; + "Mod+Shift+Ctrl+J".action.move-column-to-monitor-down = { }; + "Mod+Shift+Ctrl+K".action.move-column-to-monitor-up = { }; + "Mod+Shift+Ctrl+L".action.move-column-to-monitor-right = { }; + + "Mod+Page_Down".action.focus-workspace-down = { }; + "Mod+Page_Up".action.focus-workspace-up = { }; + "Mod+U".action.focus-workspace-down = { }; + "Mod+I".action.focus-workspace-up = { }; + "Mod+Ctrl+Page_Down".action.move-column-to-workspace-down = { }; + "Mod+Ctrl+Page_Up".action.move-column-to-workspace-up = { }; + "Mod+Ctrl+U".action.move-column-to-workspace-down = { }; + "Mod+Ctrl+I".action.move-column-to-workspace-up = { }; + + "Mod+Shift+Page_Down".action.move-workspace-down = { }; + "Mod+Shift+Page_Up".action.move-workspace-up = { }; + "Mod+Shift+U".action.move-workspace-down = { }; + "Mod+Shift+I".action.move-workspace-up = { }; + + "Mod+WheelScrollDown" = { + cooldown-ms = 150; + action.focus-workspace-down = { }; + }; + "Mod+WheelScrollUp" = { + cooldown-ms = 150; + action.focus-workspace-up = { }; + }; + "Mod+Ctrl+WheelScrollDown" = { + cooldown-ms = 150; + action.move-column-to-workspace-down = { }; + }; + "Mod+Ctrl+WheelScrollUp" = { + cooldown-ms = 150; + action.move-column-to-workspace-up = { }; + }; + + "Mod+WheelScrollRight".action.focus-column-right = { }; + "Mod+WheelScrollLeft".action.focus-column-left = { }; + "Mod+Ctrl+WheelScrollRight".action.move-column-right = { }; + "Mod+Ctrl+WheelScrollLeft".action.move-column-left = { }; + "Mod+Shift+WheelScrollDown".action.focus-column-right = { }; + "Mod+Shift+WheelScrollUp".action.focus-column-left = { }; + "Mod+Ctrl+Shift+WheelScrollDown".action.move-column-right = { }; + "Mod+Ctrl+Shift+WheelScrollUp".action.move-column-left = { }; + + "Mod+1".action.focus-workspace = 1; + "Mod+2".action.focus-workspace = 2; + "Mod+3".action.focus-workspace = 3; + "Mod+4".action.focus-workspace = 4; + "Mod+5".action.focus-workspace = 5; + "Mod+6".action.focus-workspace = 6; + "Mod+7".action.focus-workspace = 7; + "Mod+8".action.focus-workspace = 8; + "Mod+9".action.focus-workspace = 9; + "Mod+Ctrl+1".action.move-column-to-workspace = 1; + "Mod+Ctrl+2".action.move-column-to-workspace = 2; + "Mod+Ctrl+3".action.move-column-to-workspace = 3; + "Mod+Ctrl+4".action.move-column-to-workspace = 4; + "Mod+Ctrl+5".action.move-column-to-workspace = 5; + "Mod+Ctrl+6".action.move-column-to-workspace = 6; + "Mod+Ctrl+7".action.move-column-to-workspace = 7; + "Mod+Ctrl+8".action.move-column-to-workspace = 8; + "Mod+Ctrl+9".action.move-column-to-workspace = 9; + + "Mod+Comma".action.consume-window-into-column = { }; + "Mod+Period".action.expel-window-from-column = { }; + "Mod+R".action.switch-preset-column-width = { }; + "Mod+Shift+R".action.reset-window-height = { }; + "Mod+F".action.maximize-column = { }; + "Mod+Shift+F".action.fullscreen-window = { }; + "Mod+C".action.center-column = { }; + "Mod+Minus".action.set-column-width = "-10%"; + "Mod+Equal".action.set-column-width = "+10%"; + "Mod+Shift+Minus".action.set-window-height = "-10%"; + "Mod+Shift+Equal".action.set-window-height = "+10%"; + + "Print".action.screenshot = { }; + "Ctrl+Print".action.screenshot-screen = { }; + "Alt+Print".action.screenshot-window = { }; + "Mod+Shift+E".action.quit = { }; + "Mod+Shift+P".action.power-off-monitors = { }; +} diff --git a/modules/applications/niri/meta.nix b/modules/applications/niri/meta.nix new file mode 100644 index 0000000..dbfd1f1 --- /dev/null +++ b/modules/applications/niri/meta.nix @@ -0,0 +1,6 @@ +{ inputs, ... }: +{ + description = "niri Wayland compositor"; + + imports.nixos = [ inputs.niri-flake.nixosModules.niri ]; +} diff --git a/modules/applications/niri/nixos.nix b/modules/applications/niri/nixos.nix new file mode 100644 index 0000000..c39f911 --- /dev/null +++ b/modules/applications/niri/nixos.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: +{ + programs.niri.enable = true; + + environment.systemPackages = with pkgs; [ + wdisplays # Wayland display configuration GUI + wlr-randr # Wayland output management CLI + ]; +} diff --git a/modules/applications/noctalia/home.nix b/modules/applications/noctalia/home.nix new file mode 100644 index 0000000..3f79fdb --- /dev/null +++ b/modules/applications/noctalia/home.nix @@ -0,0 +1,168 @@ +{ pkgs, ... }: +let + wallpapers = pkgs.fetchFromGitHub { + owner = "moons-14"; + repo = "wallpapers"; + rev = "cc3256f4aaf2c8e7d16fb000b1ee251af54085db"; + hash = "sha256-emQ/FqKqMq3YI5bLx8gBZg/ZE72OG9Ilh71ggq78WdQ="; + }; +in +{ + home.packages = [ pkgs.networkmanagerapplet ]; + + home.file = { + ".face".source = ../../../images/avatar.jpg; + ".wallpapers" = { + source = wallpapers; + recursive = true; + }; + }; + + programs.noctalia = { + enable = true; + systemd.enable = true; + + settings = { + theme = { + mode = "auto"; + source = "wallpaper"; + templates = { + enable_builtin_templates = false; + enable_community_templates = false; + }; + }; + + desktop_widgets.enabled = false; + lockscreen = { + enabled = false; + fingerprint = false; + }; + + bar.main = { + margin_ends = 15; + position = "top"; + start = [ + "network" + "bluetooth" + "network-connection" + "spacer" + "cpu" + "cpu-graph" + "ram" + ]; + center = [ "workspaces" ]; + end = [ + "media" + "spacer" + "notifications" + "tray" + "spacer" + "battery" + "input-volume" + "output-volume" + "privacy" + "brightness" + "clock" + "control-center" + ]; + }; + + widget = { + cpu = { + type = "sysmon"; + stat = "cpu_usage"; + }; + cpu-graph = { + type = "sysmon"; + stat = "cpu_usage"; + display = "graph"; + show_label = false; + }; + ram = { + type = "sysmon"; + stat = "ram_used"; + }; + media = { + type = "media"; + hide_when_no_media = true; + title_scroll = "always"; + }; + battery = { + type = "battery"; + display_mode = "graphic"; + warning_threshold = 30; + }; + brightness = { + type = "brightness"; + show_label = false; + }; + input-volume = { + type = "volume"; + device = "input"; + }; + output-volume = { + type = "volume"; + device = "output"; + }; + clock = { + type = "clock"; + format = "{:%Y/%m/%d %H:%M}"; + vertical_format = "{:%Y/%m/%d\n%H:%M}"; + tooltip_format = "{:%Y/%m/%d %H:%M (%a)}"; + }; + network-connection = { + type = "custom_button"; + glyph = "access-point"; + command = "nm-connection-editor"; + }; + tray = { + type = "tray"; + pinned = [ "org.fcitx.Fcitx5" ]; + }; + }; + + shell = { + avatar_path = "~/.face"; + corner_radius_scale = 0.2; + clipboard_enabled = false; + launch_apps_as_systemd_services = true; + }; + + wallpaper = { + enabled = true; + directory = "~/.wallpapers"; + fill_mode = "crop"; + automation = { + enabled = true; + order = "random"; + interval_seconds = 60; + }; + default.path = "~/.wallpapers/1.jpg"; + }; + + dock = { + enabled = true; + position = "left"; + auto_hide = true; + show_dots = true; + background_opacity = 0.8; + active_monitor_only = true; + reserve_space = false; + pinned = [ + "com.mitchellh.ghostty" + "google-chrome" + "code" + ]; + }; + + control_center.shortcuts = [ + { type = "wifi"; } + { type = "bluetooth"; } + { type = "screen_recorder"; } + { type = "wallpaper"; } + { type = "notifications"; } + { type = "nightlight"; } + ]; + }; + }; +} diff --git a/modules/applications/noctalia/meta.nix b/modules/applications/noctalia/meta.nix new file mode 100644 index 0000000..333fc78 --- /dev/null +++ b/modules/applications/noctalia/meta.nix @@ -0,0 +1,9 @@ +{ inputs, ... }: +{ + description = "Noctalia Wayland desktop shell"; + + imports = { + nixos = [ inputs.noctalia.nixosModules.default ]; + home = [ inputs.noctalia.homeModules.default ]; + }; +} diff --git a/modules/applications/noctalia/nixos.nix b/modules/applications/noctalia/nixos.nix new file mode 100644 index 0000000..be57970 --- /dev/null +++ b/modules/applications/noctalia/nixos.nix @@ -0,0 +1,6 @@ +{ + programs.noctalia = { + enable = true; + recommendedServices.enable = true; + }; +} diff --git a/modules/applications/ssh/home.nix b/modules/applications/ssh/home.nix new file mode 100644 index 0000000..e2c37ee --- /dev/null +++ b/modules/applications/ssh/home.nix @@ -0,0 +1,37 @@ +{ lib, pkgs, ... }: +lib.mkMerge [ + { + home.packages = [ pkgs.openssh ]; + + programs.ssh = { + enable = true; + enableDefaultConfig = false; + + settings = { + "github.com" = { + HostName = "github.com"; + User = "git"; + AddKeysToAgent = "no"; + }; + "*.sfc.wide.ad.jp" = { + identityFile = "~/.ssh/id_ed25519_sk_rk"; + identitiesOnly = true; + }; + "*" = { + AddKeysToAgent = "no"; + SetEnv.TERM = "xterm-256color"; + }; + }; + + extraConfig = '' + Match exec "test -S %d/.1password/agent.sock" + IdentityAgent %d/.1password/agent.sock + ''; + }; + } + + (lib.mkIf pkgs.stdenv.hostPlatform.isLinux { + systemd.user.sockets.gcr-ssh-agent.Install.WantedBy = lib.mkForce [ ]; + services.ssh-agent.enable = lib.mkForce false; + }) +] diff --git a/modules/applications/ssh/nixos.nix b/modules/applications/ssh/nixos.nix new file mode 100644 index 0000000..d43087b --- /dev/null +++ b/modules/applications/ssh/nixos.nix @@ -0,0 +1,4 @@ +{ + programs.ssh.startAgent = false; + services.gnome.gcr-ssh-agent.enable = false; +} diff --git a/modules/services/swaylock/home.nix b/modules/services/swaylock/home.nix new file mode 100644 index 0000000..4760976 --- /dev/null +++ b/modules/services/swaylock/home.nix @@ -0,0 +1,23 @@ +{ lib, pkgs, ... }: +{ + home.packages = [ pkgs.swaylock ]; + + systemd.user.services.swaylock = { + Unit = { + Description = "Screen locker for Wayland"; + Documentation = [ "man:swaylock(1)" ]; + OnSuccess = [ "unlock.target" ]; + PartOf = [ "lock.target" ]; + Before = [ "lock.target" ]; + }; + + Service = { + Type = "forking"; + ExecStart = "${lib.getExe pkgs.swaylock} -f -i %h/.wallpapers/28.jpg"; + Restart = "on-failure"; + RestartSec = 0; + }; + + Install.WantedBy = [ "lock.target" ]; + }; +} diff --git a/modules/services/swaylock/nixos.nix b/modules/services/swaylock/nixos.nix new file mode 100644 index 0000000..89b942c --- /dev/null +++ b/modules/services/swaylock/nixos.nix @@ -0,0 +1,10 @@ +{ config, ... }: +{ + services.systemd-lock-handler.enable = true; + + security.pam.services.swaylock = { + fprintAuth = true; + + rules.auth.fprintd.order = config.security.pam.services.swaylock.rules.auth.unix.order + 50; + }; +}