added nix run
functionality
This commit is contained in:
parent
b9291ffb85
commit
de72f2fa7d
38
flake.nix
38
flake.nix
|
@ -15,14 +15,15 @@
|
|||
rust-overlay,
|
||||
}: let
|
||||
# rust-overlay = import rust-overlay;
|
||||
system = "x86_64-linux";
|
||||
pkgs =
|
||||
import nixpkgs
|
||||
{
|
||||
system = "x86_64-linux";
|
||||
inherit system;
|
||||
overlays = [rust-overlay.overlays.default];
|
||||
};
|
||||
in {
|
||||
devShells.x86_64-linux.default = pkgs.mkShell {
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
rust-bin.nightly.latest.default
|
||||
rust-analyzer
|
||||
|
@ -32,6 +33,37 @@
|
|||
# echo "Hello from nix dev shell"
|
||||
# '';
|
||||
};
|
||||
formatter.x86_64-linux = pkgs.alejandra;
|
||||
formatter.${system} = pkgs.alejandra;
|
||||
packages.${system}.default = pkgs.stdenv.mkDerivation rec {
|
||||
pname = "webbisitey-${version}";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./src/..;
|
||||
runtime = ./public;
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkgs.makeWrapper
|
||||
pkgs.rust-bin.nightly.latest.default
|
||||
];
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
cargo build -r
|
||||
mkdir -p $out/bin
|
||||
cp target/release/webbisitey $out/bin
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
makeWrapper $out/bin/webbisitey $out/bin/webbisitey-wrapped --run 'cd $(dirname $0)';
|
||||
cp -r $runtime $out/bin/public
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Website server backend";
|
||||
license = pkgs.lib.licenses.mit;
|
||||
mainProgram = "webbisitey-wrapped";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue