summaryrefslogtreecommitdiffstats
path: root/default.nix
blob: d46f9d8f92ccf21d3c9a70371f45c80a1751b305 (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
{
  nixpkgs ? <nixpkgs>,

  kasyncSrc ? nixpkgs.fetchgit {
    url = "https://anongit.kde.org/kasync.git";
    rev = "8a68ad7da7f9d7d10d249a16a474fa7ca82517be";
    sha256 = "1v55my24d3zhllw77sjzngs6cwddjqf9xw9v0hkwk2gq2znwp6g8";
    fetchSubmodules = true;
  },

  kimap2Src ? nixpkgs.fetchgit {
    url = "https://anongit.kde.org/kimap2.git";
    rev = "62df1b858b3fd7c6c4b3229ff5051c0e4996b1be";
    sha256 = "1q43dzza1v5kjsvzisw5j2750550596s6hra45xbqny08hkpk355";
    fetchSubmodules = true;
  },

  kdav2Src ? nixpkgs.fetchgit {
    url = "https://anongit.kde.org/kdav2.git";
    rev = "830f07b99dc8badf5df40edb81cbac63a3ddb3c4";
    sha256 = "1da6ivjjq9bh855jiv0kzxi83z736iazn747gkaj261ai8qn7spz";
    fetchSubmodules = true;
  },

  sinkSrc ? nixpkgs.fetchgit {
    url = "https://github.com/KDE/sink";
    rev = "e1a6d6f5bbaeeffd92a2049849b75e248c2d492b";
    sha256 = "196vqd7gk93mfizxnfz918rs5g3723ndarx79x84q8qvk7bngc0v";
    fetchSubmodules = true;
  },

  kubeSrc,

  compiler ? "gcc7",
  cmakeBuildType ? "Debug"
}:

let
  pkgs = import nixpkgs {};
  stdenv = pkgs.overrideCC pkgs.stdenv pkgs.${compiler};

in rec {
    kasync = stdenv.mkDerivation {
        name = "kasync";
        nativeBuildInputs = with pkgs; [ cmake ninja ccache ];
        buildInputs = with pkgs; with qt5;
        [ extra-cmake-modules qtbase ];

        src = kasyncSrc;

        inherit cmakeBuildType;
    };

    kimap2 = stdenv.mkDerivation {
        name = "kimap2";
        nativeBuildInputs = with pkgs; [ cmake ninja ccache ];
        buildInputs = with pkgs; with qt5; with kdeFrameworks;
        [ extra-cmake-modules qtbase kcoreaddons kcodecs kdeApplications.kmime cyrus_sasl ];

        src = kimap2Src;

        inherit cmakeBuildType;
    };

    kdav2 = stdenv.mkDerivation {
        name = "kdav2";
        nativeBuildInputs = with pkgs; [ cmake ninja ccache ];
        buildInputs = with pkgs; with qt5; with kdeFrameworks;
        [ extra-cmake-modules qtbase qtxmlpatterns kcoreaddons ];

        src = kdav2Src;

        inherit cmakeBuildType;
    };

    sink = stdenv.mkDerivation {
        name = "sink";
        nativeBuildInputs = with pkgs; [ cmake ninja ccache ];
        buildInputs = with pkgs; with qt5; with kdeApplications;
        [
            extra-cmake-modules kmime kcontacts kcalcore
            flatbuffers lmdb xapian cyrus_sasl curl libgit2 readline
            qtbase

            kasync kimap2 kdav2
        ];

        cmakeFlags = [
            "-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always"
            "-DCMAKE_EXPORT_COMPILE_COMMANDS=1"
        ];

        postInstall = ''
          mkdir -p $out/tests
          cp ./tests/clientapitest ./tests/resourceconfigtest ./tests/storagetest ./tests/domainadaptortest ./tests/messagequeuetest ./tests/indextest ./tests/resourcecommunicationtest ./tests/pipelinetest ./tests/querytest ./tests/modelinteractivitytest ./tests/inspectiontest ./tests/accountstest ./tests/testaccounttest ./tests/dummyresourcemailtest ./tests/interresourcemovetest ./tests/notificationtest ./tests/entitystoretest ./tests/upgradetest ./tests/resourcecontroltest ./tests/dummyresourcetest $out/tests
        '';

        src = sinkSrc;
        inherit cmakeBuildType;
    };

    sinkTest = pkgs.runCommand "sinkTest"
      { buildInputs = [ sink ]; }
      ''
      export HOME="$(mktemp -d)"
      cd "${sink}"
      ./tests/clientapitest &&
        ./tests/resourceconfigtest &&
        ./tests/storagetest &&
        ./tests/domainadaptortest &&
        ./tests/messagequeuetest &&
        ./tests/indextest &&
        ./tests/resourcecommunicationtest &&
        ./tests/pipelinetest &&
        ./tests/querytest &&
        ./tests/modelinteractivitytest &&
        ./tests/inspectiontest &&
        ./tests/accountstest &&
        ./tests/testaccounttest &&
        ./tests/dummyresourcemailtest &&
        ./tests/interresourcemovetest &&
        ./tests/notificationtest &&
        ./tests/entitystoretest &&
        ./tests/upgradetest &&
        ./tests/resourcecontroltest &&
        ./tests/dummyresourcetest
      ret=$?
      rm -rf $HOME
      return $ret
    '';

    kube = stdenv.mkDerivation {
        name = "kube";
        nativeBuildInputs = with pkgs; [ cmake ninja ccache ];
        buildInputs = with pkgs; with qt5; with kdeFrameworks; with kdeApplications; with libsForQt5;
        [
            extra-cmake-modules kcalcore kcodecs kcontacts kmime
            qtbase qtquickcontrols2 qtwebengine qgpgme

            sink kasync
        ];

        CCACHE_COMPRESS = 1;
        CCACHE_DIR = "/var/cache/ccache";
        CCACHE_UMASK = "007";

        cmakeFlags = [
            #"-DCMAKE_CXX_COMPILER_LAUNCHER=${pkgs.ccache}/bin/ccache"
            "-DCMAKE_CXX_FLAGS=-fdiagnostics-color=always"
            "-DCMAKE_EXPORT_COMPILE_COMMANDS=1"
        ];

        dontStrip = if (cmakeBuildType == "Debug") then 1 else 0;

        src = kubeSrc;

        inherit cmakeBuildType;
    };
}