diff --git a/build.sh b/build.sh index 41ba821..2909a82 100755 --- a/build.sh +++ b/build.sh @@ -109,8 +109,7 @@ if [ "$GHCVERSION" = "ghcjs" ] --arg buildStackProject "$buildStackProject" \ "$generateOptparseApplicativeCompletion" \ --arg allowInconsistentDependencies "$allowInconsistentDependencies" \ - ghcjs \ - "$@" + ghcjs else @@ -134,14 +133,26 @@ if [ "$GHCVERSION" = "ghcjs" ] --arg disableOptimization "$disableOptimization" \ --arg buildStackProject "$buildStackProject" \ "$generateOptparseApplicativeCompletion" \ - --arg allowInconsistentDependencies "$allowInconsistentDependencies" \ - "$@" + --arg allowInconsistentDependencies "$allowInconsistentDependencies" fi } MAIN() { + +# 2020-06-01: NOTE: Nix installer installs old Nix version that has bugs that prevented importing Nixpks repository channels, updating to latest Nix since it does not have that bug +# NOTE: Overall it is useful to have in CI test builds the latest stable Nix +# NOTE: User-run update for Linux setup +nix upgrade-nix || true +# NOTE: Superuser update for macOS setup +sudo nix upgrade-nix || true + +# NOTE: Make channels current +nix-channel --update || true +sudo nix-channel --update || true + + # NOTE: Secrets are not shared to PRs from forks # NOTE: nix-build | cachix push - uploads binaries, runs&works only in the branches of the main repository, so for PRs - else case runs diff --git a/default.nix b/default.nix index c7846e9..a843da9 100644 --- a/default.nix +++ b/default.nix @@ -29,17 +29,21 @@ , withHoogle ? true -, rev ? "29d57de30101b51b016310ee51c2c4ec762f88db" # 2020-05-23: NOTE: UTC 17:00 -, sha256 ? "1wjljkffb3gzdvpfc4v98mrhzack6k9i7860n8cf5nipyab6jbq9" +, useRev ? false +# Accepts Nixpkgs channel name and Git revision +, rev ? "nixpkgs-unstable" , pkgs ? if builtins.compareVersions builtins.nixVersion "2.0" < 0 then abort "hnix requires at least nix 2.0" - else import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz"; - inherit sha256; }) { - config.allowBroken = true; + else + if useRev + then import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz") {} + # Please not guard with hash, so we able to use current channels (rolling `rev`) of Haskell&Nixpkgs + else import {} + // { + config.allowBroken = true; # config.packageOverrides = pkgs: rec { # nix = pkgs.nixStable.overrideDerivation (attrs: with pkgs; rec { # src = if builtins.pathExists ./data/nix/.version @@ -76,7 +80,7 @@ # outputs = builtins.filter (s: s != "doc" && s != "man" ) attrs.outputs; # }); # }; - } + } , mkDerivation ? null }: