Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
71 lines (68 loc) · 3.05 KB
/
Copy pathflake.nix
File metadata and controls
71 lines (68 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
description = "are-the-types-wrong toolchain — the formatter and runtimes the check chain shells out to";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
comment-checker = {
url = "github:systemfsoftware/comment-checker";
inputs.nixpkgs.follows = "nixpkgs";
};
pnpm-release-management = {
url = "github:systemfsoftware/pnpm-release-management";
inputs.nixpkgs.follows = "nixpkgs";
inputs.comment-checker.follows = "comment-checker";
inputs.importPnpmLock.follows = "importPnpmLock";
};
# Hashless pnpm store: each lockfile integrity is the fetch hash.
# fetchPnpmDeps needs a second store-wide hash that Dependabot cannot update.
importPnpmLock = {
url = "github:Scrumplex/importPnpmLock.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# bwrap-sandboxed dprint on Linux, from the org cache. No nixpkgs follows,
# so the cached build is used rather than rebuilt against this flake's nixpkgs.
dprint.url = "github:systemfsoftware/dprint";
};
outputs = { self, nixpkgs, comment-checker, importPnpmLock, pnpm-release-management, dprint }:
let
systems = [ "x86_64-linux" "aarch64-linux" ];
forEachSystem = fn: nixpkgs.lib.genAttrs systems (system: fn nixpkgs.legacyPackages.${system});
in
{
packages = forEachSystem (pkgs:
let
pkgs' = pkgs.extend importPnpmLock.overlays.default;
cc = comment-checker.packages.${pkgs.system}.comment-checker;
comment-checker-bwrap = pkgs.callPackage ./nix/comment-checker-bwrap.nix { comment-checker = cc; };
attw = pkgs'.callPackage ./nix/attw.nix { };
# `workspace-tarballs` and one `<package>` output per public member.
# The builder requires `packageManager` to pin exactly this pnpm.
workspace = pnpm-release-management.lib.mkPnpmWorkspacePackages {
inherit pkgs;
src = self;
pname = "are-the-types-wrong";
pnpm = pkgs.pnpm_11;
};
in workspace // { inherit attw comment-checker-bwrap; comment-checker = cc; });
# pnpm is not a nixpkgs package here: `packageManager` pins pnpm@11.25.0
# and corepack resolves exactly that version. The shim gives the release
# plan a `pnpm` on PATH (`nix develop` runs this hook). The
# `workspace-tarballs` build runs the pnpm_11 nixpkgs provides, which
# `packageManager` must name exactly (evaluation fails otherwise).
devShells = forEachSystem (pkgs: {
default = pkgs.mkShell {
packages = [
dprint.packages.${pkgs.stdenv.hostPlatform.system}.default
self.packages.${pkgs.stdenv.hostPlatform.system}.comment-checker-bwrap
pkgs.nodejs_26
pkgs.deno
pkgs.process-compose
];
shellHook = ''
mkdir -p "$HOME/.cache/corepack-shims"
corepack enable pnpm --install-directory "$HOME/.cache/corepack-shims"
export PATH="$HOME/.cache/corepack-shims:$PATH"
'';
};
});
};
}