From f3c138b7d4e584aaa0886e09fdae2b43f1c3b558 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Fri, 20 Mar 2020 17:08:00 +0100 Subject: [PATCH] Add nix expression to build the project --- default.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 default.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..370f1df --- /dev/null +++ b/default.nix @@ -0,0 +1,32 @@ +{ sources ? import ./nix/sources.nix +, system ? builtins.currentSystem +}: + +let + rustOverlay = import "${sources.nixpkgs-mozilla}/rust-overlay.nix"; + cargo2nixOverlay = import "${sources.cargo2nix}/overlay"; + + pkgs = import sources.nixpkgs { + # pkgs = import { + inherit system; + overlays = [ cargo2nixOverlay rustOverlay ]; + }; + + rustPkgs = pkgs.rustBuilder.makePackageSet' { + rustChannel = "stable"; + packageFun = import ./Cargo.nix; + localPatterns = + [ + ''^(src|tests)(/.*)?'' + ''[^/]*\.(rs|toml)$'' + # include other directory from the project repository + ''^templates(/.*)?'' + ''^static(/.*)?'' + ''^.git.*(/.*)?'' + ]; + # packageOverrides + }; +in + (rustPkgs.workspace.hoc {}).overrideAttrs (drv: { + buildInputs = drv.buildInputs or [ ] ++ [ pkgs.git ]; + })