commit b556e76ed936e26f2b8b0c131060934f79291e4c
parent 871241456540aad5ef2854e3a7ce9dd1fc6c871d
Author: Jared Tobin <jared@jtobin.io>
Date: Wed, 31 May 2023 12:11:29 +0400
Basic nix skeleton.
Diffstat:
4 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,12 +1,4 @@
-rust_intro
-probs
-bin
-target
-*.swp
-*.o
-*.hi
-etc/working
-deprecated
-/target/
-**/*.rs.bk
-Cargo.lock
+.cabal-sandbox
+cabal.sandbox.config
+dist-newstyle
+*swp
diff --git a/README.md b/README.md
@@ -2,10 +2,6 @@
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jtobin/cryptopals/blob/master/LICENSE)
-Matasano's [cryptopals challenges](http://cryptopals.com/), implemented mainly
-in [Rust](https://www.rust-lang.org) and [Haskell](https://haskell-lang.org/)
-(with plenty of help from bash and friends).
-
## Problems
* [Problem Set 1](docs/s1.md)
diff --git a/default.nix b/default.nix
@@ -0,0 +1,34 @@
+let
+ revision = "813836d64";
+
+ tarball = owner: repo: rev:
+ builtins.fetchTarball {
+ url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
+ };
+
+ compilerSet = pkgs.haskell.packages."ghc902";
+
+ pkgs = import (tarball "NixOS" "nixpkgs" revision) { inherit config; };
+ ignore = pkgs.nix-gitignore.gitignoreSourcePure;
+
+ config = {
+ packageOverrides = super: let self = super.pkgs; in rec {
+ haskell = super.haskell // {
+ packageOverrides = self: super: {
+ cryptopals = super.callCabal2nix "cryptopals"
+ (ignore [./.gitignore] ./.) {};
+ };
+ };
+ };
+ };
+
+in
+ {
+ inherit pkgs;
+ shell = compilerSet.shellFor {
+ packages = p: [p.cryptopals];
+ buildInputs = with pkgs; [
+ compilerSet.cabal-install
+ ];
+ };
+ }
diff --git a/shell.nix b/shell.nix
@@ -0,0 +1 @@
+(import ./default.nix).shell