home
config
modules
programs
anyrun
browser
direnv
emacs
git
hyprland
neovim
newsboat
nix-index
rofi
ssh
tealdeer
tmux
vscode
xmobar
xmonad
zed
zsh
alacritty.nix
aria2.nix
atuin.nix
bash.nix
bat.nix
beets.nix
bottom.nix
cargo.nix
comma.nix
eza.nix
feh.nix
firefox.nix
fzf.nix
gdb.nix
gh-dash.nix
gh.nix
gpg.nix
helix.nix
home-manager.nix
jq.nix
less.nix
man.nix
mpv.nix
ncmpcpp.nix
nix.nix
nushell.nix
obs-studio.nix
pandoc.nix
prism-launcher.nix
python.nix
qutebrowser.nix
ripgrep.nix
skim.nix
sqlite.nix
taskwarrior.nix
texlive.nix
thunderbird.nix
uv.nix
waybar.nix
yazi.nix
yt-dlp.nix
zathura.nix
zoxide.nix
services
breakerbox.nix
home.nix
packages.nix
shell.nix
hosts
lib
modules
overlays
secrets
.envrc
.gitignore
.sops.yaml
LICENSE
README.md
flake.lock
flake.nix
32 lines
906 B
Nix
32 lines
906 B
Nix
{ config, lib, pkgs, extendedLib, ... }:
|
|
let
|
|
cfg = config.programs.python;
|
|
in
|
|
{
|
|
options.programs.python.enable = lib.mkEnableOption "python";
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
# Python for interactive use
|
|
home.packages = [
|
|
(pkgs.python3.withPackages (pypkgs: with pypkgs; [
|
|
requests
|
|
]))
|
|
];
|
|
|
|
xdg.configFile."python/pyrc".text = ''
|
|
#!/usr/bin/env python3
|
|
import sys
|
|
|
|
# You also need \x01 and \x02 to separate escape sequence, due to:
|
|
# https://stackoverflow.com/a/9468954/1147688
|
|
sys.ps1='\x01\x1b${extendedLib.termColors.front.blue "[Python]> "}\x02>>>\x01\x1b[0m\x02 ' # bright yellow
|
|
sys.ps2='\x01\x1b[1;49;31m\x02...\x01\x1b[0m\x02 ' # bright red
|
|
'';
|
|
|
|
home.sessionVariables = {
|
|
PYTHONSTARTUP = "${config.xdg.configHome}/python/pyrc";
|
|
PYTHON_HISTORY = "${config.xdg.dataHome}/python_history";
|
|
};
|
|
};
|
|
}
|