$ devbox init
✓ Downloading version 0.4.2... [DONE]✓ Verifying checksum... [DONE]✓ Unpacking binary... [DONE]? Do you want to enable direnv integration for this devbox project? [y/N]
$ devbox add ruby
Installing nix packages.
this derivation will be built:
/nix/store/kzhm3ccb4n76djyl8p031nrwqjkhb3y8-devbox-development.drv
this path will be fetched (4.05 MiB download, 17.84 MiB unpacked):
/nix/store/68b23xs1x21037lspz52dh5ck7w7wqg7-ruby-2.7.6
copying path '/nix/store/68b23xs1x21037lspz52dh5ck7w7wqg7-ruby-2.7.6' from 'https://cache.nixos.org'...
building '/nix/store/kzhm3ccb4n76djyl8p031nrwqjkhb3y8-devbox-development.drv'...
created 18 symlinks in user environment
building '/nix/store/frxp5w9pziibvajnc10bvspaa7hmslma-user-environment.drv'...
This plugin sets the following environment variables:
* RUBY_CONFDIR=/Users/teraoka/work/rails-devbox/.devbox/virtenv/ruby
* GEMRC=/Users/teraoka/work/rails-devbox/.devbox/virtenv/ruby/.gemrc
* GEM_HOME=/Users/teraoka/work/rails-devbox/.devbox/virtenv/ruby
To show this information, run `devbox info ruby`ruby (ruby-2.7.6) is now installed.
この記事を書いている時点ではデフォルトは Ruby 2.7 のようです。
もうちょい新しいバージョンを使いたいので入れ直します。
1
2
3
$ devbox rm ruby
Uninstalling nix packages.
ruby (ruby-2.7.6) is now removed.
最新の Ruby は 3.2.1 ですが、devbox では 3.1.x が最新のようです。
1
2
3
4
5
6
7
$ devbox add ruby_3_2
error: attribute 'ruby_3_2' in selection path 'ruby_3_2' not found
Did you mean one of ruby_3_0, ruby_3_1 or ruby_2_7?
Error: ruby_3_2: package not found
To search for packages use https://search.nixos.org/packages
$ devbox add ruby_3_1
Installing nix packages.
this derivation will be built:
/nix/store/i5kw0js4xzh7imibp2mznrf75517bg20-devbox-development.drv
building '/nix/store/i5kw0js4xzh7imibp2mznrf75517bg20-devbox-development.drv'...
created 19 symlinks in user environment
building '/nix/store/j9jkl4kjlf1r6l64jxayhi4pnzk8dd90-user-environment.drv'...
This plugin sets the following environment variables:
* RUBY_CONFDIR=/Users/teraoka/work/rails-devbox/.devbox/virtenv/ruby_3_1
* GEMRC=/Users/teraoka/work/rails-devbox/.devbox/virtenv/ruby_3_1/.gemrc
* GEM_HOME=/Users/teraoka/work/rails-devbox/.devbox/virtenv/ruby_3_1
To show this information, run `devbox info ruby_3_1`ruby_3_1 (ruby-3.1.2) is now installed.
$ devbox add nodejs-18_x
Installing nix packages.
this derivation will be built:
/nix/store/0crzc6ilmg4lm8kj9mfv59kzn847rabm-devbox-development.drv
building '/nix/store/0crzc6ilmg4lm8kj9mfv59kzn847rabm-devbox-development.drv'...
created 99 symlinks in user environment
building '/nix/store/38h0q2ix2vra62py8phr85k3sbsnc6cy-user-environment.drv'...
nodejs-18_x (nodejs-18.13.0) is now installed.
To update your shell and ensure your new packages are usable, please run:
eval$(devbox shellenv)
$ devbox add yarn
Installing nix packages.
this derivation will be built:
/nix/store/xj4bj2xi7mk6iqklwrb3pjknvgw4g96z-devbox-development.drv
this path will be fetched (0.85 MiB download, 5.08 MiB unpacked):
/nix/store/3qr0nz4gj73cwybvbagcsj1px7h5723r-yarn-1.22.19
copying path '/nix/store/3qr0nz4gj73cwybvbagcsj1px7h5723r-yarn-1.22.19' from 'https://cache.nixos.org'...
building '/nix/store/xj4bj2xi7mk6iqklwrb3pjknvgw4g96z-devbox-development.drv'...
created 101 symlinks in user environment
building '/nix/store/kg40s5pdz3rqs65icjxvq2mpca1nj2rp-user-environment.drv'...
yarn (yarn-1.22.19) is now installed.
To update your shell and ensure your new packages are usable, please run:
eval$(devbox shellenv)
$ devbox add postgresql_14
Installing nix packages.
this derivation will be built:
/nix/store/qc08nll2anma4nw2a973h313hkga2w6j-devbox-development.drv
building '/nix/store/qc08nll2anma4nw2a973h313hkga2w6j-devbox-development.drv'...
created 382 symlinks in user environment
building '/nix/store/zs3jiclvv5x67gsfvzrq3fqm295glcaz-user-environment.drv'...
postgresql NOTES:
To initialize the database run `initdb`.
Services:
* postgresql
Use `devbox services start|stop [service]` to interact with services
This plugin creates the following helper files:
This plugin sets the following environment variables:
* PGDATA=/Users/teraoka/work/rails-devbox/.devbox/virtenv/postgresql_14/data
* PGHOST=/Users/teraoka/work/rails-devbox/.devbox/virtenv/postgresql_14
To show this information, run `devbox info postgresql_14`postgresql_14 (postgresql-14.6) is now installed.
To update your shell and ensure your new packages are usable, please run:
eval$(devbox shellenv)
$ initdb
The files belonging to this database system will be owned by user "teraoka".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
fixing permissions on existing directory /Users/teraoka/work/rails-devbox/.devbox/virtenv/postgresql_14/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Tokyo
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
pg_ctl -D /Users/teraoka/work/rails-devbox/.devbox/virtenv/postgresql_14/data -l logfile start
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------------------+-----------
teraoka | Superuser, Create role, Create DB, Replication, Bypass RLS | {}
Unix-domain socket path "/Users/teraoka/ghq/github.com/yteraoka/django-otel-cloud-trace/.devbox/virtenv/postgresql_14/.s.PGSQL.5432" is too long (maximum 103 bytes)
$ gem install pg
Fetching pg-1.4.6.gem
Building native extensions. This could take a while...
Successfully installed pg-1.4.6
Parsing documentation for pg-1.4.6
Installing ri documentation for pg-1.4.6
Done installing documentation for pg after 5 seconds
1 gem installed
$ devbox add redis
Installing nix packages.
this derivation will be built:
/nix/store/zadjqfb3ndrxqy0wil5vkvw1jsk04l58-devbox-development.drv
building '/nix/store/zadjqfb3ndrxqy0wil5vkvw1jsk04l58-devbox-development.drv'...
created 388 symlinks in user environment
building '/nix/store/b9zfg0m64xq3726njarxkgdy2lp2dp1q-user-environment.drv'...
redis NOTES:
Running `devbox services start redis` will start redis as a daemon in the background.
You can manually start Redis in the foreground by running `redis-server $REDIS_CONF --port $REDIS_PORT`.
Logs, pidfile, and data dumps are stored in `.devbox/virtenv/redis`. You can change this by modifying the `dir` directive in `devbox.d/redis/redis.conf`Services:
* redis
Use `devbox services start|stop [service]` to interact with services
This plugin creates the following helper files:
* /Users/teraoka/work/rails-devbox/devbox.d/redis/redis.conf
This plugin sets the following environment variables:
* REDIS_PORT=6379* REDIS_CONF=/Users/teraoka/work/rails-devbox/devbox.d/redis/redis.conf
To show this information, run `devbox info redis`redis (redis-7.0.8) is now installed.
To update your shell and ensure your new packages are usable, please run:
eval$(devbox shellenv)
redis の場合は devbox.d/redis/redis.conf に設定ファイルが置かれています。
.devbox/virtenv/redis 配下ではないのですね。redis.conf の中の dir 設定は
dir .devbox/virtenv/redis/
と設定されているので save コマンドでのデータファイルの出力先や aof のファイルはここに出力されるようです。
If you’re having trouble building grpcio in Devbox, you might need to set NIX_CFLAGS_COMPILE in your devbox.json’s init hook. See this repo Temporal example which uses grpcio: https://t.co/cVdfmj58YS