devcontainers / devcontainers/features

Nix feature should provide a way to access `flake#devShell`

オープン
#274 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
enhancement help wanted
主要言語
Shell
スター
1.5k
フォーク
621
平均マージ
6日 53分
マージ済み PR(30日)
9

説明

It is common for repositories which provide flakes to provide development shells under a top-level attribute `flake#devShells`, with `flake#devShell` being the default one (an alias for `flake#devShells."".default`). These are accessed with the command `nix develop flake#myShell`; an excerpt from https://nixos.wiki/wiki/Flakes:

```
# Used by `nix develop .#`
devShells.""."" = derivation;
# Used by `nix develop`
devShells."".default = derivation;
```

However, you can't pass something like `"flakeUri": "github:owner/repo#devShell"` to the Nix feature provided here, because it (rightly) complains that this isn't a derivation (the correct derivation would be `github:owner/repo#devShell.x86_64-linux`). Fundamentally, this is because the implementation uses `nix profile install`, which searches for derivations under the `flake#packages` top-level attribute:

https://github.com/devcontainers/features/blob/f7f05f76fabda70f4fbcaefd55e6fe6fd09a8145/src/nix/post-install-steps.sh#L11-L15

Ideally, somewhere in this feature a call should be made to `nix develop` to enable access to the development shells provided by a flake, rather than having to use the workaround of `flake#devShell.x86_64-linux`.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

参照されている nix プロファイルのインストール呼び出しがある src/nix/post-install-steps.sh から始め、次に Nix の機能が flakeUri の値をどのように受け取り、処理しているかを確認します。flake#devShell に対する nix develop の動作を確認し、現在のパッケージインストールパスと比較します。明示的なシステムサフィックスを必要とせずに、機能から flake のデフォルト開発シェルにアクセスできれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
shell
領域
devops
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。