Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
devenvに入門した
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Tomohiko Himura
September 13, 2023
Technology
140
1
Share
devenvに入門した
devenvというnixをベースした開発環境と本番用のコンテナイメージを作れるツールを紹介しました。
https://devenv.sh/
Tomohiko Himura
September 13, 2023
More Decks by Tomohiko Himura
See All by Tomohiko Himura
Marpでmermaidは簡単だときいたけど
eiel
1
2.1k
バイナリ読むのにElixirしてみた
eiel
0
99
アジャイルはさておきMake People Awesomeしたい
eiel
0
210
レビューは最優先にするようにしている
eiel
0
340
再考 Fourkeys メトリクス
eiel
2
710
Test mockをSnapshot testする
eiel
0
160
関数プログラミングの考え方
eiel
1
360
逆コンウェイ作戦はフィードバックループを作るために 逆向きの流れをつくること (5分版)
eiel
0
480
組織のパフォーマンスを高めるために 第1話 学習と文化
eiel
0
270
Other Decks in Technology
See All in Technology
Choose your own adventure in agentic design patterns
glaforge
0
140
Keeping Ruby Running on Cygwin
fd0
0
160
[最強DB講義]推薦システム | 基礎編
recsyslab
PRO
1
170
Standards et agents IA : un tour d’horizon de MCP, A2A, ADK et plus encore
glaforge
0
170
2026年、知っておくべき最新 サーバレスTips10選/serverless-10-tips
slsops
13
5.2k
マルチエージェント × ハーネスエンジニアリング × GitLab Duo Agent Platformで実現する「AIエージェントに仕事をさせる時代へ。」 / 20260421 GitLab Duo Agent Platform
n11sh1
0
160
AzureのIaC管理からログ調査まで、随所に役立つSkillsとCustom-Instructions / Boosting IaC and Log Analysis with Skills
aeonpeople
0
230
実践ハーネスエンジニアリング:TAKTで実現するAIエージェント制御 / Practical Harness Engineering: AI Agent Control Enabled by TAKT
nrslib
11
4.6k
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
320
ネットワーク運用を楽にするAWS DevOps Agent活用法!! / 20260421 Masaki Okuda
shift_evolve
PRO
2
210
Do Vibe Coding ao LLM em Produção para Busca Agêntica - TDC 2026 - Summit IA - São Paulo
jpbonson
3
120
AI駆動1on1〜AIに自分を育ててもらう〜
yoshiakiyasuda
0
120
Featured
See All Featured
Embracing the Ebb and Flow
colly
88
5k
Speed Design
sergeychernyshev
33
1.6k
How STYLIGHT went responsive
nonsquared
100
6.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
180
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
100
We Are The Robots
honzajavorek
0
220
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
270
Code Reviewing Like a Champion
maltzj
528
40k
How Software Deployment tools have changed in the past 20 years
geshan
0
33k
Site-Speed That Sticks
csswizardry
13
1.2k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
180
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
140
Transcript
devenvに入門した 2023/08/17 ひむら ともひこ
自己紹介 ひむら ともひこ 最近趣味で遊んでるもの • Nix • GNU Emacs
devenvに入門した
None
こういうことありませんか?
リポジトリをクローンしてきたけど ビルドや実行するまでに いろいろインストールしなきゃいけない
開発するのに VagrantやDockerなど起動しないといけない
つらい
そこでdevenvですよ
devenvとは何か
devenv知ってる人 1人
devenv使ってる人 0人
開発環境構築ツール デプロイ用コンテナイメージ作成ツール
https://devenv.sh/
devenvが導入されてる環境で使ってみる
devenvの設定ファイルがあるプロジェクトで $ devenv up # 開発サーバーやデータベースサーバーなどが起動する $ devenv shell #
開発するのに必要なコマンドがそろった環境に入る
実例
devenv.nix { pkgs, ... }: { env.GREET = "devenv"; packages
= [ pkgs.git ]; scripts.hello.exec = "echo hello from $GREET"; enterShell = '' hello git --version ''; languages.javascript.enable = true; languages.javascript.package = pkgs.nodejs_20; processes.watch.exec = "npm run watch:build"; processes.test.exec = "npm run test --watch"; processes.storybook.exec = "npm run storybook"; }
devenv.yaml inputs: nixpkgs: url: github:NixOS/nixpkgs/nixpkgs-unstable
設定ファイル • devenv.nix ◦ nix言語を用いて設定やインストールするパッケージのカスタマ イズができる • devenv.yaml ◦ パッケージマネージャ自体の設定をする
◦ 外部のdevenvの設定を読み込みする
devenvのinstall方法
ここでは説明したくない
nixがインストールされていれば $ nix-env -if https://install.devenv.sh/latest
もうちょっと詳しく
devenvの環境はシステムとは別途隔離されている • プロジェクトルートの .devenv/profileに環境が作られる $ find .devenv/profile/ | head -n
20 .devenv/profile/ .devenv/profile//bin .devenv/profile//bin/git-jump .devenv/profile//bin/git-receive-pack .devenv/profile//bin/git-credential-netrc .devenv/profile//bin/git-upload-archive .devenv/profile//bin/.honcho-wrapped .devenv/profile//bin/honcho .devenv/profile//bin/git-credential-osxkeychain .devenv/profile//bin/git-cvsserver .devenv/profile//bin/hello .devenv/profile//bin/git-shell .devenv/profile//bin/node .devenv/profile//bin/corepack .devenv/profile//bin/git-upload-pack .devenv/profile//bin/scalar .devenv/profile//bin/npx .devenv/profile//bin/git-http-backend .devenv/profile//bin/npm .devenv/profile//bin/git
正確にはシンボリックリンクでnixで包括的に管理される $ ls -l .devenv/profile .devenv/profile -> /nix/store/qsvm027f4kv1qzldzm40bzrjpzgfmdi0-devenv-profile
devenv upで起動するのはprocess-manager • 有名なものでいうとforeman(ruby) • デフォルトで使われるのはhoncho(python) ◦ 出力に色もつかない • 他に選択できるもの
◦ hivemind(go) ▪ 環境によってはうまくうごかないことがある(おそらくdevenvで使ってる人が少ない) ◦ overmind(go + tmux) ▪ tmuxを使えるならいろいろ便利 ◦ process-compose(go) ◦ ▪ TUI付きでリッチ
いくつか備え付けのpre-commit hookがあるよ • https://github.com/cachix/pre-commit-hooks.nix • PHP ◦ php-cs-fixer, phpcbf, phpcs
• JavaScript/TypeScript ◦ deno fmt, deno lint, eslint, rome • Golang ◦ go fmt, go test, govet, revive, staticcheck • Rust ◦ rustfmt, clippy, cargo check
editorとの連携は…つらいかもしれない • おそらくdirenv を連携してなんとかすることになる • .envrc に以下を書いとけばきっと… source_url "https://raw.githubusercontent.com/cachix/devenv/d1f7b48e35e6d ee421cfd0f51481d17f77586997/direnvrc"
"sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0=" use devenv
まとめ
devenvまとめ • 仮想化技術を使わずとも ◦ VagrantやDockerをつかった開発環境に近いものを作れる ▪ 同じくらいcleanに使える (ただしnixが必要) ◦ ansibleやdockerfile不要
(近いものをnixが内蔵) • 設定されているリポジトリならお手軽に使える ◦ 使うには nix が必要 ◦ 設定するには nix力が必要