I'll be curious as to what the offical answer is, but in the meantime the
following somewhat akward expression appears to work:
haskellPackages.purescript.override (oldargs:
{ cabal = oldargs.cabal.override (oldargs:
{ extension = self: super: (oldargs.extension self super) //
{ version = "0.6.2";
sha256 = "1zf2yyk3rdwk5992fhvqyd7b5w7mkzjcc0iyp75bscnjsggs31k0";
buildDepends = super.buildDepends ++ [
haskellPackages.optparseApplicative ];
};
});
})
Note that 0.6.2 has removed the dependency on cmdtheline and replaced it
with optparseApplicative. Filtering out cmdtheline from
super.buildDepends can be done but it is so akward that I didn't bother.
After all, having extra unused buildDepends isn't so terrible.
If you do go this route you'll probably want to abstract the above with a
helper function that takes a derivation and your set of version, sha256,
etc. overrides and does all this. Maybe call it cabalOverride.
let cabalOverride = drv: newAttrs:
drv.override (oldargs:
{ cabal = oldargs.cabal.override (oldargs:
{ extension = self: super:
(oldargs.extension self super) // (newAttrs self super);
});
});
in cabalOverride haskellPackages.purescript (self: super:
{ version = "0.6.2";
sha256 = "1zf2yyk3rdwk5992fhvqyd7b5w7mkzjcc0iyp75bscnjsggs31k0";
buildDepends = super.buildDepends ++ [
haskellPackages.optparseApplicative ];
})
On Sun, 14 Dec 2014, Alex Berg wrote:
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
'';
};
--
Russell O'Connor <http://r6.ca/>
``All talk about `theft,''' the general counsel of the American Graphophone
Company wrote, ``is the merest claptrap, for there exists no property in
ideas musical, literary or artistic, except as defined by statute.''
_______________________________________________
nix-dev mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-dev