File tree 9 files changed +99
-16
lines changed
9 files changed +99
-16
lines changed Original file line number Diff line number Diff line change 3
3
push :
4
4
branches : [main]
5
5
pull_request :
6
-
7
6
jobs :
8
7
kit :
9
8
name : Svelte Kit
Original file line number Diff line number Diff line change 6
6
push :
7
7
branches :
8
8
- main
9
-
10
9
jobs :
11
10
format :
12
11
name : Format JS
50
49
working-directory : service # doesn't work without this
51
50
- run : bun install --frozen-lockfile
52
51
- run : bun check
53
-
54
52
nix-checks :
55
53
name : Nix checks
56
54
runs-on : ubuntu-latest
Original file line number Diff line number Diff line change 7
7
push :
8
8
branches :
9
9
- main
10
-
11
10
# env:
12
11
# DATABASE_URL: ${{ secrets.DATABASE_URL }}
13
-
14
12
jobs :
15
13
build :
16
14
name : " Tests (todo)"
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ wip: 開発中です。
11
11
a. Nix を使える場合
12
12
13
13
1 . [ Nix と nix-direnv をインストールします。] ( ./docs/install-nix.md )
14
- 2 . ` direnv allow ` と実行します。
14
+ 1 . ` direnv allow ` と実行します。
15
15
16
16
b. Nix を使えない場合
17
17
Original file line number Diff line number Diff line change 2
2
3
3
## Nix のインストール
4
4
5
- Nix 本体をインストールします。
6
- [ 公式から提供されているインストーラー ] ( https://nixos.org/download/ ) でもいいですが、
7
- [ DeterminateSystems が提供するインストーラー ] ( https://github.com/DeterminateSystems/nix-installer ) も色々便利らしいです。
5
+ Nix 本体をインストールします。 [ 公式から提供されているインストーラー ] ( https://nixos.org/download/ ) でもいいですが、
6
+ [ DeterminateSystems が提供するインストーラー ] ( https://github.com/DeterminateSystems/nix-installer )
7
+ も色々便利らしいです。
8
8
9
9
各ドキュメントを読めば難しいことはない、というかシェルスク一行のはずです。
10
10
@@ -28,9 +28,10 @@ NixOS は入れてないと思うので、 Standalone で入れましょう。
28
28
29
29
## Nix-Direnv のインストール
30
30
31
- Home Manager をインストールしたら、 ` ~/.config/home-manager/home.nix ` が作成されていることと思います。
32
- そこに、` direnv ` と ` nix-direnv ` の設定を追加しましょう。 < https://github.com/nix-community/nix-direnv?tab=readme-ov-file#via-home-manager >
33
- 最終的には、` home.nix ` はこんな感じになると思います。
31
+ Home Manager をインストールしたら、 ` ~/.config/home-manager/home.nix ` が作成されていることと思います。 そこに、` direnv `
32
+ と ` nix-direnv ` の設定を追加しましょう。
33
+ < https://github.com/nix-community/nix-direnv?tab=readme-ov-file#via-home-manager > 最終的には、` home.nix `
34
+ はこんな感じになると思います。
34
35
35
36
``` nix
36
37
{ pkgs, ... }: {
@@ -62,4 +63,5 @@ Nix 経由で direnv がインストールできたことを確認するため
62
63
$ readlink $( which direnv)
63
64
/nix/store/id5qc6k2rh5micxhsxjard2ypp503zw0-direnv-2.35.0/bin/direnv
64
65
```
66
+
65
67
上のように、` /nix/store ` 以下にファイルがあると表示されれば成功です。
Original file line number Diff line number Diff line change 4
4
inputs = {
5
5
nixpkgs . url = "github:nixos/nixpkgs/nixpkgs-unstable" ;
6
6
flake-utils . url = "github:numtide/flake-utils" ;
7
+ treefmt-nix . url = "github:numtide/treefmt-nix" ;
8
+ treefmt-nix . inputs . nixpkgs . follows = "nixpkgs" ;
7
9
} ;
8
10
9
11
outputs = {
10
12
nixpkgs ,
11
13
flake-utils ,
12
- ...
14
+ treefmt-nix ,
15
+ self ,
13
16
} :
14
17
flake-utils . lib . eachDefaultSystem (
15
18
system : let
16
19
pkgs = nixpkgs . legacyPackages . ${ system } ;
20
+ treefmt = ( treefmt-nix . lib . evalModule pkgs ./treefmt.nix ) . config . build ;
17
21
in {
18
- formatter = pkgs . alejandra ;
22
+ formatter = treefmt . wrapper ;
19
23
devShells . default = pkgs . callPackage ./shell.nix { } ;
24
+ checks . format = treefmt . check self ;
20
25
}
21
26
) ;
22
27
}
Original file line number Diff line number Diff line change @@ -2,28 +2,35 @@ default:
2
2
just --list
3
3
4
4
i : install
5
+
5
6
install :
6
7
cd web; bun install --frozen-lockfile
7
8
cd service; bun install --frozen-lockfile
8
9
9
10
b : build
11
+
10
12
build : build-svelte build-worker
13
+
11
14
build-svelte :
12
15
bun run build
16
+
13
17
build-worker :
14
18
cd worker; bunx tsc
15
19
16
20
format :
17
21
deno fmt --check .
22
+
18
23
format-fix :
19
24
deno fmt .
25
+
20
26
lint :
21
27
biome lint .
28
+
22
29
lint-fix :
23
30
biome lint --fix .
24
31
25
32
check : format lint
26
33
cd web; bun check
27
34
cd service; bun check
28
- fix : format-fix lint-fix
29
35
36
+ fix : format-fix lint-fix
Original file line number Diff line number Diff line change
1
+ let
2
+ deno-includes = [
3
+ "*.css"
4
+ "*.html"
5
+ "*.js"
6
+ "*.json"
7
+ "*.jsonc"
8
+ "*.jsx"
9
+ "*.less"
10
+ "*.markdown"
11
+ "*.md"
12
+ "*.sass"
13
+ "*.scss"
14
+ "*.ts"
15
+ "*.tsx"
16
+ "*.yaml"
17
+ "*.yml"
18
+ "*.svelte"
19
+ ] ;
20
+ global-excludes = [
21
+ "node_modules"
22
+ ".gitignore"
23
+ ".npmrc"
24
+ ".ignore"
25
+ ".envrc"
26
+ ".env.example"
27
+ "*.png"
28
+ "*.svg"
29
+ "*.webp"
30
+ "robots.txt"
31
+ ] ;
32
+ in {
33
+ # <https://github.com/numtide/treefmt-nix>
34
+
35
+ settings . global . excludes = builtins . concatMap ( name : [ name ( "**/" + name ) ] ) global-excludes ;
36
+ programs = {
37
+ # config DSL
38
+ taplo . enable = true ;
39
+ yamlfmt . enable = true ;
40
+ just . enable = true ;
41
+ mdformat . enable = true ;
42
+
43
+ # JS
44
+ deno . enable = true ;
45
+ deno . includes = deno-includes ;
46
+ biome . enable = true ;
47
+
48
+ # Nix
49
+ alejandra . enable = true ;
50
+ statix . enable = true ;
51
+ deadnix . enable = true ;
52
+ } ;
53
+ }
You can’t perform that action at this time.
0 commit comments