From 78785a06f99d20ae86479c4f6896463f812e2760 Mon Sep 17 00:00:00 2001
From: Will Dietz <w@wdtz.org>
Date: Wed, 4 Oct 2017 17:35:45 -0500
Subject: [PATCH] lsb-release: wrap to ensure needed utilities are available

---
 pkgs/os-specific/linux/lsb-release/default.nix | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/pkgs/os-specific/linux/lsb-release/default.nix b/pkgs/os-specific/linux/lsb-release/default.nix
index 9715f77f9e4..34dae105a8d 100644
--- a/pkgs/os-specific/linux/lsb-release/default.nix
+++ b/pkgs/os-specific/linux/lsb-release/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, getopt }:
+{ stdenv, fetchurl, perl, coreutils, getopt, makeWrapper }:
 
 stdenv.mkDerivation rec {
   version = "1.4";
@@ -16,7 +16,14 @@ stdenv.mkDerivation rec {
 
   installFlags = [ "prefix=$(out)" ];
 
-  buildInputs = [ perl getopt ];
+  nativeBuildInputs  = [ makeWrapper perl ];
+
+  buildInputs = [ coreutils getopt ];
+
+  # Ensure utilities used are available
+  preFixup = ''
+    wrapProgram $out/bin/lsb_release --prefix PATH : ${stdenv.lib.makeBinPath [ coreutils getopt ]}
+  '';
 
   meta = {
     description = "Prints certain LSB (Linux Standard Base) and Distribution information";