-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
72 lines (63 loc) · 2.52 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
description = "C and Python code to build Julia and Mandelbrot sets.";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
dependencies = with pkgs; [ ]; # Input the build dependencies here
in
{
packages.juliac = pkgs.stdenv.mkDerivation {
name = "juliac";
src = ./src;
buildInputs = [ pkgs.libpng ];
buildPhase = "gcc julia.c -o juliac -lm";
installPhase = ''
mkdir -p $out/bin
cp juliac $out/bin
'';
};
packages.juliamandelpy = pkgs.stdenv.mkDerivation {
pname = "juliamandelpy";
version = "0.0.1";
src = ./src;
buildInputs = [ (pkgs.python39.buildEnv.override {
extraLibs = with pkgs.python39Packages; [ ipython pillow ]; } ) ];
buildPhase = "chmod +x juliamandel.py";
installPhase = ''
mkdir -p $out/bin
cp juliamandel.py $out/bin/juliamandelpy
'';
};
packages.tweet = pkgs.stdenv.mkDerivation {
name = "tweet";
src = ./src;
buildInputs = [ (self.packages.${system}.juliac) (pkgs.python39.buildEnv.override {
extraLibs = with pkgs.python39Packages; [ ipython pillow tweepy ]; } ) ];
buildPhase = ''
substituteInPlace ./tweet.py \
--replace 'os.path.isfile("{0}/julia.out".format(path)) == ' ' ' \
--replace '{0}/julia.out' '${self.packages.${system}.juliac}/bin/juliac'
chmod +x tweet.py
'';
installPhase = ''
mkdir -p $out/bin
cp tweet.py $out/bin/tweet
'';
};
defaultPackage = self.packages.${system}.juliac;
devShell = pkgs.mkShell {
inputsFrom = [ self.packages.${system}.juliac
# self.packages.${system}.juliamandelpy
self.packages.${system}.tweet
];
buildInputs = with pkgs;
[ clang-tools
];
};
}
);
}