home/breakerbox: init

This commit is contained in:
2025-06-04 12:01:57 +02:00
parent 465d33fadf
commit 0026cfb484
41 changed files with 310 additions and 237 deletions

View File

@@ -1,24 +1,31 @@
{ config, pkgs, extendedLib, ... }:
{ config, lib, pkgs, extendedLib, ... }:
let
cfg = config.programs.python;
in
{
# Python for interactive use
home.packages = [
(pkgs.python3.withPackages (pypkgs: with pypkgs; [
requests
]))
];
options.programs.python.enable = lib.mkEnableOption "python";
xdg.configFile."python/pyrc".text = ''
#!/usr/bin/env python3
import sys
config = lib.mkIf cfg.enable {
# Python for interactive use
home.packages = [
(pkgs.python3.withPackages (pypkgs: with pypkgs; [
requests
]))
];
# 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
'';
xdg.configFile."python/pyrc".text = ''
#!/usr/bin/env python3
import sys
home.sessionVariables = {
PYTHONSTARTUP = "${config.xdg.configHome}/python/pyrc";
PYTHON_HISTORY = "${config.xdg.dataHome}/python_history";
# 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";
};
};
}