poop-graph/flake.nix

61 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";
fenix.url = "github:nix-community/fenix";
2022-04-15 23:27:29 -04:00
};
outputs = { self, nixpkgs, utils, fenix }: let
2022-04-15 23:27:29 -04:00
name = "poop-graph";
in
utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ fenix.overlays.default ];
};
fenixStable = fenix.packages.${system}.stable;
fenixPlatform = pkgs.makeRustPlatform {
cargo = fenixStable.toolchain;
rustc = fenixStable.toolchain;
2022-04-15 23:27:29 -04:00
};
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};
packages."${name}-unwrapped" = let
cargoTOML = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in fenixPlatform.buildRustPackage {
pname = name;
inherit (cargoTOML.package) version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
};
2022-04-16 01:57:34 -04:00
devShell = with pkgs; let
fenixWith = fenixStable.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
];
in mkShell {
nativeBuildInputs = [ fenixWith cargo-audit stdenv.cc ];
2022-04-15 23:27:29 -04:00
};
}
);
}