2021-03-31 02:12:04 +01:00
|
|
|
{
|
|
|
|
description = "tlater.net web server";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-20.09";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
rust-overlay = {
|
|
|
|
url = "github:oxalica/rust-overlay";
|
|
|
|
inputs = {
|
|
|
|
flake-utils.follows = "flake-utils";
|
|
|
|
nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
};
|
2021-03-31 22:25:44 +01:00
|
|
|
naersk = {
|
|
|
|
url = "github:nmattia/naersk";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2021-03-31 02:12:04 +01:00
|
|
|
};
|
|
|
|
|
2021-03-31 22:25:44 +01:00
|
|
|
outputs = { self, nixpkgs, flake-utils, rust-overlay, naersk }@inputs:
|
2021-03-31 02:12:04 +01:00
|
|
|
flake-utils.lib.simpleFlake {
|
|
|
|
inherit self nixpkgs;
|
2021-04-09 19:14:56 +01:00
|
|
|
name = "tlaternet-webserver";
|
2021-03-31 02:12:04 +01:00
|
|
|
preOverlays = [ rust-overlay.overlay ];
|
|
|
|
|
2021-03-31 22:25:44 +01:00
|
|
|
overlay = final: prev: {
|
2021-04-09 19:14:56 +01:00
|
|
|
tlaternet-webserver = let
|
2021-03-31 22:25:44 +01:00
|
|
|
# The rust toolchain to use
|
|
|
|
toolchain =
|
|
|
|
prev.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
|
|
|
|
|
|
|
# The rust build lib, set to use the toolchain
|
|
|
|
naersk-lib = naersk.lib.${prev.system}.override {
|
|
|
|
cargo = toolchain;
|
|
|
|
rustc = toolchain;
|
|
|
|
};
|
|
|
|
|
|
|
|
# pkg-config, needed to include many native libs
|
|
|
|
nativeBuildInputs = [ prev.pkgconfig ];
|
|
|
|
|
|
|
|
# Native libs
|
|
|
|
buildInputs = [ prev.openssl ];
|
|
|
|
|
|
|
|
in rec {
|
|
|
|
# The packages provided by this flake
|
2021-04-09 19:15:27 +01:00
|
|
|
packages = {
|
2021-03-31 22:25:44 +01:00
|
|
|
webserver = prev.callPackage
|
|
|
|
({ rustPlatform, openssl, pkgconfig, ... }:
|
|
|
|
naersk-lib.buildPackage {
|
|
|
|
inherit nativeBuildInputs buildInputs;
|
|
|
|
|
|
|
|
pname = "tlaternet-webserver";
|
|
|
|
root = ./.;
|
|
|
|
}) { };
|
|
|
|
};
|
2021-04-09 19:15:27 +01:00
|
|
|
defaultPackage = packages.webserver;
|
2021-03-31 22:25:44 +01:00
|
|
|
|
|
|
|
# A dev shell to hack manually; note this includes
|
|
|
|
# additional toolchain components
|
|
|
|
devShell = prev.mkShell {
|
|
|
|
inherit buildInputs;
|
|
|
|
nativeBuildInputs = nativeBuildInputs ++ [
|
|
|
|
(toolchain.override {
|
|
|
|
extensions =
|
|
|
|
[ "rust-src" "rust-analysis" "rust-analyzer-preview" ];
|
|
|
|
})
|
|
|
|
];
|
|
|
|
};
|
2021-03-31 02:12:04 +01:00
|
|
|
};
|
2021-03-31 22:25:44 +01:00
|
|
|
};
|
2021-03-31 02:12:04 +01:00
|
|
|
};
|
|
|
|
}
|