feat(desktop/firefox): add synced profile support and move desktop config
This commit is contained in:
parent
7e256c954d
commit
02c356494a
6 changed files with 82 additions and 47 deletions
|
@ -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;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue