feat: modular home

This commit is contained in:
Ryan Yin
2023-12-24 19:54:39 +08:00
parent 2d44bc6006
commit ac4f625768
10 changed files with 105 additions and 56 deletions

View File

@@ -17,7 +17,7 @@ return {
{ import = "astrocommunity.colorscheme.catppuccin" }, { import = "astrocommunity.colorscheme.catppuccin" },
-- Highly experimental plugin that completely replaces -- Highly experimental plugin that completely replaces
-- the UI for messages, cmdline and the popupmenu. -- 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 -- Fully featured & enhanced replacement for copilot.vim
-- <Tab> work with both auto completion in cmp and copilot -- <Tab> work with both auto completion in cmp and copilot
{ import = "astrocommunity.media.vim-wakatime" }, { import = "astrocommunity.media.vim-wakatime" },
@@ -77,7 +77,7 @@ return {
-- lazy-loading on events -- lazy-loading on events
event = { "InsertLeave", "TextChanged" }, event = { "InsertLeave", "TextChanged" },
opts = function(_, opts) opts = function(_, opts)
opts.prompt_style = "notify" -- or stdout opts.prompt_style = "stdout" -- notify or stdout
end, end,
}, },

View File

@@ -10,6 +10,7 @@ with lib; let
in { in {
imports = [ imports = [
anyrun.homeManagerModules.default anyrun.homeManagerModules.default
./nvidia.nix
]; ];
options.modules.desktop.hyprland = { options.modules.desktop.hyprland = {

View File

@@ -13,8 +13,15 @@ env = WLR_NO_HARDWARE_CURSORS,1
# format: # format:
# monitor=name,resolution,position,scale # 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 ---------------------------------------------------- #-- Input ----------------------------------------------------
# Configure mouse and touchpad here. # Configure mouse and touchpad here.

View File

@@ -12,7 +12,7 @@
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
package = hyprland.packages.${pkgs.system}.hyprland; package = hyprland.packages.${pkgs.system}.hyprland;
settings = lib.mkForce {}; settings = {};
extraConfig = builtins.readFile ./hypr-conf/hyprland.conf; extraConfig = builtins.readFile ./hypr-conf/hyprland.conf;
# gammastep/wallpaper-switcher need this to be enabled. # gammastep/wallpaper-switcher need this to be enabled.
systemd.enable = true; systemd.enable = true;
@@ -62,13 +62,5 @@
"NIXOS_OZONE_WL" = "1"; # for any ozone-based browser & electron apps to run on wayland "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_ENABLE_WAYLAND" = "1"; # for firefox to run on wayland
"MOZ_WEBRENDER" = "1"; "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";
}; };
} }

View File

@@ -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";
};
};
}

View File

@@ -7,6 +7,10 @@
with lib; let with lib; let
cfg = config.modules.desktop.i3; cfg = config.modules.desktop.i3;
in { in {
imports = [
./nvidia.nix
];
options.modules.desktop.i3 = { options.modules.desktop.i3 = {
enable = mkEnableOption "i3 window manager"; enable = mkEnableOption "i3 window manager";
}; };

View File

@@ -52,10 +52,4 @@ _: {
# allow fontconfig to discover fonts and configurations installed through home.packages # allow fontconfig to discover fonts and configurations installed through home.packages
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
systemd.user.sessionVariables = {
"LIBVA_DRIVER_NAME" = "nvidia";
"GBM_BACKEND" = "nvidia-drm";
"__GLX_VENDOR_LIBRARY_NAME" = "nvidia";
};
} }

View File

@@ -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";
};
};
}

View File

@@ -0,0 +1,12 @@
{
modules.desktop.hyprland = {
nvidia = false;
# settings = {
# monitor = "";
# };
};
modules.desktop.i3 = {
nvidia = false;
};
}

View File

@@ -1,5 +1,5 @@
let let
_dekstop_bass_modules = { desktop_base_modules = {
nixos-modules = [ nixos-modules = [
../secrets/nixos.nix ../secrets/nixos.nix
../modules/nixos/desktop.nix ../modules/nixos/desktop.nix
@@ -8,51 +8,34 @@ let
../home/linux/desktop.nix ../home/linux/desktop.nix
]; ];
}; };
in {
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 {
# 星野 アイ, Hoshino Ai # 星野 アイ, Hoshino Ai
idol_ai_modules_i3 = { idol_ai_modules_i3 = {
nixos-modules = nixos-modules =
[ [
../hosts/idols/ai ../hosts/idols/ai
{modules.desktop.xorg.enable = true;}
] ]
++ desktop_i3_modules.nixos-modules; ++ desktop_base_modules.nixos-modules;
home-module = desktop_i3_modules.home-module; home-module.imports =
[
{modules.desktop.i3.enable = true;}
]
++ desktop_base_modules.home-module.imports;
}; };
idol_ai_modules_hyprland = { idol_ai_modules_hyprland = {
nixos-modules = nixos-modules =
[ [
../hosts/idols/ai ../hosts/idols/ai
{modules.desktop.wayland.enable = true;}
] ]
++ desktop_hyprland_modules.nixos-modules; ++ desktop_base_modules.nixos-modules;
home-module = desktop_hyprland_modules.home-module; home-module.imports =
[
{modules.desktop.hyprland.enable = true;}
]
++ desktop_base_modules.home-module.imports;
}; };
# 星野 愛久愛海, Hoshino Akuamarin # 星野 愛久愛海, Hoshino Akuamarin
@@ -132,18 +115,30 @@ in rec {
nixos-modules = nixos-modules =
[ [
../hosts/12kingdoms/shoukei ../hosts/12kingdoms/shoukei
{modules.desktop.xorg.enable = true;}
] ]
++ desktop_i3_modules.nixos-modules; ++ desktop_base_modules.nixos-modules;
home-module = desktop_i3_modules.home-module; home-module.imports =
[
../hosts/12kingdoms/shoukei/home.nix
{modules.desktop.i3.enable = true;}
]
++ desktop_base_modules.home-module.imports;
}; };
_12kingdoms_shoukei_modules_hyprland = { _12kingdoms_shoukei_modules_hyprland = {
nixos-modules = nixos-modules =
[ [
../hosts/12kingdoms/shoukei ../hosts/12kingdoms/shoukei
{modules.desktop.wayland.enable = true;}
] ]
++ desktop_hyprland_modules.nixos-modules; ++ desktop_base_modules.nixos-modules;
home-module = desktop_hyprland_modules.home-module; home-module.imports =
[
../hosts/12kingdoms/shoukei/home.nix
{modules.desktop.hyprland.enable = true;}
]
++ desktop_base_modules.home-module.imports;
}; };
# darwin systems # darwin systems