Skip to content

Instantly share code, notes, and snippets.

@kgadek
Created October 14, 2014 01:01
Show Gist options
  • Save kgadek/80586b3b29344a1e59e7 to your computer and use it in GitHub Desktop.
Save kgadek/80586b3b29344a1e59e7 to your computer and use it in GitHub Desktop.
Works for me :)
require "formula"
# Documentation: https://github.com/Homebrew/homebrew/wiki/Formula-Cookbook
# /usr/local/Library/Contributions/example-formula.rb
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class Nix < Formula
homepage "http://nixos.org/nix"
url "http://nixos.org/releases/nix/nix-1.7/nix-1.7.tar.xz"
version "1.7"
sha1 "1948671fc60002fdde094beef72ff987333bfbc3"
depends_on 'bdw-gc'
depends_on 'sqlite'
depends_on 'xz'
depends_on 'libxml2'
depends_on 'libxslt'
depends_on 'bison'
depends_on 'flex'
depends_on 'pkg-config' => :build
depends_on 'perl' => :build
depends_on 'WWW::Curl' => :perl
depends_on 'DBD::SQLite' => :perl
def install
system "./configure", "--prefix=#{prefix}"
system "gnumake"
system "gnumake", "install"
(bin+'nix-init.sh').write <<-EOS.undent
#!/bin/bash
source #{prefix}/etc/profile.d/nix.sh
EOS
chmod 0775, bin+'nix-init.sh'
end
def caveats; <<-EOS.undent
You can use the 'nix-init.sh' script to prepare your shell environment.
You need to add the nixpkgs channel:
$ nix-init.sh
$ nix-channel --add http://nixos.org/channels/nixpkgs-unstable
$ nix-channel --update
EOS
end
test do
system "nix-env --help"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment