Repository navigation
Nix flake で他環境へのワンコマンド配布対応 - #31
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
flake.nix を追加し、Nixを使う環境で `nix run github:kamiriku/todo_cli` だけで todo / tb / td の3バイナリをビルド・実行できるようにした。 - buildGoModule で 3 binaries (todo, tb, td) をビルド - apps エントリで `nix run .#todo` などを公開 - devShell に go / gopls / golangci-lint / gnumake を同梱 - /result symlink を .gitignore に追加 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
flake.nixを追加し、Nix が入ってる環境であればnix run github:karimiku/todo_cliだけでtodo/tb/tdをビルド・実行できるようにしたLICENSE(MIT) を追加(無いと法的に他人がコピー不可で、nixpkgs にも載せられない)nix buildが生成する/resultシンボリックリンクを.gitignoreに追加なぜ
Go製CLIの配布で「相手のマシンに即届ける」最短ルートとして、まず Nix flake から整備する。今後 GoReleaser + Homebrew tap を足せば配布範囲を広げられるが、第一歩として依存が無く決定論的に動く Nix を選択。
flake.nix の構成
buildGoModuleでcmd/todo,cmd/tb,cmd/tdをsubPackages指定でビルドglebarez/sqliteが pure Go なのでCGO_ENABLED=0ldflags = [ "-s" "-w" ]でバイナリを stripapps.{default,todo,tb,td}を公開(nix run .#tb等で個別起動可能)devShells.defaultに go / gopls / gotools / golangci-lint / gnumake動作確認
ローカル (Determinate Nix 3.19.0, darwin) で確認済み:
nix buildが成功しresult/bin/{todo,tb,td}が生成されるnix run .#todo -- --helpがヘルプを出力nix run .#tb -- --help/nix run .#td -- --helpも動作Test plan
nix run github:karimiku/todo_cli/feature/add-nix-flakeを試すnix flake checkがエラーなく通るmake build/make test/make ciが引き続き動作する🤖 Generated with Claude Code