Skip to content

Instantly share code, notes, and snippets.

@sorki
Created July 27, 2021 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorki/cbc5f8870daad71d5ec4629b27894ed5 to your computer and use it in GitHub Desktop.
Save sorki/cbc5f8870daad71d5ec4629b27894ed5 to your computer and use it in GitHub Desktop.
FirejailedFox
{ config, pkgs, lib, ... }:
{
nixpkgs.overlays = [
(self: super: {
firejailedFirefox = super.stdenv.mkDerivation rec {
name = "firejailed-firefox-desktop-item";
dontBuild = true;
unpackPhase = "true";
desktopItem = super.makeDesktopItem {
name = "firefox";
exec = "/run/current-system/sw/bin/firefox";
genericName = "Web Browser";
categories = "Application;Network;WebBrowser;";
desktopName = "firefox";
mimeType = lib.concatStringsSep ";" [
"text/html"
"text/xml"
"application/xhtml+xml"
"application/vnd.mozilla.xul+xml"
"x-scheme-handler/http"
"x-scheme-handler/https"
"x-scheme-handler/ftp"
];
};
installPhase = ''
mkdir -p $out/share
cp -r ${desktopItem}/share/applications $out/share
'';
};
})
];
programs.firejail = {
enable = true;
wrappedBinaries.firefox = "${pkgs.lib.getBin pkgs.firefox}/bin/firefox";
};
# or users packages
environment.systemPackages = [ firejailedFirefox ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment