sneedstr/flake.nix
2024-01-12 09:35:31 -06:00

53 lines
1.3 KiB
Nix

{
inputs = {
flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, flake-utils, naersk, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = (import nixpkgs) { inherit system; };
naersk' = pkgs.callPackage naersk { };
wwwPath = "www";
templatesPath = "templates";
in rec {
# For `nix build` & `nix run`:
defaultPackage = naersk'.buildPackage {
src = ./.;
nativeBuildInputs = with pkgs; [ pkg-config openssl sqlite ];
GIT_HASH = "000000000000000000000000000000";
postInstall = ''
mkdir -p $out/templates
mkdir -p $out/www
cp -r ${wwwPath} $out/
cp -r ${templatesPath} $out/
'';
};
# For `nix develop`:
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustc
cargo
cargo-watch
clippy
rustfmt
rust-analyzer
pkg-config
openssl
sqlite
];
env = {
DATABASE_URL = "sqlite://sqlite.db";
RUST_BACKTRACE = 1;
};
};
});
}