diff --git a/hm-module.nix b/hm-module.nix index 5d3080f..24d593b 100644 --- a/hm-module.nix +++ b/hm-module.nix @@ -71,6 +71,12 @@ in { description = "Extra preferences to be included."; }; + icon = mkOption { + type = types.nullOr (types.either types.str types.path); + default = null; + description = "Icon to be used for the application. It's only expected to work on Linux."; + }; + profiles = mkOption { type = with types; attrsOf ( @@ -280,6 +286,12 @@ in { }; config = mkIf cfg.enable { + assertions = [ + { + assertion = cfg.icon == null || pkgs.stdenv.isLinux; + message = "The 'icon' option is only supported on Linux."; + } + ]; programs.zen-browser = { package = lib.mkDefault ( (pkgs.wrapFirefox (self.packages.${pkgs.stdenv.hostPlatform.system}."${name}-unwrapped".override { @@ -288,7 +300,9 @@ in { policies = cfg.policies; }) { icon = - if name == "beta" + if cfg.icon != null + then cfg.icon + else if name == "beta" then "zen-browser" else "zen-${name}"; }).override diff --git a/package.nix b/package.nix index efc1900..5998f11 100644 --- a/package.nix +++ b/package.nix @@ -1,6 +1,7 @@ { name, variant, + icon ? null, policies ? {}, lib, stdenv, @@ -138,7 +139,10 @@ in name = binaryName; desktopName = "Zen Browser${lib.optionalString (name == "twilight") " Twilight"}"; exec = "${binaryName} %u"; - icon = desktopIconName; + icon = + if icon != null && (lib.isString icon || lib.isPath icon) + then icon + else desktopIconName; type = "Application"; mimeTypes = [ "text/html"