Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Last active May 13, 2020 03:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cleverca22/5786bf2ecccaf7424331ce29c0c235e1 to your computer and use it in GitHub Desktop.
Save cleverca22/5786bf2ecccaf7424331ce29c0c235e1 to your computer and use it in GitHub Desktop.
let
pkgs = import <nixpkgs> {};
img2ascii-src = pkgs.fetchFromGitHub {
owner = "Drezil";
repo = "img2ascii";
rev = "f60ab724b7af7f5a413ed2e700a22cfe3387cf4a";
sha256 = "0xqgq38w18mf4ljkyn44zw0vnbci2agq0s9qvw6rirbw42ksiqsj";
};
source = builtins.toFile "example.hs" ''
module Main (main) where
main :: IO ()
main = putStrLn "hello world";
'';
ghcWithStuff = pkgs.haskellPackages.ghcWithPackages (hsPkgs: [ hsPkgs.JuicyPixels hsPkgs.optparse-applicative ]);
in rec {
hello-world = builtins.derivation {
system = builtins.currentSystem;
name = "raw-ghc";
builder = "${pkgs.haskellPackages.ghc}/bin/ghc";
args = [ source "-threaded" "-o" "${builtins.placeholder "out"}" ];
};
roseJpg = pkgs.fetchurl {
url = "https://images.homedepot-static.com/productImages/e350ef76-f7ff-46ee-83d2-606aab23453c/svn/mea-nursery-rose-bushes-62014-64_1000.jpg";
sha256 = "11abhkr7njl04wr2a8bd3vsyvn5mj9qcgiwcs1rdjkj1nksb5z8p";
};
img2ascii = builtins.derivation {
system = builtins.currentSystem;
name = "img2ascii";
builder = "${ghcWithStuff}/bin/ghc";
args = [ "${img2ascii-src}/src/Main.hs" "-threaded" "-o" "${builtins.placeholder "out"}" "-hidir" "/build" "-odir" "/build" ];
};
rose-art = builtins.derivation {
system = builtins.currentSystem;
name = "rose-art";
builder = "${img2ascii}";
args = [ roseJpg "128" "128" ];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment