29 rustPlatform.buildRustPackage rec {
33 src = fetchFromGitHub {
35 repo = "PWAsForFirefox";
37 hash = "sha256-eZNbM2T7Owu11b7NHqHExm3MYF+LfMGOYKOhZRxjZ28=";
40 sourceRoot = "${src.name}/native";
41 buildFeatures = [ "immutable-runtime" ];
44 lockFile = ./Cargo.lock;
46 "mime-0.4.0-a.0" = "sha256-LjM7LH6rL3moCKxVsA+RUL9lfnvY31IrqHa9pDIAZNE=";
47 "web_app_manifest-0.0.0" = "sha256-G+kRN8AEmAY1TxykhLmgoX8TG8y2lrv7SCRJlNy0QzA=";
52 sed -i 's;version = "0.0.0";version = "${version}";' Cargo.toml
53 sed -zi 's;name = "firefoxpwa"\nversion = "0.0.0";name = "firefoxpwa"\nversion = "${version}";' Cargo.lock
54 sed -i $'s;DISTRIBUTION_VERSION = \'0.0.0\';DISTRIBUTION_VERSION = \'${version}\';' userchrome/profile/chrome/pwa/chrome.jsm
62 buildInputs = [ openssl ];
64 FFPWA_EXECUTABLES = ""; # .desktop entries generated without any store path references
65 FFPWA_SYSDATA = "${placeholder "out"}/share/firefoxpwa";
66 completions = "target/${stdenv.targetPlatform.config}/release/completions";
68 gtk_modules = map (x: x + x.gtkModule) [ libcanberra-gtk3 ];
72 lib.optionals stdenv.hostPlatform.isLinux [
88 lib.makeLibraryPath libs + ":" + lib.makeSearchPathOutput "lib" "lib64" libs;
92 mkdir -p $out/share/firefoxpwa
93 cp -Lr ${firefox-unwrapped}/lib/firefox $out/share/firefoxpwa/runtime
94 chmod -R +w $out/share/firefoxpwa
97 cp -r userchrome $out/share/firefoxpwa
100 FFPWA_USERDATA=$out/share/firefoxpwa $out/bin/firefoxpwa runtime patch
103 sed -i "s!/usr/libexec!$out/bin!" manifests/linux.json
104 install -Dm644 manifests/linux.json $out/lib/mozilla/native-messaging-hosts/firefoxpwa.json
106 installShellCompletion --cmd firefoxpwa \
107 --bash $completions/firefoxpwa.bash \
108 --fish $completions/firefoxpwa.fish \
109 --zsh $completions/_firefoxpwa
112 install -Dm644 packages/appstream/si.filips.FirefoxPWA.metainfo.xml $out/share/metainfo/si.filips.FirefoxPWA.metainfo.xml
113 install -Dm644 packages/appstream/si.filips.FirefoxPWA.svg $out/share/icons/hicolor/scalable/apps/si.filips.FirefoxPWA.svg
115 wrapProgram $out/bin/firefoxpwa \
116 --prefix FFPWA_SYSDATA : "$out/share/firefoxpwa" \
117 --prefix LD_LIBRARY_PATH : "$libs" \
118 --suffix-each GTK_PATH : "$gtk_modules"
120 wrapProgram $out/bin/firefoxpwa-connector \
121 --prefix FFPWA_SYSDATA : "$out/share/firefoxpwa" \
122 --prefix LD_LIBRARY_PATH : "$libs" \
123 --suffix-each GTK_PATH : "$gtk_modules"
126 passthru.tests.firefoxpwa = nixosTests.firefoxpwa;
129 description = "Tool to install, manage and use Progressive Web Apps (PWAs) in Mozilla Firefox (native component)";
131 Progressive Web Apps (PWAs) are web apps that use web APIs and features along
132 with progressive enhancement strategy to bring a native app-like user experience
133 to cross-platform web applications. Although Firefox supports many of Progressive
134 Web App APIs, it does not support functionality to install them as a standalone
135 system app with an app-like experience.
137 This project creates a custom modified Firefox runtime to allow websites to be
138 installed as standalone apps and provides a console tool and browser extension
139 to install, manage and use them.
141 This package contains only the native part of the PWAsForFirefox project. You
142 should also install the browser extension if you haven't already. You can download
143 it from the [Firefox Add-ons](https://addons.mozilla.org/firefox/addon/pwas-for-firefox/)
146 To install the package on NixOS, you need to add the following options:
149 programs.firefox.nativeMessagingHosts.packages = [ pkgs.firefoxpwa ];
150 environment.systemPackages = [ pkgs.firefoxpwa ];
153 As it needs to be both in the `PATH` and in the `nativeMessagingHosts` to make it
154 possible for the extension to detect and use it.
156 homepage = "https://pwasforfirefox.filips.si/";
157 changelog = "https://github.com/filips123/PWAsForFirefox/releases/tag/v${version}";
158 license = lib.licenses.mpl20;
159 platforms = lib.platforms.unix;
160 maintainers = with lib.maintainers; [
165 mainProgram = "firefoxpwa";