Merge pull request #203826 from figsoda/lint
nixos/*: apply some lints from statix and nil
This commit is contained in:
commit
5195ca2346
13 changed files with 34 additions and 48 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 [ ];
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 == "");
|
||||
|
||||
|
|
|
@ -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: ''
|
||||
|
|
|
@ -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" ];
|
||||
|
|
|
@ -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 = {
|
||||
|
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue