8

我在 NixOS 下工作,到目前为止我很喜欢它。

对于我的编码项目,我正在尝试实现单独的开发环境。例如,对于我的 Scala/node.js 项目,我为 nix-shell 编写了 default.nix:

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

        shellHook = ''
        '';
    };
}

到目前为止,一切都很好。现在我想添加一个数据库,例如 posgtres。有没有办法向 nix-shell 添加服务?

4

1 回答 1

6

我认为https://github.com/chrisfarms/nixos-shell应该完全符合您的要求。我自己没有使用过它,但据我了解,它的工作原理是采用一个描述您想要的服务的 configuration.nix,然后在一个临时的 NixOS 容器中构建配置并将您放入容器中的 shell 中。

于 2016-09-26T09:49:34.500 回答