From d26c303bef670e33d7211b6c053fdb04983c7692 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Sat, 21 Jul 2018 00:04:19 +0200 Subject: [PATCH 1/5] futhark: init at 0.6.2 --- .../development/compilers/futhark/default.nix | 24 ++++++++ .../compilers/futhark/unwrapped.nix | 55 +++++++++++++++++++ .../haskell-modules/configuration-common.nix | 2 + 3 files changed, 81 insertions(+) create mode 100644 pkgs/development/compilers/futhark/default.nix create mode 100644 pkgs/development/compilers/futhark/unwrapped.nix diff --git a/pkgs/development/compilers/futhark/default.nix b/pkgs/development/compilers/futhark/default.nix new file mode 100644 index 00000000000..6cabd686b49 --- /dev/null +++ b/pkgs/development/compilers/futhark/default.nix @@ -0,0 +1,24 @@ +{ callPackage, symlinkJoin, makeWrapper, stdenv, gcc, opencl-headers, opencl-icd }: + +let + unwrapped = callPackage ./unwrapped.nix {}; + + path = stdenv.lib.makeBinPath [ gcc ]; + + wrapped = symlinkJoin { + name = "futhark-wrapped"; + buildInputs = [ makeWrapper ]; + paths = [ unwrapped ]; + postBuild = '' + wrapProgram $out/bin/futhark-c \ + --prefix PATH : "${path}" + + wrapProgram $out/bin/futhark-opencl \ + --prefix PATH : "${path}" \ + --set NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST 1 \ + --set NIX_CFLAGS_COMPILE "-I${opencl-headers}/include" \ + --set NIX_CFLAGS_LINK "-L${opencl-icd}/lib" + ''; + }; + +in wrapped diff --git a/pkgs/development/compilers/futhark/unwrapped.nix b/pkgs/development/compilers/futhark/unwrapped.nix new file mode 100644 index 00000000000..890be3431c3 --- /dev/null +++ b/pkgs/development/compilers/futhark/unwrapped.nix @@ -0,0 +1,55 @@ +# Generated using `cabal2nix --hpack .`, then replace src +{ mkDerivation, alex, array, base, bifunctors, binary, blaze-html +, bytestring, containers, data-binary-ieee754, directory +, directory-tree, dlist, extra, file-embed, filepath, gitrev, happy +, haskeline, hpack, HUnit, json, language-c-quote, mainland-pretty +, markdown, mtl, neat-interpolation, parallel, parsec, process +, process-extras, QuickCheck, random, raw-strings-qq, regex-tdfa +, srcloc, stdenv, template-haskell, temporary, test-framework +, test-framework-hunit, test-framework-quickcheck2, text +, th-lift-instances, transformers, vector, vector-binary-instances +, zlib, fetchFromGitHub +}: +mkDerivation { + pname = "futhark"; + version = "0.6.2"; + src = fetchFromGitHub { + owner = "diku-dk"; + repo = "futhark"; + rev = "v0.6.2"; + sha256 = "0yj7n01swpvqblybdnks3mjf0mzf1gdg2b2cpxdpxnrjw5j0pnq2"; + }; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + array base bifunctors binary blaze-html bytestring containers + data-binary-ieee754 directory directory-tree dlist extra file-embed + filepath gitrev language-c-quote mainland-pretty markdown mtl + neat-interpolation parallel parsec process raw-strings-qq + regex-tdfa srcloc template-haskell text th-lift-instances + transformers vector vector-binary-instances zlib + ]; + libraryToolDepends = [ alex happy hpack ]; + executableHaskellDepends = [ + array base bifunctors binary blaze-html bytestring containers + data-binary-ieee754 directory directory-tree dlist extra file-embed + filepath gitrev haskeline json language-c-quote mainland-pretty + markdown mtl neat-interpolation parallel parsec process + process-extras random raw-strings-qq regex-tdfa srcloc + template-haskell temporary text th-lift-instances transformers + vector vector-binary-instances zlib + ]; + testHaskellDepends = [ + array base bifunctors binary blaze-html bytestring containers + data-binary-ieee754 directory directory-tree dlist extra file-embed + filepath gitrev HUnit language-c-quote mainland-pretty markdown mtl + neat-interpolation parallel parsec process QuickCheck + raw-strings-qq regex-tdfa srcloc template-haskell test-framework + test-framework-hunit test-framework-quickcheck2 text + th-lift-instances transformers vector vector-binary-instances zlib + ]; + preConfigure = "hpack"; + homepage = "https://futhark-lang.org"; + description = "An optimising compiler for a functional, array-oriented language"; + license = stdenv.lib.licenses.isc; +} diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 8ff6aed506f..447e9cb4227 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -707,6 +707,8 @@ self: super: { # vaultenv is not available from Hackage. vaultenv = self.callPackage ../tools/haskell/vaultenv { }; + futhark = self.callPackage ../compilers/futhark { }; + # https://github.com/Philonous/hs-stun/pull/1 # Remove if a version > 0.1.0.1 ever gets released. stunclient = overrideCabal super.stunclient (drv: { From 0c25079958ac46f7438d2a90e837acf7c69a2ab9 Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Mon, 20 Aug 2018 22:14:32 +0200 Subject: [PATCH 2/5] futhark: introduce the top-level futhark attribute The fact that futhark is a Haskell package is an implementation detail. To install it users should just have to specify `futhark` instead of `haskellPackages.futhark`. Additionally futhark is overridden with `haskell.lib.justStaticExecutables` to reduce closure size. --- .../development/compilers/futhark/default.nix | 77 +++++++++++++------ .../compilers/futhark/unwrapped.nix | 55 ------------- .../haskell-modules/configuration-common.nix | 1 + .../haskell-modules/configuration-nix.nix | 15 ++++ pkgs/tools/audio/mpdsync/default.nix | 24 ++++++ pkgs/top-level/all-packages.nix | 2 + 6 files changed, 96 insertions(+), 78 deletions(-) delete mode 100644 pkgs/development/compilers/futhark/unwrapped.nix create mode 100644 pkgs/tools/audio/mpdsync/default.nix diff --git a/pkgs/development/compilers/futhark/default.nix b/pkgs/development/compilers/futhark/default.nix index 6cabd686b49..890be3431c3 100644 --- a/pkgs/development/compilers/futhark/default.nix +++ b/pkgs/development/compilers/futhark/default.nix @@ -1,24 +1,55 @@ -{ callPackage, symlinkJoin, makeWrapper, stdenv, gcc, opencl-headers, opencl-icd }: - -let - unwrapped = callPackage ./unwrapped.nix {}; - - path = stdenv.lib.makeBinPath [ gcc ]; - - wrapped = symlinkJoin { - name = "futhark-wrapped"; - buildInputs = [ makeWrapper ]; - paths = [ unwrapped ]; - postBuild = '' - wrapProgram $out/bin/futhark-c \ - --prefix PATH : "${path}" - - wrapProgram $out/bin/futhark-opencl \ - --prefix PATH : "${path}" \ - --set NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST 1 \ - --set NIX_CFLAGS_COMPILE "-I${opencl-headers}/include" \ - --set NIX_CFLAGS_LINK "-L${opencl-icd}/lib" - ''; +# Generated using `cabal2nix --hpack .`, then replace src +{ mkDerivation, alex, array, base, bifunctors, binary, blaze-html +, bytestring, containers, data-binary-ieee754, directory +, directory-tree, dlist, extra, file-embed, filepath, gitrev, happy +, haskeline, hpack, HUnit, json, language-c-quote, mainland-pretty +, markdown, mtl, neat-interpolation, parallel, parsec, process +, process-extras, QuickCheck, random, raw-strings-qq, regex-tdfa +, srcloc, stdenv, template-haskell, temporary, test-framework +, test-framework-hunit, test-framework-quickcheck2, text +, th-lift-instances, transformers, vector, vector-binary-instances +, zlib, fetchFromGitHub +}: +mkDerivation { + pname = "futhark"; + version = "0.6.2"; + src = fetchFromGitHub { + owner = "diku-dk"; + repo = "futhark"; + rev = "v0.6.2"; + sha256 = "0yj7n01swpvqblybdnks3mjf0mzf1gdg2b2cpxdpxnrjw5j0pnq2"; }; - -in wrapped + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + array base bifunctors binary blaze-html bytestring containers + data-binary-ieee754 directory directory-tree dlist extra file-embed + filepath gitrev language-c-quote mainland-pretty markdown mtl + neat-interpolation parallel parsec process raw-strings-qq + regex-tdfa srcloc template-haskell text th-lift-instances + transformers vector vector-binary-instances zlib + ]; + libraryToolDepends = [ alex happy hpack ]; + executableHaskellDepends = [ + array base bifunctors binary blaze-html bytestring containers + data-binary-ieee754 directory directory-tree dlist extra file-embed + filepath gitrev haskeline json language-c-quote mainland-pretty + markdown mtl neat-interpolation parallel parsec process + process-extras random raw-strings-qq regex-tdfa srcloc + template-haskell temporary text th-lift-instances transformers + vector vector-binary-instances zlib + ]; + testHaskellDepends = [ + array base bifunctors binary blaze-html bytestring containers + data-binary-ieee754 directory directory-tree dlist extra file-embed + filepath gitrev HUnit language-c-quote mainland-pretty markdown mtl + neat-interpolation parallel parsec process QuickCheck + raw-strings-qq regex-tdfa srcloc template-haskell test-framework + test-framework-hunit test-framework-quickcheck2 text + th-lift-instances transformers vector vector-binary-instances zlib + ]; + preConfigure = "hpack"; + homepage = "https://futhark-lang.org"; + description = "An optimising compiler for a functional, array-oriented language"; + license = stdenv.lib.licenses.isc; +} diff --git a/pkgs/development/compilers/futhark/unwrapped.nix b/pkgs/development/compilers/futhark/unwrapped.nix deleted file mode 100644 index 890be3431c3..00000000000 --- a/pkgs/development/compilers/futhark/unwrapped.nix +++ /dev/null @@ -1,55 +0,0 @@ -# Generated using `cabal2nix --hpack .`, then replace src -{ mkDerivation, alex, array, base, bifunctors, binary, blaze-html -, bytestring, containers, data-binary-ieee754, directory -, directory-tree, dlist, extra, file-embed, filepath, gitrev, happy -, haskeline, hpack, HUnit, json, language-c-quote, mainland-pretty -, markdown, mtl, neat-interpolation, parallel, parsec, process -, process-extras, QuickCheck, random, raw-strings-qq, regex-tdfa -, srcloc, stdenv, template-haskell, temporary, test-framework -, test-framework-hunit, test-framework-quickcheck2, text -, th-lift-instances, transformers, vector, vector-binary-instances -, zlib, fetchFromGitHub -}: -mkDerivation { - pname = "futhark"; - version = "0.6.2"; - src = fetchFromGitHub { - owner = "diku-dk"; - repo = "futhark"; - rev = "v0.6.2"; - sha256 = "0yj7n01swpvqblybdnks3mjf0mzf1gdg2b2cpxdpxnrjw5j0pnq2"; - }; - isLibrary = true; - isExecutable = true; - libraryHaskellDepends = [ - array base bifunctors binary blaze-html bytestring containers - data-binary-ieee754 directory directory-tree dlist extra file-embed - filepath gitrev language-c-quote mainland-pretty markdown mtl - neat-interpolation parallel parsec process raw-strings-qq - regex-tdfa srcloc template-haskell text th-lift-instances - transformers vector vector-binary-instances zlib - ]; - libraryToolDepends = [ alex happy hpack ]; - executableHaskellDepends = [ - array base bifunctors binary blaze-html bytestring containers - data-binary-ieee754 directory directory-tree dlist extra file-embed - filepath gitrev haskeline json language-c-quote mainland-pretty - markdown mtl neat-interpolation parallel parsec process - process-extras random raw-strings-qq regex-tdfa srcloc - template-haskell temporary text th-lift-instances transformers - vector vector-binary-instances zlib - ]; - testHaskellDepends = [ - array base bifunctors binary blaze-html bytestring containers - data-binary-ieee754 directory directory-tree dlist extra file-embed - filepath gitrev HUnit language-c-quote mainland-pretty markdown mtl - neat-interpolation parallel parsec process QuickCheck - raw-strings-qq regex-tdfa srcloc template-haskell test-framework - test-framework-hunit test-framework-quickcheck2 text - th-lift-instances transformers vector vector-binary-instances zlib - ]; - preConfigure = "hpack"; - homepage = "https://futhark-lang.org"; - description = "An optimising compiler for a functional, array-oriented language"; - license = stdenv.lib.licenses.isc; -} diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 447e9cb4227..46e104e3472 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -707,6 +707,7 @@ self: super: { # vaultenv is not available from Hackage. vaultenv = self.callPackage ../tools/haskell/vaultenv { }; + # futhark is not available from Hackage. futhark = self.callPackage ../compilers/futhark { }; # https://github.com/Philonous/hs-stun/pull/1 diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index bb9b0e5d5fe..523f4ed0212 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -528,4 +528,19 @@ self: super: builtins.intersectAttrs super { # The test-suite requires a running PostgreSQL server. Frames-beam = dontCheck super.Frames-beam; + + futhark = with pkgs; + let path = stdenv.lib.makeBinPath [ gcc ]; + in overrideCabal (addBuildTool super.futhark makeWrapper) (_drv: { + postInstall = '' + wrapProgram $out/bin/futhark-c \ + --prefix PATH : "${path}" + + wrapProgram $out/bin/futhark-opencl \ + --prefix PATH : "${path}" \ + --set NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST 1 \ + --set NIX_CFLAGS_COMPILE "-I${opencl-headers}/include" \ + --set NIX_CFLAGS_LINK "-L${opencl-icd}/lib" + ''; + }); } diff --git a/pkgs/tools/audio/mpdsync/default.nix b/pkgs/tools/audio/mpdsync/default.nix new file mode 100644 index 00000000000..51f5ba65616 --- /dev/null +++ b/pkgs/tools/audio/mpdsync/default.nix @@ -0,0 +1,24 @@ +{ stdenv, python2, fetchFromGitHub }: +with python2.pkgs; +stdenv.mkDerivation { + name = "mpdsync-2017-06-15"; + + src = fetchFromGitHub { + owner = "alphapapa"; + repo = "mpdsync"; + rev = "da90058f44dd9578cc5f2fb96a1fb2b26da40d07"; + sha256 = "1mfg3ipqj5dvyyqbgp6ia6sc1ja5gmm2c9mfrwx0jw2dl182if6q"; + }; + + pythonPath = [ mpd2 ]; + + nativeBuildInputs = [ + wrapPython + ]; + + dontBuild = true; + + installPhase = "install -D mpdsync.py $out/bin/mpdsync"; + postFixup = "wrapPythonPrograms"; + +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a31834b053a..eb6e1505db9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1336,6 +1336,8 @@ with pkgs; fsmark = callPackage ../tools/misc/fsmark { }; + futhark = haskell.lib.justStaticExecutables haskellPackages.futhark; + fwup = callPackage ../tools/misc/fwup { }; fzf = callPackage ../tools/misc/fzf { }; From 7b49b870cb2326b998e90818a22055fd6e52959d Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Sat, 25 Aug 2018 15:24:41 +0200 Subject: [PATCH 3/5] haskell: have a dedicated file for non Hackage packages We had a few "overrides" in configuration-common.nix that were really extensions. They introduced packages that weren't in hackage-packages.nix. The advantage of having a dedicated file for these packages is that we can still place Nix-specific overrides to these packages in configuration-nix.nix. We weren't able do this before because configuration-nix.nix extended only the packages from hackage-packages.nix. --- .../haskell-modules/configuration-common.nix | 9 --------- pkgs/development/haskell-modules/default.nix | 5 ++++- .../haskell-modules/non-hackage-packages.nix | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 pkgs/development/haskell-modules/non-hackage-packages.nix diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 46e104e3472..15bd1507cc9 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -704,12 +704,6 @@ self: super: { then appendConfigureFlag super.gtk "-fhave-quartz-gtk" else super.gtk; - # vaultenv is not available from Hackage. - vaultenv = self.callPackage ../tools/haskell/vaultenv { }; - - # futhark is not available from Hackage. - futhark = self.callPackage ../compilers/futhark { }; - # https://github.com/Philonous/hs-stun/pull/1 # Remove if a version > 0.1.0.1 ever gets released. stunclient = overrideCabal super.stunclient (drv: { @@ -950,9 +944,6 @@ self: super: { # Tries to read a file it is not allowed to in the test suite load-env = dontCheck super.load-env; - # Add support for https://github.com/haskell-hvr/multi-ghc-travis. - multi-ghc-travis = self.callPackage ../tools/haskell/multi-ghc-travis {}; - # https://github.com/yesodweb/Shelly.hs/issues/162 shelly = dontCheck super.shelly; diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix index b8943a55394..a4f0399cf3c 100644 --- a/pkgs/development/haskell-modules/default.nix +++ b/pkgs/development/haskell-modules/default.nix @@ -4,6 +4,7 @@ , packageSetConfig ? (self: super: {}) , overrides ? (self: super: {}) , initialPackages ? import ./initial-packages.nix +, nonHackagePackages ? import ./non-hackage-packages.nix , configurationCommon ? import ./configuration-common.nix , configurationNix ? import ./configuration-nix.nix }: @@ -26,7 +27,9 @@ let (extends packageSetConfig (extends compilerConfig (extends commonConfiguration - (extends nixConfiguration haskellPackages))))); + (extends nixConfiguration + (extends nonHackagePackages + haskellPackages)))))); in diff --git a/pkgs/development/haskell-modules/non-hackage-packages.nix b/pkgs/development/haskell-modules/non-hackage-packages.nix new file mode 100644 index 00000000000..642c6bff6b5 --- /dev/null +++ b/pkgs/development/haskell-modules/non-hackage-packages.nix @@ -0,0 +1,14 @@ +# EXTRA HASKELL PACKAGES NOT ON HACKAGE +# +# This file should only contain packages that are not in ./hackage-packages.nix. +# Attributes in this set should be nothing more than a callPackage call. +# Overrides to these packages should go to either configuration-nix.nix, +# configuration-common.nix or to one of the compiler specific configuration +# files. +self: super: { + multi-ghc-travis = self.callPackage ../tools/haskell/multi-ghc-travis { }; + + vaultenv = self.callPackage ../tools/haskell/vaultenv { }; + + futhark = self.callPackage ../compilers/futhark { }; +} From b64193f69bb1dbadb9ff44cefb990d48d2a5d198 Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Sat, 25 Aug 2018 15:54:17 +0200 Subject: [PATCH 4/5] haskellPackages.multi-ghc-travis: removed in favour of haskell-ci multi-ghc-travis has been renamed to haskell-ci which is now also on Hackage. --- pkgs/development/haskell-modules/non-hackage-packages.nix | 4 +++- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pkgs/development/haskell-modules/non-hackage-packages.nix b/pkgs/development/haskell-modules/non-hackage-packages.nix index 642c6bff6b5..6b8477b524b 100644 --- a/pkgs/development/haskell-modules/non-hackage-packages.nix +++ b/pkgs/development/haskell-modules/non-hackage-packages.nix @@ -6,7 +6,9 @@ # configuration-common.nix or to one of the compiler specific configuration # files. self: super: { - multi-ghc-travis = self.callPackage ../tools/haskell/multi-ghc-travis { }; + + multi-ghc-travis = throw ("haskellPackages.multi-ghc-travis has been renamed" + + "to haskell-ci, which is now on hackage"); vaultenv = self.callPackage ../tools/haskell/vaultenv { }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index eb6e1505db9..88fe95c4196 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8602,7 +8602,7 @@ with pkgs; msitools = callPackage ../development/tools/misc/msitools { }; - multi-ghc-travis = haskell.lib.justStaticExecutables haskellPackages.multi-ghc-travis; + haskell-ci = haskell.lib.justStaticExecutables haskellPackages.haskell-ci; neoload = callPackage ../development/tools/neoload { licenseAccepted = (config.neoload.accept_license or false); From 5ea9d9d097222cd0aa7ed9ff3ceaa9cd81a3e8cf Mon Sep 17 00:00:00 2001 From: Bas van Dijk Date: Sat, 25 Aug 2018 15:54:30 +0200 Subject: [PATCH 5/5] haskell: add GitHub issues to non-hackage-packages.nix --- pkgs/development/haskell-modules/non-hackage-packages.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/haskell-modules/non-hackage-packages.nix b/pkgs/development/haskell-modules/non-hackage-packages.nix index 6b8477b524b..68fcbdb79a5 100644 --- a/pkgs/development/haskell-modules/non-hackage-packages.nix +++ b/pkgs/development/haskell-modules/non-hackage-packages.nix @@ -10,7 +10,9 @@ self: super: { multi-ghc-travis = throw ("haskellPackages.multi-ghc-travis has been renamed" + "to haskell-ci, which is now on hackage"); + # https://github.com/channable/vaultenv/issues/1 vaultenv = self.callPackage ../tools/haskell/vaultenv { }; + # https://github.com/diku-dk/futhark/issues/614 futhark = self.callPackage ../compilers/futhark { }; }