KaC
KaC

Reputation: 613

Can a service be run in nix-shell

I work under NixOS, and I love it so far.

For my coding projects, I'm trying to achieve separate development environments. So for example for my Scala/node.js project, I have written default.nix for nix-shell :

with import <nixpkgs> {}; {
    tarifs2Env = stdenv.mkDerivation {
        name = "webapp";
        buildInputs = with pkgs; [ 
            sbt 
            nodejs
            nodePackages.gulp
        ];

        shellHook = ''
        '';
    };
}

So far so good. Now I would like to add a database, posgtres for example. Is there a way to add a service to a nix-shell?

Upvotes: 11

Views: 2956

Answers (1)

brocking
brocking

Reputation: 831

I think https://github.com/chrisfarms/nixos-shell should do exactly what you're after. I've not used it myself but as I understand it works by taking a configuration.nix that describes the service(s) that you want then builds the config in an ephemeral NixOS container and drops you into a shell in the container.

Upvotes: 7

Related Questions