Skip to content

Commit 431010b

Browse files
Merge pull request #725 from andrew-scott-fischer/update-nix-flake-impl
Update nix flake impl
2 parents d0c2f8a + e4531f3 commit 431010b

File tree

14 files changed

+159
-649
lines changed

14 files changed

+159
-649
lines changed

.github/workflows/format.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,14 @@ concurrency:
99
cancel-in-progress: true
1010

1111
jobs:
12-
check:
12+
nix-flake-check:
13+
name: Nix Flake Check
1314
runs-on: ubuntu-latest
14-
1515
steps:
16+
- name: Install Nix
17+
uses: DeterminateSystems/nix-installer-action@de22e16c4711fca50c816cc9081563429d1cf563 # v10
18+
1619
- name: Checkout
1720
uses: actions/checkout@v4
1821

19-
- name: Configure Node.js
20-
uses: actions/setup-node@v4
21-
with:
22-
cache: npm
23-
node-version: lts/*
24-
25-
- name: Install dependencies
26-
run: npm ci
27-
28-
- name: Check code formatting
29-
run: npm run format --workspaces
22+
- run: nix flake check

.github/workflows/pull-request-edit.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
run-scan:
1919
name: Trigger Renovate Scan
2020
if:
21-
${{ contains(github.event.pull_request.body, '[x] <!-- rebase-check -->')
22-
&& github.event.pull_request.user.login == 'bitgo-renovate-bot[bot]' }}
21+
${{ contains(github.event.pull_request.body, '[x] <!-- rebase-check -->') &&
22+
github.event.pull_request.user.login == 'bitgo-renovate-bot[bot]' }}
2323
runs-on: ubuntu-latest
2424
steps:
2525
- id: trigger-renovate-scan

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.pre-commit-config.yaml
12
.direnv/
23
coverage/
34
dist/

.lintstagedrc.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
coverage/
22
dist/
3-
package-lock.json
3+
flake.lock

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ type-checked and runtime-validated HTTP calls in a standardized manner.
2525

2626
## io-ts Compatibility
2727

28-
**api-ts** is built and tested against the stable channel of io-ts (v2.1).
29-
**api-ts** is not currently compatible with the experimental channel of io-ts (v2.2).
28+
**api-ts** is built and tested against the stable channel of io-ts (v2.1). **api-ts** is
29+
not currently compatible with the experimental channel of io-ts (v2.2).
3030

3131
## Developing
3232

flake.lock

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

flake.nix

Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,53 @@
11
{
22
description = "api-ts";
3-
43
inputs = {
54
nixpkgs.url = "github:nixos/nixpkgs";
6-
flake-utils.url = "github:numtide/flake-utils";
5+
pre-commit-hooks = {
6+
url = "github:cachix/pre-commit-hooks.nix";
7+
inputs = {
8+
nixpkgs.follows = "nixpkgs";
9+
};
10+
};
711
};
812

913
outputs = {
1014
self,
1115
nixpkgs,
12-
flake-utils,
13-
}: (
14-
flake-utils.lib.eachDefaultSystem (
15-
system: (
16-
let
17-
pkgs = nixpkgs.legacyPackages.${system};
18-
in {
19-
devShell = pkgs.mkShell {
20-
name = "api-ts-shell";
16+
pre-commit-hooks,
17+
}: let
18+
forEachSystem = nixpkgs.lib.genAttrs [
19+
"aarch64-darwin"
20+
"aarch64-linux"
21+
"x86_64-darwin"
22+
"x86_64-linux"
23+
];
24+
in {
25+
checks = forEachSystem (system: let
26+
pre-commit-check = pre-commit-hooks.lib.${system}.run {
27+
src = ./.;
28+
hooks = {
29+
actionlint.enable = true;
30+
alejandra.enable = true;
31+
prettier.enable = true;
32+
};
33+
};
34+
in {
35+
inherit pre-commit-check;
36+
});
2137

22-
packages = with pkgs; [
23-
nodejs
24-
];
38+
devShells = forEachSystem (system: let
39+
pkgs = nixpkgs.legacyPackages.${system};
40+
in {
41+
default = pkgs.mkShell {
42+
packages = with pkgs; [
43+
nodejs
44+
];
2545

26-
shellHook = ''
27-
export PATH="$(pwd)/node_modules/.bin:$PATH"
28-
'';
29-
};
30-
}
31-
)
32-
)
33-
);
46+
shellHook = ''
47+
${self.checks.${system}.pre-commit-check.shellHook}
48+
export PATH="$(pwd)/node_modules/.bin:$PATH"
49+
'';
50+
};
51+
});
52+
};
3453
}

0 commit comments

Comments
 (0)