From ca6c2c211148bf090ad954f361cac97fa453c901 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 17:24:39 -0500 Subject: [PATCH 01/13] nixos/docker-image: clean up let-in binding --- nixos/modules/profiles/docker-container.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nixos/modules/profiles/docker-container.nix b/nixos/modules/profiles/docker-container.nix index 183645de36fb..5365e49711dc 100644 --- a/nixos/modules/profiles/docker-container.nix +++ b/nixos/modules/profiles/docker-container.nix @@ -1,13 +1,12 @@ { config, lib, pkgs, ... }: -with lib; - -let inherit (pkgs) writeScript; in - let - pkgs2storeContents = l : map (x: { object = x; symlink = "none"; }) l; + inherit (pkgs) writeScript; -in { + pkgs2storeContents = map (x: { object = x; symlink = "none"; }); +in + +{ # Docker image config. imports = [ ../installer/cd-dvd/channel.nix From fd4f865645cfba121f2ac6d052786cdf9638b318 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 17:26:31 -0500 Subject: [PATCH 02/13] nixos/nixpkgs: remove unused binding --- nixos/modules/misc/nixpkgs.nix | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/nixos/modules/misc/nixpkgs.nix b/nixos/modules/misc/nixpkgs.nix index 7f7417226d17..7f44c3f6f3f0 100644 --- a/nixos/modules/misc/nixpkgs.nix +++ b/nixos/modules/misc/nixpkgs.nix @@ -23,12 +23,12 @@ let optionalAttrs (lhs ? packageOverrides) { packageOverrides = pkgs: optCall lhs.packageOverrides pkgs // - optCall (attrByPath ["packageOverrides"] ({}) rhs) pkgs; + optCall (attrByPath [ "packageOverrides" ] { } rhs) pkgs; } // optionalAttrs (lhs ? perlPackageOverrides) { perlPackageOverrides = pkgs: optCall lhs.perlPackageOverrides pkgs // - optCall (attrByPath ["perlPackageOverrides"] ({}) rhs) pkgs; + optCall (attrByPath [ "perlPackageOverrides" ] { } rhs) pkgs; }; configType = mkOptionType { @@ -67,11 +67,6 @@ let # Context for messages hostPlatformLine = optionalString hasHostPlatform "${showOptionWithDefLocs opt.hostPlatform}"; buildPlatformLine = optionalString hasBuildPlatform "${showOptionWithDefLocs opt.buildPlatform}"; - platformLines = optionalString hasPlatform '' - Your system configuration configures nixpkgs with platform parameters: - ${hostPlatformLine - }${buildPlatformLine - }''; legacyOptionsDefined = optional (opt.localSystem.highestPrio < (mkDefault {}).priority) opt.system From a356511f1ade96ba4c7b1adae371693db8ea026b Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 17:29:36 -0500 Subject: [PATCH 03/13] nixos/crossfire-server: remove unnecessary parentheses --- nixos/modules/services/games/crossfire-server.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/games/crossfire-server.nix b/nixos/modules/services/games/crossfire-server.nix index 7820a08be40b..0849667e61c9 100644 --- a/nixos/modules/services/games/crossfire-server.nix +++ b/nixos/modules/services/games/crossfire-server.nix @@ -131,9 +131,9 @@ in { exp_table = ""; forbid = ""; metaserver2 = ""; - motd = (fileContents "${cfg.package}/etc/crossfire/motd"); - news = (fileContents "${cfg.package}/etc/crossfire/news"); - rules = (fileContents "${cfg.package}/etc/crossfire/rules"); + motd = fileContents "${cfg.package}/etc/crossfire/motd"; + news = fileContents "${cfg.package}/etc/crossfire/news"; + rules = fileContents "${cfg.package}/etc/crossfire/rules"; settings = ""; stat_bonus = ""; } // cfg.configFiles); From 1b9b057d9248539e20c25609edc690d457d42b4e Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 17:31:28 -0500 Subject: [PATCH 04/13] nixos/buildbot: syntax clean up --- .../services/continuous-integration/buildbot/master.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/continuous-integration/buildbot/master.nix b/nixos/modules/services/continuous-integration/buildbot/master.nix index d9055149b77f..d00e0ba39565 100644 --- a/nixos/modules/services/continuous-integration/buildbot/master.nix +++ b/nixos/modules/services/continuous-integration/buildbot/master.nix @@ -10,7 +10,7 @@ let python = cfg.package.pythonModule; - escapeStr = s: escape ["'"] s; + escapeStr = escape [ "'" ]; defaultMasterCfg = pkgs.writeText "master.cfg" '' from buildbot.plugins import * @@ -245,9 +245,7 @@ in { description = "Buildbot User."; isNormalUser = true; createHome = true; - home = cfg.home; - group = cfg.group; - extraGroups = cfg.extraGroups; + inherit (cfg) home group extraGroups; useDefaultShell = true; }; }; From 025142b808b4511f1ef31a2b553b733b8444ddb7 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 17:32:53 -0500 Subject: [PATCH 05/13] nixos/hbase: remove unnecessary parenthesis --- nixos/modules/services/cluster/hadoop/hbase.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/cluster/hadoop/hbase.nix b/nixos/modules/services/cluster/hadoop/hbase.nix index 237a1d428fe2..97951ebfe334 100644 --- a/nixos/modules/services/cluster/hadoop/hbase.nix +++ b/nixos/modules/services/cluster/hadoop/hbase.nix @@ -141,9 +141,9 @@ in services.hadoop.hbaseSiteInternal."hbase.rootdir" = cfg.hbase.rootdir; - networking.firewall.allowedTCPPorts = (mkIf cfg.hbase.master.openFirewall [ + networking.firewall.allowedTCPPorts = mkIf cfg.hbase.master.openFirewall [ 16000 16010 - ]); + ]; }) @@ -168,9 +168,9 @@ in services.hadoop.hbaseSiteInternal."hbase.rootdir" = cfg.hbase.rootdir; networking = { - firewall.allowedTCPPorts = (mkIf cfg.hbase.regionServer.openFirewall [ + firewall.allowedTCPPorts = mkIf cfg.hbase.regionServer.openFirewall [ 16020 16030 - ]); + ]; hosts = mkIf cfg.hbase.regionServer.overrideHosts { "127.0.0.2" = mkForce [ ]; "::1" = mkForce [ ]; From dfff1a2b83d3cd795a3178a3142544eac7026153 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 17:36:07 -0500 Subject: [PATCH 06/13] nixos/prosody: simplify logic --- nixos/modules/services/networking/prosody.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/networking/prosody.nix b/nixos/modules/services/networking/prosody.nix index 6cd4678ae4ac..2d122bcf655a 100644 --- a/nixos/modules/services/networking/prosody.nix +++ b/nixos/modules/services/networking/prosody.nix @@ -263,7 +263,7 @@ let if builtins.isString x then ''"${x}"'' else if builtins.isBool x then boolToString x else if builtins.isInt x then toString x - else if builtins.isList x then ''{ ${lib.concatStringsSep ", " (map (n: toLua n) x) } }'' + else if builtins.isList x then "{ ${lib.concatMapStringsSep ", " toLua x} }" else throw "Invalid Lua value"; createSSLOptsStr = o: '' From d65639ce40d4f26c362732d81e1f27fb88d6c9e5 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 17:38:52 -0500 Subject: [PATCH 07/13] nixos/redis: simplify --- nixos/modules/services/databases/redis.nix | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/nixos/modules/services/databases/redis.nix b/nixos/modules/services/databases/redis.nix index 95c0afb8f835..1464f4487e39 100644 --- a/nixos/modules/services/databases/redis.nix +++ b/nixos/modules/services/databases/redis.nix @@ -67,7 +67,7 @@ in { ''); servers = mkOption { - type = with types; attrsOf (submodule ({config, name, ...}@args: { + type = with types; attrsOf (submodule ({ config, name, ... }: { options = { enable = mkEnableOption (lib.mdDoc '' Redis server. @@ -271,14 +271,11 @@ in { }; config.settings = mkMerge [ { - port = config.port; + inherit (config) port logfile databases maxclients appendOnly; daemonize = false; supervised = "systemd"; loglevel = config.logLevel; - logfile = config.logfile; syslog-enabled = config.syslog; - databases = config.databases; - maxclients = config.maxclients; save = if config.save == [] then ''""'' # Disable saving with `save = ""` else map @@ -286,12 +283,11 @@ in { config.save; dbfilename = "dump.rdb"; dir = "/var/lib/${redisName name}"; - appendOnly = config.appendOnly; appendfsync = config.appendFsync; slowlog-log-slower-than = config.slowLogLogSlowerThan; slowlog-max-len = config.slowLogMaxLen; } - (mkIf (config.bind != null) { bind = config.bind; }) + (mkIf (config.bind != null) { inherit (config) bind; }) (mkIf (config.unixSocket != null) { unixsocket = config.unixSocket; unixsocketperm = toString config.unixSocketPerm; From 55acad5c357c3f49808dc8c01982ec3ed4e2d27d Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 17:56:56 -0500 Subject: [PATCH 08/13] nixos/softether: apply statix suggestions --- nixos/modules/services/networking/softether.nix | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/networking/softether.nix b/nixos/modules/services/networking/softether.nix index 8d69b5304c88..c8e888eafcc2 100644 --- a/nixos/modules/services/networking/softether.nix +++ b/nixos/modules/services/networking/softether.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.services.softether; - package = cfg.package.override { dataDir = cfg.dataDir; }; + package = cfg.package.override { inherit (cfg) dataDir; }; in { @@ -88,7 +88,7 @@ in }; } - (mkIf (cfg.vpnserver.enable) { + (mkIf cfg.vpnserver.enable { systemd.services.vpnserver = { description = "SoftEther VPN Server"; after = [ "softether-init.service" ]; @@ -109,7 +109,7 @@ in }; }) - (mkIf (cfg.vpnbridge.enable) { + (mkIf cfg.vpnbridge.enable { systemd.services.vpnbridge = { description = "SoftEther VPN Bridge"; after = [ "softether-init.service" ]; @@ -130,7 +130,7 @@ in }; }) - (mkIf (cfg.vpnclient.enable) { + (mkIf cfg.vpnclient.enable { systemd.services.vpnclient = { description = "SoftEther VPN Client"; after = [ "softether-init.service" ]; From 7dfc2a1369e115e565dc7fa1e18d847bd6c286f9 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 17:58:55 -0500 Subject: [PATCH 09/13] nixos/user-groups: remove unnecessary parentheses --- nixos/modules/config/users-groups.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/config/users-groups.nix b/nixos/modules/config/users-groups.nix index 2660b0e6c938..61d70ccc19b2 100644 --- a/nixos/modules/config/users-groups.nix +++ b/nixos/modules/config/users-groups.nix @@ -618,7 +618,7 @@ in { # Install all the user shells environment.systemPackages = systemShells; - environment.etc = (mapAttrs' (_: { packages, name, ... }: { + environment.etc = mapAttrs' (_: { packages, name, ... }: { name = "profiles/per-user/${name}"; value.source = pkgs.buildEnv { name = "user-environment"; @@ -626,7 +626,7 @@ in { inherit (config.environment) pathsToLink extraOutputsToInstall; inherit (config.system.path) ignoreCollisions postBuild; }; - }) (filterAttrs (_: u: u.packages != []) cfg.users)); + }) (filterAttrs (_: u: u.packages != []) cfg.users); environment.profiles = [ "$HOME/.nix-profile" From d1c73c25435d17a2221968ff138b63cda50b2eb3 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 17:59:52 -0500 Subject: [PATCH 10/13] nixos/keepalived: remove unnecessary parentheses --- nixos/modules/services/networking/keepalived/default.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nixos/modules/services/networking/keepalived/default.nix b/nixos/modules/services/networking/keepalived/default.nix index e9df08f00c37..29fbea5545c3 100644 --- a/nixos/modules/services/networking/keepalived/default.nix +++ b/nixos/modules/services/networking/keepalived/default.nix @@ -84,13 +84,11 @@ let '' ) vrrpInstances); - virtualIpLine = (ip: - ip.addr + virtualIpLine = ip: ip.addr + optionalString (notNullOrEmpty ip.brd) " brd ${ip.brd}" + optionalString (notNullOrEmpty ip.dev) " dev ${ip.dev}" + optionalString (notNullOrEmpty ip.scope) " scope ${ip.scope}" - + optionalString (notNullOrEmpty ip.label) " label ${ip.label}" - ); + + optionalString (notNullOrEmpty ip.label) " label ${ip.label}"; notNullOrEmpty = s: !(s == null || s == ""); From 1ecbafd0a2853a3aac0e5a483c8cc7cfd87f3ac2 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 18:01:29 -0500 Subject: [PATCH 11/13] nixos/discourse: remove unnecessary parentheses --- nixos/modules/services/web-apps/discourse.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/web-apps/discourse.nix b/nixos/modules/services/web-apps/discourse.nix index 6500b8cad217..1ab0e679a54b 100644 --- a/nixos/modules/services/web-apps/discourse.nix +++ b/nixos/modules/services/web-apps/discourse.nix @@ -19,9 +19,9 @@ let # We only want to create a database if we're actually going to connect to it. databaseActuallyCreateLocally = cfg.database.createLocally && cfg.database.host == null; - tlsEnabled = (cfg.enableACME + tlsEnabled = cfg.enableACME || cfg.sslCertificate != null - || cfg.sslCertificateKey != null); + || cfg.sslCertificateKey != null; in { options = { From f97daa68bc8c77be68c24fd8c51175c7237c61f8 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 18:12:53 -0500 Subject: [PATCH 12/13] nixos/gammu-smsd: remove unnecessary parentheses --- nixos/modules/services/misc/gammu-smsd.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/misc/gammu-smsd.nix b/nixos/modules/services/misc/gammu-smsd.nix index 72e83a249c84..2c7d90b28ded 100644 --- a/nixos/modules/services/misc/gammu-smsd.nix +++ b/nixos/modules/services/misc/gammu-smsd.nix @@ -45,8 +45,8 @@ let initDBDir = "share/doc/gammu/examples/sql"; gammuPackage = with cfg.backend; (pkgs.gammu.override { - dbiSupport = (service == "sql" && sql.driver == "sqlite"); - postgresSupport = (service == "sql" && sql.driver == "native_pgsql"); + dbiSupport = service == "sql" && sql.driver == "sqlite"; + postgresSupport = service == "sql" && sql.driver == "native_pgsql"; }); in { From b865b96b9734658add24b41bf002fd8053ec8f73 Mon Sep 17 00:00:00 2001 From: figsoda Date: Wed, 30 Nov 2022 18:13:58 -0500 Subject: [PATCH 13/13] nixos/invoiceplane: remove unnecessary parentheses --- nixos/modules/services/web-apps/invoiceplane.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/web-apps/invoiceplane.nix b/nixos/modules/services/web-apps/invoiceplane.nix index cccf70295e89..99e7b1f96eac 100644 --- a/nixos/modules/services/web-apps/invoiceplane.nix +++ b/nixos/modules/services/web-apps/invoiceplane.nix @@ -327,7 +327,7 @@ in )) eachSite; systemd.services = - (mapAttrs' (hostName: cfg: ( + mapAttrs' (hostName: cfg: ( nameValuePair "invoiceplane-cron-${hostName}" (mkIf cfg.cron.enable { serviceConfig = { Type = "oneshot"; @@ -335,7 +335,7 @@ in ExecStart = "${pkgs.curl}/bin/curl --header 'Host: ${hostName}' http://localhost/invoices/cron/recur/${cfg.cron.key}"; }; }) - )) eachSite); + )) eachSite; }