summaryrefslogtreecommitdiff
path: root/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix89
1 files changed, 49 insertions, 40 deletions
diff --git a/default.nix b/default.nix
index cceeb50..566e710 100644
--- a/default.nix
+++ b/default.nix
@@ -1,44 +1,53 @@
+{ nixpkgs ? import <nixpkgs> {}, compiler ? "default", doBenchmark ? false }:
+
let
- sources = import ./nix/sources.nix {};
- haskellNix = import sources.haskellNix {};
- # Import nixpkgs and pass the haskell.nix provided nixpkgsArgs
- pkgs = import
- # use haskell.nix's nixpkgs, which may (?) have more substitutes available
- haskellNix.sources.nixpkgs-unstable
- # args for nixpkgs; includes the haskell.nix overlay
- (haskellNix.nixpkgsArgs // {
- system = "x86_64-linux";
- });
+ inherit (nixpkgs) pkgs;
+
+ f = { mkDerivation, aeson, aeson-pretty, async, base, base-compat
+ , base64-bytestring, bytestring, containers, cryptohash-sha1
+ , deepseq, directory, dotgen, either, extra, filepath, fmt
+ , getopt-generics, hpack, http-client, http-types, lib, lucid
+ , microlens-platform, monad-logger, network-uri, process
+ , regex-tdfa, servant, servant-client, servant-lucid
+ , servant-server, servant-websockets, stm, template-haskell, text
+ , text-metrics, time, tomland, transformers, universum, uri-encode
+ , uuid, vector, wai, wai-extra, warp, websockets
+ }:
+ mkDerivation {
+ pname = "walint";
+ version = "0.1";
+ src = ./.;
+ isLibrary = true;
+ isExecutable = true;
+ libraryHaskellDepends = [
+ aeson base bytestring containers deepseq dotgen either extra
+ filepath getopt-generics network-uri regex-tdfa text text-metrics
+ transformers universum uri-encode vector
+ ];
+ libraryToolDepends = [ hpack ];
+ executableHaskellDepends = [
+ aeson aeson-pretty async base base-compat base64-bytestring
+ bytestring containers cryptohash-sha1 directory extra filepath fmt
+ getopt-generics http-client http-types lucid microlens-platform
+ monad-logger process servant servant-client servant-lucid
+ servant-server servant-websockets stm template-haskell text time
+ tomland universum uuid wai wai-extra warp websockets
+ ];
+ doHaddock = false;
+ prePatch = "hpack";
+ homepage = "https://stuebinm.eu/git/walint";
+ license = "unknown";
+ hydraPlatforms = lib.platforms.none;
+ };
+
+ haskellPackages = if compiler == "default"
+ then pkgs.haskellPackages
+ else pkgs.haskell.packages.${compiler};
+
+ variant = if doBenchmark then pkgs.haskell.lib.doBenchmark else pkgs.lib.id;
+
+ drv = variant (haskellPackages.callPackage f {});
- drvs = pkgs.haskell-nix.project {
- # 'cleanGit' cleans a source directory based on the files known by git
- src = pkgs.haskell-nix.haskellLib.cleanGit {
- src = ./.;
- name = "walint";
- };
- modules = [{
- packages.walint.components.exes = {
- # don't include gcc or ghc in the dependency closure …
- walint-server.dontStrip = false;
- walint.dontStrip = false;
- };
- }];
- stack-sha256 = "0bp3dwj2kl6n0swz5yf9kjy5ahp6i5qrnb39hkrsqgf0682i9nk1";
- };
in
-{
- walint = drvs.walint.components.exes.walint;
- walint-server = pkgs.stdenvNoCC.mkDerivation {
- name = "walint-server-with-assets";
- src = drvs.walint.components.exes.walint-mapserver;
- phases = [ "buildPhase" ];
- buildPhase = ''
- mkdir -p $out
- cp -r $src/* $out
- cp -r ${pkgs.copyPathToStore ./static} $out/static
- cp ${pkgs.copyPathToStore ./config.json} $out/config.json
- cp ${pkgs.copyPathToStore ./config.toml} $out/config.toml
- '';
- };
-}
+ drv