firefox: add container support

This commit is contained in:
Damien Cassou 2023-10-13 08:34:32 +02:00 committed by Robert Helgesson
parent 858fe2f09a
commit 54586daa59
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
5 changed files with 155 additions and 3 deletions

View file

@ -3,4 +3,5 @@
firefox-state-version-19_09 = ./state-version-19_09.nix;
firefox-deprecated-native-messenger = ./deprecated-native-messenger.nix;
firefox-duplicate-profile-ids = ./duplicate-profile-ids.nix;
firefox-duplicate-container-ids = ./duplicate-container-ids.nix;
}

View file

@ -0,0 +1,35 @@
{ config, lib, ... }:
{
imports = [ ./setup-firefox-mock-overlay.nix ];
config = lib.mkIf config.test.enableBig {
test.asserts.assertions.expected = [''
Must not have a Firefox container with an existing ID but
- ID 9 is used by dangerous, shopping''];
programs.firefox = {
enable = true;
profiles = {
my-profile = {
isDefault = true;
id = 1;
containers = {
"shopping" = {
id = 9;
color = "blue";
icon = "circle";
};
"dangerous" = {
id = 9;
color = "red";
icon = "circle";
};
};
};
};
};
};
}

View file

@ -0,0 +1 @@
{"identities":[{"color":"yellow","icon":"circle","name":"shopping","public":true,"userContextId":6}],"lastUserContextId":6,"version":4}

View file

@ -1,7 +1,5 @@
{ config, lib, pkgs, ... }:
with lib;
{
imports = [ ./setup-firefox-mock-overlay.nix ];
@ -142,6 +140,17 @@ with lib;
};
};
};
profiles.containers = {
id = 5;
containers = {
"shopping" = {
id = 6;
icon = "circle";
color = "yellow";
};
};
};
};
nmt.script = ''
@ -155,6 +164,10 @@ with lib;
home-files/.mozilla/firefox/test/user.js \
${./profile-settings-expected-user.js}
assertFileContent \
home-files/.mozilla/firefox/containers/containers.json \
${./profile-settings-expected-containers.json}
bookmarksUserJs=$(normalizeStorePaths \
home-files/.mozilla/firefox/bookmarks/user.js)