mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-04-24 12:19:12 +00:00
treewide: replace builtins.map usage to lib.map
This commit is contained in:
parent
6fd69b1005
commit
c09faac74f
@ -2,7 +2,7 @@
|
||||
|
||||
let userConfig = hmConfig.users.foo-dogsquared;
|
||||
in {
|
||||
extraPlugins = builtins.map (path:
|
||||
extraPlugins = lib.map (path:
|
||||
pkgs.runCommand "vim-plugin-bare" { } ''
|
||||
mkdir -p "$out"
|
||||
cp -r ${path}/* "$out"
|
||||
|
@ -27,13 +27,13 @@ let
|
||||
inherit name;
|
||||
inherit (value) subscriptions extraArgs;
|
||||
}) db);
|
||||
jobsList = builtins.map (category:
|
||||
jobsList = lib.map (category:
|
||||
let jobExtraArgs = lib.attrByPath [ "data" "extraArgs" ] [ ] category;
|
||||
in {
|
||||
name = category.data.name;
|
||||
value = {
|
||||
extraArgs = extraArgs ++ jobExtraArgs;
|
||||
urls = builtins.map (subscription: subscription.url)
|
||||
urls = lib.map (subscription: subscription.url)
|
||||
category.data.subscriptions;
|
||||
startAt =
|
||||
lib.elemAt days (lib.mod category.index (lib.length days));
|
||||
|
@ -103,7 +103,7 @@ in {
|
||||
};
|
||||
applySystemdAttr = secretPaths:
|
||||
lib.listToAttrs
|
||||
(builtins.map (path: lib.nameValuePair path systemdNetworkFileAttrs))
|
||||
(lib.map (path: lib.nameValuePair path systemdNetworkFileAttrs))
|
||||
secretPaths;
|
||||
in applySystemdAttr [
|
||||
"wireguard/private-key"
|
||||
|
@ -16,7 +16,7 @@ let
|
||||
mode = "repokey-blake2";
|
||||
};
|
||||
extraCreateArgs = lib.concatStringsSep " "
|
||||
(builtins.map (patternFile: "--patterns-from ${patternFile}") patterns);
|
||||
(lib.map (patternFile: "--patterns-from ${patternFile}") patterns);
|
||||
extraInitArgs = "--make-parent-dirs";
|
||||
|
||||
# We're emptying them since we're specifying them all through the patterns file.
|
||||
|
@ -92,13 +92,13 @@ in {
|
||||
inherit name;
|
||||
inherit (value) subscriptions extraArgs;
|
||||
}) db);
|
||||
jobsList = builtins.map (category:
|
||||
jobsList = lib.map (category:
|
||||
let jobExtraArgs = lib.attrByPath [ "data" "extraArgs" ] [ ] category;
|
||||
in {
|
||||
name = category.data.name;
|
||||
value = {
|
||||
extraArgs = extraArgs ++ jobExtraArgs;
|
||||
urls = builtins.map (subscription: subscription.url)
|
||||
urls = lib.map (subscription: subscription.url)
|
||||
category.data.subscriptions;
|
||||
startAt =
|
||||
lib.elemAt days (lib.mod category.index (lib.length days));
|
||||
|
@ -22,10 +22,10 @@ let
|
||||
};
|
||||
extraCreateArgs = let
|
||||
args = lib.flatten [
|
||||
(builtins.map
|
||||
(lib.map
|
||||
(patternFile: "--patterns-from ${lib.escapeShellArg patternFile}")
|
||||
patternFiles)
|
||||
(builtins.map (pattern: "--pattern ${lib.escapeShellArg pattern}")
|
||||
(lib.map (pattern: "--pattern ${lib.escapeShellArg pattern}")
|
||||
patterns)
|
||||
];
|
||||
in lib.concatStringsSep " " args;
|
||||
|
@ -88,7 +88,7 @@ in {
|
||||
# A set of bindings to be used for each jump direction.
|
||||
bindings:
|
||||
let
|
||||
mappings = builtins.map (motion:
|
||||
mappings = lib.map (motion:
|
||||
let
|
||||
inherit (motion) region jumpDirection variant;
|
||||
jumpDirection' = lib.strings.toLower jumpDirection;
|
||||
@ -164,7 +164,7 @@ in {
|
||||
binding:
|
||||
|
||||
let
|
||||
mappingsList = builtins.map (variant:
|
||||
mappingsList = lib.map (variant:
|
||||
let prefixMap' = prefixMap.${variant};
|
||||
in lib.nameValuePair "${prefixMap'.key}${binding}" {
|
||||
query = "@${query}.${variant}";
|
||||
@ -200,7 +200,7 @@ in {
|
||||
|
||||
mkQueryMappings = acc: query: bindings:
|
||||
let
|
||||
mappings = builtins.map (motion:
|
||||
mappings = lib.map (motion:
|
||||
let
|
||||
inherit (motion) jumpDirection variant;
|
||||
jumpDirection' = lib.strings.toLower jumpDirection;
|
||||
|
@ -65,7 +65,7 @@ in {
|
||||
|
||||
mkEnableServerConfig = server:
|
||||
lib.nameValuePair server { enable = true; };
|
||||
in lib.listToAttrs (builtins.map mkEnableServerConfig servers);
|
||||
in lib.listToAttrs (lib.map mkEnableServerConfig servers);
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ let
|
||||
sha256 = hash;
|
||||
};
|
||||
in if version == 3 then
|
||||
builtins.mapAttrs (_: mkSource) data.pins
|
||||
lib.mapAttrs (_: mkSource) data.pins
|
||||
else
|
||||
throw "Unsupported format version ${
|
||||
toString version
|
||||
|
@ -53,7 +53,7 @@ in {
|
||||
|
||||
config = lib.mkIf (config.diskoConfigs != [ ]) (let
|
||||
diskoConfigs =
|
||||
builtins.map (name: "${partsConfig.setups.configDir}/disko/${name}")
|
||||
lib.map (name: "${partsConfig.setups.configDir}/disko/${name}")
|
||||
config.diskoConfigs;
|
||||
in {
|
||||
modules = lib.singleton {
|
||||
|
@ -363,7 +363,7 @@ in {
|
||||
# A quick data structure we can pass through multiple build pipelines.
|
||||
pureHomeManagerConfigs = let
|
||||
generatePureConfigs = username: metadata:
|
||||
lib.listToAttrs (builtins.map (system:
|
||||
lib.listToAttrs (lib.map (system:
|
||||
let
|
||||
nixpkgs = inputs.${metadata.nixpkgs.branch};
|
||||
|
||||
|
@ -283,7 +283,7 @@ in {
|
||||
cfg.configs;
|
||||
|
||||
generatePureConfigs = hostname: metadata:
|
||||
lib.listToAttrs (builtins.map (system:
|
||||
lib.listToAttrs (lib.map (system:
|
||||
let
|
||||
nixpkgs = inputs.${metadata.nixpkgs.branch};
|
||||
|
||||
@ -344,7 +344,7 @@ in {
|
||||
extraModules = cfg.sharedModules ++ metadata.modules;
|
||||
});
|
||||
|
||||
images = builtins.map buildImage metadata.formats;
|
||||
images = lib.map buildImage metadata.formats;
|
||||
in lib.listToAttrs images;
|
||||
in lib.concatMapAttrs generateImages validImages;
|
||||
};
|
||||
|
@ -254,7 +254,7 @@ in {
|
||||
modules = cfg.sharedModules ++ cfg.standaloneConfigModules
|
||||
++ metadata.modules ++ [{ package = neovimPackage; }];
|
||||
});
|
||||
nixvimConfigs = builtins.map mkNixvimConfig' metadata.components;
|
||||
nixvimConfigs = lib.map mkNixvimConfig' metadata.components;
|
||||
in lib.listToAttrs nixvimConfigs;
|
||||
in lib.concatMapAttrs generateNixvimConfigs validConfigs;
|
||||
in {
|
||||
|
@ -7,7 +7,7 @@ let
|
||||
# `$out/share/pop-launcher`.
|
||||
pluginsDir = pkgs.symlinkJoin {
|
||||
name = "pop-launcher-plugins-system";
|
||||
paths = builtins.map (p: "${p}/share/pop-launcher") cfg.plugins;
|
||||
paths = lib.map (p: "${p}/share/pop-launcher") cfg.plugins;
|
||||
};
|
||||
in {
|
||||
options.programs.pop-launcher = {
|
||||
|
@ -131,7 +131,7 @@ in {
|
||||
"app.drey.Dialect"
|
||||
"com.belmoussaoui.Authenticator"
|
||||
];
|
||||
apply = builtins.map (x: "${x}.desktop");
|
||||
apply = lib.map (x: "${x}.desktop");
|
||||
};
|
||||
|
||||
disableNotifications = lib.mkOption {
|
||||
@ -222,14 +222,14 @@ in {
|
||||
};
|
||||
"org/gnome/shell" = {
|
||||
enabled-extensions =
|
||||
builtins.map (p: p.extensionUuid) shellExtensions';
|
||||
lib.map (p: p.extensionUuid) shellExtensions';
|
||||
};
|
||||
}
|
||||
|
||||
# Disable all of the messenger's notification (only the annoying
|
||||
# ones).
|
||||
(lib.pipe cfg.disableNotifications [
|
||||
(builtins.map (app:
|
||||
(lib.map (app:
|
||||
lib.nameValuePair
|
||||
"org/gnome/desktop/notifications/application/${app}" {
|
||||
show-banners = false;
|
||||
|
@ -158,7 +158,7 @@ in {
|
||||
requiredComponents =
|
||||
let
|
||||
gsdComponents =
|
||||
builtins.map
|
||||
lib.map
|
||||
(gsdc: "org.gnome.SettingsDaemon.''${gsdc}")
|
||||
[
|
||||
"A11ySettings"
|
||||
@ -175,7 +175,7 @@ in {
|
||||
|
||||
systemd.targetUnit = {
|
||||
requires = [ "org.gnome.Shell.target" ];
|
||||
wants = builtins.map (c: "''${c}.target") (lib.lists.remove "org.gnome.Shell" sessionCfg.requiredComponents);
|
||||
wants = lib.map (c: "''${c}.target") (lib.lists.remove "org.gnome.Shell" sessionCfg.requiredComponents);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -67,7 +67,7 @@ in {
|
||||
default = [ config.fullName ];
|
||||
defaultText = "[ <session>.fullName ]";
|
||||
apply = names:
|
||||
builtins.map (name:
|
||||
lib.map (name:
|
||||
if (lib.elem name validDesktopNames) || (lib.hasPrefix "X-" name) then
|
||||
name
|
||||
else
|
||||
@ -222,7 +222,7 @@ in {
|
||||
systemd.targetUnit = {
|
||||
overrideStrategy = lib.mkForce "asDropin";
|
||||
wants = lib.mkDefault
|
||||
(builtins.map (c: "${c}.target") config.requiredComponents);
|
||||
(lib.map (c: "${c}.target") config.requiredComponents);
|
||||
};
|
||||
|
||||
settings."GNOME Session" = {
|
||||
|
@ -7,7 +7,7 @@ let
|
||||
# `$out/share/pop-launcher`.
|
||||
pluginsDir = pkgs.symlinkJoin {
|
||||
name = "pop-launcher-plugins-system";
|
||||
paths = builtins.map (p: "${p}/share/pop-launcher") cfg.plugins;
|
||||
paths = lib.map (p: "${p}/share/pop-launcher") cfg.plugins;
|
||||
};
|
||||
in {
|
||||
options.programs.pop-launcher = {
|
||||
|
@ -70,7 +70,7 @@ in {
|
||||
default = [ config.fullName ];
|
||||
defaultText = "[ <session>.fullName ]";
|
||||
apply = names:
|
||||
builtins.map (name:
|
||||
lib.map (name:
|
||||
if (lib.elem name validDesktopNames) || (lib.hasPrefix "X-" name) then
|
||||
name
|
||||
else
|
||||
|
@ -110,8 +110,8 @@ in {
|
||||
config.extraArgs = let inherit (config) policies;
|
||||
in lib.optionals (policies.level != null)
|
||||
[ "--${policies.level}=${name}" ]
|
||||
++ builtins.map (rule: "--call=${name}=${rule}") policies.call
|
||||
++ builtins.map (rule: "--broadcast=${name}=${rule}") policies.broadcast;
|
||||
++ lib.map (rule: "--call=${name}=${rule}") policies.call
|
||||
++ lib.map (rule: "--broadcast=${name}=${rule}") policies.broadcast;
|
||||
};
|
||||
|
||||
bubblewrapModule = { config, lib, pkgs, name, ... }:
|
||||
|
@ -235,13 +235,13 @@ in {
|
||||
(lib.mkIf (submoduleCfg.sharedNixPaths != [ ]) {
|
||||
wraparound.bubblewrap.extraArgs =
|
||||
let closurePaths = getClosurePaths submoduleCfg.sharedNixPaths;
|
||||
in builtins.map (p: "--ro-bind ${p} ${p}") closurePaths;
|
||||
in lib.map (p: "--ro-bind ${p} ${p}") closurePaths;
|
||||
})
|
||||
|
||||
(lib.mkIf submoduleCfg.dbus.enable {
|
||||
wraparound.bubblewrap.dbus.filter.bwrapArgs =
|
||||
let closurePaths = getClosurePaths submoduleCfg.sharedNixPaths;
|
||||
in builtins.map (p: "--ro-bind ${p} ${p}") closurePaths;
|
||||
in lib.map (p: "--ro-bind ${p} ${p}") closurePaths;
|
||||
})
|
||||
]);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user