Replace builtins with lib where possible

This commit is contained in:
Simon Bruder 2021-02-27 19:55:12 +01:00
parent f03c1daa31
commit c77328af22
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
12 changed files with 15 additions and 15 deletions

View file

@ -65,6 +65,6 @@ let
};
};
in
builtins.mapAttrs
lib.mapAttrs
(hostname: configuration: kropsDeploy ({ inherit hostname; } // configuration))
(import ./machines)

View file

@ -2,7 +2,7 @@
let
# any nixpkgs fetcher fails with infinite recursion when importing a module
# from it
infinisilSystem = builtins.fetchTarball {
infinisilSystem = fetchTarball {
url = "https://github.com/Infinisil/system/archive/91c5df20db68a995155218c5334db0e394185ca8.tar.gz";
sha256 = "1qlz96mla0rlsqax9r8pmwycy8f8byisvjxlk2545mpk9lp2yspv";
};

View file

@ -17,7 +17,7 @@
docker = {
enable = true;
logDriver = "journald";
extraOptions = builtins.concatStringsSep " " [
extraOptions = lib.concatStringsSep " " [
"--ipv6"
"--fixed-cidr-v6=fd00:d0ce:d0ce:d0ce::/64"
];

View file

@ -23,7 +23,7 @@ in
trustedKeys = lib.mkOption {
type = lib.types.listOf lib.types.str;
description = "Trusted public keys, automatically generated from <literal>sbruder.pubkeys.trustedNames</literal>";
default = builtins.map
default = map
(name: cfg.keys."${name}")
cfg.trustedNames;
};

View file

@ -27,7 +27,7 @@ let
# Docker (state should be kept somewhere else)
"/var/lib/docker/"
] ++ cfg.extraExcludes;
excludesFile = pkgs.writeText "exludes.txt" (builtins.concatStringsSep "\n" excludes);
excludesFile = pkgs.writeText "exludes.txt" (lib.concatStringsSep "\n" excludes);
# script to use restic as user without dealing with authentication
authScript = pkgs.writeShellScriptBin "restic-auth" ''
@ -42,8 +42,8 @@ in
options.sbruder.restic = {
enable = lib.mkEnableOption "restic";
timerConfig = lib.recursiveUpdate
((builtins.elemAt
(builtins.elemAt
((lib.elemAt
(lib.elemAt
options.services.restic.backups.type.getSubModules
0
).imports

View file

@ -20,7 +20,7 @@ in
};
config = {
nixpkgs.config.allowUnfreePredicate = (pkg: builtins.elem (lib.getName pkg) (
nixpkgs.config.allowUnfreePredicate = (pkg: lib.elem (lib.getName pkg) (
lib.optionals cfg.allowAssets [
"corefonts"
"vista-fonts"

View file

@ -1,9 +1,9 @@
{
bang-evaluator = builtins.fetchTarball {
bang-evaluator = fetchTarball {
url = "https://git.sbruder.de/simon/bangs/archive/ca0d9ed47b21d7424a3b8be7bb55c55c62d17d3a.tar.gz";
sha256 = "1dk5lrhfnyqq604ih584kdb9z3zg49rp9y6b0ai3g5i3f0lwcfw7";
};
aria2_exporter = builtins.fetchTarball {
aria2_exporter = fetchTarball {
url = "https://github.com/sbruder/aria2_exporter/archive/141a9c0bdbfea2cda4e7a620cc74435a9d549c70.tar.gz";
sha256 = "1drdhlpfdwsaizi3ys4z6pd0cc19f0rq0ry21b98hphb37cv2cnb";
};

View file

@ -51,7 +51,7 @@ pkgs.mkShell {
git
niv
nixpkgs-fmt
]) ++ (builtins.attrValues (builtins.mapAttrs pkgs.writeShellScriptBin scripts));
]) ++ (pkgs.lib.mapAttrsToList pkgs.writeShellScriptBin scripts);
shellHook = ''
${pre-commit-check.shellHook}
'';

View file

@ -45,7 +45,7 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
visualizer_type = "spectrum";
# Song list formatting
song_columns_list_format = builtins.concatStringsSep " " [
song_columns_list_format = lib.concatStringsSep " " [
"(6f)[green]{NE}"
"(45)[white]{t|f:Title}"
"(20)[]{a}"

View file

@ -60,7 +60,7 @@ let
meta.license = lib.licenses.gpl2;
};
cycleShaders = shaders: "cycle-values glsl-shaders ${builtins.concatStringsSep " " shaders}";
cycleShaders = shaders: "cycle-values glsl-shaders ${lib.concatStringsSep " " shaders}";
in
{
programs.mpv = {

View file

@ -1,6 +1,6 @@
{ config, lib, nixosConfig, pkgs, ... }:
let
languageClientSettings = pkgs.writeText "LanguageClient.json" (builtins.toJSON {
languageClientSettings = pkgs.writeText "LanguageClient.json" (lib.generators.toJSON { } {
rust.clippy_preference = "on";
});
rainbow_csv = pkgs.vimUtils.buildVimPluginFrom2Nix rec {

View file

@ -259,7 +259,7 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
xdg.configFile = {
# home-managers waybar module performs additional checks that are overly strict
"waybar/config".text = builtins.toJSON {
"waybar/config".text = lib.generators.toJSON { } {
layer = "top";
position = "top";
height = 24;