From efb23367138b836832acb1e2f544994b7baa218d Mon Sep 17 00:00:00 2001 From: datsudo <76833632+datsudo@users.noreply.github.com> Date: Wed, 4 Jun 2025 13:02:03 +0800 Subject: [PATCH] change hyprland installation setup --- flake.nix | 5 +++++ shared/hyprland.nix | 13 +++++++++++++ system/de-twm.nix | 16 ++++++++++------ 3 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 shared/hyprland.nix diff --git a/flake.nix b/flake.nix index 41ddd95..427ec14 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,11 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + hyprland.url = "github:hyprwm/Hyprland"; + hyprland-plugins = { + url = "github:hyprwm/hyprland-plugins"; + inputs.hyprland.follows = "hyprland"; + }; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/shared/hyprland.nix b/shared/hyprland.nix new file mode 100644 index 0000000..502cbc1 --- /dev/null +++ b/shared/hyprland.nix @@ -0,0 +1,13 @@ +{ lib, ... }: + +let + inherit (lib) mkOption types; +in +{ + options = { + shared.hyprland.enable = mkOption { + default = true; + type = types.bool; + }; + }; +} diff --git a/system/de-twm.nix b/system/de-twm.nix index a4f3e9e..11b7c61 100644 --- a/system/de-twm.nix +++ b/system/de-twm.nix @@ -1,10 +1,14 @@ -{ config, pkgs, lib, ... }: +{ inputs, config, pkgs, lib, ... }: let inherit (lib) mkOption mkIf types; cfg = config.deWm; in { + imports = [ + ../shared/hyprland.nix + ]; + options.deWm = { cinnamon.enable = mkOption { default = true; ## at least one of them has to be enabled @@ -15,7 +19,7 @@ in type = types.bool; }; hyprland.enable = mkOption { - default = false; + default = config.shared.hyprland.enable; type = types.bool; }; }; @@ -28,9 +32,10 @@ in }; }; - programs.hyprland = { - enable = cfg.hyprland.enable; - xwayland.enable = cfg.hyprland.enable; + programs.hyprland = mkIf cfg.hyprland.enable { + enable = true; + package = inputs.hyprland.packages."${pkgs.system}".hyprland; + xwayland.enable = true; }; environment.systemPackages = with pkgs; [ @@ -38,7 +43,6 @@ in ] ++ lib.optionals cfg.xfce.enable [ xfce.gigolo xfce.xfce4-dict xfce.xfce4-panel xfce.xfce4-pulseaudio-plugin xfce.xfce4-whiskermenu-plugin xfce.mousepad xfce.xfwm4-themes xfce.xfce4-netload-plugin - ] ++ lib.optionals cfg.hyprland.enable [ ]; environment.xfce.excludePackages = with pkgs.xfce; mkIf cfg.xfce.enable [