Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export NIX_CONFIG="experimental-features = nix-command flakes"
use flake
72 changes: 72 additions & 0 deletions .github/workflows/lint-nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Lint / Nix

on:
workflow_call:

push:
branches: [main]
paths:
- .github/workflows/lint-nix.yml
- flake.lock
- flake.nix
- '**/*.nix'

pull_request:
branches: [main]
paths:
- .github/workflows/lint-nix.yml
- flake.lock
- flake.nix
- '**/*.nix'

permissions:
contents: read

concurrency:
group: check-nix-${{ github.ref }}
cancel-in-progress: true

jobs:
check-nix:
runs-on: ubuntu-22.04
steps:
- name: Check out repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false

- name: Set up Nix
uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22

- name: Check flake
shell: bash
run: |
set -o pipefail

nix flake check \
--all-systems \
--show-trace \
--print-build-logs \
2>&1 | tee /tmp/nix-flake-check.log

- name: Reject Nix warnings
shell: bash
run: |
if grep -Ei '(^|[^[:alpha:]])warning:' /tmp/nix-flake-check.log; then
echo "::error::Nix emitted one or more warnings"
exit 1
fi

- name: Check formatting
shell: bash
run: |
mapfile -t nix_files < <(git ls-files '*.nix')
nix run --inputs-from . nixpkgs#nixfmt -- --check "${nix_files[@]}"

- name: Statix
shell: bash
run: nix run --inputs-from . nixpkgs#statix -- check .

- name: Deadnix
shell: bash
run: nix run --inputs-from . nixpkgs#deadnix -- --fail .
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ yarn-error.log*

# misc
engine.bin

# Nix
.direnv/
result
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

[![lint](https://img.shields.io/github/actions/workflow/status/axone-protocol/docs/lint.yml?label=lint&style=for-the-badge&logo=github)](https://github.com/axone-protocol/docs/actions/workflows/lint.yml)
[![build](https://img.shields.io/github/actions/workflow/status/axone-protocol/docs/build.yml?label=build&style=for-the-badge&logo=github)](https://github.com/axone-protocol/docs/actions/workflows/build.yml)
[![Built with Nix](https://img.shields.io/badge/Built_With-Nix-5277C3.svg?style=for-the-badge&logo=nixos&logoColor=white)](https://nixos.org/)
[![vercel deploy](https://deploy-badge.vercel.app/vercel/docs-bgu5cuq5p-axone?style=for-the-badge)](https://docs.axone.xyz/)
[![license][bsd-3-clause-image]][bsd-3-clause]
[![cc-by-sa-4.0][cc-by-sa-image]][cc-by-sa]
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

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

55 changes: 55 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
description = "Axone technical reference development environment";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
};

outputs =
{ nixpkgs, ... }:
let
supportedSystems = [
"aarch64-darwin"
"x86_64-darwin"
"x86_64-linux"
"aarch64-linux"
];

forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor =
system:
import nixpkgs {
inherit system;
config.allowDeprecatedx86_64Darwin = true;
};
in
{
devShells = forAllSystems (
system:
let
pkgs = nixpkgsFor system;
in
{
default = pkgs.mkShell {
packages = [
pkgs.codespell
pkgs.git
pkgs.marksman
pkgs.markdownlint-cli2
pkgs.nixd
pkgs.nodejs_22
pkgs.rtk
pkgs.shellcheck
pkgs.typescript-language-server
pkgs.vscode-langservers-extracted
pkgs.yaml-language-server
pkgs.yarn
];
shellHook = ''
echo "Axone technical reference development environment loaded"
'';
};
}
);
};
}
Loading