nix-ssh-serve.nix: Remove unnecessary check
ForceCommand ensures that we always run nix-store --serve, so there is no need to check SSH_ORIGINAL_COMMAND.
This commit is contained in:
parent
50510d1985
commit
3e9c2bf4b5
@ -1,21 +1,12 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
with lib;
|
||||||
serveOnly = pkgs.writeScript "nix-store-serve" ''
|
|
||||||
#!${pkgs.stdenv.shell}
|
|
||||||
if [ "$SSH_ORIGINAL_COMMAND" != "nix-store --serve" ]; then
|
|
||||||
echo 'Error: You are only allowed to run `nix-store --serve'\'''!' >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
exec /run/current-system/sw/bin/nix-store --serve
|
|
||||||
'';
|
|
||||||
|
|
||||||
inherit (lib) mkIf mkOption types;
|
{
|
||||||
in {
|
|
||||||
options = {
|
options = {
|
||||||
nix.sshServe = {
|
nix.sshServe = {
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
description = "Whether to enable serving the nix store over ssh.";
|
description = "Whether to enable serving the Nix store as a binary cache via SSH.";
|
||||||
default = false;
|
default = false;
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
};
|
};
|
||||||
@ -24,7 +15,7 @@ in {
|
|||||||
|
|
||||||
config = mkIf config.nix.sshServe.enable {
|
config = mkIf config.nix.sshServe.enable {
|
||||||
users.extraUsers.nix-ssh = {
|
users.extraUsers.nix-ssh = {
|
||||||
description = "User for running nix-store --serve.";
|
description = "Nix SSH substituter user";
|
||||||
uid = config.ids.uids.nix-ssh;
|
uid = config.ids.uids.nix-ssh;
|
||||||
shell = pkgs.stdenv.shell;
|
shell = pkgs.stdenv.shell;
|
||||||
};
|
};
|
||||||
@ -38,7 +29,7 @@ in {
|
|||||||
PermitTTY no
|
PermitTTY no
|
||||||
PermitTunnel no
|
PermitTunnel no
|
||||||
X11Forwarding no
|
X11Forwarding no
|
||||||
ForceCommand ${serveOnly}
|
ForceCommand ${config.nix.package}/bin/nix-store --serve
|
||||||
Match All
|
Match All
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user