[Nix-dev] How to version-bump haskell package in nix-shell?

Alex Berg chexxor at gmail.com
Sun Dec 14 09:31:22 CET 2014


I have a shell.nix file to give me a shell which has PureScript in it. I
sometimes want to version-bump that. How do I do that? I pasted my
shell.nix file at the bottom of this message, which includes a few attempts
at doing this.

I see that boothead is doing what I want in his shell.nix [1], but not in
the way I want to do it. He is redefining the *entire* package in a local
file, but I want to just edit the "version" and "sha256" attributes of the
central nix expression.

The "Modifying Packages" wiki page [2] says we can use an "override"
attribute to add custom values to attributes, which sounds like exactly
what I want to do. However, all the examples I see, including the "Haskell"
wiki page [3], teach us to redefine the entire package in a local file.
Surely we are also able to use the "override" attribute here, can't we? The
"override" technique seems so much simpler and needs less boilerplate.

I did some source-code reading, which isn't fun, and I found a function
called "makeOverridable" [4]. If we add that function to the cabal builder
here [5], will this allow us to use this "override" technique?

If I add "stdenv.lib.makeOverridable" here, will I be able to do
"haskellPackages.somePackage.override { version = "1.2.4" }" ?

[1] https://github.com/boothead/purescript-nix/blob/master/shell.nix
[2]
https://nixos.org/wiki/Nix_Modifying_Packages#Overriding_Existing_Packages
[3]
https://nixos.org/wiki/Haskell#Maintaining_your_own_set_of_additional_Haskell_packages
[4]
https://github.com/NixOS/nixpkgs/blob/492dd14e78aebea0722dcb6becb2d6601ad51dc8/lib/customisation.nix
[5]
https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/cabal/default.nix#L312


----- shell.nix -----

{ }:

with import <nixpkgs> {};

#let purescript = pkgs.stdenv.lib.overrideDerivation
pkgs.haskellPackages.purescript ( oldAttrs : {
#       src = {
#               version = "0.6.2";
#               sha256 = "";
#       };
#});
let purescript = pkgs.haskellPackages.purescript.override {
        version = "0.6.2";
        sha256 = "";
};
#let haskellPackages = pkgs.haskellPackages.override {
#       extension = self: super: {
#               #purescript = self.callPackage ./purescript.nix {
#               purescript = self.purescript.override {
#                       version = "0.6.2";
#                       sha256 = "";
#                };
#       };
#};
in rec {
        pursEnv = stdenv.mkDerivation rec {
                name = "purescript-env";
                version = "1.1.1.1";
                src = ./.;
                buildInputs = [
                        #haskellPackages.purescript
                        purescript
                        pkgs.nodePackages.grunt-cli
                        pkgs.nodePackages.bower
                        git
                        which
                        vim
                        tree
                        ];
                shellHook =
  ''
    echo "Patching NODE_PATH"
    export
NODE_PATH=$NODE_PATH:/nix/store/hhpwgi9k2j3c0r4q6rn0l0cf1r8vf98q-node-es5-ext-0.10.4/lib/node_modules
  '';
        };
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20141214/a8b18470/attachment.html 


More information about the nix-dev mailing list