poop-graph/flake.nix

60 lines
1.7 KiB
Nix
Raw Normal View History

2022-04-15 23:27:29 -04:00
{
description = "Better web UI for COVID wastewater data";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
2022-04-15 23:27:29 -04:00
utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay/6ddde85465a678aa549cef26dd7ddb012aa0eda3";
2022-04-15 23:27:29 -04:00
crate2nix = {
url = "github:kolloch/crate2nix";
flake = false;
};
};
outputs = { self, nixpkgs, utils, rust-overlay, crate2nix }: let
name = "poop-graph";
in
utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlay
(final: prev: {
rustc = final.rust-bin.stable.latest.default;
cargo = final.rust-bin.stable.latest.default;
})
];
};
inherit (import "${crate2nix}/tools.nix" { inherit pkgs; })
generatedCargoNix;
project = import
(generatedCargoNix {
inherit name;
src = ./.;
})
{ inherit pkgs; };
in rec {
2022-04-16 01:57:34 -04:00
packages.${name} = pkgs.symlinkJoin {
inherit name;
paths = [ packages."${name}-unwrapped" ];
buildInputs = [ pkgs.makeWrapper ];
postBuild = ''
wrapProgram $out/bin/${name} \
--set STATIC_DIR ${./static}
'';
};
2022-04-15 23:27:29 -04:00
defaultPackage = packages.${name};
2022-04-16 01:57:34 -04:00
packages."${name}-unwrapped" = project.rootCrate.build;
2022-04-15 23:27:29 -04:00
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ rustc cargo cargo-audit stdenv.cc ];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
}
);
}