Gabriella439 / nix-diff

Explain why two Nix derivations differ
BSD 3-Clause "New" or "Revised" License
357 stars 19 forks source link

Configuration setup issue when trying to build #11

Closed binaryphile closed 12 months ago

binaryphile commented 6 years ago

When trying to install on nix-1.11.16 or nix-2.0.1 I get the following error for nix-diff:

Configuring nix-diff-1.0.1...
CallStack (from HasCallStack):
  die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:948:20 in Cabal-2.0.1.0:Distribution.Simple.Configure
  configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:470:12 in Cabal-2.0.1.0:Distribution.Simple.Configure
  configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:570:20 in Cabal-2.0.1.0:Distribution.Simple
  confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:67:5 in Cabal-2.0.1.0:Distribution.Simple.UserHooks
  configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:174:19 in Cabal-2.0.1.0:Distribution.Simple
  defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:119:27 in Cabal-2.0.1.0:Distribution.Simple
  defaultMain, called at Setup.hs:2:8 in main:Main
Setup: Encountered missing dependencies:
optparse-generic >=1.1 && <1.3

Don't know if there's a solution but I figured I'd let you know.

Gabriella439 commented 6 years ago

@binaryphile: In this case installing a newer version of nix-diff (1.0.3 is the latest version), will resolve this issue.

If you use the latest release of the nixpkgs-unstable channel then it already defaults to picking nix-diff-1.0.3. If that's not an option (i.e. you prefer to use the stable nixos-18.03 channel or an older stable channel) then that defaults to nix-diff-1.0.1, which means that you will need to override that to select a newer version.

The next option is to open an issue against Nixpkgs asking them if they can upgrade nix-diff to a newer version for the 18.03 branch.

If that's not an option, the second thing you can ask them is if they can add a pkgs.haskellPackages.nix-diff_1_0_3 derivation.

If that's still not an option, you can also install a newer version by saving the following Nix expression to a file:

# nix-diff.nix

let
  nix-diff =
    { mkDerivation, attoparsec, base, containers, Diff, mtl
    , nix-derivation, optparse-generic, stdenv, system-filepath, text
    , unix, vector
    }:
    mkDerivation {
      pname = "nix-diff";
      version = "1.0.3";
      sha256 = "f07cbdcbec4721c0804ed18f6228c800337a62a09fe7264ccb5f7859187e0095";
      isLibrary = false;
      isExecutable = true;
      executableHaskellDepends = [
        attoparsec base containers Diff mtl nix-derivation optparse-generic
        system-filepath text unix vector
      ];
      homepage = "https://github.com/Gabriel439/nix-diff";
      description = "Explain why two Nix derivations differ";
      license = stdenv.lib.licenses.bsd3;
    };

  config = {
    packageOverrides = pkgs: {
      haskellPackages = pkgs.haskellPackages.override {
        overrides = haskellPackagesNew: haskellPackagesOld: {
          nix-diff = haskellPackagesNew.callPackage nix-diff { };
        };
      };
    };
  };

  pkgs = import <nixpkgs> { inherit config; };

in
  pkgs.haskellPackages.nix-diff

... and then running (for nix-1.*)

$ nix-env --install --file nix-diff.nix

I haven't used Nix 2.0 yet so I'm not sure what the equivalent idiomatic command would be for that but from reading the manual it looks like nix-env is still supported

binaryphile commented 6 years ago

Thanks for spelling out all of the options, that's going above and beyond.

I'll update my nixpkgs and see what happens.

Gabriella439 commented 6 years ago

You're welcome! 🙂

sorki commented 12 months ago

I think this can be closed safely :smile: