summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorSamuel Dionne-Riel <samuel@dionne-riel.com>2019-06-08 01:13:52 -0400
committerSamuel Dionne-Riel <samuel@dionne-riel.com>2019-06-15 00:56:42 -0400
commit861bbbcb3c406f4a5a7131e48f2621431514c91e (patch)
treea26662a5ee532795d26bea869f38dbfd97a00817 /nixos
parent7815c86c104a99417db844791dcda34fe7a7965f (diff)
downloadnixpkgs-861bbbcb3c406f4a5a7131e48f2621431514c91e.tar
nixpkgs-861bbbcb3c406f4a5a7131e48f2621431514c91e.tar.gz
nixpkgs-861bbbcb3c406f4a5a7131e48f2621431514c91e.tar.bz2
nixpkgs-861bbbcb3c406f4a5a7131e48f2621431514c91e.tar.lz
nixpkgs-861bbbcb3c406f4a5a7131e48f2621431514c91e.tar.xz
nixpkgs-861bbbcb3c406f4a5a7131e48f2621431514c91e.tar.zst
nixpkgs-861bbbcb3c406f4a5a7131e48f2621431514c91e.zip
nixos/sshd: fixes validation for cross-compilation
See https://github.com/NixOS/nixpkgs/pull/62853
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/services/networking/ssh/sshd.nix10
1 files changed, 9 insertions, 1 deletions
diff --git a/nixos/modules/services/networking/ssh/sshd.nix b/nixos/modules/services/networking/ssh/sshd.nix
index 89f56a726f4..0f9d2420903 100644
--- a/nixos/modules/services/networking/ssh/sshd.nix
+++ b/nixos/modules/services/networking/ssh/sshd.nix
@@ -4,7 +4,15 @@ with lib;
 
 let
 
-  sshconf = pkgs.runCommand "sshd.conf-validated" { nativeBuildInputs = [ cfgc.package ]; } ''
+  # The splicing information needed for nativeBuildInputs isn't available
+  # on the derivations likely to be used as `cfgc.package`.
+  # This middle-ground solution ensures *an* sshd can do their basic validation
+  # on the configuration.
+  validationPackage = if pkgs.stdenv.buildPlatform == pkgs.stdenv.hostPlatform
+    then [ cfgc.package ]
+    else [ pkgs.buildPackages.openssh ];
+
+  sshconf = pkgs.runCommand "sshd.conf-validated" { nativeBuildInputs = [ validationPackage ]; } ''
     cat >$out <<EOL
     ${cfg.extraConfig}
     EOL