diff --git a/Droidnix/Prompt b/Droidnix/Prompt index 888276378..d4b717872 100644 --- a/Droidnix/Prompt +++ b/Droidnix/Prompt @@ -2,36 +2,69 @@ Rewrite my ./generated/modules/traveldroid/desktop/stylix.nix to integrate nice Avoid infinite recursion Just look at how to rewrite this, ignore previous interactions around this nix. Solve the error. That is really important. +Look at hyprland.nix to see how to avoid the home error +{ lib, config, pkgs, flakeRoot, ... }: -error: - … while calling the 'seq' builtin - at /nix/store/s7bvgynzfisna3jdq2cr4jx73xnhxs27-source/lib/modules.nix:402:18: - 401| options = checked options; - 402| config = checked (removeAttrs config [ "_module" ]); - | ^ - 403| _module = checked (config._module); +let + username = config.defaultUser or "henrov"; + moduleName = "stylix"; - … while calling the 'throw' builtin - at /nix/store/s7bvgynzfisna3jdq2cr4jx73xnhxs27-source/lib/modules.nix:374:13: - 373| else - 374| throw baseMsg - | ^ - 375| else + # Path to stylix assets + assetPath = "${flakeRoot}/assets/system/conf/${moduleName}"; - error: The option `stylix' does not exist. Definition values: - - In `/nix/store/fidsc6g16ir0rrf5g8cxdyz0hy24zc5z-source/Droidnix/generated/modules/traveldroid/desktop/stylix.nix': - { - base16Scheme = "/nix/store/fidsc6g16ir0rrf5g8cxdyz0hy24zc5z-source/Droidnix/assets/system/theming/stylix/catppuccin-mocha.yaml"; - enable = true; - polarity = "dark"; - targets = { - ... + # Read all files in the asset directory + programFiles = builtins.readDir assetPath; - Did you mean `lib', `nix' or `stubby'? -Command 'nix --extra-experimental-features 'nix-command flakes' build --print-out-paths '.#nixosConfigurations."traveldroid".config.system.build.nixos-rebuild' --no-link' returned non-zero exit status 1. + files = lib.genAttrs (builtins.attrNames programFiles) (name: { + source = "${assetPath}/${name}"; + }); + # Optional stylix.conf + stylixConfFile = "${assetPath}/stylix.conf"; + stylixConf = + if builtins.pathExists stylixConfFile + then builtins.readFile stylixConfFile + else ""; + # Cursor defaults + cursorName = "phinger-cursors-light"; + cursorSize = 24; +in +{ + ################################# + # System packages + ################################# + environment.systemPackages = [ + pkgs.feh + pkgs.st + ]; + + ################################# + # Home Manager user-level configuration + ################################# + _module.args.hmUsers = { + "${username}" = { + # Copy all stylix config files into ~/.config/stylix/ + home.file = lib.mkMerge (lib.mapAttrs' (name: value: { + name = "${moduleName}/${name}"; + value = { inherit (value) source; }; + }) files); + + # Include stylix.conf if it exists + home.file."${moduleName}/stylix.conf".text = stylixConf; + + # Session variables for Stylix & cursors + home.sessionVariables = { + STYLIX_CONF = "$HOME/.config/stylix/stylix.conf"; + XCURSOR_THEME = cursorName; + XCURSOR_SIZE = toString cursorSize; + HYPRCURSOR_THEME = cursorName; + HYPRCURSOR_SIZE = toString cursorSize; + }; + }; + }; +} ------------------------------------------------------------------------ { lib, config, pkgs, flakeRoot, ... }: @@ -206,3 +239,46 @@ in home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; } + + +hyprland.Nix + + +{ lib, config, pkgs, flakeRoot, home-manager, inputs, ... }: + +let + username = config.defaultUser or "henrov"; + assetPath = "${flakeRoot}/assets/traveldroid/conf/hypr/"; + + # Read all files in the asset directory + assetFiles = builtins.attrNames (builtins.readDir assetPath); + + # Convert files to Home Manager xdg config entries + hyprFiles = lib.genAttrs assetFiles (f: { + # Destination path in home directory + name = ".config/hypr/${f}"; + # Source file path + value = { source = "${assetPath}/${f}"; }; + }); + + # Determine Hyprland package + hyprlandPkg = + pkgs.hyprland or + pkgs.hyprland-git or + inputs.hyprland.packages.${pkgs.system}.default; +in +{ + environment.systemPackages = [ hyprlandPkg ]; + + _module.args.hmUsers = { + ${username} = { + home.packages = [ hyprlandPkg ]; + + # Merge all files in the asset folder into ~/.config/hypr/ + home.file = lib.mkMerge hyprFiles; + + # Optional: Hyprland settings + settings.general."col.active_border" = "0xff97cbcd 0xff89b4fa"; + }; + }; +} diff --git a/Droidnix/README.org b/Droidnix/README.org index 961920a03..f40c2d357 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -710,13 +710,15 @@ let assetPath = "${flakeRoot}/assets/system/conf/${moduleName}"; # Read all files in the asset directory - programFiles = builtins.readDir assetPath; + assetFiles = builtins.attrNames (builtins.readDir assetPath); - files = lib.genAttrs (builtins.attrNames programFiles) (name: { - source = "${assetPath}/${name}"; + # Convert files to Home Manager xdg config entries + stylixFiles = lib.genAttrs assetFiles (f: { + name = ".config/${moduleName}/${f}"; + value = { source = "${assetPath}/${f}"; }; }); - # Optional stylix.conf + # Optional stylix.conf contents stylixConfFile = "${assetPath}/stylix.conf"; stylixConf = if builtins.pathExists stylixConfFile @@ -728,24 +730,22 @@ let cursorSize = 24; in { - ################################# + ############################ # System packages - ################################# + ############################ environment.systemPackages = [ pkgs.feh pkgs.st ]; - ################################# + ############################ # Home Manager user-level configuration - ################################# + ############################ + # Follow the hyprland pattern to avoid "option does not exist" _module.args.hmUsers = { "${username}" = { - # Copy all stylix config files into ~/.config/stylix/ - home.file = lib.mkMerge (lib.mapAttrs' (name: value: { - name = "${moduleName}/${name}"; - value = { inherit (value) source; }; - }) files); + # Merge all Stylix asset files into ~/.config/stylix/ + home.file = lib.mkMerge stylixFiles; # Include stylix.conf if it exists home.file."${moduleName}/stylix.conf".text = stylixConf; diff --git a/Droidnix/generated/modules/traveldroid/desktop/stylix.nix b/Droidnix/generated/modules/traveldroid/desktop/stylix.nix index 21e07630c..314d4f6ba 100644 --- a/Droidnix/generated/modules/traveldroid/desktop/stylix.nix +++ b/Droidnix/generated/modules/traveldroid/desktop/stylix.nix @@ -8,13 +8,15 @@ let assetPath = "${flakeRoot}/assets/system/conf/${moduleName}"; # Read all files in the asset directory - programFiles = builtins.readDir assetPath; + assetFiles = builtins.attrNames (builtins.readDir assetPath); - files = lib.genAttrs (builtins.attrNames programFiles) (name: { - source = "${assetPath}/${name}"; + # Convert files to Home Manager xdg config entries + stylixFiles = lib.genAttrs assetFiles (f: { + name = ".config/${moduleName}/${f}"; + value = { source = "${assetPath}/${f}"; }; }); - # Optional stylix.conf + # Optional stylix.conf contents stylixConfFile = "${assetPath}/stylix.conf"; stylixConf = if builtins.pathExists stylixConfFile @@ -26,24 +28,22 @@ let cursorSize = 24; in { - ################################# + ############################ # System packages - ################################# + ############################ environment.systemPackages = [ pkgs.feh pkgs.st ]; - ################################# + ############################ # Home Manager user-level configuration - ################################# + ############################ + # Follow the hyprland pattern to avoid "option does not exist" _module.args.hmUsers = { "${username}" = { - # Copy all stylix config files into ~/.config/stylix/ - home.file = lib.mkMerge (lib.mapAttrs' (name: value: { - name = "${moduleName}/${name}"; - value = { inherit (value) source; }; - }) files); + # Merge all Stylix asset files into ~/.config/stylix/ + home.file = lib.mkMerge stylixFiles; # Include stylix.conf if it exists home.file."${moduleName}/stylix.conf".text = stylixConf;