Repository navigation
Expand file tree
/
Copy pathflake.nix
More file actions
107 lines (99 loc) · 4.11 KB
/
Copy pathflake.nix
File metadata and controls
107 lines (99 loc) · 4.11 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{
description = "TabHerd - Auto Tab Groups";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{
systems,
flake-parts,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.treefmt-nix.flakeModule
];
systems = import systems;
perSystem =
{
config,
lib,
pkgs,
...
}:
{
# `nix fmt` / `nix flake check` (checks.treefmt) で使用
treefmt = {
projectRootFile = "flake.nix";
programs = {
nixfmt.enable = true;
rumdl-check.enable = true;
shellcheck.enable = true;
shfmt = {
enable = true;
# フラグ付きで起動されると shfmt は .editorconfig を読まないため、明示的に揃える
indent_size = 2;
};
};
# direnv の DSL はシェルスクリプトとして解釈できないため除外
settings.formatter.shellcheck.excludes = [ ".envrc*" ];
settings.formatter.shfmt.excludes = [ ".envrc*" ];
# OpenSpec の生成物(`openspec init` / `openspec update` で上書きされる)は整形しない
settings.global.excludes = [
".agents/skills/openspec-*/*"
".claude/skills/openspec-*/*"
".claude/commands/opsx/*"
# gh-stack スキルの生成物(`gh skill install` で上書きされる)は整形しない
".claude/skills/gh-stack/*"
];
};
devShells = {
default = pkgs.mkShellNoCC {
packages = [
config.treefmt.build.wrapper
pkgs.actionlint
pkgs.betterleaks
pkgs.commitlint
pkgs.gh-stack
pkgs.jq
# WXT は Node.js >= 22 を要求する。LTS の 24 系に固定する
pkgs.nodejs_24
pkgs.pnpm
pkgs.prek
];
# OpenSpec のテレメトリと npm への更新確認を無効化(更新は Renovate の PR で行う)
OPENSPEC_TELEMETRY = "0";
shellHook = ''
# OpenSpec のスキルは `openspec` を直接呼ぶため、devDependencies の CLI を PATH に通す
export PATH="$PWD/node_modules/.bin:$PATH"
# ローカルではGitフックを冪等にインストール(フック種別は .pre-commit-config.yaml の default_install_hook_types)
if [ -z "''${CI:-}" ] && git rev-parse --git-dir >/dev/null 2>&1; then
prek install --quiet
fi
'';
};
}
# E2E テスト用。Chromium(依存を含めて約 690 MiB)を既定の devShell に入れないよう分ける。
# nixpkgs の Playwright のブラウザは Linux 向けのみ。devShells は lazyAttrsOf のため、
# mkIf ではなく optionalAttrs で Linux 以外の属性そのものを作らない
// lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
e2e = pkgs.mkShellNoCC {
# パッケージと shellHook を引き継ぐ。環境変数は引き継がれないため重ねて渡す
inputsFrom = [ config.devShells.default ];
inherit (config.devShells.default) OPENSPEC_TELEMETRY;
# 実行ファイルのディレクトリ名がアーキテクチャで異なる(chrome-linux64・chrome-linux-arm64)ため、shell で探す
shellHook = ''
TABHERD_E2E_CHROMIUM="$(echo ${pkgs.playwright-driver.passthru.components.chromium}/chrome-linux*/chrome)"
export TABHERD_E2E_CHROMIUM
'';
};
};
};
};
}