summaryrefslogtreecommitdiffhomepage
path: root/dlang/flake.nix
diff options
context:
space:
mode:
Diffstat (limited to 'dlang/flake.nix')
-rw-r--r--dlang/flake.nix49
1 files changed, 49 insertions, 0 deletions
diff --git a/dlang/flake.nix b/dlang/flake.nix
new file mode 100644
index 0000000..954cad9
--- /dev/null
+++ b/dlang/flake.nix
@@ -0,0 +1,49 @@
+{
+ description = "ocda-lib: the object-centric document abstraction as a D library";
+
+ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+
+ outputs = { self, nixpkgs }:
+ let
+ system = "x86_64-linux"; # adjust for aarch64-linux / darwin
+ pkgs = import nixpkgs { inherit system; };
+
+ /* A library, so there is nothing to install as a binary. What is
+ built here is the agreement check, which is the library's own
+ reason to exist put to the question: load a document's .ssp and
+ its .ocda.db and compare the two models.
+ */
+ mkAgree = { compiler, compilerBin }: pkgs.stdenv.mkDerivation {
+ pname = "ocda-lib-agree";
+ version = "0.1.0";
+ src = self;
+ nativeBuildInputs = [ compiler ];
+ buildInputs = [ pkgs.sqlite ];
+ buildPhase = ''
+ runHook preBuild
+ export HOME=$TMPDIR
+ ${compilerBin} -I=src -of=agree src/ocda/*.d test/agree.d -L-lsqlite3
+ runHook postBuild
+ '';
+ installPhase = ''
+ runHook preInstall
+ mkdir -p $out/bin
+ install -m755 agree $out/bin/ocda-agree
+ runHook postInstall
+ '';
+ meta = {
+ description = "checks that the .ssp and .ocda.db loaders give one model";
+ mainProgram = "ocda-agree";
+ };
+ };
+ in {
+ packages.${system} = {
+ default = self.packages.${system}.ocda-agree;
+ ocda-agree = mkAgree { compiler = pkgs.ldc; compilerBin = "ldmd2"; };
+ };
+
+ devShells.${system}.default = pkgs.mkShell {
+ packages = [ pkgs.ldc pkgs.dub pkgs.dtools pkgs.sqlite ];
+ };
+ };
+}