From ee1550b763c0fe100ded752de6cc11676951a346 Mon Sep 17 00:00:00 2001
From: Jan Malakhovski <oxij@oxij.org>
Date: Sat, 9 Jun 2018 20:14:36 +0000
Subject: [PATCH] hello-unfree: init at 1.0 (#41763)

Also add `version` attribute to GNU `hello` while we are at it.
---
 .../misc/hello-unfree/default.nix             | 23 +++++++++++++++++++
 pkgs/applications/misc/hello/default.nix      |  3 ++-
 pkgs/top-level/all-packages.nix               |  1 +
 3 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 pkgs/applications/misc/hello-unfree/default.nix

diff --git a/pkgs/applications/misc/hello-unfree/default.nix b/pkgs/applications/misc/hello-unfree/default.nix
new file mode 100644
index 000000000000..ef378b2c5ffb
--- /dev/null
+++ b/pkgs/applications/misc/hello-unfree/default.nix
@@ -0,0 +1,23 @@
+{ stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "example-unfree-package-${version}";
+  version = "1.0";
+
+  phases = [ "installPhase" "fixupPhase" ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cat > $out/bin/hello-unfree << EOF
+    #!/bin/sh
+    echo "Hello, you are running an unfree system!"
+    EOF
+    chmod +x $out/bin/hello-unfree
+  '';
+
+  meta = {
+    description = "An example package with unfree license (for testing)";
+    license = stdenv.lib.licenses.unfree;
+    maintainers = [ stdenv.lib.maintainers.oxij ];
+  };
+}
diff --git a/pkgs/applications/misc/hello/default.nix b/pkgs/applications/misc/hello/default.nix
index c94f78317f4e..7998d30f253f 100644
--- a/pkgs/applications/misc/hello/default.nix
+++ b/pkgs/applications/misc/hello/default.nix
@@ -1,7 +1,8 @@
 { stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "hello-2.10";
+  name = "hello-${version}";
+  version = "2.10";
 
   src = fetchurl {
     url = "mirror://gnu/hello/${name}.tar.gz";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a5dacded6fe6..659f28407227 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -16297,6 +16297,7 @@ with pkgs;
   };
 
   hello = callPackage ../applications/misc/hello { };
+  hello-unfree = callPackage ../applications/misc/hello-unfree { };
 
   helmholtz = callPackage ../applications/audio/pd-plugins/helmholtz { };