Skip to content

Commit

Permalink
feat(nix): allow the user to specify the package being used
Browse files Browse the repository at this point in the history
  • Loading branch information
ys5g committed Oct 27, 2024
1 parent 0e64f4f commit 4e9021c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ in {
options.programs.matugen = {
enable = lib.mkEnableOption "Matugen declarative theming";

package = lib.mkPackageOption pkgs "matugen" {
default = matugen.packages.${pkgs.system}.default;
};

wallpaper = lib.mkOption {
type = with lib.types; nullOr path;
default = osCfg.wallpaper or null;
Expand Down Expand Up @@ -67,8 +71,6 @@ in {
};

config = let
package = matugen.packages.${pkgs.system}.default;

mergedCfg =
cfg.settings
// (
Expand All @@ -80,10 +82,10 @@ in {
configFile = tomlFormat.generate "config.toml" mergedCfg;
in
lib.mkIf cfg.enable {
home.packages = [package];
home.packages = [cfg.package];

home.activation.matugenCopyWallpapers = lib.hm.dag.entryAfter ["writeBoundary"] ''
${package}/bin/matugen image ${cfg.wallpaper} --config ${configFile}
${cfg.package}/bin/matugen image ${cfg.wallpaper} --config ${configFile}
'';

xdg.configFile."matugen/config.toml".source =
Expand Down

0 comments on commit 4e9021c

Please sign in to comment.