mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-20 17:10:46 +03:00

Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
86 lines
2.1 KiB
Nix
86 lines
2.1 KiB
Nix
{
|
|
pkgs,
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
|
|
let
|
|
cfg = config.services.cockpit;
|
|
inherit (lib)
|
|
types
|
|
mkEnableOption
|
|
mkOption
|
|
mkIf
|
|
literalMD
|
|
mkPackageOption
|
|
;
|
|
settingsFormat = pkgs.formats.ini { };
|
|
in
|
|
{
|
|
options = {
|
|
services.cockpit = {
|
|
enable = mkEnableOption "Cockpit";
|
|
|
|
package = mkPackageOption pkgs "Cockpit" {
|
|
default = [ "cockpit" ];
|
|
};
|
|
|
|
settings = lib.mkOption {
|
|
type = settingsFormat.type;
|
|
|
|
default = { };
|
|
|
|
description = ''
|
|
Settings for cockpit that will be saved in /etc/cockpit/cockpit.conf.
|
|
|
|
See the [documentation](https://cockpit-project.org/guide/latest/cockpit.conf.5.html), that is also available with `man cockpit.conf.5` for details.
|
|
'';
|
|
};
|
|
|
|
port = mkOption {
|
|
description = "Port where cockpit will listen.";
|
|
type = types.port;
|
|
default = 9090;
|
|
};
|
|
|
|
openFirewall = mkOption {
|
|
description = "Open port for cockpit.";
|
|
type = types.bool;
|
|
default = false;
|
|
};
|
|
};
|
|
};
|
|
config = mkIf cfg.enable {
|
|
|
|
# expose cockpit-bridge system-wide
|
|
environment.systemPackages = [ cfg.package ];
|
|
|
|
# allow cockpit to find its plugins
|
|
environment.pathsToLink = [ "/share/cockpit" ];
|
|
|
|
# generate cockpit settings
|
|
environment.etc."cockpit/cockpit.conf".source = settingsFormat.generate "cockpit.conf" cfg.settings;
|
|
|
|
security.pam.services.cockpit = { };
|
|
|
|
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ cfg.port ];
|
|
|
|
systemd.packages = [ cfg.package ];
|
|
systemd.sockets.cockpit.wantedBy = [ "multi-user.target" ];
|
|
systemd.sockets.cockpit.listenStreams = [
|
|
""
|
|
(toString cfg.port)
|
|
];
|
|
|
|
systemd.tmpfiles.rules = [
|
|
# From $out/lib/tmpfiles.d/cockpit-tmpfiles.conf
|
|
"C /run/cockpit/inactive.motd 0640 root root - ${cfg.package}/share/cockpit/motd/inactive.motd"
|
|
"f /run/cockpit/active.motd 0640 root root -"
|
|
"L+ /run/cockpit/motd - - - - inactive.motd"
|
|
"d /etc/cockpit/ws-certs.d 0600 root root 0"
|
|
];
|
|
};
|
|
|
|
meta.maintainers = pkgs.cockpit.meta.maintainers;
|
|
}
|