fork/home-manager
git clone https://git.julia.blue/fork/home-manager
75790441
master
1{ config , lib , pkgs , ...} : 2 3let 4 5cfg = config . programs . sagemath ; 6 7inherit ( lib ) literalExpression mkEnableOption mkOption types ; 8 9in { 10meta . maintainers = [ lib . maintainers . kirelagin ]; 11 12options . programs . sagemath = { 13enable = mkEnableOption "SageMath, a mathematics software system" ; 14 15package = mkOption { 16type = types . package ; 17default = pkgs . sage ; 18defaultText = literalExpression "pkgs.sage" ; 19description = "The SageMath package to use." ; 20}; 21 22configDir = mkOption { 23type = types . str ; 24default = " ${ config . xdg . configHome } /sage" ; 25defaultText = literalExpression "\${config.xdg.configHome}/sage" ; 26description = '' 27Directory where the {file}`sage.init` file will be stored. 28Note that the upstream default is {file}`~/.sage`, 29but our default is to follow XDG. 30'' ; 31}; 32 33dataDir = mkOption { 34type = types . str ; 35default = " ${ config . xdg . dataHome } /sage" ; 36defaultText = literalExpression "\${config.xdg.dataHome}/sage" ; 37description = '' 38Location for {env}`DOT_SAGE`. 39Note that the upstream default is {file}`~/.sage`, 40but our default is to follow XDG. 41'' ; 42}; 43 44initScript = mkOption { 45type = types . lines ; 46default = "" ; 47example = "%colors linux" ; 48description = '' 49Contents of the {file}`init.sage` file that is loaded on startup. 50'' ; 51}; 52}; 53 54config = lib . mkIf cfg . enable { 55home . packages = [ cfg . package ]; 56 57home . file . " ${ cfg . configDir } /init.sage" . text = cfg . initScript ; 58home . sessionVariables = { 59DOT_SAGE = cfg . dataDir ; 60SAGE_STARTUP_FILE = " ${ cfg . configDir } /init.sage" ; 61}; 62}; 63}