mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-23 01:41:05 +03:00

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-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
78 lines
1.9 KiB
Nix
78 lines
1.9 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.nix.sshServe;
|
|
command =
|
|
if cfg.protocol == "ssh" then
|
|
"nix-store --serve ${lib.optionalString cfg.write "--write"}"
|
|
else
|
|
"nix-daemon --stdio";
|
|
in
|
|
{
|
|
options = {
|
|
|
|
nix.sshServe = {
|
|
|
|
enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Whether to enable serving the Nix store as a remote store via SSH.";
|
|
};
|
|
|
|
write = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = false;
|
|
description = "Whether to enable writing to the Nix store as a remote store via SSH. Note: the sshServe user is named nix-ssh and is not a trusted-user. nix-ssh should be added to the {option}`nix.settings.trusted-users` option in most use cases, such as allowing remote building of derivations.";
|
|
};
|
|
|
|
keys = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [ ];
|
|
example = [ "ssh-dss AAAAB3NzaC1k... alice@example.org" ];
|
|
description = "A list of SSH public keys allowed to access the binary cache via SSH.";
|
|
};
|
|
|
|
protocol = lib.mkOption {
|
|
type = lib.types.enum [
|
|
"ssh"
|
|
"ssh-ng"
|
|
];
|
|
default = "ssh";
|
|
description = "The specific Nix-over-SSH protocol to use.";
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
users.users.nix-ssh = {
|
|
description = "Nix SSH store user";
|
|
isSystemUser = true;
|
|
group = "nix-ssh";
|
|
shell = pkgs.bashInteractive;
|
|
};
|
|
users.groups.nix-ssh = { };
|
|
|
|
services.openssh.enable = true;
|
|
|
|
services.openssh.extraConfig = ''
|
|
Match User nix-ssh
|
|
AllowAgentForwarding no
|
|
AllowTcpForwarding no
|
|
PermitTTY no
|
|
PermitTunnel no
|
|
X11Forwarding no
|
|
ForceCommand ${config.nix.package.out}/bin/${command}
|
|
Match All
|
|
'';
|
|
|
|
users.users.nix-ssh.openssh.authorizedKeys.keys = cfg.keys;
|
|
|
|
};
|
|
}
|