config/machines/sif/services/website.nix

38 lines
1,007 B
Nix

{ pkgs, lib, config, ... }:
let secret = config.age.secrets."website".path;
builder = pkgs.rustPlatform.buildRustPackage.override {
rustc = (pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal)).overrideAttrs (old: {
meta.platforms = [
"x86_64-linux"
"aarch64-linux"
];
});
};
website = builder {
pname = "website";
version = "0.1.0";
cargoSha256 = "sha256-4v45QaZKyjifn2MGyuy+SovfFBWu55FYR9nWRWlaQOM=";
postInstall = ''
cp ./links.toml $out/links.toml
cp -r ./static/ $out/static/
'';
src = pkgs.fetchgit {
url = "https://im.badat.dev/riley/website.git";
rev = "refs/heads/mistress";
sha256 = "sha256-QONZR4zpgifEQByH3rtfkHQjwQVrjRy89RVvVLMciKs=";
};
};
in {
systemd.services."website" = {
enable = true;
description = "Run my website :)";
path = [ website ];
script = ''
cd ${website}
SITE_API_SECRET=$(cat ${secret}) ${website}/bin/website
'';
};
}