Closed shishkin closed 3 weeks ago
Please use flake template from the documentation
To avoid cargo-culting, would you mind pointing out to the significant difference that I missed?
Ok, I figured it out after blending the template with my setup. I just missed the devenv-up
package. It was present in the template, but absent in the docs.
Here is a full working example in case anyone finds it useful:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
devenv.url = "github:cachix/devenv";
devenv.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{ self, nixpkgs, devenv, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in {
packages = {
devenv-up = self.devShells.${system}.default.config.procfileScript;
};
devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [{
services.postgres = {
enable = true;
initialDatabases = [{ name = "postgres"; }];
};
}];
};
});
}
I'm trying to setup a dev shell with a postgres service. I'm using flake-utils, but otherwise tried to follow the devenv flake guidance. I also have direnv, which has
use flake . --impure
line.When direnv activates the shell there is no postgres running and
devenv up
complains that my flake doesn't providedevenv-up
. What am I doing wrong?Here is my flake: