idempotent devshell ephemeral services
example | ||
.gitignore | ||
default.nix | ||
flake.nix | ||
ides.nix | ||
README.md |
ides
(idempotent devshell ephemeral services)
ides provides automatic idempotent launching of ephemeral services in your devshell, right here, right now.
what ?
it's automatic
- ides will instantly launch all your declared services, as soon as you enter the..
devshell
- works just like regular mkShell
- full support for
shell.nix
,flake.nix
, anddirenv
it's ephemeral
- ides packages and configs are present only in the nix store, and once shut down all traces effectively disappear
they're idempotent
- ides services cah only ever run one (1) instance of any package+config combination, regardless of how many times the devshell is opened, or the launch command invoked
they're services
- ides runs on systemd user services - no impostor process manager needed
the bottom line
your dev environment now includes your service dependencies!
how ?
here's how:
service configuration (caddy.nix)
{
pkg = pkgs.caddy;
args = "run -c %CFG% --adapter caddyfile";
config = ''
http://*:8080 {
respond "hello"
}
'';
}
we template the provided config into %CFG% so you can feed it to the service as needed
classic nix(tm)
let
pkgs = import <nixpkgs> {};
ides = import (fetchGit {
url = "https://git.atagen.co/atagen/ides";
});
mkShell = ides.use pkgs;
in
mkShell {
noCC = true;
services.caddy = import ./caddy.nix;
}
flake enjoyers
{
inputs = {
ides.url = "git+https://git.atagen.co/atagen/ides";
};
outputs = {
nixpkgs,
ides,
...
}: let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
mkShell = ides.lib.use pkgs;
in {
devShells.x86_64-linux.default = mkShell {
noCC = true;
services = {
caddy = import ./caddy.nix;
};
};
};
}
cli
in case you need manual control, an ides shell provides commands:
ides
: raise the service set manuallyet-tu
: shut down the service set manuallyrestart
: do both of the above in succession
why not reuse (nixpkgs/hm/...) module system ?
ides was originally conceived with this in mind, but in practice, it is rather difficult to decouple the module systems from the deployments they are intended to fulfill. occasional prodding is ongoing, and some activity appears to have begin in nixpkgs to modularise services, which would allow ides to take full advantage of the enormous nixos ecosystem.
acknowledgements
me the bald gang nixpkgs manual writers
devenv probably