2022-04-28 00:48:47 -04:00
|
|
|
{
|
|
|
|
description = "transbeam: a low-latency file drop web app";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
utils.url = "github:numtide/flake-utils";
|
2022-12-09 16:06:50 -05:00
|
|
|
fenix.url = "github:nix-community/fenix";
|
2022-04-28 00:48:47 -04:00
|
|
|
};
|
|
|
|
|
2022-12-09 16:06:50 -05:00
|
|
|
outputs = { self, nixpkgs, utils, fenix }: let
|
2022-04-28 00:48:47 -04:00
|
|
|
name = "transbeam";
|
|
|
|
in
|
|
|
|
utils.lib.eachDefaultSystem
|
|
|
|
(system:
|
|
|
|
let
|
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
2022-12-09 16:06:50 -05:00
|
|
|
overlays = [ fenix.overlays.default ];
|
|
|
|
};
|
|
|
|
fenixStable = fenix.packages.${system}.stable;
|
|
|
|
fenixPlatform = pkgs.makeRustPlatform {
|
|
|
|
cargo = fenixStable.toolchain;
|
|
|
|
rustc = fenixStable.toolchain;
|
2022-04-28 00:48:47 -04:00
|
|
|
};
|
|
|
|
in rec {
|
|
|
|
packages.${name} = pkgs.symlinkJoin {
|
|
|
|
inherit name;
|
|
|
|
paths = [ packages."${name}-unwrapped" ];
|
|
|
|
buildInputs = [ pkgs.makeWrapper ];
|
|
|
|
postBuild = ''
|
|
|
|
wrapProgram $out/bin/${name} \
|
2022-05-26 14:43:03 -04:00
|
|
|
--set TRANSBEAM_STATIC_DIR ${./static} \
|
|
|
|
--set TRANSBEAM_CACHEBUSTER ${builtins.substring 0 8 (builtins.hashString "sha256" (toString ./static))}
|
2022-04-28 00:48:47 -04:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultPackage = packages.${name};
|
|
|
|
|
2022-12-09 16:06:50 -05:00
|
|
|
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-28 00:48:47 -04:00
|
|
|
|
2022-05-25 09:43:20 -04:00
|
|
|
packages."${name}-cli" = with pkgs.python3Packages; buildPythonApplication {
|
|
|
|
pname = "${name}-cli";
|
|
|
|
version = "0.1";
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
tqdm
|
|
|
|
websockets
|
|
|
|
];
|
|
|
|
src = ./cli;
|
|
|
|
};
|
|
|
|
|
2022-12-09 16:06:50 -05:00
|
|
|
devShell = with pkgs; let
|
|
|
|
fenixWith = fenixStable.withComponents [
|
|
|
|
"cargo"
|
|
|
|
"clippy"
|
|
|
|
"rust-src"
|
|
|
|
"rustc"
|
|
|
|
"rustfmt"
|
|
|
|
];
|
|
|
|
in mkShell {
|
|
|
|
nativeBuildInputs = [
|
2022-04-28 01:29:11 -04:00
|
|
|
stdenv.cc
|
2022-12-09 16:06:50 -05:00
|
|
|
fenixWith
|
2022-04-28 01:29:11 -04:00
|
|
|
cargo-audit
|
|
|
|
cargo-flamegraph
|
2022-05-25 09:43:20 -04:00
|
|
|
(python3.withPackages (p: with p; [
|
|
|
|
tqdm
|
|
|
|
websockets
|
|
|
|
]))
|
2022-04-28 01:29:11 -04:00
|
|
|
];
|
2022-04-28 00:48:47 -04:00
|
|
|
};
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|