cachix / devenv

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

Generic Service Module (or custom service) #1581

Closed cowboyai closed 2 days ago

cowboyai commented 1 week ago

Question: Running Existing NixOS Services in Devenv - Is There a More Generic Way?

I've been using .direnv for a while, but I'm relatively new to devenv and exploring its capabilities for running services.

I'm trying to figure out if there's a more generic way to call into services and programs that are already present in NixOS through devenv.

Specifically, I'm interested in enabling services.pcscd. In a typical configuration.nix, this is a single line. However, with devenv, it appears I need to write a custom module that essentially duplicates what's already available in nixpkgs for services.pcscd. I've been looking at /devenv/src/modules/services, and it seems like services in devenv.nix are limited to "supported" services and don't integrate with nixosConfiguration.<name>.services but rather duplicate them(and fix bugs).

Am I missing something here? Is there an existing method to enable and run services without delving deeply into how direnv creates .devenv/profile? I'm competent in Rust and Nix but feel like I'm overlooking an existing solution or approach.

Any insights or guidance would be greatly appreciated!

sandydoo commented 1 week ago

Duplicate of https://github.com/cachix/devenv/issues/75?

There's no solution to this. Service modules are currently "duplicated" across NixOS, nix-darwin, home-manager, devenv, and so on. It would be great to eventually have an all-encompassing service spec, where we would have a unified service interface with different implementations for each environment. But, as you can imagine, this would require a colossal RFC and cooperation/compliance from all of the stakeholders.

sandydoo commented 1 week ago

Link to NixOS RFC: https://github.com/NixOS/rfcs/pull/163

domenkozar commented 2 days ago

This can't work :)