add cursed hacks

This commit is contained in:
nora 2024-08-02 17:24:01 +02:00
parent ce8c65aeaf
commit 2da7939965
3 changed files with 14 additions and 4 deletions

View file

@ -169,7 +169,7 @@ fn build(rng: &mut rand::rngs::StdRng, root: &Path) -> Result<()> {
let sub_config = let sub_config =
submodule::Submodules::parse(&sub_config).wrap_err("invalid submodules.toml")?; submodule::Submodules::parse(&sub_config).wrap_err("invalid submodules.toml")?;
let submodules_path = root.join("submodules"); let submodules_path = root.join("submodules");
submodule::sync(&submodules_path, &sub_config).wrap_err("syncing subtrees")?; submodule::sync(&submodules_path, &sub_config).wrap_err("syncing submodules")?;
let dist_path = root.join("dist"); let dist_path = root.join("dist");
build::assemble_website( build::assemble_website(

View file

@ -28,7 +28,7 @@ use color_eyre::{
Result, Result,
}; };
use crate::utils; use crate::utils::{self, cp_r};
pub struct Submodules { pub struct Submodules {
configs: Vec<SyncConfig>, configs: Vec<SyncConfig>,
@ -86,6 +86,13 @@ pub fn sync(path: &Path, config: &Submodules) -> color_eyre::Result<()> {
let _span = span.enter(); let _span = span.enter();
let sub_path = path.join(name); let sub_path = path.join(name);
if let Ok(path) = std::env::var(format!("SUBMODULE_DIR_{}", name.to_uppercase())) {
info!(?name, ?path, "Taking submodule from hardcoded path");
cp_r(Path::new(&path), &sub_path).wrap_err("copying path from SUBMODULE_DIR")?;
continue;
}
if !sub_path.exists() { if !sub_path.exists() {
info!(?name, ?url, "Cloning"); info!(?name, ?url, "Cloning");
let mut cmd = process::Command::new("git"); let mut cmd = process::Command::new("git");

View file

@ -1,4 +1,4 @@
{ pkgs ? import <nixpkgs> { }, ... }: { pkgs ? import <nixpkgs> { }, slides ? null, blog ? null, ... }:
let let
generator = import ./builder { inherit pkgs; }; generator = import ./builder { inherit pkgs; };
in in
@ -8,6 +8,9 @@ pkgs.stdenv.mkDerivation {
src = ./.; src = ./.;
unpackSrc = false; unpackSrc = false;
SUBMODULE_DIR_SLIDES = slides;
SUBMODULE_DIR_BLOG = blog;
WEBSITE_RNG_SEED = "99"; WEBSITE_RNG_SEED = "99";
nativeBuildInputs = with pkgs; [ git hugo ]; nativeBuildInputs = with pkgs; [ git hugo ];