Skip to content

Commit 984c6b0

Browse files
authored
split into consumer flake and dev flake (#33)
1 parent 265e196 commit 984c6b0

File tree

13 files changed

+220
-217
lines changed

13 files changed

+220
-217
lines changed

.envrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
use flake
1+
use flake ./dev

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v5
2323
- uses: cachix/install-nix-action@v31
24-
- run: nix flake check
24+
- run: nix flake check ./dev

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"[nix]": {
3-
"editor.defaultFormatter": "brettm12345.nixfmt-vscode"
3+
"editor.defaultFormatter": "VanCoding.vscode-treefmt-nix"
44
}
55
}

dev/checks.nix

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{
2+
perSystem =
3+
{ pkgs, ... }:
4+
let
5+
prisma-factory = import ../prisma.nix;
6+
yarn-v1 = pkgs.writeShellApplication {
7+
name = "yarn-v1";
8+
checkPhase = "";
9+
runtimeInputs = [ pkgs.yarn ];
10+
text = "yarn $@";
11+
};
12+
yarn-berry = pkgs.writeShellApplication {
13+
name = "yarn-berry";
14+
checkPhase = "";
15+
runtimeInputs = [ pkgs.yarn-berry ];
16+
text = "yarn $@";
17+
};
18+
in
19+
{
20+
checks =
21+
(pkgs.callPackages ../tests.nix {
22+
fetcherMode = "new";
23+
inherit
24+
pkgs
25+
prisma-factory
26+
yarn-v1
27+
yarn-berry
28+
;
29+
})
30+
// (pkgs.callPackages ../tests.nix {
31+
fetcherMode = "legacy";
32+
inherit
33+
pkgs
34+
prisma-factory
35+
yarn-v1
36+
yarn-berry
37+
;
38+
})
39+
// {
40+
fetcher-assert-npm =
41+
let
42+
# force download debian for consistent hash across systems
43+
binaryTargetBySystem = {
44+
x86_64-linux = "debian";
45+
aarch64-linux = "debian";
46+
x86_64-darwin = "debian";
47+
aarch64-darwin = "debian";
48+
};
49+
prisma-legacy = prisma-factory {
50+
inherit pkgs binaryTargetBySystem;
51+
hash = "sha256-R9PG286KQTbzF0r/PPcShUkMiYam2prRh/JICjmhCZA=";
52+
};
53+
prisma-new =
54+
lockName: lockFile:
55+
prisma-factory {
56+
inherit pkgs binaryTargetBySystem;
57+
hash = "sha256-R9PG286KQTbzF0r/PPcShUkMiYam2prRh/JICjmhCZA=";
58+
${lockName} = lockFile;
59+
};
60+
in
61+
assert
62+
(prisma-legacy.fromNpmLock ../npm/package-lock.json).env
63+
== (prisma-new "npmLock" ../npm/package-lock.json).env;
64+
pkgs.hello;
65+
prisma-next =
66+
(prisma-factory {
67+
pkgs = pkgs;
68+
versionString = "6.20.0-16.next-0c19ccc313cf9911a90d99d2ac2eb0280c76c513";
69+
hash =
70+
{
71+
x86_64-linux = "sha256-JWX+N/mmp9uJLcv4XFbQ3yg34fFf2BLIUpOLrrfTjEM=";
72+
x86_64-darwin = "sha256-WNwFOoeDOebbfAh4y/NvZCyE9otaJdg2hHb4ifEFD+Y=";
73+
aarch64-linux = "sha256-f9FuPZaGx0FwKo4pA9f8g82MTcAzYLwWslxjb7oqk6E=";
74+
aarch64-darwin = "sha256-NMI+JcP3epBO3V37D19TDgzivMnPekgrYqUrXB6qNV0=";
75+
}
76+
.${pkgs.system};
77+
}).package;
78+
};
79+
};
80+
}

dev/flake.lock

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

dev/flake.nix

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
4+
flake-parts.url = "github:hercules-ci/flake-parts";
5+
treefmt-nix.url = "github:numtide/treefmt-nix";
6+
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
7+
};
8+
outputs =
9+
inputs:
10+
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
11+
systems = [
12+
"x86_64-linux"
13+
"aarch64-linux"
14+
"x86_64-darwin"
15+
"aarch64-darwin"
16+
];
17+
imports = [
18+
./treefmt.nix
19+
./shell.nix
20+
./checks.nix
21+
];
22+
};
23+
}

dev/shell.nix

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
perSystem =
3+
{ pkgs, config, ... }:
4+
{
5+
devShells.default = pkgs.mkShell {
6+
buildInputs = [
7+
pkgs.nodejs_24
8+
pkgs.pnpm
9+
pkgs.bun
10+
pkgs.stdenv.cc.cc.lib
11+
config.treefmt.build.wrapper
12+
];
13+
};
14+
};
15+
}

dev/treefmt.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{ inputs, ... }:
2+
{
3+
imports = [ inputs.treefmt-nix.flakeModule ];
4+
perSystem.treefmt = {
5+
programs.nixfmt.enable = true;
6+
};
7+
}

flake.lock

Lines changed: 1 addition & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)