-
Notifications
You must be signed in to change notification settings - Fork 7
/
flake.nix
23 lines (23 loc) · 818 Bytes
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
(flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
pkgJson = pkgs.lib.importJSON ./package.json;
# Build package with yarn
# (then fix up shebangs for nix-friendliness)
jsExe = pkgs.mkYarnPackage {
src = ./.;
buildPhase = ''
yarn --offline build
chmod +x deps/${pkgJson.name}/dist/${pkgJson.name}.js
patchShebangs --host deps/${pkgJson.name}/dist/
'';
};
in {
# What 'nix build' builds by default, and what 'nix shell' puts into PATH
packages.default = jsExe;
}
));
}