feat(desktop/firefox): add synced profile support and move desktop config

This commit is contained in:
Mohammad Rafiq 2025-06-13 21:09:43 +08:00
parent 7e256c954d
commit 02c356494a
No known key found for this signature in database
6 changed files with 82 additions and 47 deletions

View file

@ -1,12 +1,30 @@
{ osConfig, lib, ... }:
let
inherit (builtins) map listToAttrs;
inherit (lib.lists) findFirstIndex;
cfg = osConfig.desktop.browser.firefox;
profileCfg = id: {
inherit id;
};
profiles = listToAttrs (
map (name: {
inherit name;
# If there are duplicate profile names, findFirstIndex will cause issues.
# We sanitize the input in nixosModules.desktop to avoid this.
value = profileCfg (findFirstIndex (x: x == name) null cfg.syncedProfiles);
}) cfg.syncedProfiles
);
in
{
config = lib.mkIf (osConfig.desktop.browser == "firefox") {
config = lib.mkIf cfg.enable {
home.persistence."/persist/home/rafiq".directories = [ ".mozilla/firefox" ];
home.sessionVariables.BROWSER = "firefox";
programs.firefox = {
enable = true;
profiles.rafiq.id = 0;
profiles.test.id = 1;
inherit profiles;
};
stylix.targets.firefox = {
profileNames = cfg.syncedProfiles;
};
};
}