Skip to content

Instantly share code, notes, and snippets.

@emptyflask
Created June 3, 2019 05:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emptyflask/30cb1803db7be36a343c09c13eaf9fac to your computer and use it in GitHub Desktop.
Save emptyflask/30cb1803db7be36a343c09c13eaf9fac to your computer and use it in GitHub Desktop.
# in rails project
with (import <nixpkgs> {});
let
rubyenv = bundlerEnv {
name = "cart-env";
# Setup for ruby gems using bundix generated gemset.nix
inherit ruby_2_6;
gemfile = ./Gemfile;
lockfile = ./Gemfile.lock;
gemset = ./gemset.nix;
# Bundler groups available in this environment
groups = ["default" "development" "test" "toolbox"];
};
in stdenv.mkDerivation {
name = "cart";
version = "0.0.1";
buildInputs = [
stdenv
git
# Ruby deps
ruby_2_6.devEnv
bundler
bundix
# Rails deps
clang
libxml2
libxslt
nodejs
openssl
postgresql_10
readline
zlib
];
shellHook = ''
export LIBXML2_DIR=${pkgs.libxml2}
export LIBXSLT_DIR=${pkgs.libxslt}
'';
}
# home-manager config
{
systemd.user.services.cart = {
Unit = {
Description = "Cart";
};
Service = {
WorkingDirectory = "/home/jon/dev/cart";
ExecStart = "nix-shell --run 'bundle exec foreman start -p 5001'";
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment