mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-24 18:00:58 +01:00
treewide: flatten single file modules
Some files don't need nesting and can be root level again to reduce conflicts with other PRs. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
bda9deb791
commit
86402a17b6
424 changed files with 15 additions and 15 deletions
75
modules/programs/sagemath.nix
Normal file
75
modules/programs/sagemath.nix
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
|
||||
cfg = config.programs.sagemath;
|
||||
|
||||
inherit (lib)
|
||||
literalExpression
|
||||
mkEnableOption
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
in
|
||||
{
|
||||
meta.maintainers = [ lib.maintainers.kirelagin ];
|
||||
|
||||
options.programs.sagemath = {
|
||||
enable = mkEnableOption "SageMath, a mathematics software system";
|
||||
|
||||
package = lib.mkPackageOption pkgs "sage" {
|
||||
nullable = true;
|
||||
extraDescription = ''
|
||||
The SageMath package to use.
|
||||
'';
|
||||
};
|
||||
|
||||
configDir = mkOption {
|
||||
type = types.str;
|
||||
default = "${config.xdg.configHome}/sage";
|
||||
defaultText = literalExpression "\${config.xdg.configHome}/sage";
|
||||
description = ''
|
||||
Directory where the {file}`sage.init` file will be stored.
|
||||
Note that the upstream default is {file}`~/.sage`,
|
||||
but our default is to follow XDG.
|
||||
'';
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "${config.xdg.dataHome}/sage";
|
||||
defaultText = literalExpression "\${config.xdg.dataHome}/sage";
|
||||
description = ''
|
||||
Location for {env}`DOT_SAGE`.
|
||||
Note that the upstream default is {file}`~/.sage`,
|
||||
but our default is to follow XDG.
|
||||
'';
|
||||
};
|
||||
|
||||
initScript = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = "%colors linux";
|
||||
description = ''
|
||||
Contents of the {file}`init.sage` file that is loaded on startup.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
|
||||
|
||||
home.file."${cfg.configDir}/init.sage".text = cfg.initScript;
|
||||
|
||||
home.sessionVariables = {
|
||||
DOT_SAGE = cfg.dataDir;
|
||||
SAGE_STARTUP_FILE = "${cfg.configDir}/init.sage";
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue