blob: 94e1edbb94a5b94fb4403ab296ef78069209e0f3 (
plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
{
description = "build dummy D package using dub build tool";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = {
self,
nixpkgs,
flake-utils,
} @ inputs: let
pname = "dummy";
version = "0.1.0";
shell = ./shell.nix;
devEnv = ./nixDevEnv.sh; # ./.envrc;
supportedSystems = ["x86_64-linux"]; # [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs {inherit system;});
checkPhase = ''
runHook preCheck
#dub test --combined --skip-registry=all
runHook postCheck
'';
localOverlay = (final: prev: {
ldc = prev.callPackage ./nix-overlays/ldc { }; # -> ok 1.38.0
dmd = prev.callPackage ./nix-overlays/dmd { }; # -> ok 2.108.0
dub = prev.callPackage ./nix-overlays/dub { }; # -> ? 1.36.0
dtools = prev.callPackage ./nix-overlays/dtools { }; # -> ok 2.103.1
#gdc = prev.callPackage ./nix-overlays/gdc { }; # empty
});
pkgsForSystem = system: import nixpkgs {
overlays = [
localOverlay
];
inherit system;
};
installPhase = ''
runHook preInstall
mkdir -p $out/bin
install -m755 ./bin/dummy $out/bin/dummy
runHook postInstall
'';
postInstall = ''
echo `ls -la $out/bin/dummy`
$out/bin/dummy -v
'';
in {
packages = forAllSystems (system: let
pkgs-ovl = pkgsForSystem system;
pkgs-nix = nixpkgsFor.${system};
in
with pkgs-ovl; {
default = tilix;
check-tilix = tilix;
check-local-dir-build = stdenv.mkDerivation {
inherit pname;
inherit version;
meta.mainProgram = "dummy";
executable = true;
src = self;
inherit shell;
inherit devEnv;
buildInputs = [sqlite];
nativeBuildInputs = [dub ldc gnumake]; # [ dub dmd ]; [ dub ldc ]; [ dub gdc ];
buildPhase = ''
runHook preBuild
for DC_ in dmd ldmd2 ldc2 gdc gdmd; do
echo "- check for D compiler $DC_"
DC=$(type -P $DC_ || echo "")
if [ ! "$DC" == "" ]; then break; fi
done
if [ "$DC" == "" ]; then exit "Error: could not find D compiler"; fi
echo "$DC_ used as D compiler to build $pname"
dub build --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all
runHook postBuild
'';
inherit checkPhase;
inherit installPhase;
inherit postInstall;
};
});
devShells = forAllSystems (system: let
pkgs-ovl = pkgsForSystem system;
pkgs-nix = nixpkgsFor.${system};
shellHook = ''
'';
in
with pkgs-ovl; {
dsh-overlay-dtools = mkShell {
name = "overlay - ldc-1.38.0 - dub-1.36.0 - dtools-2.103.1";
inherit shell;
inherit devEnv;
packages = [
gnumake
ldc
dub
dtools
];
inherit shellHook;
};
dsh-overlay-ldc-dub = mkShell {
name = "overlay - ldc-1.38.0 - dub-1.36.0";
inherit shell;
inherit devEnv;
packages = [
gnumake
ldc
dub
];
inherit shellHook;
};
dsh-overlay-dmd-dub = mkShell {
name = "overlay - dmd-2.108.0 - dub-1.36.0";
inherit shell;
inherit devEnv;
packages = [
gnumake
dmd
dub
];
inherit shellHook;
};
dsh-overlay-dtest-tilix = mkShell {
name = "overlay - ldc-1.38.0 - dub-1.36.0 - tilix - gtkd";
inherit shell;
inherit devEnv;
packages = [
gnumake
ldc
gtkd
tilix
dub
];
inherit shellHook;
};
#dsh-overlay-gdc = mkShell {
# name = "dub + gdc dev shell";
# inherit shell;
# inherit devEnv;
# packages = [
# gnumake
# gdc
# dub
# ];
# inherit shellHook;
#};
dsh-nixpkgs-ldc-dub = mkShell {
name = "nixpkgs - ldc - dub";
inherit shell;
inherit devEnv;
packages = with pkgs-nix; [
ldc
dub
gnumake
];
inherit shellHook;
};
dsh-nixpkgs-dmd-dub = mkShell {
name = "nixpkgs - ldc - dub";
inherit shell;
inherit devEnv;
packages = with pkgs-nix; [
dmd
dub
gnumake
];
inherit shellHook;
};
default = import ./shell.nix {inherit pkgs-nix;};
});
};
}
|