Skip to content

Instantly share code, notes, and snippets.

@kgadek
kgadek / nix.rb
Created October 14, 2014 01:01
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"
@kgadek
kgadek / nix.rb
Last active August 29, 2015 14:07
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"
def remove_all_of_haskell(noninteractive=False):
with _section("Finding all haskell artifacts..."):
remove = [
"~/.flowbox"
]
remove.extend(
local("find /usr/bin /usr/local/bin -type l | xargs -If sh -c '/bin/echo -n f /; readlink f' | egrep '//Library/(Haskell|Frameworks/(GHC|HaskellPlatform).framework)' | awk '{print $1}'",
capture=True)
.split("\n")
❯ pwd
~/tmp/hprotoc-2.0.15
❯ cabal install
Resolving dependencies...
Configuring protocol-buffers-descriptor-2.0.14...
Building protocol-buffers-descriptor-2.0.14...
Installed protocol-buffers-descriptor-2.0.14
Configuring hprotoc-2.0.15...
Building hprotoc-2.0.15...
@kgadek
kgadek / prisms.hs
Created July 30, 2014 11:26
question on lenses/prisms
{-# LANGUAGE TemplateHaskell #-}
import Control.Lens
import Test.Hspec
import Control.Monad
data Gene = X {_ident::Int, _xx::String} | Y {_ident::Int, _yy::Char}
makeLenses ''Gene
makePrisms ''Gene
[root@cbeff4f8926d bla]# cabal sandbox init
Writing a default package environment file to /root/bla/cabal.sandbox.config
Creating a new sandbox at /root/bla/.cabal-sandbox
[root@cbeff4f8926d bla]# cabal install protocol-buffers==2.0.14
Resolving dependencies...
Notice: installing into a sandbox located at /root/bla/.cabal-sandbox
Configuring syb-0.4.2...
Configuring utf8-string-0.3.8...
Building utf8-string-0.3.8...
Building syb-0.4.2...
[root@cbeff4f8926d flowbox-env]# ./bootstrap.py ../flowbox
Working in /data/slave/flowbox_builder__GHC_7_8_3_/flowbox-env/dist/tmp
Downloading ghc (http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-x86_64-unknown-linux.tar.bz2)
File /data/slave/flowbox_builder__GHC_7_8_3_/flowbox-env/dist/tmp/ghc-7.6.3-x86_64-unknown-linux.tar.bz2 already exists. Skipping download.
Extracting ghc
File /data/slave/flowbox_builder__GHC_7_8_3_/flowbox-env/dist/tmp/ghc-7.6.3/LICENSE already exists. Skipping extraction.
Target ghc seems to be installed in /data/slave/flowbox_builder__GHC_7_8_3_/flowbox-env/dist/linux-x86_64/base. Skipping installation process.
Recaching local package db at '/root/.flowbox/pkgDb'
Recaching global package db at '/data/slave/flowbox_builder__GHC_7_8_3_/flowbox-env/dist/linux-x86_64/global/pkgDb'
Compiling all flowbox packages
Building flowbox-graphics-0.14.0.0...
Failed to install flowbox-graphics-0.14.0.0
Last 10 lines of the build log ( /Users/konrad/.cabal/logs/flowbox-graphics-0.14.0.0.log ):
(and originally defined in `Control.Monad.Trans.Class')
src/Flowbox/Graphics/Color/CMY/Accelerate.hs:48:89:
Ambiguous occurrence `lift'
It could refer to either `Data.Array.Accelerate.lift',
imported from `Data.Array.Accelerate' at src/Flowbox/Graphics/Color/CMY/Accelerate.hs:15:1-34
(and originally defined in `accelerate-0.14.0.0:Data.Array.Accelerate.Prelude')
@kgadek
kgadek / gist:3b002e1212317e2a4e35
Created July 28, 2014 23:40
Installing arithmoi in fresh sandbox
Resolving dependencies...
Configuring random-1.0.1.1...
Building random-1.0.1.1...
Preprocessing library random-1.0.1.1...
[1 of 1] Compiling System.Random ( System/Random.hs, dist/dist-sandbox-f730ba9d/build/System/Random.o )
[1 of 1] Compiling System.Random ( System/Random.hs, dist/dist-sandbox-f730ba9d/build/System/Random.p_o )
In-place registering random-1.0.1.1...
Running Haddock for random-1.0.1.1...
Preprocessing library random-1.0.1.1...
Haddock coverage:
def get_fresh_flowbox():
with _section("Getting repositories"):
for repo in ["flowbox", "flowbox-env"]:
if not exists(repo):
local(_f("git clone git@github.com:wdanilo/{repo}.git"))
elif not isdir(repo):
abort(_f("path {repo} exists but does not look like a repository"))
with _section("Preparing flowbox - disabling CUDA", local_directory="flowbox"):
result = _local_withstdin("patch -u -p1 -N", patch_nocuda, noerror=True)