80 lines
2.2 KiB
Nix
80 lines
2.2 KiB
Nix
{
|
|
description = "RSS Reader Web Application";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
overlays = [ (import rust-overlay) ];
|
|
pkgs = import nixpkgs {
|
|
inherit system overlays;
|
|
};
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
pkg-config
|
|
rust-bin.stable.latest.default
|
|
];
|
|
|
|
buildInputs = with pkgs; [
|
|
openssl
|
|
sqlite
|
|
];
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
inherit nativeBuildInputs buildInputs;
|
|
|
|
shellHook = ''
|
|
export DATABASE_URL="sqlite:rss-reader.db"
|
|
'';
|
|
};
|
|
|
|
packages.default = pkgs.rustPlatform.buildRustPackage {
|
|
pname = "rss-reader";
|
|
version = "0.1.0";
|
|
src = ./.;
|
|
|
|
cargoLock = {
|
|
lockFile = ./Cargo.lock;
|
|
};
|
|
|
|
inherit nativeBuildInputs buildInputs;
|
|
|
|
# Copy static files to the output
|
|
postInstall = ''
|
|
mkdir -p $out/share/rss-reader
|
|
cp -r static $out/share/rss-reader/
|
|
cp -r templates $out/share/rss-reader/
|
|
|
|
# Create a wrapper script that sets the correct paths
|
|
mv $out/bin/rss-reader $out/bin/.rss-reader-unwrapped
|
|
cat > $out/bin/rss-reader << EOF
|
|
#!/bin/sh
|
|
export ROCKET_STATIC_DIR="$out/share/rss-reader/static"
|
|
export ROCKET_TEMPLATE_DIR="$out/share/rss-reader/templates"
|
|
exec $out/bin/.rss-reader-unwrapped "\$@"
|
|
EOF
|
|
chmod +x $out/bin/rss-reader
|
|
'';
|
|
|
|
meta = with pkgs.lib; {
|
|
description = "A web-based RSS reader application";
|
|
# TODO add real homepage
|
|
homepage = "https://example.com/yourusername/rss-reader";
|
|
# TODO figure out license
|
|
#license = licenses.mit;
|
|
maintainers = [];
|
|
};
|
|
};
|
|
}
|
|
);
|
|
}
|