2025-01-29 12:16:47 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib ? pkgs.lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
2025-01-29 12:27:13 +00:00
|
|
|
cfg = config.services.fixMallocPkgs;
|
2025-01-29 12:16:47 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
|
2025-01-29 12:27:13 +00:00
|
|
|
services.fixMallocPkgs = rec {
|
2025-01-29 12:16:47 +00:00
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Enable overlay to disable custom memory allocators to affected packages (based on grapheneos-light)
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
# the simple-go-server does not actually support specifying a port
|
|
|
|
# so this actually does nothing, but it could/should be picked up and
|
|
|
|
# inserted into the systemd config for the service
|
|
|
|
# port = mkOption {
|
|
|
|
# type = types.int;
|
|
|
|
# default = 8080;
|
|
|
|
# description = ''
|
|
|
|
# The port to run the service on
|
|
|
|
# '';
|
|
|
|
# };
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
|
|
|
|
(self: super: {
|
|
|
|
firefox = pkgs.symlinkJoin {
|
|
|
|
name = "firefox";
|
|
|
|
paths = [ super.firefox];
|
|
|
|
buildInputs = [ pkgs.makeWrapper pkgs.bubblewrap ];
|
|
|
|
postBuild = ''
|
|
|
|
bwrap --dev-bind / / --ro-bind /dev/null $(readlink /etc/static/ld-nix.so.preload) $out/bin/firefox
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
})
|
|
|
|
|
|
|
|
(final: prev: {
|
|
|
|
tor-browser = prev.buildFHSEnv {
|
|
|
|
runScript = "${pkgs.bubblewrap}/bin/bwrap --dev-bind / / --ro-bind /dev/null $(readlink /etc/static/ld-nix.so.preload) $out/bin/tor-browser";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|