diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-07-25 10:54:00 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-07-25 14:29:08 +0200 |
commit | 3e9c2bf4b5d55c2a8f8e944e6b8335761a40efb9 (patch) | |
tree | 12f5a7b183a1225f6219b2c568d162cd6ccb7949 /nixos/modules/services/misc/nix-ssh-serve.nix | |
parent | 50510d1985e37cd7513464e9e308c0d1c24928de (diff) | |
download | nixpkgs-3e9c2bf4b5d55c2a8f8e944e6b8335761a40efb9.tar nixpkgs-3e9c2bf4b5d55c2a8f8e944e6b8335761a40efb9.tar.gz nixpkgs-3e9c2bf4b5d55c2a8f8e944e6b8335761a40efb9.tar.bz2 nixpkgs-3e9c2bf4b5d55c2a8f8e944e6b8335761a40efb9.tar.lz nixpkgs-3e9c2bf4b5d55c2a8f8e944e6b8335761a40efb9.tar.xz nixpkgs-3e9c2bf4b5d55c2a8f8e944e6b8335761a40efb9.tar.zst nixpkgs-3e9c2bf4b5d55c2a8f8e944e6b8335761a40efb9.zip |
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.
Diffstat (limited to 'nixos/modules/services/misc/nix-ssh-serve.nix')
-rw-r--r-- | nixos/modules/services/misc/nix-ssh-serve.nix | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/nixos/modules/services/misc/nix-ssh-serve.nix b/nixos/modules/services/misc/nix-ssh-serve.nix index 80e7961b1f8..51fe79270a6 100644 --- a/nixos/modules/services/misc/nix-ssh-serve.nix +++ b/nixos/modules/services/misc/nix-ssh-serve.nix @@ -1,21 +1,12 @@ { config, lib, pkgs, ... }: -let - 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 - ''; +with lib; - inherit (lib) mkIf mkOption types; -in { +{ options = { nix.sshServe = { 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; type = types.bool; }; @@ -24,7 +15,7 @@ in { config = mkIf config.nix.sshServe.enable { users.extraUsers.nix-ssh = { - description = "User for running nix-store --serve."; + description = "Nix SSH substituter user"; uid = config.ids.uids.nix-ssh; shell = pkgs.stdenv.shell; }; @@ -38,7 +29,7 @@ in { PermitTTY no PermitTunnel no X11Forwarding no - ForceCommand ${serveOnly} + ForceCommand ${config.nix.package}/bin/nix-store --serve Match All ''; }; |