mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.
Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.
A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.
This commit was automatically created and can be verified using
nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
--argstr baseRev b32a094368
result/bin/apply-formatting $NIXPKGS_PATH
This commit is contained in:
parent
b32a094368
commit
4f0dadbf38
21293 changed files with 701351 additions and 428307 deletions
|
@ -1,19 +1,23 @@
|
|||
{ lib, pkgs, config, ... }:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
settingsFormat = pkgs.formats.yaml { };
|
||||
|
||||
# gemstash uses a yaml config where the keys are ruby symbols,
|
||||
# which means they start with ':'. This would be annoying to use
|
||||
# on the nix side, so we rewrite plain names instead.
|
||||
prefixColon = s: lib.listToAttrs (map
|
||||
(attrName: {
|
||||
name = ":${attrName}";
|
||||
value =
|
||||
if lib.isAttrs s.${attrName}
|
||||
then prefixColon s."${attrName}"
|
||||
else s."${attrName}";
|
||||
})
|
||||
(lib.attrNames s));
|
||||
prefixColon =
|
||||
s:
|
||||
lib.listToAttrs (
|
||||
map (attrName: {
|
||||
name = ":${attrName}";
|
||||
value = if lib.isAttrs s.${attrName} then prefixColon s."${attrName}" else s."${attrName}";
|
||||
}) (lib.attrNames s)
|
||||
);
|
||||
|
||||
# parse the port number out of the tcp://ip:port bind setting string
|
||||
parseBindPort = bind: lib.strings.toInt (lib.last (lib.strings.splitString ":" bind));
|
||||
|
@ -33,7 +37,7 @@ in
|
|||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
default = {};
|
||||
default = { };
|
||||
description = ''
|
||||
Configuration for Gemstash. The details can be found at in
|
||||
[gemstash documentation](https://github.com/rubygems/gemstash/blob/master/man/gemstash-configuration.5.md).
|
||||
|
@ -53,7 +57,14 @@ in
|
|||
description = "Host and port combination for the server to listen on.";
|
||||
};
|
||||
db_adapter = lib.mkOption {
|
||||
type = lib.types.nullOr (lib.types.enum [ "sqlite3" "postgres" "mysql" "mysql2" ]);
|
||||
type = lib.types.nullOr (
|
||||
lib.types.enum [
|
||||
"sqlite3"
|
||||
"postgres"
|
||||
"mysql"
|
||||
"mysql2"
|
||||
]
|
||||
);
|
||||
default = null;
|
||||
description = "Which database type to use. For choices other than sqlite3, the dbUrl has to be specified as well.";
|
||||
};
|
||||
|
@ -67,35 +78,36 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config =
|
||||
lib.mkIf cfg.enable {
|
||||
users = {
|
||||
users.gemstash = {
|
||||
group = "gemstash";
|
||||
isSystemUser = true;
|
||||
};
|
||||
groups.gemstash = { };
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [ (parseBindPort cfg.settings.bind) ];
|
||||
|
||||
systemd.services.gemstash = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = lib.mkMerge [
|
||||
{
|
||||
ExecStart = "${pkgs.gemstash}/bin/gemstash start --no-daemonize --config-file ${settingsFormat.generate "gemstash.yaml" (prefixColon cfg.settings)}";
|
||||
NoNewPrivileges = true;
|
||||
User = "gemstash";
|
||||
Group = "gemstash";
|
||||
PrivateTmp = true;
|
||||
RestrictSUIDSGID = true;
|
||||
LockPersonality = true;
|
||||
}
|
||||
(lib.mkIf (cfg.settings.base_path == "/var/lib/gemstash") {
|
||||
StateDirectory = "gemstash";
|
||||
})
|
||||
];
|
||||
config = lib.mkIf cfg.enable {
|
||||
users = {
|
||||
users.gemstash = {
|
||||
group = "gemstash";
|
||||
isSystemUser = true;
|
||||
};
|
||||
groups.gemstash = { };
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [
|
||||
(parseBindPort cfg.settings.bind)
|
||||
];
|
||||
|
||||
systemd.services.gemstash = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = lib.mkMerge [
|
||||
{
|
||||
ExecStart = "${pkgs.gemstash}/bin/gemstash start --no-daemonize --config-file ${settingsFormat.generate "gemstash.yaml" (prefixColon cfg.settings)}";
|
||||
NoNewPrivileges = true;
|
||||
User = "gemstash";
|
||||
Group = "gemstash";
|
||||
PrivateTmp = true;
|
||||
RestrictSUIDSGID = true;
|
||||
LockPersonality = true;
|
||||
}
|
||||
(lib.mkIf (cfg.settings.base_path == "/var/lib/gemstash") {
|
||||
StateDirectory = "gemstash";
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue