Monday, 15 April 2024

shell.nix for zsh, tmux, poetry

{ pkgs ? import  {} }:

pkgs.mkShell {
  buildInputs = [
    pkgs.gcc
    pkgs.zsh
    pkgs.tmux
  ];

  shellHook = ''
    export SHELL=${pkgs.zsh}/bin/zsh
    export LD_LIBRARY_PATH=${pkgs.gcc}/lib64:${pkgs.stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH
    echo "LD_LIBRARY_PATH adjusted to include libstdc++.so.6"

    # Get the name of the current directory to use as the tmux session name
    SESSION_NAME=$(basename "$(pwd)")

    # Check if tmux is already running, if not start it with the session name as the current directory name
    if [ -z "$TMUX" ]; then
      tmux new-session -A -s "$SESSION_NAME" || tmux attach-session -t "$SESSION_NAME"
    fi

    poetry shell
    exec ${pkgs.zsh}/bin/zsh
  '';
}

No comments:

Post a Comment

Parse Wikipedia dump

""" This module processes Wikipedia dump files by extracting individual articles and parsing them into a structured format, ...