treewide: apply statix fixes
This commit is contained in:
parent
10a9705ec6
commit
dbbf2330fd
9 changed files with 19 additions and 21 deletions
|
@ -4,7 +4,7 @@ with lib;
|
||||||
let
|
let
|
||||||
getHostConfigurations = svcConfig: hostName:
|
getHostConfigurations = svcConfig: hostName:
|
||||||
lib.mapAttrsToList (groupName: _: svcConfig.nixos.${groupName})
|
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;
|
getServiceConfigurations = svcConfig: getHostConfigurations svcConfig config.vars.hostName;
|
||||||
in
|
in
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
let
|
let
|
||||||
cfg = config.services.patroni;
|
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);
|
genLinks = mode: nodes: f: lib.mapAttrs' (renameToLink mode) (lib.genAttrs nodes f);
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
mkDeployments = hosts: overrides: lib.genAttrs hosts
|
mkDeployments = hosts: overrides: lib.genAttrs hosts
|
||||||
(host: mkDeploy host // (overrides.${host} or {}) );
|
(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; } {
|
in flake-parts.lib.mkFlake { inherit self; } {
|
||||||
inherit systems;
|
inherit systems;
|
||||||
flake = {
|
flake = {
|
||||||
|
|
|
@ -9,8 +9,8 @@ let
|
||||||
cfg = { inherit (config.services) loki; };
|
cfg = { inherit (config.services) loki; };
|
||||||
|
|
||||||
toString' = v:
|
toString' = v:
|
||||||
if v == true then "true" else
|
if v then "true" else
|
||||||
if v == false then "false" else
|
if !v then "false" else
|
||||||
toString v;
|
toString v;
|
||||||
|
|
||||||
mapPaths = lib.mapAttrsRecursive (
|
mapPaths = lib.mapAttrsRecursive (
|
||||||
|
|
|
@ -162,7 +162,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
settings = mkOption {
|
settings = mkOption {
|
||||||
type = format.type;
|
inherit (format) type;
|
||||||
default = { };
|
default = { };
|
||||||
description = mdDoc ''
|
description = mdDoc ''
|
||||||
The primary patroni configuration. See the [documentation](https://patroni.readthedocs.io/en/latest/SETTINGS.html)
|
The primary patroni configuration. See the [documentation](https://patroni.readthedocs.io/en/latest/SETTINGS.html)
|
||||||
|
@ -185,13 +185,13 @@ in
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
services.patroni.settings = {
|
services.patroni.settings = {
|
||||||
scope = cfg.scope;
|
inherit (cfg) scope;
|
||||||
name = cfg.name;
|
inherit (cfg) name;
|
||||||
namespace = cfg.namespace;
|
inherit (cfg) namespace;
|
||||||
|
|
||||||
restapi = {
|
restapi = {
|
||||||
listen = "${cfg.nodeIp}:${toString(cfg.restApiPort)}";
|
listen = "${cfg.nodeIp}:${toString cfg.restApiPort}";
|
||||||
connect_address = "${cfg.nodeIp}:${toString(cfg.restApiPort)}";
|
connect_address = "${cfg.nodeIp}:${toString cfg.restApiPort}";
|
||||||
};
|
};
|
||||||
|
|
||||||
raft = mkIf cfg.raft {
|
raft = mkIf cfg.raft {
|
||||||
|
@ -201,8 +201,8 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
postgresql = {
|
postgresql = {
|
||||||
listen = "${cfg.nodeIp}:${toString(cfg.postgresqlPort)}";
|
listen = "${cfg.nodeIp}:${toString cfg.postgresqlPort}";
|
||||||
connect_address = "${cfg.nodeIp}:${toString(cfg.postgresqlPort)}";
|
connect_address = "${cfg.nodeIp}:${toString cfg.postgresqlPort}";
|
||||||
data_dir = cfg.postgresqlDataDir;
|
data_dir = cfg.postgresqlDataDir;
|
||||||
bin_dir = "${postgresql}/bin";
|
bin_dir = "${postgresql}/bin";
|
||||||
pgpass = "${cfg.dataDir}/pgpass";
|
pgpass = "${cfg.dataDir}/pgpass";
|
||||||
|
@ -219,7 +219,7 @@ in
|
||||||
users = {
|
users = {
|
||||||
users = mkIf (cfg.user == defaultUser) {
|
users = mkIf (cfg.user == defaultUser) {
|
||||||
patroni = {
|
patroni = {
|
||||||
group = cfg.group;
|
inherit (cfg) group;
|
||||||
isSystemUser = true;
|
isSystemUser = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -282,7 +282,7 @@ in
|
||||||
StateDirectory = "patroni patroni/raft postgresql postgresql/${postgresql.psqlSchema}";
|
StateDirectory = "patroni patroni/raft postgresql postgresql/${postgresql.psqlSchema}";
|
||||||
StateDirectoryMode = "0750";
|
StateDirectoryMode = "0750";
|
||||||
})
|
})
|
||||||
(mkIf (cfg.softwareWatchdog) {
|
(mkIf cfg.softwareWatchdog {
|
||||||
ExecStartPre = "+" + pkgs.writeShellScript "configure-software-watchdog.sh" ''
|
ExecStartPre = "+" + pkgs.writeShellScript "configure-software-watchdog.sh" ''
|
||||||
${pkgs.kmod}/bin/modprobe softdog
|
${pkgs.kmod}/bin/modprobe softdog
|
||||||
${pkgs.coreutils}/bin/chown ${cfg.user} /dev/watchdog
|
${pkgs.coreutils}/bin/chown ${cfg.user} /dev/watchdog
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
rootDir: let
|
rootDir: let
|
||||||
|
|
||||||
prefix = ((toString rootDir) + "/");
|
prefix = (toString rootDir) + "/";
|
||||||
|
|
||||||
files = lib.filesystem.listFilesRecursive rootDir;
|
files = lib.filesystem.listFilesRecursive rootDir;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
{ inputs, lib, ... }:
|
{ inputs, lib, ... }:
|
||||||
let
|
let
|
||||||
filters = import ./system-filter.nix;
|
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}"
|
filterSet ? "${name}" -> builtins.elem system filterSet."${name}"
|
||||||
) pkgSet;
|
);
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [
|
||||||
./projects.nix
|
./projects.nix
|
||||||
|
|
|
@ -18,7 +18,7 @@ let
|
||||||
sources = (builtins.fromJSON (builtins.readFile ./sources.json)).pins;
|
sources = (builtins.fromJSON (builtins.readFile ./sources.json)).pins;
|
||||||
in rustPlatform.buildRustPackage rec {
|
in rustPlatform.buildRustPackage rec {
|
||||||
pname = "npins";
|
pname = "npins";
|
||||||
version = src.version;
|
inherit (src) version;
|
||||||
src = passthru.mkSource sources.npins;
|
src = passthru.mkSource sources.npins;
|
||||||
|
|
||||||
cargoSha256 = "0rwnzkmx91cwcz9yw0rbbqv73ba6ggim9f4qgz5pgy6h696ld2k8";
|
cargoSha256 = "0rwnzkmx91cwcz9yw0rbbqv73ba6ggim9f4qgz5pgy6h696ld2k8";
|
||||||
|
|
|
@ -3,9 +3,7 @@
|
||||||
let
|
let
|
||||||
inherit (pins) cinny;
|
inherit (pins) cinny;
|
||||||
repo = cinny.repository;
|
repo = cinny.repository;
|
||||||
in
|
|
||||||
|
|
||||||
let
|
|
||||||
app = stdenvNoCC.mkDerivation rec {
|
app = stdenvNoCC.mkDerivation rec {
|
||||||
pname = "cinny-bin";
|
pname = "cinny-bin";
|
||||||
version = builtins.substring 1 (-1) cinny.version;
|
version = builtins.substring 1 (-1) cinny.version;
|
||||||
|
|
Loading…
Reference in a new issue