Personal Nix setup

Share hyprland config with NixOS module

Changed files
+127 -85
home
desktop
machines
modules
+2 -48
home/desktop/hyprland.nix
···
description = "Whether to enable Hyprland configuration.";
type = types.bool;
};
-
-
input = mkOption {
-
default = { };
-
type = types.submodule {
-
options = {
-
sensitivity = mkOption {
-
default = 0.0;
-
type = types.float;
-
};
-
kb_model = mkOption {
-
default = "apple";
-
type = types.str;
-
};
-
kb_variant = mkOption {
-
default = "mac";
-
type = types.str;
-
};
-
kb_layout = mkOption {
-
default = "gb";
-
type = types.str;
-
};
-
};
-
};
-
};
-
-
monitor = mkOption {
-
description = "Monitor configuration";
-
default = [ ];
-
type = lib.types.listOf lib.types.str;
-
};
};
config = mkIf cfg.hyprland.enable {
···
plugins = with pkgs.hyprlandPlugins; [ hyprspace ];
settings = {
general = {
gaps_out = 9;
gaps_in = 4;
···
};
};
-
input = {
-
kb_options = "ctrl:nocaps,lv3:ralt_switch";
-
kb_model = cfg.hyprland.input.kb_model;
-
kb_layout = cfg.hyprland.input.kb_layout;
-
kb_variant = cfg.hyprland.input.kb_variant;
-
sensitivity = cfg.hyprland.input.sensitivity;
-
touchpad = {
-
clickfinger_behavior = true;
-
tap-to-click = false;
-
tap-and-drag = false;
-
scroll_factor = 0.18;
-
};
-
};
-
gestures = {
workspace_swipe = true;
workspace_swipe_invert = false;
···
panelHeight = 150;
reservedArea = 38;
};
-
-
monitor = cfg.hyprland.monitor ++ [
-
", preferred, auto, 1"
-
];
bindm = [
"SUPER, mouse:272, movewindow"
···
description = "Whether to enable Hyprland configuration.";
type = types.bool;
};
};
config = mkIf cfg.hyprland.enable {
···
plugins = with pkgs.hyprlandPlugins; [ hyprspace ];
settings = {
+
source = [ "/etc/hypr/hyprland.conf" ];
+
general = {
gaps_out = 9;
gaps_in = 4;
···
};
};
gestures = {
workspace_swipe = true;
workspace_swipe_invert = false;
···
panelHeight = 150;
reservedArea = 38;
};
bindm = [
"SUPER, mouse:272, movewindow"
+13 -1
machines/pepper/configuration.nix
···
};
modules = {
-
desktop.enable = true;
server = {
enable = true;
sshd.enable = true;
···
};
modules = {
+
desktop = {
+
enable = true;
+
hyprland = {
+
input = {
+
sensitivity = -0.5;
+
kb_layout = "us";
+
};
+
monitor = [
+
"desc:Samsung Electric Company Odyssey G60SD HNAX300205, 2560x1440@360, 0x0, 1, vrr, 1"
+
"desc:LG Electronics 27GL850 005NTPC4Q200, preferred, auto, 1, transform, 1, vrr, 1"
+
];
+
};
+
};
server = {
enable = true;
sshd.enable = true;
+1 -13
machines/pepper/home.nix
···
{
modules = {
-
desktop = {
-
enable = true;
-
hyprland = {
-
input = {
-
sensitivity = -0.5;
-
kb_layout = "us";
-
};
-
monitor = [
-
"desc:Samsung Electric Company Odyssey G60SD HNAX300205, 2560x1440@360, 0x0, 1, vrr, 1"
-
"desc:LG Electronics 27GL850 005NTPC4Q200, preferred, auto, 1, transform, 1, vrr, 1"
-
];
-
};
-
};
development.enable = false;
apps = {
enable = true;
···
{
modules = {
+
desktop.enable = true;
development.enable = false;
apps = {
enable = true;
+3
machines/sodacream/configuration.nix
···
enable = true;
rawaccel.enable = false;
affinity.performanceCores = [ 4 5 6 7 ];
};
server = {
enable = true;
···
enable = true;
rawaccel.enable = false;
affinity.performanceCores = [ 4 5 6 7 ];
+
hyprland = {
+
monitor = [ "eDP-1, preferred, 0x0, 1.6" ];
+
};
};
server = {
enable = true;
+1 -4
machines/sodacream/home.nix
···
{ ... }: {
modules = {
-
desktop = {
-
enable = true;
-
hyprland.monitor = [ "eDP-1, preferred, 0x0, 1.6" ];
-
};
development = {
enable = true;
js.enable = true;
···
{ ... }: {
modules = {
+
desktop.enable = true;
development = {
enable = true;
js.enable = true;
+1
modules/desktop/default.nix
···
./rawaccel.nix
./audio.nix
./networking.nix
];
config = mkIf cfg.enable {
···
./rawaccel.nix
./audio.nix
./networking.nix
+
./hyprland.nix
];
config = mkIf cfg.enable {
+105
modules/desktop/hyprland.nix
···
···
+
{ lib, pkgs, config, ... }:
+
+
with lib;
+
let
+
cfg = config.modules.desktop;
+
in {
+
options.modules.desktop.hyprland = {
+
enable = mkOption {
+
default = cfg.enable;
+
example = true;
+
description = "Whether to enable Hyprland";
+
type = types.bool;
+
};
+
+
input = mkOption {
+
default = { };
+
type = types.submodule {
+
options = {
+
sensitivity = mkOption {
+
default = 0.0;
+
type = types.float;
+
};
+
kb_model = mkOption {
+
default = "apple";
+
type = types.str;
+
};
+
kb_variant = mkOption {
+
default = "mac";
+
type = types.str;
+
};
+
kb_layout = mkOption {
+
default = "gb";
+
type = types.str;
+
};
+
};
+
};
+
};
+
+
monitor = mkOption {
+
description = "Monitor configuration";
+
default = [ ];
+
type = lib.types.listOf lib.types.str;
+
};
+
};
+
+
config = mkIf cfg.hyprland.enable {
+
programs = {
+
hyprlock.enable = true;
+
hyprland = {
+
enable = true;
+
withUWSM = true;
+
xwayland.enable = true;
+
};
+
};
+
+
security.pam.services.hyprlock = {};
+
+
xdg.portal = {
+
enable = true;
+
xdgOpenUsePortal = true;
+
extraPortals = with pkgs; [
+
xdg-desktop-portal-hyprland
+
xdg-desktop-portal-gtk
+
];
+
};
+
+
environment.etc."hypr/hyprland.conf".text = ''
+
debug {
+
error_position=1
+
}
+
+
general {
+
allow_tearing=true
+
}
+
+
input {
+
touchpad {
+
clickfinger_behavior=true
+
scroll_factor=0.180000
+
tap-and-drag=false
+
tap-to-click=false
+
}
+
kb_options=ctrl:nocaps,lv3:ralt_switch
+
kb_layout=${cfg.hyprland.input.kb_layout}
+
kb_model=${cfg.hyprland.input.kb_model}
+
kb_variant=${cfg.hyprland.input.kb_variant}
+
sensitivity=${toString cfg.hyprland.input.sensitivity}
+
}
+
+
misc {
+
disable_hyprland_logo=true
+
disable_splash_rendering=true
+
vrr=1
+
}
+
+
render {
+
direct_scanout=1
+
expand_undersized_textures=false
+
}
+
+
${concatMapStringsSep "\n" (x: "monitor=${x}") cfg.hyprland.monitor}
+
monitor=, preferred, auto, 1
+
'';
+
};
+
}
+1 -19
modules/desktop/session.nix
···
theme = gtkTheme;
settings.GTK.application_prefer_dark_theme = true;
};
-
hyprlock.enable = true;
-
hyprland = {
-
enable = true;
-
withUWSM = true;
-
xwayland.enable = true;
-
};
};
-
security = {
-
polkit.enable = true;
-
pam.services.hyprlock = {};
-
};
-
-
xdg.portal = {
-
enable = true;
-
xdgOpenUsePortal = true;
-
extraPortals = with pkgs; [
-
xdg-desktop-portal-hyprland
-
xdg-desktop-portal-gtk
-
];
-
};
};
}
···
theme = gtkTheme;
settings.GTK.application_prefer_dark_theme = true;
};
};
+
security.polkit.enable = true;
};
}