From 1b2c329422635aabe8c23b2e577a4e38cb6cba63 Mon Sep 17 00:00:00 2001 From: emily Date: Tue, 10 Sep 2024 12:02:18 +0200 Subject: [PATCH] graphical: Move config to a module --- config/common/users/emily/default.nix | 1 + config/hosts/ryuuko/configuration.nix | 9 +- config/profiles/graphical/default.nix | 218 ---------------- config/profiles/graphical/nixvim.nix | 219 ---------------- modules/default.nix | 1 + modules/graphical/default.nix | 238 ++++++++++++++++++ .../profiles => modules}/graphical/files.nix | 12 +- .../graphical/files/icons/brightness-100.png | Bin .../graphical/files/icons/brightness-20.png | Bin .../graphical/files/icons/brightness-40.png | Bin .../graphical/files/icons/brightness-60.png | Bin .../graphical/files/icons/brightness-80.png | Bin .../graphical/files/icons/dropper.png | Bin .../graphical/files/icons/microphone-mute.png | Bin .../graphical/files/icons/microphone.png | Bin .../graphical/files/icons/music.png | Bin .../graphical/files/icons/palette.png | Bin .../graphical/files/icons/picture.png | Bin .../graphical/files/icons/timer.png | Bin .../graphical/files/icons/volume-high.png | Bin .../graphical/files/icons/volume-low.png | Bin .../graphical/files/icons/volume-mid.png | Bin .../graphical/files/icons/volume-mute.png | Bin .../graphical/files/rofi/confirm.rasi | 0 .../graphical/files/rofi/launcher.rasi | 0 .../graphical/files/rofi/powermenu.rasi | 0 .../graphical/files/rofi/runner.rasi | 0 .../graphical/files/rofi/screenshot.rasi | 0 .../graphical/files/rofi/shared/colors.rasi | 0 .../graphical/files/scripts/colorpicker.sh | 0 .../graphical/files/scripts/rofi_powermenu.sh | 0 .../files/scripts/rofi_screenshot.sh | 0 .../graphical/files/scripts/screenshot.sh | 0 .../graphical/files/waybar-style.css | 0 .../graphical/hyprland.nix | 58 +---- modules/graphical/hyprlock.nix | 56 +++++ modules/graphical/nixvim.nix | 220 ++++++++++++++++ .../graphical/waybar-hyprland.nix | 4 +- 38 files changed, 534 insertions(+), 502 deletions(-) delete mode 100644 config/profiles/graphical/default.nix delete mode 100644 config/profiles/graphical/nixvim.nix create mode 100644 modules/graphical/default.nix rename {config/profiles => modules}/graphical/files.nix (89%) rename {config/profiles => modules}/graphical/files/icons/brightness-100.png (100%) rename {config/profiles => modules}/graphical/files/icons/brightness-20.png (100%) rename {config/profiles => modules}/graphical/files/icons/brightness-40.png (100%) rename {config/profiles => modules}/graphical/files/icons/brightness-60.png (100%) rename {config/profiles => modules}/graphical/files/icons/brightness-80.png (100%) rename {config/profiles => modules}/graphical/files/icons/dropper.png (100%) rename {config/profiles => modules}/graphical/files/icons/microphone-mute.png (100%) rename {config/profiles => modules}/graphical/files/icons/microphone.png (100%) rename {config/profiles => modules}/graphical/files/icons/music.png (100%) rename {config/profiles => modules}/graphical/files/icons/palette.png (100%) rename {config/profiles => modules}/graphical/files/icons/picture.png (100%) rename {config/profiles => modules}/graphical/files/icons/timer.png (100%) rename {config/profiles => modules}/graphical/files/icons/volume-high.png (100%) rename {config/profiles => modules}/graphical/files/icons/volume-low.png (100%) rename {config/profiles => modules}/graphical/files/icons/volume-mid.png (100%) rename {config/profiles => modules}/graphical/files/icons/volume-mute.png (100%) rename {config/profiles => modules}/graphical/files/rofi/confirm.rasi (100%) rename {config/profiles => modules}/graphical/files/rofi/launcher.rasi (100%) rename {config/profiles => modules}/graphical/files/rofi/powermenu.rasi (100%) rename {config/profiles => modules}/graphical/files/rofi/runner.rasi (100%) rename {config/profiles => modules}/graphical/files/rofi/screenshot.rasi (100%) rename {config/profiles => modules}/graphical/files/rofi/shared/colors.rasi (100%) rename {config/profiles => modules}/graphical/files/scripts/colorpicker.sh (100%) rename {config/profiles => modules}/graphical/files/scripts/rofi_powermenu.sh (100%) rename {config/profiles => modules}/graphical/files/scripts/rofi_screenshot.sh (100%) rename {config/profiles => modules}/graphical/files/scripts/screenshot.sh (100%) rename {config/profiles => modules}/graphical/files/waybar-style.css (100%) rename {config/profiles => modules}/graphical/hyprland.nix (86%) create mode 100644 modules/graphical/hyprlock.nix create mode 100644 modules/graphical/nixvim.nix rename config/profiles/graphical/waybar.nix => modules/graphical/waybar-hyprland.nix (97%) diff --git a/config/common/users/emily/default.nix b/config/common/users/emily/default.nix index 11b9835..c26d2b0 100644 --- a/config/common/users/emily/default.nix +++ b/config/common/users/emily/default.nix @@ -23,6 +23,7 @@ whois htop restic + fend ] ++ lib.optionals config.kyouma.machine-type.graphical [ linux-manual colmena diff --git a/config/hosts/ryuuko/configuration.nix b/config/hosts/ryuuko/configuration.nix index fd68f8d..371d8a3 100644 --- a/config/hosts/ryuuko/configuration.nix +++ b/config/hosts/ryuuko/configuration.nix @@ -2,7 +2,6 @@ imports = [ inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-extreme-gen4 ../../common - ../../profiles/graphical ../../profiles/physical.nix ./disko.nix ./hardware-configuration.nix @@ -41,7 +40,13 @@ extraBackends = [ pkgs.utsushi ]; }; - kyouma.machine-type.portable = true; + kyouma = { + graphical = { + enable = true; + compositor = "hyprland"; + }; + machine-type.portable = true; + }; networking.hostName = "ryuuko"; networking.firewall.allowedTCPPorts = [ 22000 ]; diff --git a/config/profiles/graphical/default.nix b/config/profiles/graphical/default.nix deleted file mode 100644 index be5b0c5..0000000 --- a/config/profiles/graphical/default.nix +++ /dev/null @@ -1,218 +0,0 @@ -{ config, pkgs, lib, inputs, ... }: { - imports = [ - inputs.home-manager.nixosModules.home-manager - inputs.stylix.nixosModules.stylix - ./files.nix - ./hyprland.nix - ./nixvim.nix - ./waybar.nix - ]; - - kyouma.machine-type.graphical = true; - - boot.plymouth.enable = true; - - security.pam.services.hyprlock = {}; - - services.dbus.packages = [ pkgs.gcr ]; - services.geoclue2.enable = true; - - services.pipewire = { - enable = true; - alsa.enable = true; - pulse.enable = true; - }; - - services.udisks2.enable = true; - - environment.variables = { - CLUTTER_BACKEND = "wayland"; - GDK_BACKEND = "wayland,x11"; - MOZ_ENABLE_WAYLAND = "1"; - QT_QPA_PLATFORM = "wayland;xcb"; - QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; - SDL_VIDEODRIVER = "wayland"; - LIBVA_DRIVER_NAME = "radeonsi"; - MESA_VK_DEVICE_SELECT = "1002:73df"; - WLR_DRM_DEVICES = "$HOME/.config/hypr/external-gpu:$HOME/.config/hypr/internal-gpu"; - }; - xdg.icons.enable = true; - xdg.portal = { - enable = true; - wlr.enable = true; - configPackages = [ pkgs.xdg-desktop-portal-hyprland ]; - }; - - stylix= { - image = pkgs.fetchurl { - url = "https://kyouma.net/wallpaper.png"; - sha256 = "1f46b439a864cd28b8ea93563b4762f1efb2648bae0148fd6b45f3033b10b0e8"; - }; - polarity = "dark"; - #base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml"; - fonts = { - sansSerif = { - package = pkgs.noto-fonts; - name = "Noto Sans"; - }; - serif = config.stylix.fonts.sansSerif; - monospace = { - package = pkgs.jetbrains-mono; - name = "JetBrains Mono Regular"; - }; - sizes.terminal = 11; - }; - cursor = { - package = pkgs.capitaine-cursors; - name = "capitaine"; - size = 24; - }; - targets = { - console.enable = false; - gnome.enable = true; - fish.enable = false; - }; - }; - - home-manager.users.emily = { - stylix.targets = { - hyprland.enable = false; - kitty.enable = false; - mako.enable = false; - rofi.enable = false; - swaylock.enable = false; - waybar.enable = false; - nixvim.enable = false; - fish.enable = false; - }; - home.keyboard = { - layout = "de"; - variant = "neo_qwerty"; - }; - - programs.imv.enable = true; - - programs.wpaperd = { - enable = true; - settings.default = { - path = "/home/emily/Pictures/wallpapers/sylviaritter/"; - duration = "60m"; - sorting = "random"; - }; - }; - programs.kitty = { - enable = true; - font.size = 13; - font.name = "JetBrains Mono"; - settings = { - enable_audio_bell = false; - scrollback_lines = 65536; - remember_window_size = false; - initial_window_width = 1200; - initial_window_height = 800; - - bold_font = "auto"; - italic_font = "auto"; - bold_italic_font = "auto"; - - background = "#090312"; - background_opacity = "0.7"; - }; - keybindings = { - "shift+right" = "next_tab"; - "ctrl+l" = "next_tab"; - "shift+left" = "previous_tab"; - "ctrl+h" = "previous_tab"; - }; - }; - programs.rofi = { - enable = true; - package = pkgs.rofi-wayland; - }; - - programs.zoxide = { - enable = true; - options = [ "--cmd cd" ]; - }; - programs.fzf.enable = true; - - qt = { - enable = true; - platformTheme.name = "qtct"; - style.name = "kvantum-dark"; - style.package = with pkgs; [ - libsForQt5.qtstyleplugin-kvantum - qt6Packages.qtstyleplugin-kvantum - (catppuccin-kvantum.override { accent = "Mauve"; variant = "Macchiato"; }) - ]; - }; - gtk.iconTheme.name = "Adwaita"; - gtk.iconTheme.package = pkgs.gnome.adwaita-icon-theme; - - services.gammastep = { - enable = true; - provider = "geoclue2"; - temperature.day = 6500; - temperature.night = 3700; - settings.general.adjustment-method = "wayland"; - }; - services.mako = { - enable = true; - anchor = "top-right"; - backgroundColor = "#24273a"; - borderColor = "#c6a0f6"; - borderRadius = 15; - borderSize = 2; - defaultTimeout = 5000; - layer = "overlay"; - maxIconSize = 48; - padding = "15"; - progressColor = "over #B4A1DB"; - sort = "-time"; - textColor = "#cad3f5"; - extraConfig = '' - max-history=100 - on-button-left=dismiss - on-button-right=dismiss-all - on-notify=exec ${pkgs.mpv}/bin/mpv /usr/share/sounds/freedesktop/stereo/message.oga - - [urgency=low] - border-color=#B4A1DB - default-timeout=2000 - - [urgency=normal] - border-color=#B4A1DB - default-timeout=5000 - - [urgency=high] - border-color=#D04E9D - text-color=#D04E9D - default-timeout=0 - - [category=mpd] - border-color=#E49186 - default-timeout=2000 - group-by=category - ''; - }; - services.gpg-agent = { - enable = true; - enableSshSupport = true; - pinentryPackage = pkgs.pinentry-gnome3; - }; - services.syncthing = { - enable = true; - tray.enable = true; - tray.command = "syncthingtray --replace"; - }; - services.udiskie = { - enable = true; - automount = false; - }; - systemd.user.services.syncthingtray.Service = { - ExecStartPre = "${pkgs.coreutils-full}/bin/sleep 2"; - Restart = "on-failure"; - RestartSec = "1s"; - }; - }; -} diff --git a/config/profiles/graphical/nixvim.nix b/config/profiles/graphical/nixvim.nix deleted file mode 100644 index 1dbe494..0000000 --- a/config/profiles/graphical/nixvim.nix +++ /dev/null @@ -1,219 +0,0 @@ -{ pkgs, inputs, ... }: { - home-manager.users.emily.imports = [ - inputs.nixvim.homeManagerModules.nixvim - ]; - home-manager.users.emily.programs.nixvim = { - enable = true; - extraPlugins = [ - pkgs.vimPlugins.molokai - pkgs.vimPlugins.vim-airline-themes - ]; - colorscheme = "molokai"; - vimAlias = true; - highlightOverride.Normal = { - ctermbg = "NONE"; - bg = "NONE"; - }; - opts = { - number = true; - expandtab = true; - autoindent = true; - mouse = ""; - encoding = "utf-8"; - shiftwidth = 2; - smartindent = true; - tabstop = 2; - - ignorecase = true; - incsearch = true; - smartcase = true; - }; - keymaps = [ - { - action = "Neotree toggle"; - key = ""; - mode = "n"; - options.silent = true; - } - { - action = ""; - key = ""; - mode = "t"; - } - ]; - plugins.cmp = { - enable = true; - settings.sources = [ - { name = "nvim_lsp"; } - { name = "luasnip"; } - { name = "buffer"; } - { name = "nvim_lua"; } - { name = "path"; } - ]; - settings.formatting = { - fields = [ "abbr" "kind" "menu" ]; - format = '' - function(_, item) - local icons = { - Namespace = "󰌗", - Text = "󰉿", - Method = "󰆧", - Function = "󰆧", - Constructor = "", - Field = "󰜢", - Variable = "󰀫", - Class = "󰠱", - Interface = "", - Module = "", - Property = "󰜢", - Unit = "󰑭", - Value = "󰎠", - Enum = "", - Keyword = "󰌋", - Snippet = "", - Color = "󰏘", - File = "󰈚", - Reference = "󰈇", - Folder = "󰉋", - EnumMember = "", - Constant = "󰏿", - Struct = "󰙅", - Event = "", - Operator = "󰆕", - TypeParameter = "󰊄", - Table = "", - Object = "󰅩", - Tag = "", - Array = "[]", - Boolean = "", - Number = "", - Null = "󰟢", - String = "󰉿", - Calendar = "", - Watch = "󰥔", - Package = "", - Copilot = "", - Codeium = "", - TabNine = "", - } - - local icon = icons[item.kind] or "" - item.kind = string.format("%s %s", icon, item.kind or "") - return item - end - ''; - }; - settings.snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; - settings.window = { - completion = { - winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel"; - scrollbar = false; - sidePadding = 0; - border = [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ]; - }; - documentation = { - border = [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ]; - winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel"; - }; - }; - settings.mapping = { - "" = "cmp.mapping.select_next_item()"; - "" = "cmp.mapping.select_prev_item()"; - "" = "cmp.mapping.select_next_item()"; - "" = "cmp.mapping.select_prev_item()"; - "" = "cmp.mapping.scroll_docs(-4)"; - "" = "cmp.mapping.scroll_docs(4)"; - "" = "cmp.mapping.complete()"; - "" = "cmp.mapping.close()"; - "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })"; - "" = '' - cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif require("luasnip").expand_or_jumpable() then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") - else - fallback() - end - end,{"i","s"}) - ''; - "" = '' - cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif require("luasnip").jumpable(-1) then - vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") - else - fallback() - end - end,{"i","s"}) - ''; - }; - }; - plugins.lsp = { - enable = true; - keymaps.lspBuf = { - "K" = "hover"; - "gd" = "definition"; - "gD" = "references"; - "gt" = "type_definition"; - "gi" = "implementation"; - }; - servers = { - bashls.enable = true; - lua-ls.enable = true; - nil-ls = { - enable = true; - settings.formatting.command = [ "nixfmt" "-w" "140" ]; - }; - nixd = { - enable = false; - settings = { - eval.depth = 5; - eval.workers = 6; - formatting.command = [ "nixfmt" "-w" "140" ]; - options.enable = true; - }; - }; - ruff-lsp.enable = true; - rust-analyzer = { - enable = true; - installRustc = true; - installCargo = true; - }; - }; - }; - plugins.none-ls = { - enable = true; - sources.diagnostics = { - pylint.enable = true; - statix.enable = true; - }; - sources.formatting = { - nixfmt.enable = true; - markdownlint.enable = true; - }; - }; - plugins.neo-tree = { - enable = true; - closeIfLastWindow = true; - }; - plugins.treesitter = { - enable = true; - nixGrammars = true; - settings.indent.enable = true; - }; - plugins.airline.enable = true; - plugins.cmp-buffer.enable = true; - plugins.cmp-emoji.enable = true; - plugins.cmp-nvim-lsp.enable = true; - plugins.cmp-path.enable = true; - plugins.cmp_luasnip.enable = true; - plugins.luasnip.enable = true; - plugins.nvim-autopairs.enable = true; - plugins.rainbow-delimiters.enable = true; - # Broken - plugins.rustaceanvim.enable = false; - plugins.treesitter-context.enable = true; - }; -} diff --git a/modules/default.nix b/modules/default.nix index 9f59827..b207a3b 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ ./deployment + ./graphical ./machine-type ./nginx ./update-nixfiles diff --git a/modules/graphical/default.nix b/modules/graphical/default.nix new file mode 100644 index 0000000..516e2f0 --- /dev/null +++ b/modules/graphical/default.nix @@ -0,0 +1,238 @@ +{ config, pkgs, lib, inputs, ... }: +let + cfg = config.kyouma.graphical; +in { + options = { + kyouma.graphical = { + enable = lib.mkEnableOption "graphical profile"; + compositor = lib.mkOption { + type = with lib.types; nullOr (enum [ "hyprland" "niri" ]); + default = null; + }; + }; + }; + + imports = [ + inputs.stylix.nixosModules.stylix + ./files.nix + ./hyprland.nix + ./waybar-hyprland.nix + ./hyprlock.nix + ./nixvim.nix + ]; + + config = lib.mkIf cfg.enable { + + kyouma.machine-type.graphical = true; + + boot.plymouth.enable = true; + + security.pam.services.hyprlock = {}; + + services.dbus.packages = [ pkgs.gcr ]; + services.geoclue2.enable = true; + + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; + + services.udisks2.enable = true; + + environment.variables = { + CLUTTER_BACKEND = "wayland"; + GDK_BACKEND = "wayland,x11"; + MOZ_ENABLE_WAYLAND = "1"; + QT_QPA_PLATFORM = "wayland;xcb"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + SDL_VIDEODRIVER = "wayland"; + LIBVA_DRIVER_NAME = "radeonsi"; + MESA_VK_DEVICE_SELECT = "1002:73df"; + WLR_DRM_DEVICES = "$HOME/.config/hypr/external-gpu:$HOME/.config/hypr/internal-gpu"; + }; + xdg.icons.enable = true; + xdg.portal = { + enable = true; + wlr.enable = true; + configPackages = [ (if cfg.compositor == "hyprland" + then pkgs.xdg-desktop-portal-hyprland + else pkgs.xdg-desktop-portal-wlr + ) ]; + }; + + stylix= { + image = pkgs.fetchurl { + url = "https://kyouma.net/wallpaper.png"; + sha256 = "1f46b439a864cd28b8ea93563b4762f1efb2648bae0148fd6b45f3033b10b0e8"; + }; + polarity = "dark"; + #base16Scheme = "${pkgs.base16-schemes}/share/themes/catppuccin-macchiato.yaml"; + fonts = { + sansSerif = { + package = pkgs.noto-fonts; + name = "Noto Sans"; + }; + serif = config.stylix.fonts.sansSerif; + monospace = { + package = pkgs.jetbrains-mono; + name = "JetBrains Mono Regular"; + }; + sizes.terminal = 11; + }; + cursor = { + package = pkgs.capitaine-cursors; + name = "capitaine"; + size = 24; + }; + targets = { + console.enable = false; + gnome.enable = true; + fish.enable = false; + }; + }; + + home-manager.users.emily = { + stylix.targets = { + hyprland.enable = false; + sway.enable = false; + kitty.enable = false; + mako.enable = false; + rofi.enable = false; + swaylock.enable = false; + waybar.enable = false; + nixvim.enable = false; + fish.enable = false; + }; + home.keyboard = { + layout = "de"; + variant = "neo_qwerty"; + }; + + programs.imv.enable = true; + + programs.wpaperd = { + enable = true; + settings.default = { + path = "/home/emily/Pictures/wallpapers/sylviaritter/"; + duration = "60m"; + sorting = "random"; + }; + }; + programs.kitty = { + enable = true; + font.size = 13; + font.name = "JetBrains Mono"; + settings = { + enable_audio_bell = false; + scrollback_lines = 65536; + remember_window_size = false; + initial_window_width = 1200; + initial_window_height = 800; + + bold_font = "auto"; + italic_font = "auto"; + bold_italic_font = "auto"; + + background = "#090312"; + background_opacity = "0.7"; + }; + keybindings = { + "shift+right" = "next_tab"; + "ctrl+l" = "next_tab"; + "shift+left" = "previous_tab"; + "ctrl+h" = "previous_tab"; + }; + }; + programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + }; + + programs.zoxide = { + enable = true; + options = [ "--cmd cd" ]; + }; + programs.fzf.enable = true; + + qt = { + enable = true; + platformTheme.name = "qtct"; + style.name = "kvantum-dark"; + style.package = with pkgs; [ + libsForQt5.qtstyleplugin-kvantum + qt6Packages.qtstyleplugin-kvantum + (catppuccin-kvantum.override { accent = "Mauve"; variant = "Macchiato"; }) + ]; + }; + gtk.iconTheme.name = "Adwaita"; + gtk.iconTheme.package = pkgs.gnome.adwaita-icon-theme; + + services.gammastep = { + enable = true; + provider = "geoclue2"; + temperature.day = 6500; + temperature.night = 3700; + settings.general.adjustment-method = "wayland"; + }; + services.mako = { + enable = true; + anchor = "top-right"; + backgroundColor = "#24273a"; + borderColor = "#c6a0f6"; + borderRadius = 15; + borderSize = 2; + defaultTimeout = 5000; + layer = "overlay"; + maxIconSize = 48; + padding = "15"; + progressColor = "over #B4A1DB"; + sort = "-time"; + textColor = "#cad3f5"; + extraConfig = '' + max-history=100 + on-button-left=dismiss + on-button-right=dismiss-all + on-notify=exec ${pkgs.mpv}/bin/mpv /usr/share/sounds/freedesktop/stereo/message.oga + + [urgency=low] + border-color=#B4A1DB + default-timeout=2000 + + [urgency=normal] + border-color=#B4A1DB + default-timeout=5000 + + [urgency=high] + border-color=#D04E9D + text-color=#D04E9D + default-timeout=0 + + [category=mpd] + border-color=#E49186 + default-timeout=2000 + group-by=category + ''; + }; + services.gpg-agent = { + enable = true; + enableSshSupport = true; + pinentryPackage = pkgs.pinentry-gnome3; + }; + services.syncthing = { + enable = true; + tray.enable = true; + tray.command = "syncthingtray --replace"; + }; + services.udiskie = { + enable = true; + automount = false; + }; + systemd.user.services.syncthingtray.Service = { + ExecStartPre = "${pkgs.coreutils-full}/bin/sleep 2"; + Restart = "on-failure"; + RestartSec = "1s"; + }; + }; + }; +} diff --git a/config/profiles/graphical/files.nix b/modules/graphical/files.nix similarity index 89% rename from config/profiles/graphical/files.nix rename to modules/graphical/files.nix index 8f30906..4b95cb6 100644 --- a/config/profiles/graphical/files.nix +++ b/modules/graphical/files.nix @@ -1,5 +1,5 @@ -{ config, pkgs, ... }: { - home-manager.users.emily = { +{ config, lib, pkgs, ... }: { + config.home-manager.users.emily = lib.mkIf config.kyouma.graphical.enable { home.file.".local/bin/hypr/playerctl.sh" = let playerctl = "${pkgs.playerctl}/bin/playerctl"; title = "$(${playerctl} metadata --format '{{markup_escape(title)}}')"; @@ -19,7 +19,7 @@ fi ''; }; - home.file."./local/bin/hypr/colorpicker.sh" = { + home.file.".local/bin/hypr/colorpicker.sh" = { enable = true; executable = true; source = pkgs.writeShellApplication { @@ -28,7 +28,7 @@ runtimeInputs = with pkgs; [ coreutils grim slurp imagemagick_light wl-clipboard libnotify ]; }; }; - home.file."./local/bin/hypr/rofi_powermenu.sh" = { + home.file.".local/bin/hypr/rofi_powermenu.sh" = { enable = true; executable = true; source = pkgs.writeShellApplication { @@ -37,7 +37,7 @@ runtimeInputs = with pkgs; [ rofi hyprlock coreutils-full toybox xdg-user-dirs ]; }; }; - home.file."./local/bin/hypr/rofi_screenshot.sh" = { + home.file.".local/bin/hypr/rofi_screenshot.sh" = { enable = true; executable = true; source = pkgs.writeShellApplication { @@ -46,7 +46,7 @@ runtimeInputs = with pkgs; [ coreutils grim hyprland imv slurp wl-clipboard libnotify pulseaudio toybox rofi xdg-user-dirs ]; }; }; - home.file."./local/bin/hypr/screenshot.sh" = { + home.file.".local/bin/hypr/screenshot.sh" = { enable = true; executable = true; source = pkgs.writeShellApplication { diff --git a/config/profiles/graphical/files/icons/brightness-100.png b/modules/graphical/files/icons/brightness-100.png similarity index 100% rename from config/profiles/graphical/files/icons/brightness-100.png rename to modules/graphical/files/icons/brightness-100.png diff --git a/config/profiles/graphical/files/icons/brightness-20.png b/modules/graphical/files/icons/brightness-20.png similarity index 100% rename from config/profiles/graphical/files/icons/brightness-20.png rename to modules/graphical/files/icons/brightness-20.png diff --git a/config/profiles/graphical/files/icons/brightness-40.png b/modules/graphical/files/icons/brightness-40.png similarity index 100% rename from config/profiles/graphical/files/icons/brightness-40.png rename to modules/graphical/files/icons/brightness-40.png diff --git a/config/profiles/graphical/files/icons/brightness-60.png b/modules/graphical/files/icons/brightness-60.png similarity index 100% rename from config/profiles/graphical/files/icons/brightness-60.png rename to modules/graphical/files/icons/brightness-60.png diff --git a/config/profiles/graphical/files/icons/brightness-80.png b/modules/graphical/files/icons/brightness-80.png similarity index 100% rename from config/profiles/graphical/files/icons/brightness-80.png rename to modules/graphical/files/icons/brightness-80.png diff --git a/config/profiles/graphical/files/icons/dropper.png b/modules/graphical/files/icons/dropper.png similarity index 100% rename from config/profiles/graphical/files/icons/dropper.png rename to modules/graphical/files/icons/dropper.png diff --git a/config/profiles/graphical/files/icons/microphone-mute.png b/modules/graphical/files/icons/microphone-mute.png similarity index 100% rename from config/profiles/graphical/files/icons/microphone-mute.png rename to modules/graphical/files/icons/microphone-mute.png diff --git a/config/profiles/graphical/files/icons/microphone.png b/modules/graphical/files/icons/microphone.png similarity index 100% rename from config/profiles/graphical/files/icons/microphone.png rename to modules/graphical/files/icons/microphone.png diff --git a/config/profiles/graphical/files/icons/music.png b/modules/graphical/files/icons/music.png similarity index 100% rename from config/profiles/graphical/files/icons/music.png rename to modules/graphical/files/icons/music.png diff --git a/config/profiles/graphical/files/icons/palette.png b/modules/graphical/files/icons/palette.png similarity index 100% rename from config/profiles/graphical/files/icons/palette.png rename to modules/graphical/files/icons/palette.png diff --git a/config/profiles/graphical/files/icons/picture.png b/modules/graphical/files/icons/picture.png similarity index 100% rename from config/profiles/graphical/files/icons/picture.png rename to modules/graphical/files/icons/picture.png diff --git a/config/profiles/graphical/files/icons/timer.png b/modules/graphical/files/icons/timer.png similarity index 100% rename from config/profiles/graphical/files/icons/timer.png rename to modules/graphical/files/icons/timer.png diff --git a/config/profiles/graphical/files/icons/volume-high.png b/modules/graphical/files/icons/volume-high.png similarity index 100% rename from config/profiles/graphical/files/icons/volume-high.png rename to modules/graphical/files/icons/volume-high.png diff --git a/config/profiles/graphical/files/icons/volume-low.png b/modules/graphical/files/icons/volume-low.png similarity index 100% rename from config/profiles/graphical/files/icons/volume-low.png rename to modules/graphical/files/icons/volume-low.png diff --git a/config/profiles/graphical/files/icons/volume-mid.png b/modules/graphical/files/icons/volume-mid.png similarity index 100% rename from config/profiles/graphical/files/icons/volume-mid.png rename to modules/graphical/files/icons/volume-mid.png diff --git a/config/profiles/graphical/files/icons/volume-mute.png b/modules/graphical/files/icons/volume-mute.png similarity index 100% rename from config/profiles/graphical/files/icons/volume-mute.png rename to modules/graphical/files/icons/volume-mute.png diff --git a/config/profiles/graphical/files/rofi/confirm.rasi b/modules/graphical/files/rofi/confirm.rasi similarity index 100% rename from config/profiles/graphical/files/rofi/confirm.rasi rename to modules/graphical/files/rofi/confirm.rasi diff --git a/config/profiles/graphical/files/rofi/launcher.rasi b/modules/graphical/files/rofi/launcher.rasi similarity index 100% rename from config/profiles/graphical/files/rofi/launcher.rasi rename to modules/graphical/files/rofi/launcher.rasi diff --git a/config/profiles/graphical/files/rofi/powermenu.rasi b/modules/graphical/files/rofi/powermenu.rasi similarity index 100% rename from config/profiles/graphical/files/rofi/powermenu.rasi rename to modules/graphical/files/rofi/powermenu.rasi diff --git a/config/profiles/graphical/files/rofi/runner.rasi b/modules/graphical/files/rofi/runner.rasi similarity index 100% rename from config/profiles/graphical/files/rofi/runner.rasi rename to modules/graphical/files/rofi/runner.rasi diff --git a/config/profiles/graphical/files/rofi/screenshot.rasi b/modules/graphical/files/rofi/screenshot.rasi similarity index 100% rename from config/profiles/graphical/files/rofi/screenshot.rasi rename to modules/graphical/files/rofi/screenshot.rasi diff --git a/config/profiles/graphical/files/rofi/shared/colors.rasi b/modules/graphical/files/rofi/shared/colors.rasi similarity index 100% rename from config/profiles/graphical/files/rofi/shared/colors.rasi rename to modules/graphical/files/rofi/shared/colors.rasi diff --git a/config/profiles/graphical/files/scripts/colorpicker.sh b/modules/graphical/files/scripts/colorpicker.sh similarity index 100% rename from config/profiles/graphical/files/scripts/colorpicker.sh rename to modules/graphical/files/scripts/colorpicker.sh diff --git a/config/profiles/graphical/files/scripts/rofi_powermenu.sh b/modules/graphical/files/scripts/rofi_powermenu.sh similarity index 100% rename from config/profiles/graphical/files/scripts/rofi_powermenu.sh rename to modules/graphical/files/scripts/rofi_powermenu.sh diff --git a/config/profiles/graphical/files/scripts/rofi_screenshot.sh b/modules/graphical/files/scripts/rofi_screenshot.sh similarity index 100% rename from config/profiles/graphical/files/scripts/rofi_screenshot.sh rename to modules/graphical/files/scripts/rofi_screenshot.sh diff --git a/config/profiles/graphical/files/scripts/screenshot.sh b/modules/graphical/files/scripts/screenshot.sh similarity index 100% rename from config/profiles/graphical/files/scripts/screenshot.sh rename to modules/graphical/files/scripts/screenshot.sh diff --git a/config/profiles/graphical/files/waybar-style.css b/modules/graphical/files/waybar-style.css similarity index 100% rename from config/profiles/graphical/files/waybar-style.css rename to modules/graphical/files/waybar-style.css diff --git a/config/profiles/graphical/hyprland.nix b/modules/graphical/hyprland.nix similarity index 86% rename from config/profiles/graphical/hyprland.nix rename to modules/graphical/hyprland.nix index 4f2d49e..9c05672 100644 --- a/config/profiles/graphical/hyprland.nix +++ b/modules/graphical/hyprland.nix @@ -1,57 +1,5 @@ -{ pkgs, ... }: { - home-manager.users.emily = { - programs.hyprlock = { - enable = true; - settings = { - general = { - hide_cursor = true; - disable_loading_bar = true; - }; - background = [{ - path = "screenshot"; - #path = "$HOME/Pictures/wallpapers/lockscreen.png"; - blur_passes = 3; - contrast = 1.25; - }]; - input-field = [{ - size = "250, 60"; - outline_thickness = 2; - dots_size = 0.2; - dots_spacing = 0.2; - dots_center = true; - outer_color = "rgba(0, 0, 0, 0)"; - inner_color = "rgba(0, 0, 0, 0.5)"; - font_color = "rgb(200, 200, 200)"; - fade_on_empty = true; - fade_timeout = 5000; - font_family = "JetBrains Mono Nerd Font Mono"; - fail_text = "$FAIL $ATTEMPTS"; - position = "0, 200"; - halign = "center"; - valign = "bottom"; - }]; - label = [{ - text = "cmd[update:250] date +%X"; - color = "rgba(255, 255, 255, 0.6)"; - font_size = "100"; - font_family = "JetBrains Mono Nerd Font Mono ExtraBold"; - position = "0, -300"; - halign = "center"; - valign = "top"; - }]; - }; - }; - services.swayidle = - let - hyprlock = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock"; - in { - enable = true; - systemdTarget = "hyprland-session.target"; - events = [ - { event = "before-sleep"; command = hyprlock; } - { event = "lock"; command = hyprlock; } - ]; - }; +{ config, lib, pkgs, ... }: { + config.home-manager.users.emily = lib.mkIf (config.kyouma.graphical.compositor == "hyprland") { wayland.windowManager.hyprland = { enable = true; settings = let @@ -170,7 +118,7 @@ "eDP-1, 3840x2400@60, 0x0, 1, bitdepth, 10" #"eDP-1, 2560x1600@60, 0x0, 1, bitdepth, 10" #"eDP-1, 1920x1200@60, 0x0, 1, bitdepth, 10" - "desc:Dell Inc. AW3225QF FXK2YZ3, 3840x2160@120,5280x0,1, bitdepth,10, vrr,2" + "desc:Dell Inc. AW3225QF FXK2YZ3, 3840x2160@240,5280x0,1, bitdepth,10, vrr,2" "desc:GIGA-BYTE TECHNOLOGY CO. LTD. AORUS AD27QD 19320B000455, 2560x1440@144,3840x-350,1, bitdepth,10, transform,1" ",preferred,auto,1" ]; diff --git a/modules/graphical/hyprlock.nix b/modules/graphical/hyprlock.nix new file mode 100644 index 0000000..1d99f8e --- /dev/null +++ b/modules/graphical/hyprlock.nix @@ -0,0 +1,56 @@ +{ config, lib, pkgs, ... }: { + config.home-manager.users.emily = lib.mkIf config.kyouma.graphical.enable { + programs.hyprlock = { + enable = true; + settings = { + general = { + hide_cursor = true; + disable_loading_bar = true; + }; + background = [{ + path = "screenshot"; + #path = "$HOME/Pictures/wallpapers/lockscreen.png"; + blur_passes = 3; + contrast = 1.25; + }]; + input-field = [{ + size = "250, 60"; + outline_thickness = 2; + dots_size = 0.2; + dots_spacing = 0.2; + dots_center = true; + outer_color = "rgba(0, 0, 0, 0)"; + inner_color = "rgba(0, 0, 0, 0.5)"; + font_color = "rgb(200, 200, 200)"; + fade_on_empty = true; + fade_timeout = 5000; + font_family = "JetBrains Mono Nerd Font Mono"; + fail_text = "$FAIL $ATTEMPTS"; + position = "0, 200"; + halign = "center"; + valign = "bottom"; + }]; + label = [{ + text = "cmd[update:250] date +%X"; + color = "rgba(255, 255, 255, 0.6)"; + font_size = "100"; + font_family = "JetBrains Mono Nerd Font Mono ExtraBold"; + position = "0, -300"; + halign = "center"; + valign = "top"; + }]; + }; + }; + services.swayidle = + let + hyprlock = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock"; + in { + enable = true; + systemdTarget = "${config.kyouma.graphical.compositor}-session.target"; + events = [ + { event = "before-sleep"; command = hyprlock; } + { event = "lock"; command = hyprlock; } + ]; + }; + }; +} diff --git a/modules/graphical/nixvim.nix b/modules/graphical/nixvim.nix new file mode 100644 index 0000000..3c1fb10 --- /dev/null +++ b/modules/graphical/nixvim.nix @@ -0,0 +1,220 @@ +{ config, lib, pkgs, inputs, ... }: { + config = lib.mkIf config.kyouma.graphical.enable { + home-manager.users.emily.imports = [ + inputs.nixvim.homeManagerModules.nixvim + ]; + home-manager.users.emily.programs.nixvim = { + enable = true; + extraPlugins = [ + pkgs.vimPlugins.molokai + pkgs.vimPlugins.vim-airline-themes + ]; + colorscheme = "molokai"; + vimAlias = true; + highlightOverride.Normal = { + ctermbg = "NONE"; + bg = "NONE"; + }; + opts = { + number = true; + expandtab = true; + autoindent = true; + mouse = ""; + encoding = "utf-8"; + shiftwidth = 2; + smartindent = true; + tabstop = 2; + ignorecase = true; + incsearch = true; + smartcase = true; + }; + keymaps = [ + { + action = "Neotree toggle"; + key = ""; + mode = "n"; + options.silent = true; + } + { + action = ""; + key = ""; + mode = "t"; + } + ]; + plugins.cmp = { + enable = true; + settings.sources = [ + { name = "nvim_lsp"; } + { name = "luasnip"; } + { name = "buffer"; } + { name = "nvim_lua"; } + { name = "path"; } + ]; + settings.formatting = { + fields = [ "abbr" "kind" "menu" ]; + format = '' + function(_, item) + local icons = { + Namespace = "󰌗", + Text = "󰉿", + Method = "󰆧", + Function = "󰆧", + Constructor = "", + Field = "󰜢", + Variable = "󰀫", + Class = "󰠱", + Interface = "", + Module = "", + Property = "󰜢", + Unit = "󰑭", + Value = "󰎠", + Enum = "", + Keyword = "󰌋", + Snippet = "", + Color = "󰏘", + File = "󰈚", + Reference = "󰈇", + Folder = "󰉋", + EnumMember = "", + Constant = "󰏿", + Struct = "󰙅", + Event = "", + Operator = "󰆕", + TypeParameter = "󰊄", + Table = "", + Object = "󰅩", + Tag = "", + Array = "[]", + Boolean = "", + Number = "", + Null = "󰟢", + String = "󰉿", + Calendar = "", + Watch = "󰥔", + Package = "", + Copilot = "", + Codeium = "", + TabNine = "", + } + + local icon = icons[item.kind] or "" + item.kind = string.format("%s %s", icon, item.kind or "") + return item + end + ''; + }; + settings.snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; + settings.window = { + completion = { + winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel"; + scrollbar = false; + sidePadding = 0; + border = [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ]; + }; + documentation = { + border = [ "╭" "─" "╮" "│" "╯" "─" "╰" "│" ]; + winhighlight = "FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel"; + }; + }; + settings.mapping = { + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.select_next_item()"; + "" = "cmp.mapping.select_prev_item()"; + "" = "cmp.mapping.scroll_docs(-4)"; + "" = "cmp.mapping.scroll_docs(4)"; + "" = "cmp.mapping.complete()"; + "" = "cmp.mapping.close()"; + "" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Insert, select = true })"; + "" = '' + cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif require("luasnip").expand_or_jumpable() then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-expand-or-jump", true, true, true), "") + else + fallback() + end + end,{"i","s"}) + ''; + "" = '' + cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif require("luasnip").jumpable(-1) then + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("luasnip-jump-prev", true, true, true), "") + else + fallback() + end + end,{"i","s"}) + ''; + }; + }; + plugins.lsp = { + enable = true; + keymaps.lspBuf = { + "K" = "hover"; + "gd" = "definition"; + "gD" = "references"; + "gt" = "type_definition"; + "gi" = "implementation"; + }; + servers = { + bashls.enable = true; + lua-ls.enable = true; + nil-ls = { + enable = true; + settings.formatting.command = [ "nixfmt" "-w" "140" ]; + }; + nixd = { + enable = false; + settings = { + eval.depth = 5; + eval.workers = 6; + formatting.command = [ "nixfmt" "-w" "140" ]; + options.enable = true; + }; + }; + ruff-lsp.enable = true; + rust-analyzer = { + enable = true; + installRustc = true; + installCargo = true; + }; + }; + }; + plugins.none-ls = { + enable = true; + sources.diagnostics = { + pylint.enable = true; + statix.enable = true; + }; + sources.formatting = { + nixfmt.enable = true; + markdownlint.enable = true; + }; + }; + plugins.neo-tree = { + enable = true; + closeIfLastWindow = true; + }; + plugins.treesitter = { + enable = true; + nixGrammars = true; + settings.indent.enable = true; + }; + plugins.airline.enable = true; + plugins.cmp-buffer.enable = true; + plugins.cmp-emoji.enable = true; + plugins.cmp-nvim-lsp.enable = true; + plugins.cmp-path.enable = true; + plugins.cmp_luasnip.enable = true; + plugins.luasnip.enable = true; + plugins.nvim-autopairs.enable = true; + plugins.rainbow-delimiters.enable = true; + # Broken + plugins.rustaceanvim.enable = false; + plugins.treesitter-context.enable = true; + }; + }; +} diff --git a/config/profiles/graphical/waybar.nix b/modules/graphical/waybar-hyprland.nix similarity index 97% rename from config/profiles/graphical/waybar.nix rename to modules/graphical/waybar-hyprland.nix index 0e56520..cb45f3d 100644 --- a/config/profiles/graphical/waybar.nix +++ b/modules/graphical/waybar-hyprland.nix @@ -1,5 +1,5 @@ -{ pkgs, ... }: { - home-manager.users.emily = { +{ config, lib, pkgs, ... }: { + config.home-manager.users.emily = lib.mkIf config.kyouma.graphical.enable { programs.waybar = { enable = true; style = ./files/waybar-style.css;