summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrsmidge <smidge@xsco.net>2019-06-30 22:53:19 +0200
committerGitHub <noreply@github.com>2019-06-30 22:53:19 +0200
commit1cc09f00b53dcea778f66f22f54335d157cfef3b (patch)
treeda52b6cee4057bdce09eabe479ceca84c759eec4
parent27365451266e44611497dbeac9f991a1a03dc024 (diff)
parentf1300f8255891bf1f1372a62cd6d9e0093ef9797 (diff)
Merge pull request #1 from haslersn/enhancement/add-default-nix
Add Nix expression
-rw-r--r--.gitignore2
-rw-r--r--README.md19
-rw-r--r--default.nix47
3 files changed, 68 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index db84c78..3379c6e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,5 @@ subprojects/*
# Helper for bear (b-ear)
compile_commands.json
+# direnv configuration file
+.envrc
diff --git a/README.md b/README.md
index e9be478..d7541ad 100644
--- a/README.md
+++ b/README.md
@@ -173,6 +173,25 @@ $ ninja -C build/ test (optional, run unit tests)
# ninja -C build/ install (as a suitably-privileged user)
```
+## With Nix
+
+When [Nix](http://nixos.org/nix) is installed, then you don't need to manually install any
+dependencies.
+`libdjinterop` can then simply be built with:
+
+```
+$ nix build
+```
+
+In order to drop into a development environment with dependencies available, execute:
+
+```
+$ nix-shell
+```
+
+You can then build `libdjinterop` by using Meson as described above.
+This is advantageous when developing since it only recompiles sources that it needs to.
+
Thanks To
=========
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..88c2fe4
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,47 @@
+with import <nixpkgs> {};
+
+let
+
+ git-clang-format = stdenv.mkDerivation {
+ name = "git-clang-format";
+ version = "2019-06-21";
+ src = fetchurl {
+ url = "https://raw.githubusercontent.com/llvm-mirror/clang/2bb8e0fe002e8ffaa9ce5fa58034453c94c7e208/tools/clang-format/git-clang-format";
+ sha256 = "1kby36i80js6rwi11v3ny4bqsi6i44b9yzs23pdcn9wswffx1nlf";
+ executable = true;
+ };
+ nativeBuildInputs = [
+ makeWrapper
+ ];
+ buildInputs = [
+ clang-tools
+ python3
+ ];
+ unpackPhase = ":";
+ installPhase = ''
+ mkdir -p $out/opt $out/bin
+ cp $src $out/opt/git-clang-format
+ makeWrapper $out/opt/git-clang-format $out/bin/git-clang-format \
+ --add-flags --binary \
+ --add-flags ${clang-tools}/bin/clang-format
+ '';
+ };
+
+in
+
+stdenv.mkDerivation {
+ name = "libdjinterop";
+ version = "unstable";
+ src = nix-gitignore.gitignoreSource [ ".git*" ] ./.;
+ nativeBuildInputs = [
+ git-clang-format
+ meson
+ ninja
+ pkg-config
+ ];
+ outputs = [ "out" "dev" ];
+ buildInputs = [
+ boost
+ zlib
+ ];
+}