Files
scylladb/flake.nix
Michael Livshin 7bd13be3f2 build: improvements & upgrades to Nix dev environment
* Add some more useful stuff to the shell environment, so it actually
  works for debugging & post-mortem analysis.

* Wrap ccache & distcc transparently (distcc will be used unless
  NODISTCC is set to a non-empty value in the environment; ccache will
  be used if CCACHE_DIR is not empty).

* Package the Scylla Python driver (instead of the C* one).

* Catch up to misc build/test requirements (including optional) by
  requiring or custom-packaging: wasmtime 0.29.0, cxxbridge,
  pytest-asyncio, liburing.

* Build statically-linked zstd in a saner and more idiomatic fashion.

* In pure builds (where sources lack Git metadata), derive
  SCYLLA_RELEASE from source hash.

* Refactor things for more parameterization.

* Explicitly stub out installPhase (seeing that "nix build" succeeds
  up to installPhase means we didn't miss any dependencies).

* Add flake support.

* Add copious comments.

Signed-off-by: Michael Livshin <michael.livshin@scylladb.com>
2022-10-02 11:47:16 +03:00

52 lines
1.3 KiB
Nix

{
description = "Monstrously Fast + Scalable NoSQL";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils } @ inputs: {
overlays.default = import ./dist/nix/overlay.nix nixpkgs;
lib = {
_attrs = system: let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
repl = pkgs.writeText "repl" ''
let
self = builtins.getFlake (toString ${self.outPath});
attrs = self.lib._attrs "${system}";
in {
inherit self;
inherit (attrs) pkgs;
}
'';
args = {
flake = true;
srcPath = "${self}";
inherit pkgs repl;
};
package = import ./default.nixpkgs args;
devShell = import ./shell.nix args;
in {
inherit pkgs args package devShell;
};
};
}
// (flake-utils.lib.eachDefaultSystem (system: let
packageName = "scylla";
attrs = self.lib._attrs system;
in {
packages.${packageName} = attrs.package;
defaultPackage = self.packages.${system}.${packageName};
inherit (attrs) devShell;
}));
}