Skip to content

Commit c6cbbee

Browse files
committed
Merge branch 'support-yarn'
2 parents ffe5d4f + 06ffd2a commit c6cbbee

File tree

13 files changed

+484
-142
lines changed

13 files changed

+484
-142
lines changed

flake.nix

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@
1717
system:
1818
let
1919
nixpkgs = import pkgs { inherit system; };
20+
yarn-v1 = nixpkgs.writeShellApplication {
21+
name = "yarn-v1";
22+
checkPhase = "";
23+
runtimeInputs = [ nixpkgs.yarn ];
24+
text = "yarn $@";
25+
};
26+
yarn-berry = nixpkgs.writeShellApplication {
27+
name = "yarn-berry";
28+
checkPhase = "";
29+
runtimeInputs = [ nixpkgs.yarn-berry ];
30+
text = "yarn $@";
31+
};
2032
treefmt = treefmt-nix.lib.evalModule nixpkgs {
2133
# nixfmt is nixfmt-rfc-style
2234
programs.nixfmt.enable = true;
@@ -26,7 +38,12 @@
2638
formatter = treefmt.config.build.wrapper;
2739
checks =
2840
(nixpkgs.callPackages ./tests.nix {
29-
inherit prisma-factory nixpkgs; # nixpkgs can be removed once it is renamed to pkgs
41+
inherit
42+
prisma-factory
43+
nixpkgs
44+
yarn-v1
45+
yarn-berry
46+
;
3047
})
3148
// {
3249
format = treefmt.config.build.check self;
@@ -52,6 +69,8 @@
5269
nixpkgs.stdenv.cc.cc.lib
5370
prisma.package
5471
nixpkgs.nixfmt-rfc-style
72+
yarn-v1
73+
yarn-berry
5574
];
5675
shellHook = prisma.shellHook;
5776
};

lib/readYAML.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# converts path to yaml file -> Nix Object
2+
{ runCommand, remarshal }:
3+
path:
4+
let
5+
jsonOutputDrv = runCommand "from-yaml" {
6+
nativeBuildInputs = [ remarshal ];
7+
} "remarshal -if yaml -i \"${path}\" -of json -o \"$out\"";
8+
in
9+
# perf: importing from / reading a file in a derivation (IFD: Import From Derivation) is known to be slow.
10+
builtins.fromJSON (builtins.readFile jsonOutputDrv)

0 commit comments

Comments
 (0)