Skip to content

Commit 3cd9714

Browse files
authored
Merge pull request #106 from MatrixAI/feature-flake-indirect
Indirect package set flake input
2 parents b37aa73 + 3955031 commit 3cd9714

File tree

2 files changed

+48
-151
lines changed

2 files changed

+48
-151
lines changed

flake.lock

Lines changed: 14 additions & 108 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 34 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,45 @@
11
{
22
inputs = {
3-
nixpkgs.url = "github:nixos/nixpkgs";
3+
nixpkgs-matrix = {
4+
type = "indirect";
5+
id = "nixpkgs-matrix";
6+
};
47
flake-utils.url = "github:numtide/flake-utils";
5-
6-
nixpkgs.follows = "nixpkgs-matrix/nixpkgs";
7-
nixpkgs-matrix.url = "github:matrixai/nixpkgs-matrix";
88
};
99

10-
outputs = { nixpkgs, flake-utils, ... }:
10+
outputs = { nixpkgs-matrix, flake-utils, ... }:
1111
flake-utils.lib.eachDefaultSystem (system:
1212
let
13-
pkgs = import nixpkgs {
14-
inherit system;
15-
};
13+
pkgs = nixpkgs-matrix.legacyPackages.${system};
1614

17-
shell = { ci ? false }: with pkgs; mkShell {
18-
nativeBuildInputs = [
19-
nodejs
20-
shellcheck
21-
patchelf
22-
gitAndTools.gh
23-
];
24-
shellHook = ''
25-
echo "Entering $(npm pkg get name)"
26-
set -o allexport
27-
. ./.env
28-
set +o allexport
29-
set -v
30-
${
31-
lib.optionalString ci
32-
''
33-
set -o errexit
34-
set -o nounset
35-
set -o pipefail
36-
shopt -s inherit_errexit
37-
''
38-
}
39-
mkdir --parents "$(pwd)/tmp"
40-
export PATH="$(pwd)/dist/bin:$(npm root)/.bin:$PATH"
41-
npm install --ignore-scripts
42-
if [ -f 'node_modules/@cloudflare/workerd-linux-64/bin/workerd' ]; then
43-
patchelf \
44-
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
45-
node_modules/@cloudflare/workerd-linux-64/bin/workerd
46-
fi
47-
set +v
48-
'';
49-
};
50-
in
51-
{
15+
shell = { ci ? false }:
16+
with pkgs;
17+
mkShell {
18+
nativeBuildInputs = [ nodejs shellcheck patchelf gitAndTools.gh ];
19+
shellHook = ''
20+
echo "Entering $(npm pkg get name)"
21+
set -o allexport
22+
. ./.env
23+
set +o allexport
24+
set -v
25+
${lib.optionalString ci ''
26+
set -o errexit
27+
set -o nounset
28+
set -o pipefail
29+
shopt -s inherit_errexit
30+
''}
31+
mkdir --parents "$(pwd)/tmp"
32+
export PATH="$(pwd)/dist/bin:$(npm root)/.bin:$PATH"
33+
npm install --ignore-scripts
34+
if [ -f 'node_modules/@cloudflare/workerd-linux-64/bin/workerd' ]; then
35+
patchelf \
36+
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
37+
node_modules/@cloudflare/workerd-linux-64/bin/workerd
38+
fi
39+
set +v
40+
'';
41+
};
42+
in {
5243
devShells = {
5344
default = shell { ci = false; };
5445
ci = shell { ci = true; };

0 commit comments

Comments
 (0)