sneedstr/flake.nix

60 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";
ADMIN_PUBKEY = "npub14d2a54za7dnfzktle40vw7kdx48vk3ljy3t7w7sdpk3segea65mq2t6kc4";
RUST_BACKTRACE = 1;
};
};
});
}