InioX / matugen-themes

24 stars 5 forks source link

feat: add a nix flake and a home-manager module #12

Open ys5g opened 2 weeks ago

ys5g commented 2 weeks ago

This was tested with:

If you want to see the available templates (in nix at least) you can run the following (you need the nix-command feature and jq):

nix eval -E "import ./nix/parseReadme.nix {lib = (import <nixpkgs> {}).lib; config = { xdg.configHome = \"$HOME/.config\"; gtk.theme.name = \"hello\"; }; }" --impure --json | jq -r '.' --color-output

Notes:

hm module interface:

programs.matugen-themes.presets is limited to a list of strings(e.g. [ "hypr" "gtk3" ]). You can use the name of any template in this repo, except for 2 things that have been changed(the only hardcoded things on the nix side):

  1. the hyprland and hyprlock templates were merged into a single hypr one
  2. starship is removed since it would overwrite the settings placed by the user. Note: I know that the file would be overwritten if they don't home-manager. IDK if it will still happen if they use home-manager for starship in the first place

    Up for debate

    Should the option be moved to programs.matugen.enabledPresets or something else?

readme parsing

nix/parseReadme.nix uses regexes to parse the readme. It should keep working as-is until you add an entry under midnight-discord.

Regex explanations on regex101.com - `builtins.match ".*output_path = '([^']+)'.*" section`(line 57) - [link](https://regex101.com/r/PfFXNs/1) - `builtins.match "([^\n]+).*" section`(line 75) - [link](https://regex101.com/r/F1QK8t/1)

Manual work on the end-user's side

They need to know what programs are run in the post_hooks that they are using and place them in programs.matugen.extraPackages, at least after # 68 over at matugen is merged with some variant of my suggestions A simple realpath $(which <cmd>) should suffice