Merge pull request #607 from Anton-Latukha/upd-defaultNix-03

default.nix: follow local default <nixpkgs> by default, allow {optional,rolling} `rev`
This commit is contained in:
Anton Latukha 2020-06-01 22:18:40 +03:00 committed by GitHub
commit c090af1a6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 11 deletions

View File

@ -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 <name> - uploads binaries, runs&works only in the branches of the main repository, so for PRs - else case runs

View File

@ -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 <nixpkgs> {}
// {
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
}: