Skip to content

Commit

Permalink
Merge pull request #725 from andrew-scott-fischer/update-nix-flake-impl
Browse files Browse the repository at this point in the history
Update nix flake impl
  • Loading branch information
ericcrosson-bitgo authored Apr 1, 2024
2 parents d0c2f8a + e4531f3 commit 431010b
Show file tree
Hide file tree
Showing 14 changed files with 159 additions and 649 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,14 @@ concurrency:
cancel-in-progress: true

jobs:
check:
nix-flake-check:
name: Nix Flake Check
runs-on: ubuntu-latest

steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@de22e16c4711fca50c816cc9081563429d1cf563 # v10

- name: Checkout
uses: actions/checkout@v4

- name: Configure Node.js
uses: actions/setup-node@v4
with:
cache: npm
node-version: lts/*

- name: Install dependencies
run: npm ci

- name: Check code formatting
run: npm run format --workspaces
- run: nix flake check
4 changes: 2 additions & 2 deletions .github/workflows/pull-request-edit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ jobs:
run-scan:
name: Trigger Renovate Scan
if:
${{ contains(github.event.pull_request.body, '[x] <!-- rebase-check -->')
&& github.event.pull_request.user.login == 'bitgo-renovate-bot[bot]' }}
${{ contains(github.event.pull_request.body, '[x] <!-- rebase-check -->') &&
github.event.pull_request.user.login == 'bitgo-renovate-bot[bot]' }}
runs-on: ubuntu-latest
steps:
- id: trigger-renovate-scan
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.pre-commit-config.yaml
.direnv/
coverage/
dist/
Expand Down
6 changes: 0 additions & 6 deletions .lintstagedrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
coverage/
dist/
package-lock.json
flake.lock
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ type-checked and runtime-validated HTTP calls in a standardized manner.

## io-ts Compatibility

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

## Developing

Expand Down
93 changes: 85 additions & 8 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 41 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,34 +1,53 @@
{
description = "api-ts";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
};

outputs = {
self,
nixpkgs,
flake-utils,
}: (
flake-utils.lib.eachDefaultSystem (
system: (
let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShell = pkgs.mkShell {
name = "api-ts-shell";
pre-commit-hooks,
}: let
forEachSystem = nixpkgs.lib.genAttrs [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
in {
checks = forEachSystem (system: let
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
actionlint.enable = true;
alejandra.enable = true;
prettier.enable = true;
};
};
in {
inherit pre-commit-check;
});

packages = with pkgs; [
nodejs
];
devShells = forEachSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
packages = with pkgs; [
nodejs
];

shellHook = ''
export PATH="$(pwd)/node_modules/.bin:$PATH"
'';
};
}
)
)
);
shellHook = ''
${self.checks.${system}.pre-commit-check.shellHook}
export PATH="$(pwd)/node_modules/.bin:$PATH"
'';
};
});
};
}
Loading

0 comments on commit 431010b

Please sign in to comment.