From dbbf2330fd171f4b0f40ad212126c2833f5c4450 Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 17 Oct 2022 14:38:55 +0200 Subject: [PATCH] treewide: apply statix fixes --- cluster/lib/services.nix | 2 +- cluster/services/patroni/default.nix | 2 +- flake.nix | 2 +- hosts/VEGAS/services/monitoring/default.nix | 4 ++-- modules/patroni/default.nix | 20 +++++++++---------- .../hydrate-asset-directory/default.nix | 2 +- packages/part.nix | 4 ++-- packages/tools/npins/default.nix | 2 +- packages/web-apps/cinny/default.nix | 2 -- 9 files changed, 19 insertions(+), 21 deletions(-) diff --git a/cluster/lib/services.nix b/cluster/lib/services.nix index 68f6ca9..b97ce89 100644 --- a/cluster/lib/services.nix +++ b/cluster/lib/services.nix @@ -4,7 +4,7 @@ with lib; let getHostConfigurations = svcConfig: hostName: lib.mapAttrsToList (groupName: _: svcConfig.nixos.${groupName}) - (lib.filterAttrs (_: v: lib.elem hostName v) svcConfig.nodes); + (lib.filterAttrs (_: lib.elem hostName) svcConfig.nodes); getServiceConfigurations = svcConfig: getHostConfigurations svcConfig config.vars.hostName; in diff --git a/cluster/services/patroni/default.nix b/cluster/services/patroni/default.nix index 2818712..367c2cc 100644 --- a/cluster/services/patroni/default.nix +++ b/cluster/services/patroni/default.nix @@ -3,7 +3,7 @@ let cfg = config.services.patroni; - renameToLink = mode: n: v: lib.nameValuePair "patroni-etcd-node-${mode}-${n}" v; + renameToLink = mode: n: lib.nameValuePair "patroni-etcd-node-${mode}-${n}"; genLinks = mode: nodes: f: lib.mapAttrs' (renameToLink mode) (lib.genAttrs nodes f); diff --git a/flake.nix b/flake.nix index 1ac4c9d..7f7fe2e 100644 --- a/flake.nix +++ b/flake.nix @@ -74,7 +74,7 @@ mkDeployments = hosts: overrides: lib.genAttrs hosts (host: mkDeploy host // (overrides.${host} or {}) ); - effects = inputs.hercules-ci-effects.lib.withPkgs (nixpkgsFor.x86_64-linux); + effects = inputs.hercules-ci-effects.lib.withPkgs nixpkgsFor.x86_64-linux; in flake-parts.lib.mkFlake { inherit self; } { inherit systems; flake = { diff --git a/hosts/VEGAS/services/monitoring/default.nix b/hosts/VEGAS/services/monitoring/default.nix index a6e8872..ee68073 100644 --- a/hosts/VEGAS/services/monitoring/default.nix +++ b/hosts/VEGAS/services/monitoring/default.nix @@ -9,8 +9,8 @@ let cfg = { inherit (config.services) loki; }; toString' = v: - if v == true then "true" else - if v == false then "false" else + if v then "true" else + if !v then "false" else toString v; mapPaths = lib.mapAttrsRecursive ( diff --git a/modules/patroni/default.nix b/modules/patroni/default.nix index 85b5c7d..1e87b91 100644 --- a/modules/patroni/default.nix +++ b/modules/patroni/default.nix @@ -162,7 +162,7 @@ in }; settings = mkOption { - type = format.type; + inherit (format) type; default = { }; description = mdDoc '' The primary patroni configuration. See the [documentation](https://patroni.readthedocs.io/en/latest/SETTINGS.html) @@ -185,13 +185,13 @@ in config = mkIf cfg.enable { services.patroni.settings = { - scope = cfg.scope; - name = cfg.name; - namespace = cfg.namespace; + inherit (cfg) scope; + inherit (cfg) name; + inherit (cfg) namespace; restapi = { - listen = "${cfg.nodeIp}:${toString(cfg.restApiPort)}"; - connect_address = "${cfg.nodeIp}:${toString(cfg.restApiPort)}"; + listen = "${cfg.nodeIp}:${toString cfg.restApiPort}"; + connect_address = "${cfg.nodeIp}:${toString cfg.restApiPort}"; }; raft = mkIf cfg.raft { @@ -201,8 +201,8 @@ in }; postgresql = { - listen = "${cfg.nodeIp}:${toString(cfg.postgresqlPort)}"; - connect_address = "${cfg.nodeIp}:${toString(cfg.postgresqlPort)}"; + listen = "${cfg.nodeIp}:${toString cfg.postgresqlPort}"; + connect_address = "${cfg.nodeIp}:${toString cfg.postgresqlPort}"; data_dir = cfg.postgresqlDataDir; bin_dir = "${postgresql}/bin"; pgpass = "${cfg.dataDir}/pgpass"; @@ -219,7 +219,7 @@ in users = { users = mkIf (cfg.user == defaultUser) { patroni = { - group = cfg.group; + inherit (cfg) group; isSystemUser = true; }; }; @@ -282,7 +282,7 @@ in StateDirectory = "patroni patroni/raft postgresql postgresql/${postgresql.psqlSchema}"; StateDirectoryMode = "0750"; }) - (mkIf (cfg.softwareWatchdog) { + (mkIf cfg.softwareWatchdog { ExecStartPre = "+" + pkgs.writeShellScript "configure-software-watchdog.sh" '' ${pkgs.kmod}/bin/modprobe softdog ${pkgs.coreutils}/bin/chown ${cfg.user} /dev/watchdog diff --git a/packages/build-support/hydrate-asset-directory/default.nix b/packages/build-support/hydrate-asset-directory/default.nix index d6ece4d..64b7926 100644 --- a/packages/build-support/hydrate-asset-directory/default.nix +++ b/packages/build-support/hydrate-asset-directory/default.nix @@ -2,7 +2,7 @@ rootDir: let - prefix = ((toString rootDir) + "/"); + prefix = (toString rootDir) + "/"; files = lib.filesystem.listFilesRecursive rootDir; diff --git a/packages/part.nix b/packages/part.nix index 8f8acad..c0df59f 100644 --- a/packages/part.nix +++ b/packages/part.nix @@ -1,9 +1,9 @@ { inputs, lib, ... }: let filters = import ./system-filter.nix; - doFilter' = system: filterSet: pkgSet: lib.filterAttrs (name: _: + doFilter' = system: filterSet: lib.filterAttrs (name: _: filterSet ? "${name}" -> builtins.elem system filterSet."${name}" - ) pkgSet; + ); in { imports = [ ./projects.nix diff --git a/packages/tools/npins/default.nix b/packages/tools/npins/default.nix index 8324a2d..d65ce10 100644 --- a/packages/tools/npins/default.nix +++ b/packages/tools/npins/default.nix @@ -18,7 +18,7 @@ let sources = (builtins.fromJSON (builtins.readFile ./sources.json)).pins; in rustPlatform.buildRustPackage rec { pname = "npins"; - version = src.version; + inherit (src) version; src = passthru.mkSource sources.npins; cargoSha256 = "0rwnzkmx91cwcz9yw0rbbqv73ba6ggim9f4qgz5pgy6h696ld2k8"; diff --git a/packages/web-apps/cinny/default.nix b/packages/web-apps/cinny/default.nix index 0165d7d..7d107f9 100644 --- a/packages/web-apps/cinny/default.nix +++ b/packages/web-apps/cinny/default.nix @@ -3,9 +3,7 @@ let inherit (pins) cinny; repo = cinny.repository; -in -let app = stdenvNoCC.mkDerivation rec { pname = "cinny-bin"; version = builtins.substring 1 (-1) cinny.version;