Skip to content

Commit

Permalink
feat(nix): move hyprland to hm
Browse files Browse the repository at this point in the history
  • Loading branch information
sbulav committed Feb 21, 2024
1 parent c496a2f commit ba3d1e2
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 46 deletions.
2 changes: 1 addition & 1 deletion nix/homes/x86_64-linux/sab@nz/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ with lib.custom; {
};

desktop = {
hyprland = enabled;
addons = {
# gtk = enabled;
hyprpaper = enabled;
mako = enabled;
rofi = enabled;
Expand Down
41 changes: 41 additions & 0 deletions nix/modules/home/desktop/addons/hypridle/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
inputs,
options,
config,
lib,
pkgs,
...
}:
with lib;
with lib.custom; let
cfg = config.custom.desktop.addons.hypridle;
inherit (inputs) hypridle;
in {
imports = [hypridle.homeManagerModules.default];

options.custom.desktop.addons.hypridle = with types; {
enable = mkBoolOpt false "Whether to enable the hypridle";
};

config = mkIf cfg.enable {
services.hypridle = {
enable = true;
package = pkgs.hypridle;

lockCmd = "${getExe config.programs.hypridle.package}";
afterSleepCmd = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms on";

listeners = [
{
timeout = 900;
onTimeout = "${getExe config.programs.hypridle.package}";
}
{
timeout = 1200;
onTimeout = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms off";
onResume = "${getExe' config.wayland.windowManager.hyprland.package "hyprctl"} dispatch dpms on";
}
];
};
};
}
26 changes: 26 additions & 0 deletions nix/modules/home/desktop/hyprland/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
options,
config,
lib,
pkgs,
...
}:
with lib;
with lib.custom; let
cfg = config.custom.desktop.hyprland;
in {
options.custom.desktop.hyprland = with types; {
enable = mkBoolOpt false "Whether or not to install Hyprland and dependencies.";
};

config = mkIf cfg.enable {
wayland.windowManager.hyprland = {
enable = true;
extraConfig =
builtins.readFile ./hyprland.conf;

systemd.enable = true;
xwayland.enable = true;
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,19 @@
}:
with lib;
with lib.custom; let
cfg = config.custom.desktop.hyprland;
cfg = config.custom.desktop.addons.hyprland-utils;
in {
options.custom.desktop.hyprland = with types; {
enable = mkBoolOpt false "Whether or not to install Hyprland and dependencies.";
options.custom.desktop.addons.hyprland-utils = with types; {
enable = mkBoolOpt false "Whether or not to add support for hyprland.";
};

config = mkIf cfg.enable {
custom.desktop.addons = {
keyring = enabled;
# nautilus = enabled;
# thunar = enabled;
gtk = enabled;
# hyprpaper = enabled;
# kitty = enabled;
# mako = enabled;
regreet = enabled;
# rofi = enabled;
# swayidle = enabled;
# swaylock = enabled;
# waybar = enabled;
# wezterm = enabled;
# wlogout = enabled;
xdg-portal = enabled;
# Required as deps
programs.hyprland = {
enable = true;
xwayland.enable = true;
};

# home.configFile."hypr/hyprland.conf".source = ./hyprland.conf;

environment.systemPackages = with pkgs; [
# hyprland
# hyprland-protocols
Expand Down Expand Up @@ -66,22 +52,6 @@ in {
XDG_SESSION_DESKTOP = "Hyprland";
XDG_SCREENSHOTS_DIR = "~/Pictures/Screenshots";
};

# Required as deps
programs.hyprland = {
enable = true;
xwayland.enable = true;
};

home.wayland.windowManager.hyprland = {
enable = true;
extraConfig =
builtins.readFile ./hyprland.conf;

systemd.enable = true;
xwayland.enable = true;
};

services.xserver = {
enable = true;
displayManager = {
Expand Down
6 changes: 0 additions & 6 deletions nix/modules/nixos/home/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ with lib.custom; {
mkOpt attrs {}
"A set of files to be managed by home-manager's <option>xdg.configFile</option>.";
programs = mkOpt attrs {} "Programs to be managed by home-manager.";
services = mkOpt attrs {} "Services to be managed by home-manager.";
wayland = mkOpt attrs {} "Wayland to be managed by home-manager.";
extraOptions = mkOpt attrs {} "Options to pass directly to home-manager.";
};

Expand All @@ -29,10 +27,6 @@ with lib.custom; {
home.file = mkAliasDefinitions options.home.file;
home.stateVersion = config.system.stateVersion;
programs = mkAliasDefinitions options.home.programs;
services = mkAliasDefinitions options.home.services;
wayland = mkAliasDefinitions options.home.wayland;
xdg.configFile = mkAliasDefinitions options.home.configFile;
xdg.enable = true;
};

home-manager = {
Expand Down
8 changes: 6 additions & 2 deletions nix/modules/nixos/suites/desktop/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ in {
config = mkIf cfg.enable {
system.security.rbw.enable = true;
custom = {
desktop = {
hyprland = enabled;
desktop.addons = {
keyring = enabled;
gtk = enabled;
regreet = enabled;
xdg-portal = enabled;
hyprland-utils = enabled;
};
apps = {
firefox = enabled;
Expand Down

0 comments on commit ba3d1e2

Please sign in to comment.