Compare commits

...

2 Commits

Author SHA1 Message Date
henrov 6e7b522191 Working on reshuffling 2026-03-19 11:57:36 +00:00
henrov 6615746c1b deleted generated files 2026-03-19 11:57:36 +00:00
2 changed files with 130 additions and 66 deletions
+60 -28
View File
@@ -641,55 +641,87 @@ Finally, it creates a systemd user service (wpaperd.service) that automatically
** =generated/modules/desktop/hyprland.nix= ** =generated/modules/desktop/hyprland.nix=
Setting up Hyprland Setting up Hyprland
#+BEGIN_SRC nix :tangle generated/modules/desktop/hyprland.nix :noweb tangle :mkdirp yes :eval never-html #+BEGIN_SRC nix :tangle generated/modules/desktop/hyprland.nix :noweb tangle :mkdirp yes :eval never-html
{ lib, pkgs, flakeRoot, ... }: { lib, config, flakeRoot, ... }:
let let
# --- Define user locally --- # --- Program definition ---
username = "henrov"; programName = "hyprland";
# --- Hyprland conf directory --- # --- Assets ---
hyprConfDir = "${flakeRoot}/assets/hyprland/conf/hypr"; programAssets = "${flakeRoot}/assets/hyprland/conf/hypr";
# --- Read files --- programFiles =
hyprlandFiles = builtins.attrNames (builtins.readDir hyprConfDir); if builtins.pathExists programAssets
then builtins.readDir programAssets
else {};
# --- Exclude main hyprland.conf from automatic symlinks --- fileNames = builtins.attrNames programFiles;
otherHyprlandFiles = lib.filter (name: name != "hyprland.conf") hyprlandFiles;
# --- Generate xdg.configFile entries for the other files --- # Exclude main config (handled separately)
otherConfigs = lib.genAttrs otherHyprlandFiles (name: { otherFiles = lib.filter (name: name != "hyprland.conf") fileNames;
target = "hypr/${name}";
source = "${hyprConfDir}/${name}"; # Generate file mappings
files = lib.genAttrs otherFiles (name: {
src = "${programAssets}/${name}";
}); });
# --- Add main hyprland.conf separately --- # Main config (inline)
hyprlandConf = { mainConfigPath = "${programAssets}/hyprland.conf";
"hypr/hyprland.conf".text = builtins.readFile "${hyprConfDir}/hyprland.conf";
"hypr/.keep".text = ""; # Enable toggle (must match option)
}; enableProgram = config.enableHyprland or true;
# Resolve user safely
user = config.defaultUser or "henrov";
in in
{ {
flake.nixosModules.hyprland = { config, pkgs, lib, ... }: # --- Option ---
options.enableHyprland =
lib.mkEnableOption "Enable Hyprland desktop";
{ # --- Config ---
options.mySystem.desktop.hyprland.enable = config = lib.mkIf enableProgram {
lib.mkEnableOption "Enable Hyprland Desktop";
config = lib.mkIf (config.mySystem.desktop.hyprland.enable or false) { # --- Dendritic app definition ---
myApps.${programName} = {
enable = true;
assetsDir = programAssets;
files = files;
inherit user;
compositor = "hyprland";
};
# --- System-level enable ---
programs.hyprland.enable = true; programs.hyprland.enable = true;
home-manager.users.${username} = { # --- Home Manager wiring ---
home-manager.users.${user} = {
home.stateVersion = "25.11"; home.stateVersion = "25.11";
home.username = username; home.username = user;
home.homeDirectory = "/home/${username}"; home.homeDirectory = "/home/${user}";
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
settings.general."col.active_border" = lib.mkForce "0xff97cbcd 0xff89b4fa";
settings.general."col.active_border" =
lib.mkForce "0xff97cbcd 0xff89b4fa";
}; };
xdg.configFile = otherConfigs // hyprlandConf; # --- Config files ---
xdg.configFile =
(lib.mapAttrs' (name: value: {
name = "hypr/${name}";
value.source = value.src;
}) files)
// {
"hypr/hyprland.conf".text =
if builtins.pathExists mainConfigPath
then builtins.readFile mainConfigPath
else "";
"hypr/.keep".text = "";
}; };
}; };
}; };
+60 -28
View File
@@ -1,52 +1,84 @@
{ lib, pkgs, flakeRoot, ... }: { lib, config, flakeRoot, ... }:
let let
# --- Define user locally --- # --- Program definition ---
username = "henrov"; programName = "hyprland";
# --- Hyprland conf directory --- # --- Assets ---
hyprConfDir = "${flakeRoot}/assets/hyprland/conf/hypr"; programAssets = "${flakeRoot}/assets/hyprland/conf/hypr";
# --- Read files --- programFiles =
hyprlandFiles = builtins.attrNames (builtins.readDir hyprConfDir); if builtins.pathExists programAssets
then builtins.readDir programAssets
else {};
# --- Exclude main hyprland.conf from automatic symlinks --- fileNames = builtins.attrNames programFiles;
otherHyprlandFiles = lib.filter (name: name != "hyprland.conf") hyprlandFiles;
# --- Generate xdg.configFile entries for the other files --- # Exclude main config (handled separately)
otherConfigs = lib.genAttrs otherHyprlandFiles (name: { otherFiles = lib.filter (name: name != "hyprland.conf") fileNames;
target = "hypr/${name}";
source = "${hyprConfDir}/${name}"; # Generate file mappings
files = lib.genAttrs otherFiles (name: {
src = "${programAssets}/${name}";
}); });
# --- Add main hyprland.conf separately --- # Main config (inline)
hyprlandConf = { mainConfigPath = "${programAssets}/hyprland.conf";
"hypr/hyprland.conf".text = builtins.readFile "${hyprConfDir}/hyprland.conf";
"hypr/.keep".text = ""; # Enable toggle (must match option)
}; enableProgram = config.enableHyprland or true;
# Resolve user safely
user = config.defaultUser or "henrov";
in in
{ {
flake.nixosModules.hyprland = { config, pkgs, lib, ... }: # --- Option ---
options.enableHyprland =
lib.mkEnableOption "Enable Hyprland desktop";
{ # --- Config ---
options.mySystem.desktop.hyprland.enable = config = lib.mkIf enableProgram {
lib.mkEnableOption "Enable Hyprland Desktop";
config = lib.mkIf (config.mySystem.desktop.hyprland.enable or false) { # --- Dendritic app definition ---
myApps.${programName} = {
enable = true;
assetsDir = programAssets;
files = files;
inherit user;
compositor = "hyprland";
};
# --- System-level enable ---
programs.hyprland.enable = true; programs.hyprland.enable = true;
home-manager.users.${username} = { # --- Home Manager wiring ---
home-manager.users.${user} = {
home.stateVersion = "25.11"; home.stateVersion = "25.11";
home.username = username; home.username = user;
home.homeDirectory = "/home/${username}"; home.homeDirectory = "/home/${user}";
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
settings.general."col.active_border" = lib.mkForce "0xff97cbcd 0xff89b4fa";
settings.general."col.active_border" =
lib.mkForce "0xff97cbcd 0xff89b4fa";
}; };
xdg.configFile = otherConfigs // hyprlandConf; # --- Config files ---
xdg.configFile =
(lib.mapAttrs' (name: value: {
name = "hypr/${name}";
value.source = value.src;
}) files)
// {
"hypr/hyprland.conf".text =
if builtins.pathExists mainConfigPath
then builtins.readFile mainConfigPath
else "";
"hypr/.keep".text = "";
}; };
}; };
}; };