Fix nativeMessagingHosts (#83)

* Fix nativeMessagingHosts

Something has changed in home-manager, so the nativeMessagingHosts option was broken

* re-format code
This commit is contained in:
Dmitry Chermnykh
2025-08-09 16:34:36 +05:00
committed by GitHub
parent 7564df093b
commit b5b7136bb6
2 changed files with 29 additions and 21 deletions

View File

@@ -37,11 +37,16 @@ in {
config = lib.mkIf config.programs.zen-browser.enable {
programs.zen-browser = {
package = pkgs.wrapFirefox (self.packages.${pkgs.stdenv.system}."${name}-unwrapped".override {
# Seems like zen uses relative (to the original binary) path to the policies.json file
# and ignores the overrides by pkgs.wrapFirefox
policies = config.programs.zen-browser.policies;
}) {};
package =
(pkgs.wrapFirefox (self.packages.${pkgs.stdenv.system}."${name}-unwrapped".override {
# Seems like zen uses relative (to the original binary) path to the policies.json file
# and ignores the overrides by pkgs.wrapFirefox
policies = config.programs.zen-browser.policies;
}) {}).override
{
nativeMessagingHosts = config.programs.zen-browser.nativeMessagingHosts;
};
# This does not work, the package can't build using these policies
policies = lib.mkDefault {
DisableAppUpdate = true;

View File

@@ -57,9 +57,9 @@
ln -s zen "$out/Applications/${applicationName}.app/Contents/MacOS/${binaryName}"
cat > "$out/bin/${binaryName}" << EOF
#!/bin/bash
exec /usr/bin/open -na "$out/Applications/${applicationName}.app" --args "\$@"
EOF
#!/bin/bash
exec /usr/bin/open -na "$out/Applications/${applicationName}.app" --args "\$@"
EOF
chmod +x "$out/bin/${binaryName}"
ln -s "$out/bin/${binaryName}" "$out/bin/zen"
@@ -85,27 +85,29 @@ EOF
install -D $src/browser/chrome/icons/default/default64.png $out/share/icons/hicolor/64x64/apps/zen-${name}.png
install -D $src/browser/chrome/icons/default/default128.png $out/share/icons/hicolor/128x128/apps/zen-${name}.png
'';
in
stdenv.mkDerivation {
inherit pname;
inherit (variant) version;
src = if stdenv.hostPlatform.isDarwin
then builtins.fetchurl { inherit (variant) url sha256; }
else builtins.fetchTarball { inherit (variant) url sha256; };
src =
if stdenv.hostPlatform.isDarwin
then builtins.fetchurl {inherit (variant) url sha256;}
else builtins.fetchTarball {inherit (variant) url sha256;};
sourceRoot = lib.optionalString stdenv.hostPlatform.isDarwin ".";
desktopSrc = ./assets/desktop;
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [
wrapGAppsHook3
autoPatchelfHook
patchelfUnstable
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
undmg
];
nativeBuildInputs =
lib.optionals stdenv.hostPlatform.isLinux [
wrapGAppsHook3
autoPatchelfHook
patchelfUnstable
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
undmg
];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
gtk3
@@ -136,7 +138,8 @@ in
)
'';
installPhase = if stdenv.hostPlatform.isDarwin
installPhase =
if stdenv.hostPlatform.isDarwin
then installDarwin
else installLinux;
@@ -158,4 +161,4 @@ in
hydraPlatforms = [];
mainProgram = binaryName;
};
}
}