Compare commits
2 Commits
8292865c60
...
6e7b522191
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e7b522191 | |||
| 6615746c1b |
+65
-33
@@ -641,56 +641,88 @@ 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;
|
||||||
|
|
||||||
programs.hyprland.enable = true;
|
compositor = "hyprland";
|
||||||
|
};
|
||||||
|
|
||||||
home-manager.users.${username} = {
|
# --- System-level enable ---
|
||||||
home.stateVersion = "25.11";
|
programs.hyprland.enable = true;
|
||||||
home.username = username;
|
|
||||||
home.homeDirectory = "/home/${username}";
|
|
||||||
|
|
||||||
wayland.windowManager.hyprland = {
|
# --- Home Manager wiring ---
|
||||||
enable = true;
|
home-manager.users.${user} = {
|
||||||
settings.general."col.active_border" = lib.mkForce "0xff97cbcd 0xff89b4fa";
|
|
||||||
};
|
|
||||||
|
|
||||||
xdg.configFile = otherConfigs // hyprlandConf;
|
home.stateVersion = "25.11";
|
||||||
|
home.username = user;
|
||||||
|
home.homeDirectory = "/home/${user}";
|
||||||
|
|
||||||
|
wayland.windowManager.hyprland = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings.general."col.active_border" =
|
||||||
|
lib.mkForce "0xff97cbcd 0xff89b4fa";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# --- 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 = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,53 +1,85 @@
|
|||||||
{ 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;
|
||||||
|
|
||||||
programs.hyprland.enable = true;
|
compositor = "hyprland";
|
||||||
|
};
|
||||||
|
|
||||||
home-manager.users.${username} = {
|
# --- System-level enable ---
|
||||||
home.stateVersion = "25.11";
|
programs.hyprland.enable = true;
|
||||||
home.username = username;
|
|
||||||
home.homeDirectory = "/home/${username}";
|
|
||||||
|
|
||||||
wayland.windowManager.hyprland = {
|
# --- Home Manager wiring ---
|
||||||
enable = true;
|
home-manager.users.${user} = {
|
||||||
settings.general."col.active_border" = lib.mkForce "0xff97cbcd 0xff89b4fa";
|
|
||||||
};
|
|
||||||
|
|
||||||
xdg.configFile = otherConfigs // hyprlandConf;
|
home.stateVersion = "25.11";
|
||||||
|
home.username = user;
|
||||||
|
home.homeDirectory = "/home/${user}";
|
||||||
|
|
||||||
|
wayland.windowManager.hyprland = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
settings.general."col.active_border" =
|
||||||
|
lib.mkForce "0xff97cbcd 0xff89b4fa";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# --- 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 = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user