-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
40 lines (38 loc) · 1.17 KB
/
flake.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
{
description = "Applied cryptography - assignment 1, block ciphers and chaining modes";
inputs = {
nixpkgs.url = "github:cipharius/nixpkgs/static-haskell-patch";
};
outputs = { self, nixpkgs }: {
defaultPackage.x86_64-linux =
with import nixpkgs { system = "x86_64-linux"; };
stdenv.mkDerivation {
name = "hcrypter";
src = self;
isLibrary = false;
isExecutable = true;
enableSharedExecutables = false;
enableSharedLibraries = false;
buildInputs = [
(pkgsMusl.haskellPackages.ghcWithPackages (pkgs: with pkgs; [
bits-bytestring
bytestring
cryptonite
optparse-applicative
]))
];
buildPhase = ''ghc \
-optl=-static \
-Wall \
-Werror \
-L${pkgsMusl.gmp6.override { withStatic = true; }}/lib \
-L${pkgsMusl.zlib.static}/lib \
-L${pkgsMusl.libffi.overrideAttrs (old: { dontDisableStatic = true; })}/lib \
-o hcrypter \
-ilib \
./app/Main.hs
'';
installPhase = "mkdir -p $out/bin; install -t $out/bin hcrypter";
};
};
}