From 88463125780ff90fd1db9fb8840b718162f74288 Mon Sep 17 00:00:00 2001 From: Astro Date: Tue, 27 Oct 2020 17:36:46 +0100 Subject: [PATCH] default.nix: use filterSource, copy more assets --- default.nix | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/default.nix b/default.nix index b1d374d..315841c 100644 --- a/default.nix +++ b/default.nix @@ -2,21 +2,40 @@ }: let - cargoSha256 = "11hvxh8drqpimax7b5z5r8qiwzy00j5r0xdshml0wgzxnmrnxzqc"; - - build = pname: pkgs.rustPlatform.buildRustPackage { - inherit pname; + src = builtins.filterSource (path: type: + !builtins.elem (baseNameOf path) [ + "target" + "default.nix" + "shell.nix" + "nixos-module.nix" + ] + ) ./.; + build = { pname, cargoSha256 }: pkgs.rustPlatform.buildRustPackage { + inherit pname cargoSha256 src; version = "0.1.0"; - src = ./.; + nativeBuildInputs = with pkgs; [ pkg-config ]; buildInputs = with pkgs; [ - pkg-config openssl + openssl postgresql.lib ]; preBuild = "pushd ${pname}"; postBuild = "popd"; - inherit cargoSha256; }; in { - ticker-update = build "ticker-update"; - ticker-serve = build "ticker-serve"; + ticker-update = build { + pname = "ticker-update"; + cargoSha256 = "12bc1nyy7pajzcv5997hx7z48dkpdx1hncfkn5dg607wly8bmqcw"; + }; + ticker-serve = (build { + pname = "ticker-serve"; + cargoSha256 = "0xkvn6a9f4ary2w57vq30lx1d73cbmfgk34594hfybrk67m194zr"; + }).overrideAttrs (oa: { + postBuild = '' + ${oa.postBuild} + + mkdir -p $out/shared/libticker $out/shared/ticker-serve + cp -ar ticker-serve/static $out/shared/ticker-serve/ + cp -ar schema.sql $out/shared/libticker/ + ''; + }); }