nh2 / static-haskell-nix

easily build most Haskell programs into fully static Linux executables
388 stars 36 forks source link

static-stack: Pin nixpkgs version in stack2nix invocation #19

Closed nh2 closed 5 years ago

nh2 commented 5 years ago

In https://github.com/nh2/static-haskell-nix/blob/b766284b83945bea3ce4468fa3686419ded6a1e0/static-stack/default.nix#L62

I don't pin the nixpkgs version.

This means stack2nix will use whatever you have as <nixpkgs> right now for looking up what compilers exist, reducing reproducibility.

I should do e.g.

  nixpkgsUrl = https://github.com/NixOS/nixpkgs/archive/88ae8f7d55efa457c95187011eb410d097108445.tar.gz;

  normalPkgs = import (fetchTarball nixpkgsUrl) {};

and then

      export NIX_PATH=nixpkgs=${nixpkgsUrl}
      PATH=${pkgs.cabal-install}/bin:${normalPkgs.nix}/bin:$PATH ${stack2nix}/bin/stack2nix -o ops.nix $@
nh2 commented 5 years ago

This was fixed with commit 725ceb247963 that switched static-stack to static-stack2nix-builder, which does nixpkgs pinning in https://github.com/nh2/static-haskell-nix/blob/725ceb2479637b3b3ab29298a1bc0e48c54984c9/static-stack2nix-builder/default.nix#L58