-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshell.nix
42 lines (37 loc) · 915 Bytes
/
shell.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
let
pkgs = import <nixpkgs> {};
lib = pkgs.lib;
stdenv = pkgs.stdenv;
in stdenv.mkDerivation rec {
name = "confctl-shell";
buildInputs = with pkgs; [
git
ncurses
nix-prefetch-git
openssl
ruby
];
shellHook = ''
CONFCTL="${toString ./.}"
BASEDIR="$(realpath `pwd`)"
export GEM_HOME="$(pwd)/.gems"
BINDIR="$(ruby -e 'puts Gem.bindir')"
mkdir -p "$BINDIR"
export PATH="$BINDIR:$PATH"
export RUBYLIB="$GEM_HOME:$CONFCTL/lib"
export MANPATH="$CONFCTL/man:$(man --path)"
gem install --no-document bundler overcommit rubocop
pushd "$CONFCTL"
bundle install
bundle exec rake md2man:man
popd
cat <<EOF > "$BINDIR/confctl"
#!${pkgs.ruby}/bin/ruby
ENV['BUNDLE_GEMFILE'] = "$CONFCTL/Gemfile"
require 'bundler'
Bundler.setup
load File.join('$CONFCTL', 'bin/confctl')
EOF
chmod +x "$BINDIR/confctl"
'';
}