mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
Merge staging-next into staging
This commit is contained in:
commit
f3b4ae8402
96 changed files with 1009 additions and 486 deletions
|
@ -227,6 +227,15 @@ foreach my $u (@{$spec->{users}}) {
|
|||
$u->{hashedPassword} = hashPassword($u->{password});
|
||||
}
|
||||
|
||||
if (!defined $u->{shell}) {
|
||||
if (defined $existing) {
|
||||
$u->{shell} = $existing->{shell};
|
||||
} else {
|
||||
warn "warning: no declarative or previous shell for ‘$name’, setting shell to nologin\n";
|
||||
$u->{shell} = "/run/current-system/sw/bin/nologin";
|
||||
}
|
||||
}
|
||||
|
||||
$u->{fakePassword} = $existing->{fakePassword} // "x";
|
||||
$usersOut{$name} = $u;
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ let
|
|||
};
|
||||
|
||||
shell = mkOption {
|
||||
type = types.either types.shellPackage types.path;
|
||||
type = types.nullOr (types.either types.shellPackage types.path);
|
||||
default = pkgs.shadow;
|
||||
defaultText = "pkgs.shadow";
|
||||
example = literalExample "pkgs.bashInteractive";
|
||||
|
|
|
@ -69,6 +69,9 @@ mount --rbind /sys "$mountPoint/sys"
|
|||
|
||||
# Run the activation script. Set $LOCALE_ARCHIVE to supress some Perl locale warnings.
|
||||
LOCALE_ARCHIVE="$system/sw/lib/locale/locale-archive" chroot "$mountPoint" "$system/activate" 1>&2 || true
|
||||
|
||||
# Create /tmp
|
||||
chroot "$mountPoint" systemd-tmpfiles --create --remove --exclude-prefix=/dev 1>&2 || true
|
||||
)
|
||||
|
||||
exec chroot "$mountPoint" "${command[@]}"
|
||||
|
|
|
@ -745,6 +745,7 @@
|
|||
./services/networking/skydns.nix
|
||||
./services/networking/shadowsocks.nix
|
||||
./services/networking/shairport-sync.nix
|
||||
./services/networking/shellhub-agent.nix
|
||||
./services/networking/shorewall.nix
|
||||
./services/networking/shorewall6.nix
|
||||
./services/networking/shout.nix
|
||||
|
|
91
nixos/modules/services/networking/shellhub-agent.nix
Normal file
91
nixos/modules/services/networking/shellhub-agent.nix
Normal file
|
@ -0,0 +1,91 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.services.shellhub-agent;
|
||||
in {
|
||||
|
||||
###### interface
|
||||
|
||||
options = {
|
||||
|
||||
services.shellhub-agent = {
|
||||
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable the ShellHub Agent daemon, which allows
|
||||
secure remote logins.
|
||||
'';
|
||||
};
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.shellhub-agent;
|
||||
defaultText = "pkgs.shellhub-agent";
|
||||
description = ''
|
||||
Which ShellHub Agent package to use.
|
||||
'';
|
||||
};
|
||||
|
||||
tenantId = mkOption {
|
||||
type = types.str;
|
||||
example = "ba0a880c-2ada-11eb-a35e-17266ef329d6";
|
||||
description = ''
|
||||
The tenant ID to use when connecting to the ShellHub
|
||||
Gateway.
|
||||
'';
|
||||
};
|
||||
|
||||
server = mkOption {
|
||||
type = types.str;
|
||||
default = "https://cloud.shellhub.io";
|
||||
description = ''
|
||||
Server address of ShellHub Gateway to connect.
|
||||
'';
|
||||
};
|
||||
|
||||
privateKey = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/shellhub-agent/private.key";
|
||||
description = ''
|
||||
Location where to store the ShellHub Agent private
|
||||
key.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
###### implementation
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
systemd.services.shellhub-agent = {
|
||||
description = "ShellHub Agent";
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
requires = [ "local-fs.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [
|
||||
"local-fs.target"
|
||||
"network.target"
|
||||
"network-online.target"
|
||||
"time-sync.target"
|
||||
];
|
||||
|
||||
environment.SERVER_ADDRESS = cfg.server;
|
||||
environment.PRIVATE_KEY = cfg.privateKey;
|
||||
environment.TENANT_ID = cfg.tenantId;
|
||||
|
||||
serviceConfig = {
|
||||
# The service starts sessions for different users.
|
||||
User = "root";
|
||||
Restart = "on-failure";
|
||||
ExecStart = "${cfg.package}/bin/agent";
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [ cfg.package ];
|
||||
};
|
||||
}
|
|
@ -7,7 +7,7 @@ let
|
|||
echo "attempting to fetch configuration from EC2 user data..."
|
||||
|
||||
export HOME=/root
|
||||
export PATH=${pkgs.lib.makeBinPath [ config.nix.package pkgs.systemd pkgs.gnugrep pkgs.git pkgs.gnutar pkgs.gzip pkgs.gnused config.system.build.nixos-rebuild]}:$PATH
|
||||
export PATH=${pkgs.lib.makeBinPath [ config.nix.package pkgs.systemd pkgs.gnugrep pkgs.git pkgs.gnutar pkgs.gzip pkgs.gnused pkgs.xz config.system.build.nixos-rebuild]}:$PATH
|
||||
export NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels
|
||||
|
||||
userData=/etc/ec2-metadata/user-data
|
||||
|
|
|
@ -176,10 +176,10 @@ let
|
|||
description = ''
|
||||
Define which other containers this one depends on. They will be added to both After and Requires for the unit.
|
||||
|
||||
Use the same name as the attribute under <literal>virtualisation.oci-containers</literal>.
|
||||
Use the same name as the attribute under <literal>virtualisation.oci-containers.containers</literal>.
|
||||
'';
|
||||
example = literalExample ''
|
||||
virtualisation.oci-containers = {
|
||||
virtualisation.oci-containers.containers = {
|
||||
node1 = {};
|
||||
node2 = {
|
||||
dependsOn = [ "node1" ];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue