mirror of
https://github.com/nix-community/home-manager
synced 2024-12-25 19:29:47 +01:00
firefox: add default containers
This commit is contained in:
parent
99d47e0f57
commit
06ca1c3c6a
3 changed files with 60 additions and 1 deletions
|
@ -78,7 +78,24 @@ let
|
||||||
version = 4;
|
version = 4;
|
||||||
lastUserContextId =
|
lastUserContextId =
|
||||||
elemAt (mapAttrsToList (_: container: container.id) containers) 0;
|
elemAt (mapAttrsToList (_: container: container.id) containers) 0;
|
||||||
identities = mapAttrsToList containerToIdentity containers;
|
identities = mapAttrsToList containerToIdentity containers ++ [
|
||||||
|
{
|
||||||
|
userContextId = 4294967294; # 2^32 - 2
|
||||||
|
name = "userContextIdInternal.thumbnail";
|
||||||
|
icon = "";
|
||||||
|
color = "";
|
||||||
|
accessKey = "";
|
||||||
|
public = false;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
userContextId = 4294967295; # 2^32 - 1
|
||||||
|
name = "userContextIdInternal.webextStorageLocal";
|
||||||
|
icon = "";
|
||||||
|
color = "";
|
||||||
|
accessKey = "";
|
||||||
|
public = false;
|
||||||
|
}
|
||||||
|
];
|
||||||
}}
|
}}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -677,6 +694,20 @@ in {
|
||||||
(", namely " + concatStringsSep ", " defaults);
|
(", namely " + concatStringsSep ", " defaults);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
(let
|
||||||
|
getContainers = profiles:
|
||||||
|
flatten
|
||||||
|
(mapAttrsToList (_: value: (attrValues value.containers)) profiles);
|
||||||
|
|
||||||
|
findInvalidContainerIds = profiles:
|
||||||
|
filter (container: container.id >= 4294967294)
|
||||||
|
(getContainers profiles);
|
||||||
|
in {
|
||||||
|
assertion = cfg.profiles == { }
|
||||||
|
|| length (findInvalidContainerIds cfg.profiles) == 0;
|
||||||
|
message = "Container id must be smaller than 4294967294 (2^32 - 2)";
|
||||||
|
})
|
||||||
|
|
||||||
(mkNoDuplicateAssertion cfg.profiles "profile")
|
(mkNoDuplicateAssertion cfg.profiles "profile")
|
||||||
] ++ (mapAttrsToList
|
] ++ (mapAttrsToList
|
||||||
(_: profile: mkNoDuplicateAssertion profile.containers "container")
|
(_: profile: mkNoDuplicateAssertion profile.containers "container")
|
||||||
|
|
27
tests/modules/programs/firefox/container-id-out-of-range.nix
Normal file
27
tests/modules/programs/firefox/container-id-out-of-range.nix
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ./setup-firefox-mock-overlay.nix ];
|
||||||
|
|
||||||
|
config = lib.mkIf config.test.enableBig {
|
||||||
|
test.asserts.assertions.expected =
|
||||||
|
[ "Container id must be smaller than 4294967294 (2^32 - 2)" ];
|
||||||
|
|
||||||
|
programs.firefox = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
profiles.my-profile = {
|
||||||
|
isDefault = true;
|
||||||
|
id = 1;
|
||||||
|
|
||||||
|
containers = {
|
||||||
|
"shopping" = {
|
||||||
|
id = 4294967294;
|
||||||
|
color = "blue";
|
||||||
|
icon = "circle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -4,5 +4,6 @@
|
||||||
firefox-deprecated-native-messenger = ./deprecated-native-messenger.nix;
|
firefox-deprecated-native-messenger = ./deprecated-native-messenger.nix;
|
||||||
firefox-duplicate-profile-ids = ./duplicate-profile-ids.nix;
|
firefox-duplicate-profile-ids = ./duplicate-profile-ids.nix;
|
||||||
firefox-duplicate-container-ids = ./duplicate-container-ids.nix;
|
firefox-duplicate-container-ids = ./duplicate-container-ids.nix;
|
||||||
|
firefox-container-id-out-of-range = ./container-id-out-of-range.nix;
|
||||||
firefox-policies = ./policies.nix;
|
firefox-policies = ./policies.nix;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue