From ac4f6257685596d19387e2f8eae715a8a30deb3a Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sun, 24 Dec 2023 19:54:39 +0800 Subject: [PATCH 1/8] feat: modular home --- .../desktop/neovim/astronvim_user/init.lua | 4 +- home/linux/desktop/hyprland/default.nix | 1 + .../desktop/hyprland/hypr-conf/hyprland.conf | 11 ++- home/linux/desktop/hyprland/hyprland.nix | 10 +-- home/linux/desktop/hyprland/nvidia.nix | 24 +++++++ home/linux/desktop/i3/default.nix | 4 ++ home/linux/desktop/i3/i3.nix | 6 -- home/linux/desktop/i3/nvidia.nix | 20 ++++++ hosts/12kingdoms/shoukei/home.nix | 12 ++++ systems/vars.nix | 69 +++++++++---------- 10 files changed, 105 insertions(+), 56 deletions(-) create mode 100644 home/linux/desktop/hyprland/nvidia.nix create mode 100644 home/linux/desktop/i3/nvidia.nix create mode 100644 hosts/12kingdoms/shoukei/home.nix diff --git a/home/base/desktop/neovim/astronvim_user/init.lua b/home/base/desktop/neovim/astronvim_user/init.lua index 5494f874..1111ed79 100644 --- a/home/base/desktop/neovim/astronvim_user/init.lua +++ b/home/base/desktop/neovim/astronvim_user/init.lua @@ -17,7 +17,7 @@ return { { import = "astrocommunity.colorscheme.catppuccin" }, -- Highly experimental plugin that completely replaces -- the UI for messages, cmdline and the popupmenu. - { import = "astrocommunity.utility.noice-nvim" }, + -- { import = "astrocommunity.utility.noice-nvim" }, -- Fully featured & enhanced replacement for copilot.vim -- work with both auto completion in cmp and copilot { import = "astrocommunity.media.vim-wakatime" }, @@ -77,7 +77,7 @@ return { -- lazy-loading on events event = { "InsertLeave", "TextChanged" }, opts = function(_, opts) - opts.prompt_style = "notify" -- or stdout + opts.prompt_style = "stdout" -- notify or stdout end, }, diff --git a/home/linux/desktop/hyprland/default.nix b/home/linux/desktop/hyprland/default.nix index 56d022ac..b9a45ab2 100644 --- a/home/linux/desktop/hyprland/default.nix +++ b/home/linux/desktop/hyprland/default.nix @@ -10,6 +10,7 @@ with lib; let in { imports = [ anyrun.homeManagerModules.default + ./nvidia.nix ]; options.modules.desktop.hyprland = { diff --git a/home/linux/desktop/hyprland/hypr-conf/hyprland.conf b/home/linux/desktop/hyprland/hypr-conf/hyprland.conf index f67a28a6..68a2283a 100644 --- a/home/linux/desktop/hyprland/hypr-conf/hyprland.conf +++ b/home/linux/desktop/hyprland/hypr-conf/hyprland.conf @@ -13,8 +13,15 @@ env = WLR_NO_HARDWARE_CURSORS,1 # format: # monitor=name,resolution,position,scale - monitor=DP-2,3840x2160@144,0x0,1.6 - workspace=DP-2,1 + + + +# monitor=DP-2,3840x2160@144,0x0,1.6 +# workspace=DP-2,1 + +# Shoukei's builtin display(Macbook Pro 2022 13.3 inch) +monitor=eDP-1,2560x1660@60,0x0,1.5 +workspace=eDP-1,1 #-- Input ---------------------------------------------------- # Configure mouse and touchpad here. diff --git a/home/linux/desktop/hyprland/hyprland.nix b/home/linux/desktop/hyprland/hyprland.nix index 825ec7d3..ab7392ed 100644 --- a/home/linux/desktop/hyprland/hyprland.nix +++ b/home/linux/desktop/hyprland/hyprland.nix @@ -12,7 +12,7 @@ wayland.windowManager.hyprland = { enable = true; package = hyprland.packages.${pkgs.system}.hyprland; - settings = lib.mkForce {}; + settings = {}; extraConfig = builtins.readFile ./hypr-conf/hyprland.conf; # gammastep/wallpaper-switcher need this to be enabled. systemd.enable = true; @@ -62,13 +62,5 @@ "NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland "MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland "MOZ_WEBRENDER" = "1"; - - # for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/ - "LIBVA_DRIVER_NAME" = "nvidia"; - "XDG_SESSION_TYPE" = "wayland"; - "GBM_BACKEND" = "nvidia-drm"; - "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; - "WLR_NO_HARDWARE_CURSORS" = "1"; - "WLR_EGL_NO_MODIFIRES" = "1"; }; } diff --git a/home/linux/desktop/hyprland/nvidia.nix b/home/linux/desktop/hyprland/nvidia.nix new file mode 100644 index 00000000..7118232a --- /dev/null +++ b/home/linux/desktop/hyprland/nvidia.nix @@ -0,0 +1,24 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.modules.desktop.hyprland; +in { + options.modules.desktop.hyprland = { + nvidia = mkEnableOption "whether nvidia GPU is used"; + }; + + config = mkIf (cfg.enable && cfg.nvidia) { + systemd.user.sessionVariables = { + # for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/ + "LIBVA_DRIVER_NAME" = "nvidia"; + "XDG_SESSION_TYPE" = "wayland"; + "GBM_BACKEND" = "nvidia-drm"; + "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; + "WLR_NO_HARDWARE_CURSORS" = "1"; + "WLR_EGL_NO_MODIFIRES" = "1"; + }; + }; +} diff --git a/home/linux/desktop/i3/default.nix b/home/linux/desktop/i3/default.nix index e9386eaf..0f266af5 100644 --- a/home/linux/desktop/i3/default.nix +++ b/home/linux/desktop/i3/default.nix @@ -7,6 +7,10 @@ with lib; let cfg = config.modules.desktop.i3; in { + imports = [ + ./nvidia.nix + ]; + options.modules.desktop.i3 = { enable = mkEnableOption "i3 window manager"; }; diff --git a/home/linux/desktop/i3/i3.nix b/home/linux/desktop/i3/i3.nix index 2fac9409..f5c01892 100644 --- a/home/linux/desktop/i3/i3.nix +++ b/home/linux/desktop/i3/i3.nix @@ -52,10 +52,4 @@ _: { # allow fontconfig to discover fonts and configurations installed through home.packages fonts.fontconfig.enable = true; - - systemd.user.sessionVariables = { - "LIBVA_DRIVER_NAME" = "nvidia"; - "GBM_BACKEND" = "nvidia-drm"; - "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; - }; } diff --git a/home/linux/desktop/i3/nvidia.nix b/home/linux/desktop/i3/nvidia.nix new file mode 100644 index 00000000..b10d8e81 --- /dev/null +++ b/home/linux/desktop/i3/nvidia.nix @@ -0,0 +1,20 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.modules.desktop.i3; +in { + options.modules.desktop.i3 = { + nvidia = mkEnableOption "whether nvidia GPU is used"; + }; + + config = mkIf (cfg.enable && cfg.nvidia) { + systemd.user.sessionVariables = { + "LIBVA_DRIVER_NAME" = "nvidia"; + "GBM_BACKEND" = "nvidia-drm"; + "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; + }; + }; +} diff --git a/hosts/12kingdoms/shoukei/home.nix b/hosts/12kingdoms/shoukei/home.nix new file mode 100644 index 00000000..0d544056 --- /dev/null +++ b/hosts/12kingdoms/shoukei/home.nix @@ -0,0 +1,12 @@ +{ + modules.desktop.hyprland = { + nvidia = false; + # settings = { + # monitor = ""; + # }; + }; + + modules.desktop.i3 = { + nvidia = false; + }; +} diff --git a/systems/vars.nix b/systems/vars.nix index a2bda253..d62eb6b3 100644 --- a/systems/vars.nix +++ b/systems/vars.nix @@ -1,5 +1,5 @@ let - _dekstop_bass_modules = { + desktop_base_modules = { nixos-modules = [ ../secrets/nixos.nix ../modules/nixos/desktop.nix @@ -8,51 +8,34 @@ let ../home/linux/desktop.nix ]; }; - - desktop_i3_modules = { - nixos-modules = - [ - {modules.desktop.xorg.enable = true;} - ] - ++ _dekstop_bass_modules.nixos-modules; - home-module.imports = - [ - ../home/linux/desktop.nix - {modules.desktop.i3.enable = true;} - ] - ++ _dekstop_bass_modules.home-module.imports; - }; - desktop_hyprland_modules = { - nixos-modules = - [ - {modules.desktop.wayland.enable = true;} - ] - ++ _dekstop_bass_modules.nixos-modules; - home-module.imports = - [ - ../home/linux/desktop.nix - {modules.desktop.hyprland.enable = true;} - ] - ++ _dekstop_bass_modules.home-module.imports; - }; -in rec { +in { # 星野 アイ, Hoshino Ai idol_ai_modules_i3 = { nixos-modules = [ ../hosts/idols/ai + {modules.desktop.xorg.enable = true;} ] - ++ desktop_i3_modules.nixos-modules; - home-module = desktop_i3_modules.home-module; + ++ desktop_base_modules.nixos-modules; + home-module.imports = + [ + {modules.desktop.i3.enable = true;} + ] + ++ desktop_base_modules.home-module.imports; }; idol_ai_modules_hyprland = { nixos-modules = [ ../hosts/idols/ai + {modules.desktop.wayland.enable = true;} ] - ++ desktop_hyprland_modules.nixos-modules; - home-module = desktop_hyprland_modules.home-module; + ++ desktop_base_modules.nixos-modules; + home-module.imports = + [ + {modules.desktop.hyprland.enable = true;} + ] + ++ desktop_base_modules.home-module.imports; }; # 星野 愛久愛海, Hoshino Akuamarin @@ -132,18 +115,30 @@ in rec { nixos-modules = [ ../hosts/12kingdoms/shoukei + {modules.desktop.xorg.enable = true;} ] - ++ desktop_i3_modules.nixos-modules; - home-module = desktop_i3_modules.home-module; + ++ desktop_base_modules.nixos-modules; + home-module.imports = + [ + ../hosts/12kingdoms/shoukei/home.nix + {modules.desktop.i3.enable = true;} + ] + ++ desktop_base_modules.home-module.imports; }; _12kingdoms_shoukei_modules_hyprland = { nixos-modules = [ ../hosts/12kingdoms/shoukei + {modules.desktop.wayland.enable = true;} ] - ++ desktop_hyprland_modules.nixos-modules; - home-module = desktop_hyprland_modules.home-module; + ++ desktop_base_modules.nixos-modules; + home-module.imports = + [ + ../hosts/12kingdoms/shoukei/home.nix + {modules.desktop.hyprland.enable = true;} + ] + ++ desktop_base_modules.home-module.imports; }; # darwin systems From 55e12cddaf4ac264316c39a94d67be08d395ec22 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sun, 24 Dec 2023 21:09:16 +0800 Subject: [PATCH 2/8] feat: modular ssh config --- .../desktop/base => base/desktop}/ssh.nix | 9 +---- home/darwin/shell.nix | 34 ------------------- hosts/12kingdoms/shoukei/home.nix | 13 +++++++ hosts/README.md | 3 +- hosts/fern/home.nix | 14 ++++++++ hosts/harmonica/home.nix | 14 ++++++++ hosts/idols/ai/home.nix | 24 +++++++++++++ hosts/idols/aquamarine/home.nix | 2 ++ hosts/idols/kana/home.nix | 2 ++ hosts/idols/ruby/home.nix | 2 ++ modules/base.nix | 2 +- systems/vars.nix | 31 ++++++++++++----- 12 files changed, 98 insertions(+), 52 deletions(-) rename home/{linux/desktop/base => base/desktop}/ssh.nix (84%) create mode 100644 hosts/fern/home.nix create mode 100644 hosts/harmonica/home.nix create mode 100644 hosts/idols/ai/home.nix create mode 100644 hosts/idols/aquamarine/home.nix create mode 100644 hosts/idols/kana/home.nix create mode 100644 hosts/idols/ruby/home.nix diff --git a/home/linux/desktop/base/ssh.nix b/home/base/desktop/ssh.nix similarity index 84% rename from home/linux/desktop/base/ssh.nix rename to home/base/desktop/ssh.nix index 4d2ae668..5a396627 100644 --- a/home/linux/desktop/base/ssh.nix +++ b/home/base/desktop/ssh.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +_: { programs.ssh = { enable = true; @@ -23,13 +23,6 @@ # required to prevent sending default identity files first. IdentitiesOnly yes - Host github.com - # github is controlled by gluttony~ - IdentityFile ~/.ssh/gluttony - # Specifies that ssh should only use the identity file explicitly configured above - # required to prevent sending default identity files first. - IdentitiesOnly yes - Host gtr5 HostName 192.168.5.172 Port 22 diff --git a/home/darwin/shell.nix b/home/darwin/shell.nix index 24759905..7c391cdb 100644 --- a/home/darwin/shell.nix +++ b/home/darwin/shell.nix @@ -16,38 +16,4 @@ export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" ''; }; - - programs.ssh = { - enable = true; - - # all my ssh private key are generated by `ssh-keygen -t ed25519 -C "ryan@nickname"` - # the config's format: - # Host — given the pattern used to match against the host name given on the command line. - # HostName — specify nickname or abbreviation for host - # IdentityFile — the location of your SSH key authentication file for the account. - # format in details: - # https://www.ssh.com/academy/ssh/config - extraConfig = '' - # a private key that is used during authentication will be added to ssh-agent if it is running - AddKeysToAgent yes - - Host 192.168.* - # allow to securely use local SSH agent to authenticate on the remote machine. - # It has the same effect as adding cli option `ssh -A user@host` - ForwardAgent yes - # romantic holds my homelab~ - IdentityFile ~/.ssh/romantic - # Specifies that ssh should only use the identity file explicitly configured above - # required to prevent sending default identity files first. - IdentitiesOnly yes - - Host github.com - Hostname github.com - # github is controlled by gluttony~ - IdentityFile ~/.ssh/harmonica - # Specifies that ssh should only use the identity file explicitly configured above - # required to prevent sending default identity files first. - IdentitiesOnly yes - ''; - }; } diff --git a/hosts/12kingdoms/shoukei/home.nix b/hosts/12kingdoms/shoukei/home.nix index 0d544056..300e74a1 100644 --- a/hosts/12kingdoms/shoukei/home.nix +++ b/hosts/12kingdoms/shoukei/home.nix @@ -9,4 +9,17 @@ modules.desktop.i3 = { nvidia = false; }; + + programs.ssh = { + enable = true; + extraConfig = '' + Host github.com + Hostname github.com + # github is controlled by shoukei~ + IdentityFile ~/.ssh/shoukei + # Specifies that ssh should only use the identity file explicitly configured above + # required to prevent sending default identity files first. + IdentitiesOnly yes + ''; + }; } diff --git a/hosts/README.md b/hosts/README.md index 89a71c11..3e51cfd4 100644 --- a/hosts/README.md +++ b/hosts/README.md @@ -12,7 +12,8 @@ 1. `nozomi`: Lichee Pi 4A, TH1520(4xC910@2.0G), 8GB RAM + 32G eMMC + 64G SD Card. 2. `yukina`: Lichee Pi 4A(Internal Test Version), TH1520(4xC910@2.0G), 8GB RAM + 8G eMMC + 128G SD Card. 3. `chiaya`: Milk-V Mars, JH7110(4xU74@1.5 GHz), 4G RAM + No eMMC + 64G SD Card. -4. `12kingdoms`: Currently only one aarch64 host +4. `12kingdoms`: + 1. `shoukei`: NixOS 1. `suzu`: Orange Pi 5, RK3588s(4xA76 + 4xA55), GPU(4Cores, Mail-G610), NPU(6Tops@int8), 8G RAM + 256G SSD. diff --git a/hosts/fern/home.nix b/hosts/fern/home.nix new file mode 100644 index 00000000..57c997d2 --- /dev/null +++ b/hosts/fern/home.nix @@ -0,0 +1,14 @@ +_: { + programs.ssh = { + enable = true; + extraConfig = '' + Host github.com + Hostname github.com + # github is controlled by fern~ + IdentityFile ~/.ssh/fern + # Specifies that ssh should only use the identity file explicitly configured above + # required to prevent sending default identity files first. + IdentitiesOnly yes + ''; + }; +} diff --git a/hosts/harmonica/home.nix b/hosts/harmonica/home.nix new file mode 100644 index 00000000..0e311de0 --- /dev/null +++ b/hosts/harmonica/home.nix @@ -0,0 +1,14 @@ +_: { + programs.ssh = { + enable = true; + extraConfig = '' + Host github.com + Hostname github.com + # github is controlled by harmonica~ + IdentityFile ~/.ssh/harmonica + # Specifies that ssh should only use the identity file explicitly configured above + # required to prevent sending default identity files first. + IdentitiesOnly yes + ''; + }; +} diff --git a/hosts/idols/ai/home.nix b/hosts/idols/ai/home.nix new file mode 100644 index 00000000..6155c573 --- /dev/null +++ b/hosts/idols/ai/home.nix @@ -0,0 +1,24 @@ +{ + modules.desktop.hyprland = { + nvidia = false; + # settings = { + # monitor = ""; + # }; + }; + + modules.desktop.i3 = { + nvidia = false; + }; + + programs.ssh = { + enable = true; + extraConfig = '' + Host github.com + # github is controlled by gluttony~ + IdentityFile ~/.ssh/gluttony + # Specifies that ssh should only use the identity file explicitly configured above + # required to prevent sending default identity files first. + IdentitiesOnly yes + ''; + }; +} diff --git a/hosts/idols/aquamarine/home.nix b/hosts/idols/aquamarine/home.nix new file mode 100644 index 00000000..2c63c085 --- /dev/null +++ b/hosts/idols/aquamarine/home.nix @@ -0,0 +1,2 @@ +{ +} diff --git a/hosts/idols/kana/home.nix b/hosts/idols/kana/home.nix new file mode 100644 index 00000000..2c63c085 --- /dev/null +++ b/hosts/idols/kana/home.nix @@ -0,0 +1,2 @@ +{ +} diff --git a/hosts/idols/ruby/home.nix b/hosts/idols/ruby/home.nix new file mode 100644 index 00000000..2c63c085 --- /dev/null +++ b/hosts/idols/ruby/home.nix @@ -0,0 +1,2 @@ +{ +} diff --git a/modules/base.nix b/modules/base.nix index f2f21bb0..aa2cad91 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -2,7 +2,7 @@ users.users.${username} = { openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDiipi59EnVbi6bK1bGrcbfEM263wgdNfbrt6VBC1rHx ryan@ai-idols" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII7PTkP3ixXTZlrJNSHnXgkmHNT+QslFi9wNYXOpVwGB ryan@harmonica" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMSfp/hvegbK04HykWvoY1EbDW+vXu1AlCjVivWE2ZeR ryan@shoukei" ]; }; diff --git a/systems/vars.nix b/systems/vars.nix index d62eb6b3..25664ce3 100644 --- a/systems/vars.nix +++ b/systems/vars.nix @@ -45,7 +45,10 @@ in { ../modules/nixos/server.nix ../modules/nixos/proxmox-hardware-configuration.nix ]; - home-module = import ../home/linux/server.nix; + home-module.imports = [ + ../hosts/idols/aquamarine/home.nix + ../home/linux/server.nix + ]; }; idol_aquamarine_tags = ["dist-build" "aqua"]; @@ -56,7 +59,10 @@ in { ../modules/nixos/server.nix ../modules/nixos/proxmox-hardware-configuration.nix ]; - home-module = import ../home/linux/server.nix; + home-module.imports = [ + ../hosts/idols/ruby/home.nix + ../home/linux/server.nix + ]; }; idol_ruby_tags = ["dist-build" "ruby"]; @@ -67,7 +73,10 @@ in { ../modules/nixos/server.nix ../modules/nixos/proxmox-hardware-configuration.nix ]; - home-module = import ../home/linux/server.nix; + home-module.imports = [ + ../hosts/idols/kana/home.nix + ../home/linux/server.nix + ]; }; idol_kana_tags = ["dist-build" "kana"]; @@ -80,7 +89,7 @@ in { # cross-compilation this flake. {nixpkgs.crossSystem.system = "riscv64-linux";} ]; - # home-module = import ../home/linux/server.nix; + # home-module.imports = []; }; rolling_nozomi_tags = ["riscv" "nozomi"]; @@ -93,7 +102,7 @@ in { # cross-compilation this flake. {nixpkgs.crossSystem.system = "riscv64-linux";} ]; - # home-module = import ../home/linux/server.nix; + # home-module.imports = []; }; rolling_yukina_tags = ["riscv" "yukina"]; @@ -106,7 +115,7 @@ in { # cross-compilation this flake. {nixpkgs.crossSystem.config = "aarch64-unknown-linux-gnu";} ]; - # home-module = import ../home/linux/server.nix; + # home-module.imports = []; }; _12kingdoms_suzu_tags = ["aarch" "suzu"]; @@ -149,7 +158,10 @@ in { ../modules/darwin ../secrets/darwin.nix ]; - home-module = import ../home/darwin; + home-module.imports = [ + ../hosts/harmonica/home.nix + ../home/darwin + ]; }; darwin_fern_modules = { darwin-modules = [ @@ -158,6 +170,9 @@ in { ../modules/darwin ../secrets/darwin.nix ]; - home-module = import ../home/darwin; + home-module.imports = [ + ../hosts/fern/home.nix + ../home/darwin + ]; }; } From 3aaaeb49ca24cd35b9bf102d5e5c1ffdc4b54f5c Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sun, 24 Dec 2023 22:09:18 +0800 Subject: [PATCH 3/8] feat: modular hyprland's configurations --- home/linux/desktop/base/gtk.nix | 2 +- .../{hypr-conf => conf}/hyprland.conf | 46 +----------------- .../hyprland/{hypr-conf => conf}/mako/config | 0 .../mako/icons/brightness-100.png | Bin .../mako/icons/brightness-20.png | Bin .../mako/icons/brightness-40.png | Bin .../mako/icons/brightness-60.png | Bin .../mako/icons/brightness-80.png | Bin .../mako/icons/dropper.png | Bin .../mako/icons/microphone-mute.png | Bin .../mako/icons/microphone.png | Bin .../{hypr-conf => conf}/mako/icons/music.png | Bin .../mako/icons/palette.png | Bin .../mako/icons/picture.png | Bin .../{hypr-conf => conf}/mako/icons/timer.png | Bin .../mako/icons/volume-high.png | Bin .../mako/icons/volume-low.png | Bin .../mako/icons/volume-mid.png | Bin .../mako/icons/volume-mute.png | Bin .../desktop/hyprland/{ => conf}/mpd/mpd.conf | 0 .../{hypr-conf => conf}/scripts/brightness | 0 .../{hypr-conf => conf}/scripts/colorpicker | 0 .../{hypr-conf => conf}/scripts/lockscreen | 0 .../hyprland/{hypr-conf => conf}/scripts/menu | 0 .../{hypr-conf => conf}/scripts/notifications | 0 .../{hypr-conf => conf}/scripts/screenshot | 0 .../{hypr-conf => conf}/scripts/startup | 0 .../{hypr-conf => conf}/scripts/statusbar | 0 .../{hypr-conf => conf}/scripts/volume | 0 .../{hypr-conf => conf}/scripts/wlogout | 0 .../{hypr-conf => conf}/waybar/config.jsonc | 0 .../{hypr-conf => conf}/waybar/style.css | 0 .../wlogout/icons/hibernate.png | Bin .../wlogout/icons/lock.png | Bin .../wlogout/icons/logout.png | Bin .../wlogout/icons/reboot.png | Bin .../wlogout/icons/shutdown.png | Bin .../wlogout/icons/suspend.png | Bin .../{hypr-conf => conf}/wlogout/layout | 0 .../{hypr-conf => conf}/wlogout/style.css | 0 home/linux/desktop/hyprland/default.nix | 36 ++++++++++---- .../desktop/hyprland/options/default.nix | 3 ++ .../desktop/hyprland/{ => options}/nvidia.nix | 2 +- .../desktop/hyprland/{ => values}/anyrun.nix | 0 .../linux/desktop/hyprland/values/default.nix | 4 ++ .../hyprland/{ => values}/hyprland.nix | 32 ++++++------ .../hyprland/{ => values}/packages.nix | 0 .../hyprland/{ => values}/wayland-apps.nix | 0 hosts/12kingdoms/shoukei/home.nix | 11 +++-- hosts/idols/ai/home.nix | 11 +++-- 50 files changed, 71 insertions(+), 76 deletions(-) rename home/linux/desktop/hyprland/{hypr-conf => conf}/hyprland.conf (79%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/config (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/brightness-100.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/brightness-20.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/brightness-40.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/brightness-60.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/brightness-80.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/dropper.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/microphone-mute.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/microphone.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/music.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/palette.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/picture.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/timer.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/volume-high.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/volume-low.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/volume-mid.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/mako/icons/volume-mute.png (100%) rename home/linux/desktop/hyprland/{ => conf}/mpd/mpd.conf (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/scripts/brightness (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/scripts/colorpicker (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/scripts/lockscreen (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/scripts/menu (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/scripts/notifications (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/scripts/screenshot (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/scripts/startup (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/scripts/statusbar (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/scripts/volume (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/scripts/wlogout (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/waybar/config.jsonc (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/waybar/style.css (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/wlogout/icons/hibernate.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/wlogout/icons/lock.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/wlogout/icons/logout.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/wlogout/icons/reboot.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/wlogout/icons/shutdown.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/wlogout/icons/suspend.png (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/wlogout/layout (100%) rename home/linux/desktop/hyprland/{hypr-conf => conf}/wlogout/style.css (100%) create mode 100644 home/linux/desktop/hyprland/options/default.nix rename home/linux/desktop/hyprland/{ => options}/nvidia.nix (90%) rename home/linux/desktop/hyprland/{ => values}/anyrun.nix (100%) create mode 100644 home/linux/desktop/hyprland/values/default.nix rename home/linux/desktop/hyprland/{ => values}/hyprland.nix (70%) rename home/linux/desktop/hyprland/{ => values}/packages.nix (100%) rename home/linux/desktop/hyprland/{ => values}/wayland-apps.nix (100%) diff --git a/home/linux/desktop/base/gtk.nix b/home/linux/desktop/base/gtk.nix index 8088459a..43b36091 100644 --- a/home/linux/desktop/base/gtk.nix +++ b/home/linux/desktop/base/gtk.nix @@ -11,7 +11,7 @@ gtk.enable = true; x11.enable = true; package = pkgs.bibata-cursors; - name = "Bibata-Modern-Classic"; + name = "Bibata-Modern-Ice"; size = 24; }; diff --git a/home/linux/desktop/hyprland/hypr-conf/hyprland.conf b/home/linux/desktop/hyprland/conf/hyprland.conf similarity index 79% rename from home/linux/desktop/hyprland/hypr-conf/hyprland.conf rename to home/linux/desktop/hyprland/conf/hyprland.conf index 68a2283a..4c10a6b4 100644 --- a/home/linux/desktop/hyprland/hypr-conf/hyprland.conf +++ b/home/linux/desktop/hyprland/conf/hyprland.conf @@ -1,28 +1,3 @@ -## Hyprland configuration file - -# color-scheme: cappuccin-mocha -source=~/.config/hypr/themes/mocha.conf - -env = _JAVA_AWT_WM_NONREPARENTING,1 -env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1 -# fix https://github.com/hyprwm/Hyprland/issues/1520 -env = WLR_NO_HARDWARE_CURSORS,1 - -#-- Output ---------------------------------------------------- -# Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info. - - # format: - # monitor=name,resolution,position,scale - - - -# monitor=DP-2,3840x2160@144,0x0,1.6 -# workspace=DP-2,1 - -# Shoukei's builtin display(Macbook Pro 2022 13.3 inch) -monitor=eDP-1,2560x1660@60,0x0,1.5 -workspace=eDP-1,1 - #-- Input ---------------------------------------------------- # Configure mouse and touchpad here. input { @@ -206,10 +181,9 @@ bind=SUPER,mouse_up,workspace,e-1 #-- Startup ---------------------------------------------------- exec-once=~/.config/hypr/scripts/startup - -#-- Fcitx5 input method ---------------------------------------------------- +# -- Fcitx5 input method windowrule=pseudo,fcitx # enable this will make fcitx5 works, but fcitx5-configtool will not work! -exec-once=cp ~/.config/fcitx5/profile-bak ~/.config/fcitx5/profile # restore fcitx5 profile manged by nixos +exec-once=cp ~/.config/fcitx5/profile-bak ~/.config/fcitx5/profile # restore fcitx5 profile managed by nixos exec-once=fcitx5 -d --replace # start fcitx5 daemon bind=ALT,E,exec,pkill fcitx5 -9;sleep 1;fcitx5 -d --replace; sleep 1;fcitx5-remote -r @@ -220,20 +194,4 @@ windowrulev2 = size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$ # -- Fix input method in vscode exec-once = hyprctl setcursor "Bibata-Modern-Ice" 24 -# 效果是 wayland 原生窗口缩放完全正常 -# xwayland 窗口先渲染到 200% 再降到 hyprland config 里 monitor 设置的值,看上去和原生没啥区别 -# 相比较一开始的方案输入法字体大小也正确了.唯一有点问题的可能是 xwayland 窗口下的鼠标指针大小不对 -exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2 --- Fix HiDPI - xwayland -# change monitor to high resolution, the last argument is the scale factor -monitor=,highres,auto,2 - -# unscale XWayland -xwayland { - force_zero_scaling = true -} - -# toolkit-specific scale -env = GDK_SCALE,2 -env = XCURSOR_SIZE,32 diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/config b/home/linux/desktop/hyprland/conf/mako/config similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/config rename to home/linux/desktop/hyprland/conf/mako/config diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/brightness-100.png b/home/linux/desktop/hyprland/conf/mako/icons/brightness-100.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/brightness-100.png rename to home/linux/desktop/hyprland/conf/mako/icons/brightness-100.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/brightness-20.png b/home/linux/desktop/hyprland/conf/mako/icons/brightness-20.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/brightness-20.png rename to home/linux/desktop/hyprland/conf/mako/icons/brightness-20.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/brightness-40.png b/home/linux/desktop/hyprland/conf/mako/icons/brightness-40.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/brightness-40.png rename to home/linux/desktop/hyprland/conf/mako/icons/brightness-40.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/brightness-60.png b/home/linux/desktop/hyprland/conf/mako/icons/brightness-60.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/brightness-60.png rename to home/linux/desktop/hyprland/conf/mako/icons/brightness-60.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/brightness-80.png b/home/linux/desktop/hyprland/conf/mako/icons/brightness-80.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/brightness-80.png rename to home/linux/desktop/hyprland/conf/mako/icons/brightness-80.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/dropper.png b/home/linux/desktop/hyprland/conf/mako/icons/dropper.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/dropper.png rename to home/linux/desktop/hyprland/conf/mako/icons/dropper.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/microphone-mute.png b/home/linux/desktop/hyprland/conf/mako/icons/microphone-mute.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/microphone-mute.png rename to home/linux/desktop/hyprland/conf/mako/icons/microphone-mute.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/microphone.png b/home/linux/desktop/hyprland/conf/mako/icons/microphone.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/microphone.png rename to home/linux/desktop/hyprland/conf/mako/icons/microphone.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/music.png b/home/linux/desktop/hyprland/conf/mako/icons/music.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/music.png rename to home/linux/desktop/hyprland/conf/mako/icons/music.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/palette.png b/home/linux/desktop/hyprland/conf/mako/icons/palette.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/palette.png rename to home/linux/desktop/hyprland/conf/mako/icons/palette.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/picture.png b/home/linux/desktop/hyprland/conf/mako/icons/picture.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/picture.png rename to home/linux/desktop/hyprland/conf/mako/icons/picture.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/timer.png b/home/linux/desktop/hyprland/conf/mako/icons/timer.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/timer.png rename to home/linux/desktop/hyprland/conf/mako/icons/timer.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/volume-high.png b/home/linux/desktop/hyprland/conf/mako/icons/volume-high.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/volume-high.png rename to home/linux/desktop/hyprland/conf/mako/icons/volume-high.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/volume-low.png b/home/linux/desktop/hyprland/conf/mako/icons/volume-low.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/volume-low.png rename to home/linux/desktop/hyprland/conf/mako/icons/volume-low.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/volume-mid.png b/home/linux/desktop/hyprland/conf/mako/icons/volume-mid.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/volume-mid.png rename to home/linux/desktop/hyprland/conf/mako/icons/volume-mid.png diff --git a/home/linux/desktop/hyprland/hypr-conf/mako/icons/volume-mute.png b/home/linux/desktop/hyprland/conf/mako/icons/volume-mute.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/mako/icons/volume-mute.png rename to home/linux/desktop/hyprland/conf/mako/icons/volume-mute.png diff --git a/home/linux/desktop/hyprland/mpd/mpd.conf b/home/linux/desktop/hyprland/conf/mpd/mpd.conf similarity index 100% rename from home/linux/desktop/hyprland/mpd/mpd.conf rename to home/linux/desktop/hyprland/conf/mpd/mpd.conf diff --git a/home/linux/desktop/hyprland/hypr-conf/scripts/brightness b/home/linux/desktop/hyprland/conf/scripts/brightness similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/scripts/brightness rename to home/linux/desktop/hyprland/conf/scripts/brightness diff --git a/home/linux/desktop/hyprland/hypr-conf/scripts/colorpicker b/home/linux/desktop/hyprland/conf/scripts/colorpicker similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/scripts/colorpicker rename to home/linux/desktop/hyprland/conf/scripts/colorpicker diff --git a/home/linux/desktop/hyprland/hypr-conf/scripts/lockscreen b/home/linux/desktop/hyprland/conf/scripts/lockscreen similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/scripts/lockscreen rename to home/linux/desktop/hyprland/conf/scripts/lockscreen diff --git a/home/linux/desktop/hyprland/hypr-conf/scripts/menu b/home/linux/desktop/hyprland/conf/scripts/menu similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/scripts/menu rename to home/linux/desktop/hyprland/conf/scripts/menu diff --git a/home/linux/desktop/hyprland/hypr-conf/scripts/notifications b/home/linux/desktop/hyprland/conf/scripts/notifications similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/scripts/notifications rename to home/linux/desktop/hyprland/conf/scripts/notifications diff --git a/home/linux/desktop/hyprland/hypr-conf/scripts/screenshot b/home/linux/desktop/hyprland/conf/scripts/screenshot similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/scripts/screenshot rename to home/linux/desktop/hyprland/conf/scripts/screenshot diff --git a/home/linux/desktop/hyprland/hypr-conf/scripts/startup b/home/linux/desktop/hyprland/conf/scripts/startup similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/scripts/startup rename to home/linux/desktop/hyprland/conf/scripts/startup diff --git a/home/linux/desktop/hyprland/hypr-conf/scripts/statusbar b/home/linux/desktop/hyprland/conf/scripts/statusbar similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/scripts/statusbar rename to home/linux/desktop/hyprland/conf/scripts/statusbar diff --git a/home/linux/desktop/hyprland/hypr-conf/scripts/volume b/home/linux/desktop/hyprland/conf/scripts/volume similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/scripts/volume rename to home/linux/desktop/hyprland/conf/scripts/volume diff --git a/home/linux/desktop/hyprland/hypr-conf/scripts/wlogout b/home/linux/desktop/hyprland/conf/scripts/wlogout similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/scripts/wlogout rename to home/linux/desktop/hyprland/conf/scripts/wlogout diff --git a/home/linux/desktop/hyprland/hypr-conf/waybar/config.jsonc b/home/linux/desktop/hyprland/conf/waybar/config.jsonc similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/waybar/config.jsonc rename to home/linux/desktop/hyprland/conf/waybar/config.jsonc diff --git a/home/linux/desktop/hyprland/hypr-conf/waybar/style.css b/home/linux/desktop/hyprland/conf/waybar/style.css similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/waybar/style.css rename to home/linux/desktop/hyprland/conf/waybar/style.css diff --git a/home/linux/desktop/hyprland/hypr-conf/wlogout/icons/hibernate.png b/home/linux/desktop/hyprland/conf/wlogout/icons/hibernate.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/wlogout/icons/hibernate.png rename to home/linux/desktop/hyprland/conf/wlogout/icons/hibernate.png diff --git a/home/linux/desktop/hyprland/hypr-conf/wlogout/icons/lock.png b/home/linux/desktop/hyprland/conf/wlogout/icons/lock.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/wlogout/icons/lock.png rename to home/linux/desktop/hyprland/conf/wlogout/icons/lock.png diff --git a/home/linux/desktop/hyprland/hypr-conf/wlogout/icons/logout.png b/home/linux/desktop/hyprland/conf/wlogout/icons/logout.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/wlogout/icons/logout.png rename to home/linux/desktop/hyprland/conf/wlogout/icons/logout.png diff --git a/home/linux/desktop/hyprland/hypr-conf/wlogout/icons/reboot.png b/home/linux/desktop/hyprland/conf/wlogout/icons/reboot.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/wlogout/icons/reboot.png rename to home/linux/desktop/hyprland/conf/wlogout/icons/reboot.png diff --git a/home/linux/desktop/hyprland/hypr-conf/wlogout/icons/shutdown.png b/home/linux/desktop/hyprland/conf/wlogout/icons/shutdown.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/wlogout/icons/shutdown.png rename to home/linux/desktop/hyprland/conf/wlogout/icons/shutdown.png diff --git a/home/linux/desktop/hyprland/hypr-conf/wlogout/icons/suspend.png b/home/linux/desktop/hyprland/conf/wlogout/icons/suspend.png similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/wlogout/icons/suspend.png rename to home/linux/desktop/hyprland/conf/wlogout/icons/suspend.png diff --git a/home/linux/desktop/hyprland/hypr-conf/wlogout/layout b/home/linux/desktop/hyprland/conf/wlogout/layout similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/wlogout/layout rename to home/linux/desktop/hyprland/conf/wlogout/layout diff --git a/home/linux/desktop/hyprland/hypr-conf/wlogout/style.css b/home/linux/desktop/hyprland/conf/wlogout/style.css similarity index 100% rename from home/linux/desktop/hyprland/hypr-conf/wlogout/style.css rename to home/linux/desktop/hyprland/conf/wlogout/style.css diff --git a/home/linux/desktop/hyprland/default.nix b/home/linux/desktop/hyprland/default.nix index b9a45ab2..23d697d5 100644 --- a/home/linux/desktop/hyprland/default.nix +++ b/home/linux/desktop/hyprland/default.nix @@ -10,22 +10,38 @@ with lib; let in { imports = [ anyrun.homeManagerModules.default - ./nvidia.nix + ./options ]; options.modules.desktop.hyprland = { enable = mkEnableOption "hyprland compositor"; + settings = lib.mkOption { + type = with lib.types; let + valueType = + nullOr (oneOf [ + bool + int + float + str + path + (attrsOf valueType) + (listOf valueType) + ]) + // { + description = "Hyprland configuration value"; + }; + in + valueType; + default = {}; + }; }; config = mkIf cfg.enable ( - mkMerge - (map - (path: import path args) - [ - ./hyprland.nix - ./packages.nix - ./anyrun.nix - ./wayland-apps.nix - ]) + mkMerge ([ + { + wayland.windowManager.hyprland.settings = cfg.settings; + } + ] + ++ (import ./values args)) ); } diff --git a/home/linux/desktop/hyprland/options/default.nix b/home/linux/desktop/hyprland/options/default.nix new file mode 100644 index 00000000..eeb48a40 --- /dev/null +++ b/home/linux/desktop/hyprland/options/default.nix @@ -0,0 +1,3 @@ +{mylib, ...}: { + imports = mylib.scanPaths ./.; +} diff --git a/home/linux/desktop/hyprland/nvidia.nix b/home/linux/desktop/hyprland/options/nvidia.nix similarity index 90% rename from home/linux/desktop/hyprland/nvidia.nix rename to home/linux/desktop/hyprland/options/nvidia.nix index 7118232a..2009c851 100644 --- a/home/linux/desktop/hyprland/nvidia.nix +++ b/home/linux/desktop/hyprland/options/nvidia.nix @@ -17,8 +17,8 @@ in { "XDG_SESSION_TYPE" = "wayland"; "GBM_BACKEND" = "nvidia-drm"; "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; + # fix https://github.com/hyprwm/Hyprland/issues/1520 "WLR_NO_HARDWARE_CURSORS" = "1"; - "WLR_EGL_NO_MODIFIRES" = "1"; }; }; } diff --git a/home/linux/desktop/hyprland/anyrun.nix b/home/linux/desktop/hyprland/values/anyrun.nix similarity index 100% rename from home/linux/desktop/hyprland/anyrun.nix rename to home/linux/desktop/hyprland/values/anyrun.nix diff --git a/home/linux/desktop/hyprland/values/default.nix b/home/linux/desktop/hyprland/values/default.nix new file mode 100644 index 00000000..0e13748d --- /dev/null +++ b/home/linux/desktop/hyprland/values/default.nix @@ -0,0 +1,4 @@ +{mylib, ...} @ args: +map +(path: import path args) +(mylib.scanPaths ./.) diff --git a/home/linux/desktop/hyprland/hyprland.nix b/home/linux/desktop/hyprland/values/hyprland.nix similarity index 70% rename from home/linux/desktop/hyprland/hyprland.nix rename to home/linux/desktop/hyprland/values/hyprland.nix index ab7392ed..293cbc41 100644 --- a/home/linux/desktop/hyprland/hyprland.nix +++ b/home/linux/desktop/hyprland/values/hyprland.nix @@ -11,9 +11,11 @@ # they are all depending on hyprland/i3's user graphical-session wayland.windowManager.hyprland = { enable = true; + settings = { + source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-hyprland}/themes/mocha.conf"; + }; package = hyprland.packages.${pkgs.system}.hyprland; - settings = {}; - extraConfig = builtins.readFile ./hypr-conf/hyprland.conf; + extraConfig = builtins.readFile ../conf/hyprland.conf; # gammastep/wallpaper-switcher need this to be enabled. systemd.enable = true; }; @@ -28,29 +30,25 @@ # hyprland configs, based on https://github.com/notwidow/hyprland xdg.configFile = { "hypr/mako" = { - source = ./hypr-conf/mako; + source = ../conf/mako; recursive = true; }; "hypr/scripts" = { - source = ./hypr-conf/scripts; + source = ../conf/scripts; recursive = true; }; "hypr/waybar" = { - source = ./hypr-conf/waybar; + source = ../conf/waybar; recursive = true; }; "hypr/wlogout" = { - source = ./hypr-conf/wlogout; - recursive = true; - }; - "hypr/themes" = { - source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-hyprland}/themes"; + source = ../conf/wlogout; recursive = true; }; # music player - mpd "mpd" = { - source = ./mpd; + source = ../conf/mpd; recursive = true; }; }; @@ -59,8 +57,14 @@ fonts.fontconfig.enable = true; systemd.user.sessionVariables = { - "NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland - "MOZ_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland - "MOZ_WEBRENDER" = "1"; + NIXOS_OZONE_WL = "1"; # for any ozone-based browser & electron apps to run on wayland + MOZ_ENABLE_WAYLAND = "1"; # for firefox to run on wayland + MOZ_WEBRENDER = "1"; + # toolkit-specific scale + GDK_SCALE = "2"; + XCURSOR_SIZE = "32"; + # misc + _JAVA_AWT_WM_NONREPARENTING = "1"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; }; } diff --git a/home/linux/desktop/hyprland/packages.nix b/home/linux/desktop/hyprland/values/packages.nix similarity index 100% rename from home/linux/desktop/hyprland/packages.nix rename to home/linux/desktop/hyprland/values/packages.nix diff --git a/home/linux/desktop/hyprland/wayland-apps.nix b/home/linux/desktop/hyprland/values/wayland-apps.nix similarity index 100% rename from home/linux/desktop/hyprland/wayland-apps.nix rename to home/linux/desktop/hyprland/values/wayland-apps.nix diff --git a/hosts/12kingdoms/shoukei/home.nix b/hosts/12kingdoms/shoukei/home.nix index 300e74a1..2fae3eb1 100644 --- a/hosts/12kingdoms/shoukei/home.nix +++ b/hosts/12kingdoms/shoukei/home.nix @@ -1,9 +1,14 @@ { modules.desktop.hyprland = { nvidia = false; - # settings = { - # monitor = ""; - # }; + settings = { + # Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info. + # highres: get the best possible resolution + # auto: postition automatically + # 1.5: scale to 1.5 times + # bitdepth,10: enable 10 bit support + monitor = "eDP-1,highres,auto,1.5,bitdepth,10"; + }; }; modules.desktop.i3 = { diff --git a/hosts/idols/ai/home.nix b/hosts/idols/ai/home.nix index 6155c573..c8b05204 100644 --- a/hosts/idols/ai/home.nix +++ b/hosts/idols/ai/home.nix @@ -1,9 +1,14 @@ { modules.desktop.hyprland = { nvidia = false; - # settings = { - # monitor = ""; - # }; + settings = { + # Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info. + # highres: get the best possible resolution + # auto: postition automatically + # 1.5: scale to 1.5 times + # bitdepth,10: enable 10 bit support + monitor = "DP-2,highres,auto,1.5,bitdepth,10"; + }; }; modules.desktop.i3 = { From 30881f356a15f87d790b5565ad17fdf507617311 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sun, 24 Dec 2023 22:49:13 +0800 Subject: [PATCH 4/8] feat: modular i3's configurations --- Makefile | 2 +- .../i3/{ => conf}/dual-monitor-4k-1080p.sh | 0 home/linux/desktop/i3/{ => conf}/i3-config | 0 home/linux/desktop/i3/{ => conf}/i3blocks.conf | 0 .../desktop/i3/{ => conf}/layouts/README.md | 0 .../i3/{ => conf}/layouts/idols-monitor.json | 0 .../rofi}/arc_dark_colors.rasi | 0 .../rofi}/arc_dark_transparent_colors.rasi | 0 .../{rofi-conf => conf/rofi}/power-profiles.rasi | 0 .../i3/{rofi-conf => conf/rofi}/powermenu.rasi | 0 .../i3/{rofi-conf => conf/rofi}/rofidmenu.rasi | 0 .../i3/{rofi-conf => conf/rofi}/rofikeyhint.rasi | 0 .../desktop/i3/{ => conf}/scripts/README.md | 0 .../desktop/i3/{ => conf}/scripts/bandwidth | 0 .../desktop/i3/{ => conf}/scripts/blur-lock | 0 .../i3/{ => conf}/scripts/empty_workspace | 0 .../desktop/i3/{ => conf}/scripts/power-profiles | 0 .../desktop/i3/{ => conf}/scripts/powermenu | 0 .../{ => conf}/scripts/restore-idols-monitor.sh | 0 home/linux/desktop/i3/default.nix | 11 ++--------- home/linux/desktop/i3/options/default.nix | 3 +++ home/linux/desktop/i3/{ => options}/nvidia.nix | 0 home/linux/desktop/i3/values/default.nix | 4 ++++ home/linux/desktop/i3/{ => values}/i3.nix | 16 ++++++++-------- home/linux/desktop/i3/{ => values}/packages.nix | 1 + home/linux/desktop/i3/{ => values}/x11-apps.nix | 1 - systems/nixos.nix | 2 +- 27 files changed, 20 insertions(+), 20 deletions(-) rename home/linux/desktop/i3/{ => conf}/dual-monitor-4k-1080p.sh (100%) rename home/linux/desktop/i3/{ => conf}/i3-config (100%) rename home/linux/desktop/i3/{ => conf}/i3blocks.conf (100%) rename home/linux/desktop/i3/{ => conf}/layouts/README.md (100%) rename home/linux/desktop/i3/{ => conf}/layouts/idols-monitor.json (100%) rename home/linux/desktop/i3/{rofi-conf => conf/rofi}/arc_dark_colors.rasi (100%) rename home/linux/desktop/i3/{rofi-conf => conf/rofi}/arc_dark_transparent_colors.rasi (100%) rename home/linux/desktop/i3/{rofi-conf => conf/rofi}/power-profiles.rasi (100%) rename home/linux/desktop/i3/{rofi-conf => conf/rofi}/powermenu.rasi (100%) rename home/linux/desktop/i3/{rofi-conf => conf/rofi}/rofidmenu.rasi (100%) rename home/linux/desktop/i3/{rofi-conf => conf/rofi}/rofikeyhint.rasi (100%) rename home/linux/desktop/i3/{ => conf}/scripts/README.md (100%) rename home/linux/desktop/i3/{ => conf}/scripts/bandwidth (100%) rename home/linux/desktop/i3/{ => conf}/scripts/blur-lock (100%) rename home/linux/desktop/i3/{ => conf}/scripts/empty_workspace (100%) rename home/linux/desktop/i3/{ => conf}/scripts/power-profiles (100%) rename home/linux/desktop/i3/{ => conf}/scripts/powermenu (100%) rename home/linux/desktop/i3/{ => conf}/scripts/restore-idols-monitor.sh (100%) create mode 100644 home/linux/desktop/i3/options/default.nix rename home/linux/desktop/i3/{ => options}/nvidia.nix (100%) create mode 100644 home/linux/desktop/i3/values/default.nix rename home/linux/desktop/i3/{ => values}/i3.nix (79%) rename home/linux/desktop/i3/{ => values}/packages.nix (91%) rename home/linux/desktop/i3/{ => values}/x11-apps.nix (88%) diff --git a/Makefile b/Makefile index ff9d4d0f..2307d7b4 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ i3: nixos-rebuild switch --flake .#ai_i3 --use-remote-sudo s-i3: - nixos-rebuild switch --flake .#shoekei_i3 --use-remote-sudo + nixos-rebuild switch --flake .#shoukei_i3 --use-remote-sudo hypr: nixos-rebuild switch --flake .#ai_hyprland --use-remote-sudo diff --git a/home/linux/desktop/i3/dual-monitor-4k-1080p.sh b/home/linux/desktop/i3/conf/dual-monitor-4k-1080p.sh similarity index 100% rename from home/linux/desktop/i3/dual-monitor-4k-1080p.sh rename to home/linux/desktop/i3/conf/dual-monitor-4k-1080p.sh diff --git a/home/linux/desktop/i3/i3-config b/home/linux/desktop/i3/conf/i3-config similarity index 100% rename from home/linux/desktop/i3/i3-config rename to home/linux/desktop/i3/conf/i3-config diff --git a/home/linux/desktop/i3/i3blocks.conf b/home/linux/desktop/i3/conf/i3blocks.conf similarity index 100% rename from home/linux/desktop/i3/i3blocks.conf rename to home/linux/desktop/i3/conf/i3blocks.conf diff --git a/home/linux/desktop/i3/layouts/README.md b/home/linux/desktop/i3/conf/layouts/README.md similarity index 100% rename from home/linux/desktop/i3/layouts/README.md rename to home/linux/desktop/i3/conf/layouts/README.md diff --git a/home/linux/desktop/i3/layouts/idols-monitor.json b/home/linux/desktop/i3/conf/layouts/idols-monitor.json similarity index 100% rename from home/linux/desktop/i3/layouts/idols-monitor.json rename to home/linux/desktop/i3/conf/layouts/idols-monitor.json diff --git a/home/linux/desktop/i3/rofi-conf/arc_dark_colors.rasi b/home/linux/desktop/i3/conf/rofi/arc_dark_colors.rasi similarity index 100% rename from home/linux/desktop/i3/rofi-conf/arc_dark_colors.rasi rename to home/linux/desktop/i3/conf/rofi/arc_dark_colors.rasi diff --git a/home/linux/desktop/i3/rofi-conf/arc_dark_transparent_colors.rasi b/home/linux/desktop/i3/conf/rofi/arc_dark_transparent_colors.rasi similarity index 100% rename from home/linux/desktop/i3/rofi-conf/arc_dark_transparent_colors.rasi rename to home/linux/desktop/i3/conf/rofi/arc_dark_transparent_colors.rasi diff --git a/home/linux/desktop/i3/rofi-conf/power-profiles.rasi b/home/linux/desktop/i3/conf/rofi/power-profiles.rasi similarity index 100% rename from home/linux/desktop/i3/rofi-conf/power-profiles.rasi rename to home/linux/desktop/i3/conf/rofi/power-profiles.rasi diff --git a/home/linux/desktop/i3/rofi-conf/powermenu.rasi b/home/linux/desktop/i3/conf/rofi/powermenu.rasi similarity index 100% rename from home/linux/desktop/i3/rofi-conf/powermenu.rasi rename to home/linux/desktop/i3/conf/rofi/powermenu.rasi diff --git a/home/linux/desktop/i3/rofi-conf/rofidmenu.rasi b/home/linux/desktop/i3/conf/rofi/rofidmenu.rasi similarity index 100% rename from home/linux/desktop/i3/rofi-conf/rofidmenu.rasi rename to home/linux/desktop/i3/conf/rofi/rofidmenu.rasi diff --git a/home/linux/desktop/i3/rofi-conf/rofikeyhint.rasi b/home/linux/desktop/i3/conf/rofi/rofikeyhint.rasi similarity index 100% rename from home/linux/desktop/i3/rofi-conf/rofikeyhint.rasi rename to home/linux/desktop/i3/conf/rofi/rofikeyhint.rasi diff --git a/home/linux/desktop/i3/scripts/README.md b/home/linux/desktop/i3/conf/scripts/README.md similarity index 100% rename from home/linux/desktop/i3/scripts/README.md rename to home/linux/desktop/i3/conf/scripts/README.md diff --git a/home/linux/desktop/i3/scripts/bandwidth b/home/linux/desktop/i3/conf/scripts/bandwidth similarity index 100% rename from home/linux/desktop/i3/scripts/bandwidth rename to home/linux/desktop/i3/conf/scripts/bandwidth diff --git a/home/linux/desktop/i3/scripts/blur-lock b/home/linux/desktop/i3/conf/scripts/blur-lock similarity index 100% rename from home/linux/desktop/i3/scripts/blur-lock rename to home/linux/desktop/i3/conf/scripts/blur-lock diff --git a/home/linux/desktop/i3/scripts/empty_workspace b/home/linux/desktop/i3/conf/scripts/empty_workspace similarity index 100% rename from home/linux/desktop/i3/scripts/empty_workspace rename to home/linux/desktop/i3/conf/scripts/empty_workspace diff --git a/home/linux/desktop/i3/scripts/power-profiles b/home/linux/desktop/i3/conf/scripts/power-profiles similarity index 100% rename from home/linux/desktop/i3/scripts/power-profiles rename to home/linux/desktop/i3/conf/scripts/power-profiles diff --git a/home/linux/desktop/i3/scripts/powermenu b/home/linux/desktop/i3/conf/scripts/powermenu similarity index 100% rename from home/linux/desktop/i3/scripts/powermenu rename to home/linux/desktop/i3/conf/scripts/powermenu diff --git a/home/linux/desktop/i3/scripts/restore-idols-monitor.sh b/home/linux/desktop/i3/conf/scripts/restore-idols-monitor.sh similarity index 100% rename from home/linux/desktop/i3/scripts/restore-idols-monitor.sh rename to home/linux/desktop/i3/conf/scripts/restore-idols-monitor.sh diff --git a/home/linux/desktop/i3/default.nix b/home/linux/desktop/i3/default.nix index 0f266af5..3520023a 100644 --- a/home/linux/desktop/i3/default.nix +++ b/home/linux/desktop/i3/default.nix @@ -8,7 +8,7 @@ with lib; let cfg = config.modules.desktop.i3; in { imports = [ - ./nvidia.nix + ./options ]; options.modules.desktop.i3 = { @@ -16,13 +16,6 @@ in { }; config = mkIf cfg.enable ( - mkMerge - (map - (path: import path args) - [ - ./i3.nix - ./packages.nix - ./x11-apps.nix - ]) + mkMerge (import ./values args) ); } diff --git a/home/linux/desktop/i3/options/default.nix b/home/linux/desktop/i3/options/default.nix new file mode 100644 index 00000000..eeb48a40 --- /dev/null +++ b/home/linux/desktop/i3/options/default.nix @@ -0,0 +1,3 @@ +{mylib, ...}: { + imports = mylib.scanPaths ./.; +} diff --git a/home/linux/desktop/i3/nvidia.nix b/home/linux/desktop/i3/options/nvidia.nix similarity index 100% rename from home/linux/desktop/i3/nvidia.nix rename to home/linux/desktop/i3/options/nvidia.nix diff --git a/home/linux/desktop/i3/values/default.nix b/home/linux/desktop/i3/values/default.nix new file mode 100644 index 00000000..0e13748d --- /dev/null +++ b/home/linux/desktop/i3/values/default.nix @@ -0,0 +1,4 @@ +{mylib, ...} @ args: +map +(path: import path args) +(mylib.scanPaths ./.) diff --git a/home/linux/desktop/i3/i3.nix b/home/linux/desktop/i3/values/i3.nix similarity index 79% rename from home/linux/desktop/i3/i3.nix rename to home/linux/desktop/i3/values/i3.nix index f5c01892..2f87ac4e 100644 --- a/home/linux/desktop/i3/i3.nix +++ b/home/linux/desktop/i3/values/i3.nix @@ -9,7 +9,7 @@ _: { enable = true; windowManager.i3 = { enable = true; - extraConfig = builtins.readFile ./i3-config; + extraConfig = builtins.readFile ../conf/i3-config; }; # Path, relative to HOME, where Home Manager should write the X session script. # and NixOS will use it to start xorg session when system boot up @@ -17,20 +17,20 @@ _: { }; xdg.configFile = { - "i3/i3blocks.conf".source = ./i3blocks.conf; + "i3/i3blocks.conf".source = ../conf/i3blocks.conf; "i3/scripts" = { - source = ./scripts; + source = ../conf/scripts; # copy the scripts directory recursively recursive = true; executable = true; # make all scripts executable }; "i3/layouts" = { - source = ./layouts; + source = ../conf/layouts; recursive = true; }; # rofi is a application launcher and dmenu replacement "rofi" = { - source = ./rofi-conf; + source = ../conf/rofi; # copy the scripts directory recursively recursive = true; }; @@ -38,16 +38,16 @@ _: { home.file = { ".local/bin/bright" = { - source = ./bin/bright; + source = ../bin/bright; executable = true; }; ".local/bin/logout" = { - source = ./bin/logout; + source = ../bin/logout; executable = true; }; # xrandr - set primary screen - ".screenlayout/monitor.sh".source = ./dual-monitor-4k-1080p.sh; + ".screenlayout/monitor.sh".source = ../conf/dual-monitor-4k-1080p.sh; }; # allow fontconfig to discover fonts and configurations installed through home.packages diff --git a/home/linux/desktop/i3/packages.nix b/home/linux/desktop/i3/values/packages.nix similarity index 91% rename from home/linux/desktop/i3/packages.nix rename to home/linux/desktop/i3/values/packages.nix index 60b95b5e..833efe6d 100644 --- a/home/linux/desktop/i3/packages.nix +++ b/home/linux/desktop/i3/values/packages.nix @@ -10,6 +10,7 @@ picom # transparency and shadows feh # set wallpaper xcolor # color picker + xsel # for clipboard support in x11, required by tmux's clipboard support acpi # battery information arandr # screen layout manager diff --git a/home/linux/desktop/i3/x11-apps.nix b/home/linux/desktop/i3/values/x11-apps.nix similarity index 88% rename from home/linux/desktop/i3/x11-apps.nix rename to home/linux/desktop/i3/values/x11-apps.nix index cb22f208..4ea61f7a 100644 --- a/home/linux/desktop/i3/x11-apps.nix +++ b/home/linux/desktop/i3/values/x11-apps.nix @@ -1,7 +1,6 @@ {pkgs, ...}: { home.packages = with pkgs; [ firefox - xsel # for clipboard support in x11, required by tmux's clipboard support ]; # TODO vscode & chrome both have wayland support, but they don't work with fcitx5, need to fix it. diff --git a/systems/nixos.nix b/systems/nixos.nix index 8b159971..e98caa2e 100644 --- a/systems/nixos.nix +++ b/systems/nixos.nix @@ -16,7 +16,7 @@ in { ai_hyprland = nixosSystem (idol_ai_modules_hyprland // base_args); # shoukei - shoukei_ie = nixosSystem (_12kingdoms_shoukei_modules_i3 // base_args); + shoukei_i3 = nixosSystem (_12kingdoms_shoukei_modules_i3 // base_args); shoukei_hyprland = nixosSystem (_12kingdoms_shoukei_modules_hyprland // base_args); # three virtual machines without desktop environment. From 0a2aae246aa9764253f3b0e5cc0cff019456d252 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sun, 24 Dec 2023 23:05:58 +0800 Subject: [PATCH 5/8] fix: neovim fzf --- home/base/desktop/neovim/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/home/base/desktop/neovim/default.nix b/home/base/desktop/neovim/default.nix index 5faa3f48..d44a7a50 100644 --- a/home/base/desktop/neovim/default.nix +++ b/home/base/desktop/neovim/default.nix @@ -36,9 +36,10 @@ vimAlias = true; # currently we use lazy.nvim as neovim's package manager, so comment this one. - # plugins = with pkgs.vimPlugins; [ - # # search all the plugins using https://search.nixos.org/packages - # ]; + plugins = with pkgs.vimPlugins; [ + # search all the plugins using https://search.nixos.org/packages + telescope-fzf-native-nvim + ]; # Extra packages only available to nvim(won't pollute the global home environment) extraPackages = with pkgs; From 5e83259bcbc7acb7fe67e7848b62a55c70474b34 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sun, 24 Dec 2023 23:20:36 +0800 Subject: [PATCH 6/8] fix: enable nvidia on idol-ai --- home/linux/desktop/hyprland/values/hyprland.nix | 3 --- hosts/idols/ai/home.nix | 4 ++-- systems/vars.nix | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/home/linux/desktop/hyprland/values/hyprland.nix b/home/linux/desktop/hyprland/values/hyprland.nix index 293cbc41..9ea80c49 100644 --- a/home/linux/desktop/hyprland/values/hyprland.nix +++ b/home/linux/desktop/hyprland/values/hyprland.nix @@ -60,9 +60,6 @@ NIXOS_OZONE_WL = "1"; # for any ozone-based browser & electron apps to run on wayland MOZ_ENABLE_WAYLAND = "1"; # for firefox to run on wayland MOZ_WEBRENDER = "1"; - # toolkit-specific scale - GDK_SCALE = "2"; - XCURSOR_SIZE = "32"; # misc _JAVA_AWT_WM_NONREPARENTING = "1"; QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; diff --git a/hosts/idols/ai/home.nix b/hosts/idols/ai/home.nix index c8b05204..3b9cfc07 100644 --- a/hosts/idols/ai/home.nix +++ b/hosts/idols/ai/home.nix @@ -1,6 +1,6 @@ { modules.desktop.hyprland = { - nvidia = false; + nvidia = true; settings = { # Configure your Display resolution, offset, scale and Monitors here, use `hyprctl monitors` to get the info. # highres: get the best possible resolution @@ -12,7 +12,7 @@ }; modules.desktop.i3 = { - nvidia = false; + nvidia = true; }; programs.ssh = { diff --git a/systems/vars.nix b/systems/vars.nix index 25664ce3..c90f9e05 100644 --- a/systems/vars.nix +++ b/systems/vars.nix @@ -19,6 +19,7 @@ in { ++ desktop_base_modules.nixos-modules; home-module.imports = [ + ../hosts/idols/ai/home.nix {modules.desktop.i3.enable = true;} ] ++ desktop_base_modules.home-module.imports; @@ -33,6 +34,7 @@ in { ++ desktop_base_modules.nixos-modules; home-module.imports = [ + ../hosts/idols/ai/home.nix {modules.desktop.hyprland.enable = true;} ] ++ desktop_base_modules.home-module.imports; From 210aa544fc3a9e1e9e808368ce86a18db2497d61 Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Sun, 24 Dec 2023 23:47:48 +0800 Subject: [PATCH 7/8] fix: user environment variables do not take effects --- home/linux/base/shell.nix | 6 ++---- .../linux/desktop/hyprland/options/nvidia.nix | 14 ++++++------- .../desktop/hyprland/values/hyprland.nix | 17 +++++++-------- home/linux/desktop/i3/options/nvidia.nix | 21 ++++++++++++------- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/home/linux/base/shell.nix b/home/linux/base/shell.nix index 04bd35cb..a530468c 100644 --- a/home/linux/base/shell.nix +++ b/home/linux/base/shell.nix @@ -7,8 +7,8 @@ in rec { home.homeDirectory = "/home/${username}"; - # add environment variables - systemd.user.sessionVariables = { + # environment variables that always set at login + home.sessionVariables = { # clean up ~ LESSHISTFILE = cache + "/less/history"; LESSKEY = c + "/less/lesskey"; @@ -25,6 +25,4 @@ in rec { # enable scrolling in git diff DELTA_PAGER = "less -R"; }; - - home.sessionVariables = systemd.user.sessionVariables; } diff --git a/home/linux/desktop/hyprland/options/nvidia.nix b/home/linux/desktop/hyprland/options/nvidia.nix index 2009c851..7d604b60 100644 --- a/home/linux/desktop/hyprland/options/nvidia.nix +++ b/home/linux/desktop/hyprland/options/nvidia.nix @@ -11,14 +11,14 @@ in { }; config = mkIf (cfg.enable && cfg.nvidia) { - systemd.user.sessionVariables = { + wayland.windowManager.hyprland.settings.env = [ # for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/ - "LIBVA_DRIVER_NAME" = "nvidia"; - "XDG_SESSION_TYPE" = "wayland"; - "GBM_BACKEND" = "nvidia-drm"; - "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; + "LIBVA_DRIVER_NAME,nvidia" + "XDG_SESSION_TYPE,wayland" + "GBM_BACKEND,nvidia-drm" + "__GLX_VENDOR_LIBRARY_NAME,nvidia" # fix https://github.com/hyprwm/Hyprland/issues/1520 - "WLR_NO_HARDWARE_CURSORS" = "1"; - }; + "WLR_NO_HARDWARE_CURSORS,1" + ]; }; } diff --git a/home/linux/desktop/hyprland/values/hyprland.nix b/home/linux/desktop/hyprland/values/hyprland.nix index 9ea80c49..93abc80a 100644 --- a/home/linux/desktop/hyprland/values/hyprland.nix +++ b/home/linux/desktop/hyprland/values/hyprland.nix @@ -13,6 +13,14 @@ enable = true; settings = { source = "${nur-ryan4yin.packages.${pkgs.system}.catppuccin-hyprland}/themes/mocha.conf"; + env = [ + "NIXOS_OZONE_WL,1" # for any ozone-based browser & electron apps to run on wayland + "MOZ_ENABLE_WAYLAND,1" # for firefox to run on wayland + "MOZ_WEBRENDER,1" + # misc + "_JAVA_AWT_WM_NONREPARENTING,1" + "QT_WAYLAND_DISABLE_WINDOWDECORATION,1" + ]; }; package = hyprland.packages.${pkgs.system}.hyprland; extraConfig = builtins.readFile ../conf/hyprland.conf; @@ -55,13 +63,4 @@ # allow fontconfig to discover fonts and configurations installed through home.packages fonts.fontconfig.enable = true; - - systemd.user.sessionVariables = { - NIXOS_OZONE_WL = "1"; # for any ozone-based browser & electron apps to run on wayland - MOZ_ENABLE_WAYLAND = "1"; # for firefox to run on wayland - MOZ_WEBRENDER = "1"; - # misc - _JAVA_AWT_WM_NONREPARENTING = "1"; - QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; - }; } diff --git a/home/linux/desktop/i3/options/nvidia.nix b/home/linux/desktop/i3/options/nvidia.nix index b10d8e81..d686d317 100644 --- a/home/linux/desktop/i3/options/nvidia.nix +++ b/home/linux/desktop/i3/options/nvidia.nix @@ -10,11 +10,18 @@ in { nvidia = mkEnableOption "whether nvidia GPU is used"; }; - config = mkIf (cfg.enable && cfg.nvidia) { - systemd.user.sessionVariables = { - "LIBVA_DRIVER_NAME" = "nvidia"; - "GBM_BACKEND" = "nvidia-drm"; - "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; - }; - }; + config = mkIf (cfg.enable && cfg.nvidia) ( + let + env = { + "LIBVA_DRIVER_NAME" = "nvidia"; + "GBM_BACKEND" = "nvidia-drm"; + "__GLX_VENDOR_LIBRARY_NAME" = "nvidia"; + }; + in { + # environment set for systemd's user session + systemd.user.sessionVariables = env; + # environment set at user login + home.sessionVariables = env; + } + ); } From 647f56d21316b7fb7c59e9dd7bc2a4eb459c7cae Mon Sep 17 00:00:00 2001 From: Ryan Yin Date: Mon, 25 Dec 2023 00:08:11 +0800 Subject: [PATCH 8/8] chore: remove useless config in hyprland --- home/linux/desktop/hyprland/conf/hyprland.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/home/linux/desktop/hyprland/conf/hyprland.conf b/home/linux/desktop/hyprland/conf/hyprland.conf index 4c10a6b4..fc688763 100644 --- a/home/linux/desktop/hyprland/conf/hyprland.conf +++ b/home/linux/desktop/hyprland/conf/hyprland.conf @@ -192,6 +192,3 @@ windowrulev2 = rounding 0, xwayland:1, floating:1 windowrulev2 = center, class:^(.*jetbrains.*)$, title:^(Confirm Exit|Open Project|win424|win201|splash)$ windowrulev2 = size 640 400, class:^(.*jetbrains.*)$, title:^(splash)$ -# -- Fix input method in vscode -exec-once = hyprctl setcursor "Bibata-Modern-Ice" 24 -