Basic override for haskell package not working

New to nix. I’m trying to move my haskell project tinytools over to use nix. I have the following release.nix file

  nixpkgs = import <nixpkgs> {}; 
  compiler = "ghc96";
  mypkgs = nixpkgs.pkgs.haskell.packages.${compiler}.override {
    overrides = self: super: {
        reflex-test-host = nixpkgs.pkgs.haskellPackages.callHackageDirect {
            pkg = "reflex-test-host";
            ver = "";
            sha256 = "9ee3ad9ac4fc58c6dcabcd9fbc6d109a51d8e86ba2682cee8367bc6b452f09ea";
          } {};
        reflex-vty = nixpkgs.pkgs.haskellPackages.callHackageDirect {
            pkg = "reflex-vty";
            ver = "";
            sha256 = "ff25d77e771a08214f7e4e699fc31e16a6406bce51d3f35515430b882caafebd";
          } {};
        tinytools = nixpkgs.pkgs.haskellPackages.callHackageDirect {
            pkg = "tinytools";
            ver = "";
            sha256 = "ff25d77e771a08214f7e4e699fc31e16a6406bce51d3f35515430b882caafebd";
          } {};

  mypkgs.callCabal2nix "tinytools-vty" (./.) { }

However, nix doesn’t seem to be fetching the overrides. Specifically, nix tries to build reflex-test-host- (as opposed to the override version which will fail. I’m pretty sure it’s also not pulling the other dependencies listed as the hash for tinytools is incorrect and it did not complain about it.

I’ve tried a half dozen other slight variations thereof and continue running into the same issue. I don’t understand what I’m doing wrong. I’m following the guide here

Anyone know how I might get this working?

Thanks in advance!


no matter what version I set for reflex-test-host in callHackageDirect, it outputs the following:

~/kitchen/faucet/tinytools-vty:potato$ nix-build release.nix
these 3 derivations will be built:

I do not understand why it keeps trying to build
Actually I even tried removing all erefrences to reflex-test-host throughout my entire project and it’s still producing the same output :sweat:

this turned out to be some weird caching related issue where in this case changing the sha256 and/or version field did nothing. I know there’s an issue where if the sha256 matched an older version caused it to use that one but in this case changing the sha256 did nothing. It was super weird. I setup a basically empty release.nix and it was still trying to build reflex-test-host- :.

running nix-collect-garbage fixed the issue.

Your inner calls to nixpkgs.pkgs.haskellPackages.callHackageDirect should instead be self.callHackageDirect, since you specifically want to use callHackageDirect from your overridden package set.

Also, when posting code snippets like this, you should really make sure to pin nixpkgs, otherwise it is more difficult for people to help you.

1 Like