home: firefox: port to sane.programs API

This commit is contained in:
Colin 2023-04-26 00:52:13 +00:00
parent 8d5c917c79
commit f6579b865b

View File

@ -146,58 +146,61 @@ in
}; };
}; };
config = { config = mkMerge [
sane.programs.web-browser = { ({
inherit package; sane.programs.guiApps.suggestedPrograms = [ "web-browser" ];
# TODO: define the persistence & fs config here sane.programs.web-browser = {
}; inherit package;
sane.programs.guiApps.suggestedPrograms = [ "web-browser" ];
# uBlock filter list configuration. # uBlock filter list configuration.
# specifically, enable the GDPR cookie prompt blocker. # specifically, enable the GDPR cookie prompt blocker.
# data.toOverwrite.filterLists is additive (i.e. it supplements the default filters) # data.toOverwrite.filterLists is additive (i.e. it supplements the default filters)
# this configuration method is documented here: # this configuration method is documented here:
# - <https://github.com/gorhill/uBlock/issues/2986#issuecomment-364035002> # - <https://github.com/gorhill/uBlock/issues/2986#issuecomment-364035002>
# the specific attribute path is found via scraping ublock code here: # the specific attribute path is found via scraping ublock code here:
# - <https://github.com/gorhill/uBlock/blob/master/src/js/storage.js> # - <https://github.com/gorhill/uBlock/blob/master/src/js/storage.js>
# - <https://github.com/gorhill/uBlock/blob/master/assets/assets.json> # - <https://github.com/gorhill/uBlock/blob/master/assets/assets.json>
sane.user.fs."${cfg.browser.dotDir}/managed-storage/uBlock0@raymondhill.net.json" = sane-lib.fs.wantedText '' fs."${cfg.browser.dotDir}/managed-storage/uBlock0@raymondhill.net.json" = sane-lib.fs.wantedText ''
{ {
"name": "uBlock0@raymondhill.net", "name": "uBlock0@raymondhill.net",
"description": "ignored", "description": "ignored",
"type": "storage", "type": "storage",
"data": { "data": {
"toOverwrite": "{\"filterLists\": [\"fanboy-cookiemonster\"]}" "toOverwrite": "{\"filterLists\": [\"fanboy-cookiemonster\"]}"
} }
} }
''; '';
sane.user.fs."${cfg.browser.dotDir}/${cfg.browser.libName}.overrides.cfg" = sane-lib.fs.wantedText '' fs."${cfg.browser.dotDir}/${cfg.browser.libName}.overrides.cfg" = sane-lib.fs.wantedText ''
// if we can't query the revocation status of a SSL cert because the issuer is offline, // if we can't query the revocation status of a SSL cert because the issuer is offline,
// treat it as unrevoked. // treat it as unrevoked.
// see: <https://librewolf.net/docs/faq/#im-getting-sec_error_ocsp_server_error-what-can-i-do> // see: <https://librewolf.net/docs/faq/#im-getting-sec_error_ocsp_server_error-what-can-i-do>
defaultPref("security.OCSP.require", false); defaultPref("security.OCSP.require", false);
''; '';
# flush the cache to disk to avoid it taking up too much tmp fs."${cfg.browser.dotDir}/default" = sane-lib.fs.wantedDir;
sane.user.persist.byPath."${cfg.browser.cacheDir}" = lib.mkIf (cfg.persistCache != null) { # instruct Firefox to put the profile in a predictable directory (so we can do things like persist just it).
store = cfg.persistCache; # XXX: the directory *must* exist, even if empty; Firefox will not create the directory itself.
}; fs."${cfg.browser.dotDir}/profiles.ini" = sane-lib.fs.wantedText ''
[Profile0]
Name=default
IsRelative=1
Path=default
Default=1
sane.user.persist.byPath."${cfg.browser.dotDir}/default" = lib.mkIf (cfg.persistData != null) { [General]
store = cfg.persistData; StartWithLastProfile=1
}; '';
sane.user.fs."${cfg.browser.dotDir}/default" = sane-lib.fs.wantedDir; };
# instruct Firefox to put the profile in a predictable directory (so we can do things like persist just it). })
# XXX: the directory *must* exist, even if empty; Firefox will not create the directory itself. (mkIf config.sane.programs.web-browser.enabled {
sane.user.fs."${cfg.browser.dotDir}/profiles.ini" = sane-lib.fs.wantedText '' # TODO: move the persistence into the sane.programs API (above)
[Profile0] # flush the cache to disk to avoid it taking up too much tmp
Name=default sane.user.persist.byPath."${cfg.browser.cacheDir}" = lib.mkIf (cfg.persistCache != null) {
IsRelative=1 store = cfg.persistCache;
Path=default };
Default=1
[General] sane.user.persist.byPath."${cfg.browser.dotDir}/default" = lib.mkIf (cfg.persistData != null) {
StartWithLastProfile=1 store = cfg.persistData;
''; };
})
}; ];
} }