summaryrefslogtreecommitdiff
path: root/default.nix
diff options
context:
space:
mode:
authorstuebinm2022-02-12 21:29:07 +0100
committerstuebinm2022-03-19 19:26:32 +0100
commit7c9614d0397b9b58dc29775ac3c8057bff9c876b (patch)
tree6e12629e18469983063e51319e4850ba0be034e9 /default.nix
parent4017daeae6e22067f687e7e0edb072e5f7808627 (diff)
add haskell.nix build system
it's an annoying blockchain company, but apparently that thing is the only usable option to build stack things with nix without having to redefine all the (outdated) haskell packages in nixpkgs?
Diffstat (limited to 'default.nix')
-rw-r--r--default.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..deea282
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,42 @@
+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"; });
+
+ 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 = "16ilij2cygmwbdmjdzj6yl4yv7zi4qzwg7rxkxgp0hbjpkz6n42y";
+ };
+in
+{
+ walint = drvs.walint.components.exes.walint;
+ walint-server = pkgs.stdenvNoCC.mkDerivation {
+ name = "walint-server-with-assets";
+ src = drvs.walint.components.exes.walint-server;
+ 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
+ '';
+ };
+}