Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Allow multiple flags to be passed as a list in the OCs `enable`, `disable` and `configure`.
* Apply the `buildInputs` OC to `pkgs` when it is a function, as documented.
* Apply package-set and env OCs separately when reading pregenerated overrides.
* Add OC `github` as a convenience wrapper of `source`.

### Environments and toolchain

Expand Down
7 changes: 6 additions & 1 deletion lib/deps/api.nix
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,18 @@ let
else c2n.hackageAt conf.location
;


github = {owner, repo, rev, hash, path ? null}: let
src = config.pkgs.fetchFromGitHub { inherit owner repo rev hash; };
in if path == null then c2n.source.root src else c2n.source.sub src path;

in transformers // {
inherit (c2n) hackageAt source;
inherit self super pkgs;
final = self;
prev = super;
inherit reset transform transform_ noHpack cabalOverrides cabal2nixOverrides cabal2nixArgs revision drv;
inherit hackageConfGen hackageConf hackage;
inherit hackageConfGen hackageConf hackage github;
inherit (spec) option;
hsLib = pkgs.haskell.lib;
inherit hsLibC;
Expand Down
4 changes: 4 additions & 0 deletions lib/release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
sed -i 's/ref=[^"#]\+/ref='"$version/" readme.md examples/*/flake.nix
sed -ri 's/~[[:digit:]]+\.[[:digit:]]+\.tar/~'"''${version%.*}.tar/" readme.md
sed -i 's/hixVersion = ".*"/hixVersion = "'"$version"'"/' modules/basic.nix packages/hix/lib/Hix.hs
sed -i 's/hixRelease = false/hixRelease = true/' modules/basic.nix
sed -i "s/Unreleased/$version/" changelog.md
sed -i '/cliReleaseOverride/ s/false/true/' modules/hix-test.nix
sed -i "s/@since unreleased/@since $version/" packages/**/*.hs
Expand All @@ -145,6 +146,9 @@
ask_abort 'Ready to commit. Continue?'
${git} commit --allow-empty -m "Release $version"
${git} tag -m "Release $version" "$version"
sed -i 's/hixRelease = true/hixRelease = false/' modules/basic.nix
${git} add modules/basic.nix
${git} commit --allow-empty -m "Reset release option"
'';

grepDevCli = "${grep} --files-with-matches 'hixCli\.dev = true'";
Expand Down
5 changes: 0 additions & 5 deletions local.nix
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,6 @@ in {

internal.cabal-extra.default-extensions = ["StrictData"];

internal.hixCli = {
commit = "d14e85f7aee0878665484663e9f95347b7beb80d";
sha256 = "0disvvvvv9wwckvg6ybvjas72vg6p4nhcbcswdpddikxhs1xy9xj";
};

outputs = let

# The test runner does not copy `./test` to the temporary directory.
Expand Down
8 changes: 8 additions & 0 deletions modules/basic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ in {
readOnly = true;
};

hixRelease = mkOption {
description = "Whether this project uses a release version of Hix.";
type = bool;
default = true;
};

hixUrl = mkOption {
description = "The URL to the Hix release tag used by this project.";
type = str;
Expand Down Expand Up @@ -352,6 +358,8 @@ in {

hixVersion = "0.9.1";

hixRelease = false;

};
};
}
43 changes: 25 additions & 18 deletions modules/cli.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@ let
inherit (lib) types;
inherit (util) build;

cliNixpkgs = config.pkgs.fetchzip {
url = "https://github.com/nixos/nixpkgs/archive/a7fc11be66bdfb5cdde611ee5ce381c183da8386.tar.gz";
sha256 = "0h3gvjbrlkvxhbxpy01n603ixv0pjy19n9kf73rdkchdvqcn70j2";
};

package-set = build.package-sets config.internal.hixCli.ghc;

in {
Expand Down Expand Up @@ -40,7 +35,7 @@ in {
default = null;
};

sha256 = lib.mkOption {
hash = lib.mkOption {
description = ''
If `commit` is configured, this is the corresponding source hash.
Initially the empty string, you can add the value after the first build attempt by copying it from the error
Expand Down Expand Up @@ -75,32 +70,44 @@ in {

config.internal.hixCli = {

overrides = {hackage, source, minimal, jailbreak, super, ...}: let
commit = lib.mkIf (!config.internal.hixRelease) (lib.mkDefault "b79cf30e9275ade0b0303fce3dbb772bb1cb59b0");

hash = "sha256-xht1kRRnFOslSiDPgahg0AuXjL84bZINYrXCcVaZjtI=";

overrides = {hackage, source, github, minimal, jailbreak, ...}: let

conf = config.internal.hixCli;

githubSrc = builtins.fetchTarball {
url = "https://github.com/tek/hix/archive/${conf.commit}.tar.gz";
inherit (conf) sha256;
githubArgs = {
owner = "tek";
repo = "hix";
rev = conf.commit;
inherit (conf) hash;
path = "packages/hix";
};

devHix = source.package (if conf.commit == null then ../. else githubSrc) "hix";

prodHix = let
meta = import ../ops/cli-dep.nix;
in jailbreak (hackage meta.version meta.sha256);

useDev = conf.commit != null || conf.dev;
in hackage meta.version meta.sha256;

hix = if useDev then devHix else prodHix;
hix =
if conf.dev
then source.package ../. "hix"
else if conf.commit != null
then github githubArgs
else prodHix
;

in { hix = minimal hix; };
in { hix = jailbreak (minimal hix); };

ghc = {
name = "hix";
compiler = {
nixpkgs = {
source = cliNixpkgs;
source = {
rev = "a7fc11be66bdfb5cdde611ee5ce381c183da8386";
hash = "sha256:0h3gvjbrlkvxhbxpy01n603ixv0pjy19n9kf73rdkchdvqcn70j2";
};
extends = null;
};
source = "ghc912";
Expand Down
1 change: 0 additions & 1 deletion packages/hix/lib/Hix/Managed/Data/ReleaseConfig.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ data ReleaseConfig =
-- | Run Nix flake checks before uploading. Defaults to False; must be explicitly enabled with --check.
check :: Bool,
-- | Merge the release branch back into the initial branch after successful uploads.
-- A temporary release branch is always created. Use --merge to merge it back.
merge :: Bool,
-- | Use the global Cabal configuration file instead of hermetic @/dev/null@.
-- This allows using credentials configured in @~\/.cabal\/config@ but sacrifices reproducibility.
Expand Down