~kmaasrud/prompt

d43db9db38b80ecb3848f5191a95c3ddef360e32 — kmaasrud 1 year, 5 months ago 06a969a
add nix info
1 files changed, 11 insertions(+), 0 deletions(-)

M src/main.rs
M src/main.rs => src/main.rs +11 -0
@@ 9,6 9,10 @@ use std::process::Command;
fn main() -> Result<(), Error> {
    let mut stdout = BufWriter::new(std::io::stdout());

    faint(&mut stdout)?;
    nix(&mut stdout)?;
    reset(&mut stdout)?;

    cwd(&mut stdout)?;

    faint(&mut stdout)?;


@@ 58,3 62,10 @@ fn git<W: Write>(mut w: W) -> Result<(), Error> {
        _ => Ok(()),
    }
}

fn nix<W: Write>(mut w: W) -> Result<(), Error> {
    if let Ok(purity) = std::env::var("IN_NIX_SHELL") {
        write!(w, "{purity} ")?;
    }
    Ok(())
}