-
-
Save cleverca22/31bed88a5e903d55a040eb068c8c93bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 { | |
inherit rubyenv; | |
wrapper = writeScript "wrapper" '' | |
#!/bin/sh | |
exec ${rubyenv}/bin/bundle exec foreman start -p 5001 | |
''; | |
cart = stdenv.mkDerivation { | |
name = "cart"; | |
version = "0.0.1"; | |
buildInputs = [ | |
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} | |
''; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# home-manager config | |
{ | |
systemd.user.services.cart = { | |
Unit = { | |
Description = "Cart"; | |
}; | |
Service = { | |
WorkingDirectory = "/home/jon/dev/cart"; | |
ExecStart = "${(import ./default.nix).wrapper}"; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment