Removed pipe operator.
The pipe operator '<|' was added in Nix 2.24 as experimental. In typical nix community fashion, an eternity has passed, it's still experimental, and they're still arguing about it. Thus, in order not to burden any users of this flake, they have been removed. To get this done quickly a utility function has been added called 'compose'. It is 'lib.trivial.pipe' written in reverse. This eliminates any bugs and performance regressions from unnecessary thunk evaluation.
This commit is contained in:
parent
0f0c4c7727
commit
2a5ced3905
7 changed files with 115 additions and 89 deletions
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
pkgs,
|
||||
lib,
|
||||
sLib,
|
||||
info,
|
||||
...
|
||||
}:
|
||||
|
|
@ -12,24 +13,28 @@ let
|
|||
options = {
|
||||
packages = lib.mkOption {
|
||||
type =
|
||||
lib.types.listOf
|
||||
<| lib.types.either lib.types.package
|
||||
<| lib.types.submodule {
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = name;
|
||||
example = "ublock-origin";
|
||||
description = "The short name of the extension. To find the short name look at the extension's download link.";
|
||||
};
|
||||
sLib.compose
|
||||
[
|
||||
lib.types.listOf
|
||||
(lib.types.either lib.types.package)
|
||||
(lib.types.submodule)
|
||||
]
|
||||
{
|
||||
options = {
|
||||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = name;
|
||||
example = "ublock-origin";
|
||||
description = "The short name of the extension. To find the short name look at the extension's download link.";
|
||||
};
|
||||
|
||||
guid = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "uBlock0@raymondhill.net";
|
||||
description = "The guid of the extension. To find the guid go to https://addons.mozilla.org/api/v5/addons/addon/\${shortName}/";
|
||||
guid = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "uBlock0@raymondhill.net";
|
||||
description = "The guid of the extension. To find the guid go to https://addons.mozilla.org/api/v5/addons/addon/\${shortName}/";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
default = [ ];
|
||||
description = ''
|
||||
Extensions to install for this profile. Takes either a package or a description of an extension.
|
||||
|
|
@ -65,37 +70,37 @@ let
|
|||
x:
|
||||
x
|
||||
// lib.optionalAttrs (x ? adminSettings) {
|
||||
adminSettings =
|
||||
adminSettings = sLib.compose [
|
||||
builtins.toJSON
|
||||
<| (
|
||||
(
|
||||
y:
|
||||
y
|
||||
// lib.optionalAttrs (y ? userFilters) {
|
||||
userFilters = builtins.concatStringsSep "\n" y.userFilters;
|
||||
}
|
||||
)
|
||||
<| (
|
||||
(
|
||||
y:
|
||||
y
|
||||
// lib.optionalAttrs (y ? urlFilteringString) {
|
||||
urlFilteringString = builtins.concatStringsSep "\n" y.urlFilteringString;
|
||||
}
|
||||
)
|
||||
<| (
|
||||
(
|
||||
y:
|
||||
y
|
||||
// lib.optionalAttrs (y ? hostnameSwitchesString) {
|
||||
hostnameSwitchesString = builtins.concatStringsSep "\n" y.hostnameSwitchesString;
|
||||
}
|
||||
)
|
||||
<| (
|
||||
(
|
||||
y:
|
||||
y
|
||||
// lib.optionalAttrs (y ? dynamicFilteringString) {
|
||||
dynamicFilteringString = builtins.concatStringsSep "\n" y.dynamicFilteringString;
|
||||
}
|
||||
)
|
||||
<| x.adminSettings;
|
||||
] x.adminSettings;
|
||||
};
|
||||
};
|
||||
magic = guid: magicInfo.${guid} or lib.trivial.id;
|
||||
|
|
@ -123,9 +128,9 @@ in
|
|||
{
|
||||
policies = {
|
||||
"3rdparty".Extensions = extensions.settings;
|
||||
ExtensionSettings =
|
||||
ExtensionSettings = sLib.compose [
|
||||
builtins.listToAttrs
|
||||
<| builtins.map (
|
||||
(builtins.map (
|
||||
withExtension
|
||||
(x: {
|
||||
name = x.addonId;
|
||||
|
|
@ -143,8 +148,8 @@ in
|
|||
install_url = "https://addons.mozilla.org/firefox/downloads/latest/${x.name}/latest.xpi";
|
||||
};
|
||||
})
|
||||
)
|
||||
<| extensions.packages;
|
||||
))
|
||||
] extensions.packages;
|
||||
};
|
||||
prefs."extensions.autoDisableScopes" = 0;
|
||||
};
|
||||
|
|
@ -152,6 +157,6 @@ in
|
|||
postprocess =
|
||||
{ policies, ... }:
|
||||
lib.optionalAttrs (policies ? "3rdparty".Extensions) {
|
||||
policies."3rdparty".Extensions = builtins.mapAttrs magic <| policies."3rdparty".Extensions or { };
|
||||
policies."3rdparty".Extensions = builtins.mapAttrs magic (policies."3rdparty".Extensions or { });
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue