[Nix-dev] [haskell NG] Override package

YCH dontdieych at gmail.com
Mon Feb 16 09:42:04 CET 2015


Hello,

I'm very happily learning Haskell with nix-shell and haskell-ng environment. In
comparison to previous 'haskell', there is no problem at all.

But I've found problem that hdevtools does not see related build-depends
options in cabal file.

https://github.com/bitc/hdevtools/issues/38

So I would try patched hdevtools from fork.

https://github.com/maximkulkin/hdevtools

Cloned, checked out proper branch. What is next step?

I've read quite many document. Wiki, nix pills, ... . But I'm confused about
so many different ways doing similar things. And I'm worried about haskell-ng
specific things. There is already 'haskellngPackages.hdevtools'. So I should
override using ~/hdevtools. I'll attach my current setup information.

Arch Linux
nix-unstable

Thanks.

~~~
$ nix-env -q
cabal-install-1.22.0.0
cabal2nix-2.0
nix-1.8
nox-0.0.1

$ ls -1
cis194.cabal
HW01.hs
HW02.hs
LICENSE
Main.hs
Setup.hs
shell.nix
Test.hs
... snip ...

$ cat cis194.cabal

-- Initial cis194.cabal generated by cabal init.  For further
-- documentation, see http://haskell.org/cabal/users-guide/

name:                cis194
version:             0.1.0.0
-- synopsis:
-- description:
-- license:
license-file:        LICENSE
author:              dontdieych
maintainer:          dontdieych at gmail.com
-- copyright:
-- category:
build-type:          Simple
-- extra-source-files:
cabal-version:       >=1.10

library
  default-language:    Haskell2010
  build-depends:
    base >=4.7 && <4.8
    , MissingH
  exposed-modules:
    HW01
    , HW02

executable cis194
  default-language:    Haskell2010
  main-is:             Main.hs
  -- hs-source-dirs:
  -- other-modules:
  -- other-extensions:
  build-depends:
    base >=4.7 && <4.8

test-suite test
  default-language: Haskell2010
  type: exitcode-stdio-1.0
  main-is: Test.hs
  build-depends:
    base >=4.7 && <4.8
    , tasty
    , tasty-th
    , tasty-quickcheck
    , tasty-rerun
    -- , QuickCheck

$ cat shell.nix   # cabal2nix . --shell > shell.nix

with (import <nixpkgs> {}).pkgs;
let pkg = haskellngPackages.callPackage
            ({ mkDerivation, base, MissingH, QuickCheck, stdenv, tasty
             , tasty-hunit, tasty-quickcheck, tasty-rerun, tasty-th
             }:
             mkDerivation {
               pname = "cis194";
               version = "0.1.0.0";
               src = ./.;
               isLibrary = false;
               isExecutable = true;
               buildDepends = [
                 base MissingH QuickCheck tasty tasty-hunit tasty-quickcheck
                 tasty-rerun tasty-th
               ];
               buildTools = [
                 haskellngPackages.hdevtools # I've added this config.
               ];
               license = stdenv.lib.licenses.unfree;
             }) {};
in
  pkg.env

$ cat ../hdevtools/default.nix # via cabal2nix . > defult.nix

{ mkDerivation, base, Cabal, cmdargs, directory, filepath, ghc
, ghc-paths, network, stdenv, syb, time, transformers, unix
}:
mkDerivation {
  pname = "hdevtools";
  version = "0.1.0.6";
  src = ./.;
  isLibrary = false;
  isExecutable = true;
  buildDepends = [
    base Cabal cmdargs directory filepath ghc ghc-paths network syb
    time transformers unix
  ];
  homepage = "https://github.com/bitc/hdevtools/";
  description = "Persistent GHC powered background server for FAST
haskell development tools";
  license = stdenv.lib.licenses.mit;
}
~~~


More information about the nix-dev mailing list