-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathflake.nix
71 lines (63 loc) · 2.58 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
{
description = "UPPAAL Timed Automata Parser";
inputs.nixpkgs.url = "nixpkgs/master";
outputs = { self, nixpkgs }:
let
# System types to support.
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
# Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
# Nixpkgs instantiated for supported system types.
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
crossNixpkgsFor = forAllSystems (system: import nixpkgs {
inherit system;
crossSystem = (nixpkgsFor.${system}).lib.systems.examples.mingwW64;
});
version = "1.1.2";
in
{
defaultPackage = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
staticLibxml = pkgs.libxml2.override { enableStatic = true; };
in
pkgs.stdenv.mkDerivation {
pname = "UTAP";
inherit version;
src = ./.;
nativeBuildInputs = with pkgs; [ cmake flex bison ];
buildInputs = with pkgs; [ staticLibxml doctest ];
cmakeFlags = [ "-DTESTING=ON" ];
doCheck = true;
});
devShell = forAllSystems (system:
let
pkgs = nixpkgsFor.${system};
in
pkgs.mkShell {
nativeBuildInputs = with pkgs; [ cmake flex bison ];
buildInputs = with pkgs; [ libxml2 doctest ];
});
# To build this, use `nix build .\#utapWindows.x86_64-linux`
# Unless you're using a different OS
utapWindows = forAllSystems (system:
let
nativePkgs = nixpkgsFor.${system};
pkgs = crossNixpkgsFor.${system};
staticLibxml = pkgs.libxml2.override { enableStatic = true; enableShared = false; };
in
pkgs.stdenv.mkDerivation {
pname = "UTAP";
inherit version;
src = ./.;
nativeBuildInputs = with nativePkgs; [ cmake flex bison ];
buildInputs = with pkgs; [ staticLibxml zlib.static doctest ];
cmakeFlags = [ "-DTESTING=ON" "-DSTATIC=ON" "-DCMAKE_TOOLCHAIN_FILE=toolchain/win64.cmake" ];
WINEPATH = "${pkgs.windows.mcfgthreads}/bin;${nativePkgs.wine64Packages.stableFull}/lib/wine/x86_64-windows/";
CROSSCOMPILING_EMULATOR = "${nativePkgs.wine64Packages.stableFull}/bin/wine64";
# mkDerivation disables checkPhase when cross compiling.
postPhases = [ "crossCheck" ];
crossCheck = "WINEPREFIX=$(pwd) ctest --output-on-failure";
});
};
}