From 590b4153520c733f1c825a910cb34c4c8cc2d3da Mon Sep 17 00:00:00 2001 From: lucy Date: Mon, 19 Oct 2026 22:14:10 +0200 Subject: [PATCH] add niri, emacs and stylix modules --- modules/home/default.nix | 5 - modules/home/programs/emacs.nix | 106 ++++++++++++++ modules/home/programs/niri.nix | 184 ++++++++++++++++++++++++ modules/home/{ => programs}/nixcord.nix | 0 modules/home/stylix/targets.nix | 11 ++ modules/system/core/user.nix | 3 + 6 files changed, 304 insertions(+), 5 deletions(-) delete mode 100644 modules/home/default.nix create mode 100644 modules/home/programs/emacs.nix create mode 100644 modules/home/programs/niri.nix rename modules/home/{ => programs}/nixcord.nix (100%) create mode 100644 modules/home/stylix/targets.nix diff --git a/modules/home/default.nix b/modules/home/default.nix deleted file mode 100644 index 14fcd00..0000000 --- a/modules/home/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -{...}: { - flake.homeModules.lucy = { - - }; -} diff --git a/modules/home/programs/emacs.nix b/modules/home/programs/emacs.nix new file mode 100644 index 0000000..476844c --- /dev/null +++ b/modules/home/programs/emacs.nix @@ -0,0 +1,106 @@ +{ ... }: { + + flake.homeModules.emacs = { pkgs, ... }: { + programs.emacs = { + enable = true; + packages = pkgs.emacs-pgtk; + extraConfig = '' + ;; -*- lexical-binding: t; -*- + (setq make-backup-files nil) + + (add-to-list 'default-frame-alist '(font . "JetBrainsMono Nerd Font Mono-14")) + + (require 'package) + (add-to-list 'package-archives + '("melpa-snapshots" + . + "https://snapshots.melpa.org/packages/") + t) + ;; add packages + (use-package org-view-mode :ensure t) + (use-package envrc :ensure t) + + (use-package nix-mode :ensure t) + (use-package + eldoc-box + :ensure t + :hook (eglot-managed-mode . eldoc-box-hover-mode) + ) + (use-package + elisp-autofmt + :ensure t + :commands (elisp-autofmt-buffer elisp-autofmt-mode) + :hook (emacs-lisp-mode . elisp-autofmt-mode) + :config) + (use-package portage-modes :ensure t) + (use-package + corfu + :ensure t + :init + (setq + corfu-auto t + corfu-auto-prefix 1 + corfu-auto-delay 0.2) + (global-corfu-mode)) + + (setq tab-always-indent 'complete) + (use-package + cape + :ensure t + :bind ("C-c p" . cape-prefix-map) ;; Alternative key: M-, M-p, M-+ + :init (add-hook 'completion-at-point-functions #'cape-file)) + (setq corfu-auto-prefix 2) + (use-package qml-mode :ensure t) + (use-package lua-mode :ensure t) + (use-package elcord :ensure t :init (elcord-mode)) + + (add-to-list + 'display-buffer-alist + '("\\*compilation\\*" (display-buffer-reuse-window + display-buffer-below-selected) + (window-height . 0.3))) + + + ;; remove useless shit and set default opts + (setq org-hide-emphasis-markers t) + (setq ring-bell-function 'ignore) + (menu-bar-mode -1) + (tool-bar-mode -1) + (setq display-line-numbers-type 'relative) + (global-display-line-numbers-mode +1) + (global-tab-line-mode 1) + (scroll-bar-mode -1) + (setq inhibit-splash-screen 1) + (setq custom-file "~/.emacs.d/custom.el") + (load custom-file 'noerror) + + + ;; lsp shit + (add-hook 'nix-mode-hook #'eglot-ensure) + (add-hook 'c-mode-hook #'eglot-ensure) + (add-hook 'qml-mode-hook #'eglot-ensure) + (with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs '(nix-mode . ("nixd"))) + (add-to-list 'eglot-server-programs '(qml-mode . ("qmlls")))) + + ;; keybindings + (keymap-global-set "C-c f" 'eglot-format) + (keymap-global-set "C-c t" 'term) + (keymap-global-set "C-c c" 'compile) + (keymap-global-set "C-c k b" 'kill-current-buffer) + (keymap-global-set "C-c k w" 'kill-buffer-and-window) + (keymap-global-set "C-c v" 'org-view-mode) + (windmove-default-keybindings) + ;; replace dashes with bullets in org mode + (font-lock-add-keywords 'org-mode + '(("^ +\\([-*]\\) " + (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•")))))) + + (setq org-view-prettify-credentials nil) + (setq org-view-hide-keywords nil) + (envrc-global-mode) + + ''; + }; + }; +} diff --git a/modules/home/programs/niri.nix b/modules/home/programs/niri.nix new file mode 100644 index 0000000..d833d3f --- /dev/null +++ b/modules/home/programs/niri.nix @@ -0,0 +1,184 @@ +{ ... }: { + flake.homeModules.niri = { + wayland.windowManager.niri = { + enable = true; + settings = { + prefer-no-csd = { }; + hotkey-overlay.skip-at-startup = { }; + input = { + keyboard.xkb.layout = "eu"; + touchpad = { + tap = { }; + natural-scroll = { }; + }; + mouse = { + accel-speed = -0.4; + accel-profile = "flat"; + }; + focus-follows-mouse._props.max-scroll-amount = "20%"; + }; + spawn-at-startup = [ "qs" ]; + screenshot-path = null; + animations = { }; + layout = { + gaps = 16; + center-focused-column = "never"; + default-column-width._children = [ { proportion = 0.6; } ]; + }; + binds = { + "Mod+Return".spawn-sh = "ghostty +new-window"; + "Mod+space".spawn = [ "fuzzel" ]; + "Mod+e".spawn = [ "nautilus" ]; + "XF86AudioRaiseVolume" = { + _props.allow-when-locked = true; + spawn-sh = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+ -l 1.0"; + }; + "XF86AudioLowerVolume" = { + _props.allow-when-locked = true; + spawn-sh = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; + }; + "XF86AudioMute" = { + _props.allow-when-locked = true; + spawn-sh = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + }; + "XF86AudioMicMute" = { + _props.allow-when-locked = true; + spawn-sh = "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; + }; + "XF86AudioPlay" = { + _props.allow-when-locked = true; + spawn-sh = "playerctl play-pause"; + }; + "XF86AudioStop" = { + _props.allow-when-locked = true; + spawn-sh = "playerctl stop"; + }; + "XF86AudioPrev" = { + _props.allow-when-locked = true; + spawn-sh = "playerctl previous"; + }; + "XF86AudioNext" = { + _props.allow-when-locked = true; + spawn-sh = "playerctl next"; + }; + "XF86MonBrightnessUp" = { + _props.allow-when-locked = true; + spawn = [ + "brightnessctl" + "--class=backlight" + "set" + "+10%" + ]; + }; + "XF86MonBrightnessDown" = { + _props.allow-when-locked = true; + spawn = [ + "brightnessctl" + "--class=backlight" + "set" + "10%-" + ]; + }; + "Mod+O" = { + _props.repeat = false; + toggle-overview = { }; + }; + "Mod+Q" = { + _props.repeat = false; + close-window = { }; + }; + "Mod+Left".focus-column-left = { }; + "Mod+Down".focus-window-down = { }; + "Mod+Up".focus-window-up = { }; + "Mod+Right".focus-column-right = { }; + "Mod+H".focus-column-left = { }; + "Mod+J".focus-window-down = { }; + "Mod+K".focus-window-up = { }; + "Mod+L".focus-column-right = { }; + "Mod+Ctrl+Left".move-column-left = { }; + "Mod+Ctrl+Down".move-window-down = { }; + "Mod+Ctrl+Up".move-window-up = { }; + "Mod+Ctrl+Right".move-column-right = { }; + "Mod+Ctrl+H".move-column-left = { }; + "Mod+Ctrl+J".move-window-down = { }; + "Mod+Ctrl+K".move-window-up = { }; + "Mod+Ctrl+L".move-column-right = { }; + "Mod+comma".focus-monitor-left = { }; + "Mod+period".focus-monitor-right = { }; + "Mod+Shift+comma".move-column-to-monitor-left = { }; + "Mod+Shift+period".move-column-to-monitor-right = { }; + "Mod+Shift+WheelScrollDown".focus-column-right = { }; + "Mod+Shift+WheelScrollUp".focus-column-left = { }; + "Mod+1".focus-workspace = 1; + "Mod+2".focus-workspace = 2; + "Mod+3".focus-workspace = 3; + "Mod+4".focus-workspace = 4; + "Mod+5".focus-workspace = 5; + "Mod+6".focus-workspace = 6; + "Mod+7".focus-workspace = 7; + "Mod+8".focus-workspace = 8; + "Mod+9".focus-workspace = 9; + "Mod+Shift+1".move-column-to-workspace = 1; + "Mod+Shift+2".move-column-to-workspace = 2; + "Mod+Shift+3".move-column-to-workspace = 3; + "Mod+Shift+4".move-column-to-workspace = 4; + "Mod+Shift+5".move-column-to-workspace = 5; + "Mod+Shift+6".move-column-to-workspace = 6; + "Mod+Shift+7".move-column-to-workspace = 7; + "Mod+Shift+8".move-column-to-workspace = 8; + "Mod+Shift+9".move-column-to-workspace = 9; + "Mod+BracketLeft".consume-or-expel-window-left = { }; + "Mod+BracketRight".consume-or-expel-window-right = { }; + "Mod+F".maximize-column = { }; + "Mod+Minus".set-column-width = "-10%"; + "Mod+Equal".set-column-width = "+10%"; + "Mod+V".toggle-window-floating = { }; + "Mod+Shift+S".screenshot = { }; + "Alt+Shift+S".screenshot-screen = { }; + "Alt+Ctrl+S".screenshot-window = { }; + "Mod+Shift+q".quit = { }; + }; + _children = [ + { + output = { + _args = [ "PNP(BNQ) BenQ EX2710Q K6R04023019" ]; + mode = "2560x1440@165.002"; + scale = 1; + transform = "normal"; + position._props = { + x = 1920; + y = 0; + }; + position._props = { + x = 1920; + y = 0; + }; + }; + } + { + output = { + _args = [ "Dell Inc. DELL P2317H 9KFDW6C533DB" ]; + position._props = { + x = 0; + y = 0; + }; + }; + } + { + output = { + _args = [ "eDP-1" ]; + scale = 1; + }; + } + { + window-rule._children = [ + { geometry-corner-radius = 16; } + { clip-to-geometry = true; } + ]; + } + ]; + }; + + }; + }; +} diff --git a/modules/home/nixcord.nix b/modules/home/programs/nixcord.nix similarity index 100% rename from modules/home/nixcord.nix rename to modules/home/programs/nixcord.nix diff --git a/modules/home/stylix/targets.nix b/modules/home/stylix/targets.nix new file mode 100644 index 0000000..89761d1 --- /dev/null +++ b/modules/home/stylix/targets.nix @@ -0,0 +1,11 @@ +{inputs, ...}: { + flake.homeModules.homeStylix = { + imports = [ inputs.stylix.homeModules.stylix ]; + stylix.targets = { + ghostty.enable = true; + fuzzel.enable = true; + gtk.enable = true; + niri.enable = true; + }; + }; +} diff --git a/modules/system/core/user.nix b/modules/system/core/user.nix index 354c611..fcd59f2 100644 --- a/modules/system/core/user.nix +++ b/modules/system/core/user.nix @@ -17,6 +17,9 @@ home-manager.sharedModules = with self.homeModules; [ nixcord ghostty + niri + emacs + homeStylix ]; }; }