82 lines
2.0 KiB
Nix
82 lines
2.0 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;
|
|
};
|
|
|
|
# Create a derivation for the frontend assets
|
|
frontendDeps = pkgs.mkYarnModules {
|
|
pname = "rss-reader-frontend";
|
|
version = "0.1.0";
|
|
packageJSON = ./static/package.json;
|
|
yarnLock = ./static/yarn.lock;
|
|
};
|
|
|
|
nativeBuildInputs = with pkgs; [
|
|
pkg-config
|
|
rust-bin.stable.latest.default
|
|
nodejs_20
|
|
yarn
|
|
];
|
|
|
|
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;
|
|
|
|
# Build the Vite assets and copy them to the output
|
|
preInstall = ''
|
|
cd static
|
|
ln -s ${frontendDeps}/node_modules .
|
|
yarn build
|
|
cd ..
|
|
'';
|
|
|
|
postInstall = ''
|
|
mkdir -p $out
|
|
mkdir -p $out/static
|
|
cp -r static/dist $out/static/
|
|
cp -r templates $out
|
|
'';
|
|
|
|
meta = with pkgs.lib; {
|
|
description = "A web-based RSS reader application";
|
|
homepage = "https://example.com/yourusername/rss-reader";
|
|
maintainers = [];
|
|
};
|
|
};
|
|
});
|
|
}
|