cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
4.04k stars 303 forks source link

devenv test with flakes #1053

Open MAHDTech opened 5 months ago

MAHDTech commented 5 months ago

Hi there, just migrating over to v1.0 and have a question regarding devenv test (which is awesome!)

I'm updating my GitHub Actions which previously used devenv ci with a Nix flake.

What's the trick to running devenv test now with flakes? Because I get this error,

Error: x File devenv.nix does not exist. To get started, run:

$ devenv init
domenkozar commented 5 months ago

There's no devenv test for flakes, what's blocking you from using just devenv?

MAHDTech commented 5 months ago

Nothing other than time to refactor I guess.

I have probably around 30 repos that I already had nix flakes setup for, and then added devenv to the mix.

If using devenv directly instead of with flakes is the way to go, I will try it out migrating one repo and see how I go.

it's probably a better longer-term goal for the team I work with anyway, as the yaml format with devenv.yaml is easier for some team members.

Cheers 🥂

mpscholten commented 5 months ago

Just ran into the same issue here. Would be cool to have support for devenv test for the flakes version as well

domenkozar commented 5 months ago

@mpscholten I'm more focused on making devenv interface better than improving flakes at this stage (happy if someone submits a PR!) - what makes you prefer flakes?

mpscholten commented 5 months ago

👍

We have built the IHP devenv integration around the flake interface to allow us to provide nixosConfigurations. With nixosConfigurations we can provide a very nice deployment workflow

domenkozar commented 5 months ago

I feel like flakes aren't a good interface for beginners. Would #286 allow you to use devenv?

mpscholten commented 5 months ago

I feel like flakes aren't a good interface for beginners.

We worked around the hard-UX-problem of flakes by providing a good boilerplate flake (which mostly consists of devenv and an example for the nixosConfigurations. If you're interested, you can check it out here https://github.com/digitallyinduced/ihp-boilerplate/blob/master/flake.nix)

Looks interesting. Would that approach work with nixos-rebuild? (We have a small wrapper script called deploy-to-nixos that wraps a long nixos-rebuild call, that way we deploy our flakes to production).

mpscholten commented 5 months ago

A little bit off topic to this issue, do you think devenv could eventually also deal with deployments and replace our homegrown deploy-to-nixos helper? If useful I'd happy to jump on a call and show you our current workflow on that