nh2 / static-haskell-nix

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

add message to CI that shows what version of nixpkgs is being used to build #71

Closed cdepillabout closed 4 years ago

cdepillabout commented 4 years ago

I wanted to try to figure out what version (commit) of nixpkgs was used to build https://buildkite.com/nh2/static-haskell-nix/builds/203.

However, it appears that the version is just whatever is the latest version on the channel:

https://github.com/nh2/static-haskell-nix/blob/7699f2f7a465bfadadbfdd3e86ee8b1b0132ed76/nixpkgs.nix#L5

It would be great if this version was output in the buildkite log somehow, so that I could try to reproduce this build locally.

I'm not sure what would be the best way to output the commit. Maybe a builtins.trace message in the nixpkgs.nix file? That should show up in the buildkite log.

nh2 commented 4 years ago

I'm not sure actually, I wondered how to get that info as well!

nh2 commented 4 years ago

Equally relevant: https://buildkite.com/nh2/static-haskell-nix/builds/204

Where nixpkgs master broke the build, and it's not clear which master commit it is.

nh2 commented 4 years ago

Where nixpkgs master broke the build

Correction: It was actually nixos-unstable that we use, and that build break is fixed by https://github.com/NixOS/nixpkgs/pull/76073.

However, master is also broken, due to https://github.com/NixOS/nixpkgs/issues/74904, with my fix https://github.com/NixOS/nixpkgs/issues/75676 still having open questions.

cdepillabout commented 4 years ago

@nh2 I thought about this a little more. Maybe a simple patch like this would suffice?

diff --git a/nixpkgs.nix b/nixpkgs.nix
index cfafb35..9f2a9fe 100644
--- a/nixpkgs.nix
+++ b/nixpkgs.nix
@@ -2,7 +2,12 @@
 # We use that for scheduled builds tracking nixpkgs unstable on CI.
 # Of course that is NOT reproducible.
 if builtins.getEnv "STATIC_HASKELL_NIX_CI_NIXPKGS_UNSTABLE_BUILD" == "1"
-  then import (fetchTarball https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz) {}
+  then
+    let
+      nixpkgs =
+        import (fetchTarball https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz) {};
+      msg = "Using version ${nixpkgs.lib.version} of nixpkgs-unstable channel.";
+    in builtins.trace msg nixpkgs
   else
     # If a `./nixpkgs` submodule exists, use that.
     # Note that this will take precedence over setting NIX_PATH!
nh2 commented 4 years ago

I'll be on holiday until the 7th, can look at this again after that time!

nh2 commented 4 years ago

PR: #77