0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 13:40:28 +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:
Silvan Mosberger 2024-12-10 20:26:33 +01:00
parent b32a094368
commit 4f0dadbf38
21293 changed files with 701351 additions and 428307 deletions

View file

@ -1,25 +1,31 @@
/* This makes a keter bundle as described on the github page:
/*
This makes a keter bundle as described on the github page:
https://github.com/snoyberg/keter#bundling-your-app-for-keter
*/
{ keterDomain
, keterExecutable
, gnutar
, writeTextFile
, lib
, stdenv
, ...
{
keterDomain,
keterExecutable,
gnutar,
writeTextFile,
lib,
stdenv,
...
}:
let
str.stanzas = [{
# we just use nix as an absolute path so we're not bundling any binaries
type = "webapp";
/* Note that we're not actually putting the executable in the bundle,
we already can use the nix store for copying, so we just
symlink to the app. */
exec = keterExecutable;
host = keterDomain;
}];
str.stanzas = [
{
# we just use nix as an absolute path so we're not bundling any binaries
type = "webapp";
/*
Note that we're not actually putting the executable in the bundle,
we already can use the nix store for copying, so we just
symlink to the app.
*/
exec = keterExecutable;
host = keterDomain;
}
];
configFile = writeTextFile {
name = "keter.yml";
text = (lib.generators.toYAML { } str);

View file

@ -1,4 +1,9 @@
{ config, pkgs, lib, ... }:
{
config,
pkgs,
lib,
...
}:
let
cfg = config.services.keter;
yaml = pkgs.formats.yaml { };
@ -14,10 +19,11 @@ in
];
options.services.keter = {
enable = lib.mkEnableOption ''keter, a web app deployment manager.
Note that this module only support loading of webapps:
Keep an old app running and swap the ports when the new one is booted
'';
enable = lib.mkEnableOption ''
keter, a web app deployment manager.
Note that this module only support loading of webapps:
Keep an old app running and swap the ports when the new one is booted
'';
root = lib.mkOption {
type = lib.types.str;
@ -32,7 +38,6 @@ Keep an old app running and swap the ports when the new one is booted
description = "The keter package to be used";
};
globalKeterConfig = lib.mkOption {
type = lib.types.submodule {
freeformType = yaml.type;
@ -43,19 +48,26 @@ Keep an old app running and swap the ports when the new one is booted
description = "You want that ip-from-header in the nginx setup case. It allows nginx setting the original ip address rather then it being localhost (due to reverse proxying)";
};
listeners = lib.mkOption {
default = [{ host = "*"; port = 6981; }];
type = lib.types.listOf (lib.types.submodule {
options = {
host = lib.mkOption {
type = lib.types.str;
description = "host";
default = [
{
host = "*";
port = 6981;
}
];
type = lib.types.listOf (
lib.types.submodule {
options = {
host = lib.mkOption {
type = lib.types.str;
description = "host";
};
port = lib.mkOption {
type = lib.types.port;
description = "port";
};
};
port = lib.mkOption {
type = lib.types.port;
description = "port";
};
};
});
}
);
description = ''
You want that ip-from-header in
the nginx setup case.
@ -121,15 +133,19 @@ Keep an old app running and swap the ports when the new one is booted
let
incoming = "${cfg.root}/incoming";
globalKeterConfigFile = pkgs.writeTextFile {
name = "keter-config.yml";
text = (lib.generators.toYAML { } (cfg.globalKeterConfig // { root = cfg.root; }));
};
# If things are expected to change often, put it in the bundle!
bundle = pkgs.callPackage ./bundle.nix
(cfg.bundle // { keterExecutable = executable; keterDomain = cfg.bundle.domain; });
bundle = pkgs.callPackage ./bundle.nix (
cfg.bundle
// {
keterExecutable = executable;
keterDomain = cfg.bundle.domain;
}
);
# This indirection is required to ensure the nix path
# gets copied over to the target machine in remote deployments.
@ -153,7 +169,10 @@ Keep an old app running and swap the ports when the new one is booted
mkdir -p ${incoming}
${lib.getExe cfg.package} ${globalKeterConfigFile};
'';
wantedBy = [ "multi-user.target" "nginx.service" ];
wantedBy = [
"multi-user.target"
"nginx.service"
];
serviceConfig = {
Restart = "always";