devcontainers / devcontainers/features

Nix feature should support `"flakeUri": "../flake.nix"` to local file instead of remote Nix URI

Open
#1,518 2 comments 3 reactions 1 assignee Claimed by @v-Kaniska244 View on GitHub
Dominant language
Shell
Stars
1.5k
Forks
621
Avg merge
2d 11h
Merged PRs (30d)
4

Description

https://github.com/devcontainers/features/tree/main/src/nix#location-of-flakes :

> Currently flakeUri works best with a remote URI (e.g., github:nixos/nixpkgs/nixpkgs-unstable#hello) as local files need to be in the image.

makes the Nix feature of fairly limited use for dev containers in Nix package style repos which contain a `flake.nix` (e.g. [like this one](https://github.com/enola-dev/enola/blob/60413d580277eac7375bc88cac856cad248d0670/flake.nix#L2); for [my] https://github.com/enola-dev/enola/issues/1921).

I've tried both `"flakeUri": "../flake.nix"` and `"flakeUri": "flake.nix"` but they both fail with `error: getting status of '/tmp/dev-container-features/flake.nix': No such file or directory`, because the base URL is wrong.

Given that https://github.com/devcontainers/features/tree/main/src/nix#location-of-flakes also says:

> Proposed support for lifecycle hooks in Features (https://github.com/devcontainers/spec/issues/60) would allow for expressions files or Flakes to exist in the source tree to be automatically installed on initial container startup

and seeing that https://github.com/devcontainers/spec/issues/60 is now implemented, perhaps support for this could now be added?

@Chuxel

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.