From 3f950bc1f0abe72a4ca01a4eedc8d274098df13d Mon Sep 17 00:00:00 2001 From: "info@data-pro.nu" Date: Thu, 19 Mar 2026 07:00:20 +0000 Subject: [PATCH] Working on reshuffling --- Droidnix/README.org | 68 +++++++++++-------- .../generated/modules/desktop/hyprland.nix | 68 +++++++++++-------- 2 files changed, 78 insertions(+), 58 deletions(-) diff --git a/Droidnix/README.org b/Droidnix/README.org index 1c82e330b..eb4ba9447 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -723,46 +723,56 @@ Finally, it creates a systemd user service (wpaperd.service) that automatically ** =generated/modules/desktop/hyprland.nix= Setting up Hyprland #+BEGIN_SRC nix :tangle generated/modules/desktop/hyprland.nix :noweb tangle :mkdirp yes :eval never-html -{ - config, - pkgs, - lib, - user, - flakeRoot, - ... -}: +{ lib, pkgs, flakeRoot, ... }: let - hyprlandFiles = builtins.attrNames (builtins.readDir "${flakeRoot}/assets/hyprland/conf/hypr"); - # Filter out hyprland.conf from the list of files to symlink + # --- Define user locally --- + username = "henrov"; + + # --- Hyprland conf directory --- + hyprConfDir = "${flakeRoot}/assets/hyprland/conf/hypr"; + + # --- Read files --- + hyprlandFiles = builtins.attrNames (builtins.readDir hyprConfDir); + + # --- Exclude main hyprland.conf from automatic symlinks --- otherHyprlandFiles = lib.filter (name: name != "hyprland.conf") hyprlandFiles; - # Generate xdg.configFile entries for all files except hyprland.conf + + # --- Generate xdg.configFile entries for the other files --- otherConfigs = lib.genAttrs otherHyprlandFiles (name: { target = "hypr/${name}"; - source = "${flakeRoot}/assets/hyprland/conf/hypr/${name}"; + source = "${hyprConfDir}/${name}"; }); + + # --- Add main hyprland.conf separately --- + hyprlandConf = { + "hypr/hyprland.conf".text = builtins.readFile "${hyprConfDir}/hyprland.conf"; + "hypr/.keep".text = ""; + }; in { - programs.hyprland = { - enable = true; - }; + flake.nixosModules.hyprland = { config, pkgs, lib, ... }: - home-manager.users.${user.username} = { - home.stateVersion = "25.11"; - home.username = user.username; - home.homeDirectory = - config.home-manager.users.${user.username}.homeDirectory or "/home/${user.username}"; + { + options.mySystem.desktop.hyprland.enable = + lib.mkEnableOption "Enable Hyprland Desktop"; - wayland.windowManager.hyprland = { - enable = true; - settings.general."col.active_border" = lib.mkForce "0xff97cbcd 0xff89b4fa"; - }; + config = lib.mkIf (config.mySystem.desktop.hyprland.enable or false) { - xdg.configFile = otherConfigs // { - "hypr/hyprland.conf".text = '' - ${builtins.readFile "${flakeRoot}/assets/hyprland/conf/hypr/hyprland.conf"} - ''; - "hypr/.keep".text = ""; + programs.hyprland.enable = true; + + home-manager.users.${username} = { + home.stateVersion = "25.11"; + home.username = username; + home.homeDirectory = "/home/${username}"; + + wayland.windowManager.hyprland = { + enable = true; + settings.general."col.active_border" = lib.mkForce "0xff97cbcd 0xff89b4fa"; + }; + + xdg.configFile = otherConfigs // hyprlandConf; + }; }; }; } diff --git a/Droidnix/generated/modules/desktop/hyprland.nix b/Droidnix/generated/modules/desktop/hyprland.nix index 6cd8567c0..b8eb805a0 100644 --- a/Droidnix/generated/modules/desktop/hyprland.nix +++ b/Droidnix/generated/modules/desktop/hyprland.nix @@ -1,43 +1,53 @@ -{ - config, - pkgs, - lib, - user, - flakeRoot, - ... -}: +{ lib, pkgs, flakeRoot, ... }: let - hyprlandFiles = builtins.attrNames (builtins.readDir "${flakeRoot}/assets/hyprland/conf/hypr"); - # Filter out hyprland.conf from the list of files to symlink + # --- Define user locally --- + username = "henrov"; + + # --- Hyprland conf directory --- + hyprConfDir = "${flakeRoot}/assets/hyprland/conf/hypr"; + + # --- Read files --- + hyprlandFiles = builtins.attrNames (builtins.readDir hyprConfDir); + + # --- Exclude main hyprland.conf from automatic symlinks --- otherHyprlandFiles = lib.filter (name: name != "hyprland.conf") hyprlandFiles; - # Generate xdg.configFile entries for all files except hyprland.conf + + # --- Generate xdg.configFile entries for the other files --- otherConfigs = lib.genAttrs otherHyprlandFiles (name: { target = "hypr/${name}"; - source = "${flakeRoot}/assets/hyprland/conf/hypr/${name}"; + source = "${hyprConfDir}/${name}"; }); + + # --- Add main hyprland.conf separately --- + hyprlandConf = { + "hypr/hyprland.conf".text = builtins.readFile "${hyprConfDir}/hyprland.conf"; + "hypr/.keep".text = ""; + }; in { - programs.hyprland = { - enable = true; - }; + flake.nixosModules.hyprland = { config, pkgs, lib, ... }: - home-manager.users.${user.username} = { - home.stateVersion = "25.11"; - home.username = user.username; - home.homeDirectory = - config.home-manager.users.${user.username}.homeDirectory or "/home/${user.username}"; + { + options.mySystem.desktop.hyprland.enable = + lib.mkEnableOption "Enable Hyprland Desktop"; - wayland.windowManager.hyprland = { - enable = true; - settings.general."col.active_border" = lib.mkForce "0xff97cbcd 0xff89b4fa"; - }; + config = lib.mkIf (config.mySystem.desktop.hyprland.enable or false) { - xdg.configFile = otherConfigs // { - "hypr/hyprland.conf".text = '' - ${builtins.readFile "${flakeRoot}/assets/hyprland/conf/hypr/hyprland.conf"} - ''; - "hypr/.keep".text = ""; + programs.hyprland.enable = true; + + home-manager.users.${username} = { + home.stateVersion = "25.11"; + home.username = username; + home.homeDirectory = "/home/${username}"; + + wayland.windowManager.hyprland = { + enable = true; + settings.general."col.active_border" = lib.mkForce "0xff97cbcd 0xff89b4fa"; + }; + + xdg.configFile = otherConfigs // hyprlandConf; + }; }; }; }