config/machines/sif/website.nix

39 lines
1,007 B
Nix
Raw Normal View History

{ pkgs, lib, config, ... }:
2022-05-28 18:38:31 +02:00
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";
2022-05-28 18:38:31 +02:00
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";
2022-05-28 18:38:31 +02:00
sha256 = "sha256-QONZR4zpgifEQByH3rtfkHQjwQVrjRy89RVvVLMciKs=";
};
};
in {
systemd.services."website" = {
enable = true;
description = "Run my website :)";
path = [ website ];
2022-05-28 18:38:31 +02:00
script = ''
cd ${website}
SITE_API_SECRET=$(cat ${secret}) ${website}/bin/website
'';
};
}