about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-03-16 17:38:54 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2021-03-16 17:38:54 +0100
commitf482438f4166ab8b39a1f50cc601ef51a5e80576 (patch)
tree4abd36accf01866c1738cba594fab5a76d9c3897
parent8b80d140e3d1010b4a235cd4f5684c7dca3ee194 (diff)
feat(default.nix): build from sdist
This should allow CI to pick up on build issues we introduce by
forgetting to add stuff to extra-source-files.
-rw-r--r--default.nix25
1 files changed, 18 insertions, 7 deletions
diff --git a/default.nix b/default.nix
index cb28a45..c3eaf5d 100644
--- a/default.nix
+++ b/default.nix
@@ -1,5 +1,12 @@
 let pkgs = import <nixpkgs> {};
     hl = pkgs.haskell.lib;
+
+    src = builtins.path {
+      name = "spacecookie-source";
+      path = ./.;
+      filter = pkgs.nix-gitignore.gitignoreFilter (builtins.readFile ./.gitignore) ./.;
+    };
+
     profiled = pkgs.haskellPackages.override {
       overrides = self: super: {
         mkDerivation = args: super.mkDerivation (args // {
@@ -10,17 +17,21 @@ let pkgs = import <nixpkgs> {};
           (self.callPackage ./spacecookie.nix {})
           (drv: {
             version = "unstable";
-            src = builtins.path {
-              name = "spacecookie-source";
-              path = ./.;
-              filter = pkgs.nix-gitignore.gitignoreFilter (builtins.readFile ./.gitignore) ./.;
-            };
+            # build from sdist to make sure it isn't missing anything
+            src = pkgs.runCommandNoCC "spacecookie-sdist.tar.gz" {} ''
+              export HOME="$(mktemp -d)"
+              cd ${src}
+              ${self.cabal-install}/bin/cabal v2-sdist \
+                --builddir="$HOME/dist" --verbose=0 -o - > "$out"
+            '';
             # run integration test
             preCheck = ''
               export SPACECOOKIE_TEST_BIN=./dist/build/spacecookie/spacecookie
             '';
-            postCheck = ''
-              cat dist/test/spacecookie-*.log
+            # install man pages
+            postInstall = ''
+              install -Dm644 docs/man/*.1 -t "$out/share/man/man1"
+              install -Dm644 docs/man/*.5 -t "$out/share/man/man5"
             '';
           });
       };