Skip to content

Commit

Permalink
run bootstrap commands with cache
Browse files Browse the repository at this point in the history
  • Loading branch information
tek committed Jul 29, 2023
1 parent 0af45c1 commit 5193e8f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
7 changes: 7 additions & 0 deletions lib/with-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ let
${pkgs.git}/bin/git add flake.lock
'';

cacheWrapper = self: name: app: pkgs.writeScript name ''
${config.pkgs.nix}/bin/nix --option extra-substituters 'https://tek.cachix.org' \
--option extra-trusted-public-keys 'tek.cachix.org-1:+sdc73WFq8aEKnrVv5j/kuhmnW2hQJuqdPJF5SnaCBk=' \
run ${self}:${app} -- $@
'';

envSystemAllowed = env:
env.systems == null || (elem config.system env.systems);

Expand All @@ -149,6 +155,7 @@ in basic // {
downloadStaticCli
bootstrapWithStaticCli
bootstrapWithDynamicCli
cacheWrapper
envSystemAllowed
;
}
22 changes: 18 additions & 4 deletions local.nix
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ hix.pro ({config, lib, ...}: {
program = "${config.outputs.packages.hix}/bin/hix";
};

new = let
prog = util.bootstrapWithDynamicCli "hix-new" ''
new-nocache = let
prog = util.bootstrapWithDynamicCli "hix-new-nocache" ''
$exe new --hix-url '${config.internal.hixUrl}' "$@"
nix run .#gen-cabal
'';
Expand All @@ -116,8 +116,15 @@ hix.pro ({config, lib, ...}: {
program = "${prog}";
};

bootstrap = let
prog = util.bootstrapWithDynamicCli "hix-bootstrap" ''
new = let
prog = util.cacheWrapper inputs.self "hix-new" "new-nocache";
in {
type = "app";
program = "${prog}";
};

bootstrap-nocache = let
prog = util.bootstrapWithDynamicCli "hix-bootstrap-nocache" ''
$exe bootstrap --hix-url '${config.internal.hixUrl}' "$@"
nix run .#gen-cabal
'';
Expand All @@ -126,6 +133,13 @@ hix.pro ({config, lib, ...}: {
program = "${prog}";
};

bootstrap = let
prog = util.cacheWrapper inputs.self "hix-bootstrap" "bootstrap-nocache";
in {
type = "app";
program = "${prog}";
};

release-nix = let
release = import ./lib/release.nix { inherit config lib util; };
in {
Expand Down

0 comments on commit 5193e8f

Please sign in to comment.