[buoh/ci: 6/7] build: Add Nix expression
- From: Jan Tojnar <jtojnar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [buoh/ci: 6/7] build: Add Nix expression
- Date: Wed, 12 Sep 2018 11:55:38 +0000 (UTC)
commit 02d79f8e73df7c0965c9d1fd5e949a3b58b3048d
Author: Jan Tojnar <jtojnar gmail com>
Date: Wed Aug 29 15:27:54 2018 +0200
build: Add Nix expression
Nix [1] is purely functional package manager allowing to easily
install dependencies in a reproducible manner.
The expression is mostly taken from Coq [2] verbatim.
[1]: https://nixos.org/nix/
[2]: https://gitlab.com/coq/coq/blob/master/default.nix
README.md | 2 ++
default.nix | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
shell.nix | 7 +++++++
3 files changed, 70 insertions(+)
---
diff --git a/README.md b/README.md
index ac51368..62ef1f6 100644
--- a/README.md
+++ b/README.md
@@ -21,5 +21,7 @@ ninja -C build
ninja -C build install
```
+Alternately, with [Nix package manager](https://nixos.org/nix/), you can just run `nix-shell` in the project
directory, and it will drop you into a shell with all the required dependencies.
+
## License
Buoh is distributed under the terms of the GNU General Public License version 2, or (at your option) any
later version. You can find the whole text of the license in the [COPYING](COPYING) file.
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..9c20294
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,61 @@
+# How to use?
+
+# If you have Nix installed, you can get in an environment with everything
+# needed to compile buoh by running:
+# $ nix-shell
+# at the root of the buoh repository.
+
+# How to tweak default arguments?
+
+# nix-shell supports the --arg option (see Nix doc) that allows you for
+# instance to do this:
+# $ nix-shell --arg doCheck false
+
+# You can also compile buoh and "install" it by running:
+# $ rm -rf build # (only needed if you have left-over compilation files)
+# $ nix-build
+# at the root of the buoh repository.
+# nix-build also supports the --arg option, so you will be able to do:
+# $ nix-build --arg doCheck false
+# if you want to speed up things by not running the test-suite.
+# Once the build is finished, you will find, in the current directory,
+# a symlink to where buoh was installed.
+
+{ pkgs ?
+ (import (fetchTarball {
+ url = "https://github.com/NixOS/nixpkgs/archive/060a98e9f4ad879492e48d63e887b0b6db26299e.tar.gz";
+ sha256 = "1lzvp3md0hf6kp2bvc6dbzh40navlyd51qlns9wbkz6lqk3lgf6j";
+ }) {})
+, doCheck ? true
+, shell ? false
+ # We don't use lib.inNixShell because that would also apply
+ # when in a nix-shell of some package depending on this one.
+}:
+
+with pkgs;
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+
+ name = "buoh";
+
+ nativeBuildInputs = [
+ meson ninja pkgconfig gettext python3 wrapGAppsHook
+ ];
+
+ buildInputs = [
+ glib gtk3 libsoup libxml2
+ ];
+
+ checkInputs = [
+ desktop-file-utils
+ ];
+
+ src =
+ if shell then null
+ else
+ with builtins; filterSource
+ (path: _: !elem (baseNameOf path) [ ".git" "result" ]) ./.;
+
+ inherit doCheck;
+}
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..3cb7758
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,7 @@
+# Some developers don't want a pinned nix-shell by default.
+# If you want to use the pin nix-shell or a more sophisticated set of arguments:
+# $ nix-shell default.nix --arg shell true
+import ./default.nix {
+ pkgs = import <nixpkgs> {};
+ shell = true;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]