59 lines
1.5 KiB
Nix
59 lines
1.5 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`:
|
|
packages.default = 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/
|
|
'';
|
|
};
|
|
|
|
nixosModules.default = { inputs, pkgs, ... }: {
|
|
imports = [
|
|
./modules/sneedstr.nix
|
|
];
|
|
};
|
|
|
|
# For `nix develop`:
|
|
devShells.default = pkgs.mkShell {
|
|
nativeBuildInputs = with pkgs; [
|
|
rustc
|
|
cargo
|
|
cargo-watch
|
|
clippy
|
|
rustfmt
|
|
rust-analyzer
|
|
pkg-config
|
|
|
|
openssl
|
|
sqlite
|
|
];
|
|
env = {
|
|
DATABASE_URL = "/tmp/sqlite.db";
|
|
RUST_BACKTRACE = 1;
|
|
};
|
|
};
|
|
});
|
|
}
|