better host identification method

This commit is contained in:
cnst
2024-11-02 14:05:41 +01:00
parent 81a45ac062
commit 0f497bb437
6 changed files with 55 additions and 42 deletions

View File

@@ -19,7 +19,6 @@ in {
options = { options = {
home.programs.hyprland = { home.programs.hyprland = {
enable = mkEnableOption "Enable Hyprland"; enable = mkEnableOption "Enable Hyprland";
user = mkOption {type = types.enum ["cnst" "toothpick"];};
}; };
}; };

View File

@@ -5,13 +5,8 @@
... ...
}: let }: let
inherit (lib) mkIf mkEnableOption mkMerge; inherit (lib) mkIf mkEnableOption mkMerge;
kbOption =
if osConfig.networking.hostName == "cnixpad"
then "ctrl:swapcaps"
else "";
cfg = config.home.programs.hyprland; cfg = config.home.programs.hyprland;
host = osConfig.networking.hostName;
in { in {
options = { options = {
home.programs.hyprland.inputs.enable = mkEnableOption "Enables input settings in Hyprland"; home.programs.hyprland.inputs.enable = mkEnableOption "Enables input settings in Hyprland";
@@ -44,7 +39,6 @@ in {
input = { input = {
kb_layout = "se"; kb_layout = "se";
kb_variant = "nodeadkeys"; kb_variant = "nodeadkeys";
kb_options = kbOption;
follow_mouse = 1; follow_mouse = 1;
accel_profile = "flat"; accel_profile = "flat";
sensitivity = 0; # -1.0 - 1.0, 0 means no modification. sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
@@ -84,31 +78,37 @@ in {
}; };
} }
(mkIf (cfg.user == "toothpick") { (mkIf (host == "toothpc") {
wayland.windowManager.hyprland.settings.render = { wayland.windowManager.hyprland.settings = {
render = {
explicit_sync = 0; explicit_sync = 0;
explicit_sync_kms = 0; explicit_sync_kms = 0;
direct_scanout = false; direct_scanout = false;
}; };
cursor = {
no_hardware_cursors = true;
};
};
}) })
(mkIf (cfg.user != "toothpick") { (mkIf (host != "toothpc") {
wayland.windowManager.hyprland.settings.render = { wayland.windowManager.hyprland.settings = {
render = {
explicit_sync = 2; explicit_sync = 2;
explicit_sync_kms = 2; explicit_sync_kms = 2;
direct_scanout = false; direct_scanout = false;
}; };
}) cursor = {
no_hardware_cursors = 2;
(mkIf (cfg.user == "toothpick") { };
wayland.windowManager.hyprland.settings.cursor = {
no_hardware_cursors = true;
}; };
}) })
(mkIf (cfg.user != "toothpick") { (mkIf (host == "cnixpad") {
wayland.windowManager.hyprland.settings.cursor = { wayland.windowManager.hyprland.settings = {
no_hardware_cursors = 2; input = {
kb_options = "ctrl:swapcaps";
};
}; };
}) })
]); ]);

View File

@@ -7,6 +7,7 @@
}: let }: let
inherit (lib) mkIf mkEnableOption mkMerge; inherit (lib) mkIf mkEnableOption mkMerge;
cfg = config.home.programs.hyprland; cfg = config.home.programs.hyprland;
host = osConfig.networking.hostName;
in { in {
options = { options = {
home.programs.hyprland.keybinds.enable = mkEnableOption "Enables keybind settings in Hyprland"; home.programs.hyprland.keybinds.enable = mkEnableOption "Enables keybind settings in Hyprland";
@@ -86,32 +87,38 @@ in {
}; };
} }
(mkIf (cfg.user == "cnst") { (mkIf (host == "cnix") {
wayland.windowManager.hyprland.settings = let wayland.windowManager.hyprland.settings = {
cnixpad = osConfig.networking.hostName == "cnixpad";
modKey =
if cnixpad
then "ALT_L"
else "SUPER";
in {
"$terminal" = "alacritty"; "$terminal" = "alacritty";
"$browser" = "zen"; "$browser" = "zen";
"$browserinc" = "zen --private-window"; "$browserinc" = "zen --private-window";
"$mod" = modKey; "$mod" = "SUPER";
bind = [ bind = [
# Add more host-specific binds as needed # Add more host-specific binds as needed
]; ];
}; };
}) })
(mkIf (cfg.user == "toothpick") { (mkIf (host == "cnixpad") {
wayland.windowManager.hyprland.settings = {
"$terminal" = "foot";
"$browser" = "zen";
"$browserinc" = "zen --private-window";
"$mod" = "ALT_L";
bind = [
# Add more host-specific binds as needed
];
};
})
(mkIf (host == "toothpc") {
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
"$terminal" = "foot"; "$terminal" = "foot";
"$browser" = "firefox"; "$browser" = "firefox";
"$browserinc" = "firefox --private-window"; "$browserinc" = "firefox --private-window";
"$mod" = "ALT_L"; "$mod" = "ALT_L";
bind = [ bind = [
# Add more toothpc-specific binds as needed # Add more host-specific binds as needed
]; ];
}; };
}) })

View File

@@ -1,10 +1,12 @@
{ {
lib, lib,
config, config,
osConfig,
... ...
}: let }: let
inherit (lib) mkIf mkEnableOption mkMerge; inherit (lib) mkIf mkEnableOption mkMerge;
cfg = config.home.programs.hyprland; cfg = config.home.programs.hyprland;
host = osConfig.networking.hostName;
in { in {
options = { options = {
home.programs.hyprland.startup.enable = mkEnableOption "Enables startup settings in Hyprland"; home.programs.hyprland.startup.enable = mkEnableOption "Enables startup settings in Hyprland";
@@ -22,7 +24,7 @@ in {
}; };
} }
(mkIf (cfg.user == "cnix") { (mkIf (host == "cnix") {
wayland.windowManager.hyprland.settings.exec-once = [ wayland.windowManager.hyprland.settings.exec-once = [
"mullvad-vpn" "mullvad-vpn"
"blueman-applet" "blueman-applet"
@@ -31,7 +33,14 @@ in {
]; ];
}) })
(mkIf (cfg.user == "toothpc") { (mkIf (host == "cnixpad") {
wayland.windowManager.hyprland.settings.exec-once = [
"blueman-applet"
"pamixer --set-volume 50"
];
})
(mkIf (host == "toothpc") {
wayland.windowManager.hyprland.settings.exec-once = [ wayland.windowManager.hyprland.settings.exec-once = [
"mullvad-vpn" "mullvad-vpn"
"hyprctl dispatch exec 'sleep 3s && solaar -w hide'" "hyprctl dispatch exec 'sleep 3s && solaar -w hide'"

View File

@@ -49,7 +49,6 @@
}; };
hyprland = { hyprland = {
enable = true; enable = true;
user = "cnst";
}; };
hyprlock = { hyprlock = {
enable = true; enable = true;

View File

@@ -40,7 +40,6 @@
}; };
hyprland = { hyprland = {
enable = true; enable = true;
user = "toothpick";
}; };
hyprlock = { hyprlock = {
enable = true; enable = true;