tools for building gleam projects with nix
1# SPDX-FileCopyrightText: 2025 Ruby Iris Juric <ruby@srxl.me>
2#
3# SPDX-License-Identifier: 0BSD
4
5{
6 stdenv,
7 lib,
8
9 nodejs,
10 pnpm,
11}:
12
13let
14 fs = lib.fileset;
15 sources = fs.intersection (fs.gitTracked ../docs) (
16 fs.unions [
17 ../docs/astro.config.mjs
18 ../docs/package.json
19 ../docs/pnpm-lock.yaml
20 ../docs/src
21 ../docs/tsconfig.json
22 ]
23 );
24 src = fs.toSource {
25 root = ../docs;
26 fileset = sources;
27 };
28in
29
30stdenv.mkDerivation rec {
31 pname = "gleam2nix-docs";
32 version = "0.1.0";
33
34 inherit src;
35
36 pnpmDeps = pnpm.fetchDeps {
37 inherit pname version src;
38 fetcherVersion = 2;
39 hash = "sha256-1QBuT8E7acKsEQDv444UYyt2K7KXysMTDXYPc4II4rM=";
40 };
41
42 nativeBuildInputs = [
43 nodejs
44 pnpm.configHook
45 ];
46
47 buildPhase = ''
48 pnpm build
49 '';
50
51 installPhase = ''
52 cp -r dist $out
53 '';
54}