about summary refs log tree commit diff
path: root/users/Profpatsch/cas-serve/default.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2023-05-28T18·58+0200
committerclbot <clbot@tvl.fyi>2023-07-13T23·03+0000
commit8c4730c433ba01cb17aab2917d495d055c4f468e (patch)
tree0817b780ac451b91109771876805e7c0c5a93404 /users/Profpatsch/cas-serve/default.nix
parentee21f725a38855e43fd8e82eb8c6c6fc99aca235 (diff)
chore(users/Profpatsch/*): more cabal maintenance r/6409
Change-Id: Ib1714abce2815873eb50dbeac088e812fa9098ab
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8686
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Autosubmit: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/cas-serve/default.nix')
-rw-r--r--users/Profpatsch/cas-serve/default.nix41
1 files changed, 31 insertions, 10 deletions
diff --git a/users/Profpatsch/cas-serve/default.nix b/users/Profpatsch/cas-serve/default.nix
index 6e4bfd324233..1b4fbe03e78f 100644
--- a/users/Profpatsch/cas-serve/default.nix
+++ b/users/Profpatsch/cas-serve/default.nix
@@ -1,17 +1,38 @@
 { depot, pkgs, lib, ... }:
 
 let
-  cas-serve = pkgs.writers.writeHaskell "cas-serve"
-    {
-      libraries = [
-        pkgs.haskellPackages.wai
-        pkgs.haskellPackages.warp
-        pkgs.haskellPackages.sqlite-simple
-        depot.users.Profpatsch.my-prelude
-      ];
-      ghcArgs = [ "-threaded" ];
+  bins = depot.nix.getBins pkgs.sqlite [ "sqlite3" ];
 
-    } ./CasServe.hs;
+  cas-serve = pkgs.haskellPackages.mkDerivation {
+    pname = "cas-serve";
+    version = "0.1.0";
 
+    src = depot.users.Profpatsch.exactSource ./. [
+      ./cas-serve.cabal
+      ./CasServe.hs
+    ];
+
+    libraryHaskellDepends = [
+      pkgs.haskellPackages.pa-prelude
+      pkgs.haskellPackages.pa-label
+      pkgs.haskellPackages.ihp-hsx
+      pkgs.haskellPackages.wai
+      pkgs.haskellPackages.warp
+      pkgs.haskellPackages.sqlite-simple
+      depot.users.Profpatsch.arglib.netencode.haskell
+      depot.users.Profpatsch.netencode.netencode-hs
+    ];
+
+    isExecutable = true;
+    isLibrary = false;
+    license = lib.licenses.mit;
+  };
+
+  create-cas-database = depot.nix.writeExecline "create-cas-database" { readNArgs = 1; } [
+    bins.sqlite3
+    "$1"
+    "-init"
+    ./schema.sql
+  ];
 in
 cas-serve