mirror of
https://github.com/nix-community/home-manager
synced 2024-11-10 07:04:17 +00:00
sagemath: add module
This commit is contained in:
parent
5a8b29bc7a
commit
204f9808d3
8 changed files with 97 additions and 0 deletions
3
.github/CODEOWNERS
vendored
3
.github/CODEOWNERS
vendored
|
@ -194,6 +194,9 @@
|
|||
|
||||
/modules/programs/rtorrent.nix @marsam
|
||||
|
||||
/modules/programs/sagemath.nix @kirelagin
|
||||
/tests/modules/programs/sagemath @kirelagin
|
||||
|
||||
/modules/programs/sbt.nix @kubukoz
|
||||
/tests/modules/programs/sbt @kubukoz
|
||||
|
||||
|
|
|
@ -2344,6 +2344,13 @@ in
|
|||
A new module is available: 'services.swayidle'.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2022-01-11T12:26:43+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.sagemath'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ let
|
|||
./programs/rofi-pass.nix
|
||||
./programs/rofi.nix
|
||||
./programs/rtorrent.nix
|
||||
./programs/sagemath.nix
|
||||
./programs/sbt.nix
|
||||
./programs/scmpuff.nix
|
||||
./programs/senpai.nix
|
||||
|
|
63
modules/programs/sagemath.nix
Normal file
63
modules/programs/sagemath.nix
Normal file
|
@ -0,0 +1,63 @@
|
|||
{ 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 = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.sage;
|
||||
defaultText = literalExpression "pkgs.sage";
|
||||
description = "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 <filename>sage.init</filename> file will be stored.
|
||||
Note that the upstream default is <filename>~/.sage</filename>,
|
||||
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 <envar>DOT_SAGE</envar>.
|
||||
Note that the upstream default is <filename>~/.sage</filename>,
|
||||
but our default is to follow XDG.
|
||||
'';
|
||||
};
|
||||
|
||||
initScript = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = "%colors linux";
|
||||
description = ''
|
||||
Contents of the <filename>init.sage</filename> file that is loaded on startup.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home.packages = [ cfg.package ];
|
||||
|
||||
home.file."${cfg.configDir}/init.sage".text = cfg.initScript;
|
||||
home.sessionVariables = {
|
||||
DOT_SAGE = cfg.dataDir;
|
||||
SAGE_STARTUP_FILE = "${cfg.configDir}/init.sage";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -89,6 +89,7 @@ import nmt {
|
|||
./modules/programs/powerline-go
|
||||
./modules/programs/qutebrowser
|
||||
./modules/programs/readline
|
||||
./modules/programs/sagemath
|
||||
./modules/programs/sbt
|
||||
./modules/programs/scmpuff
|
||||
./modules/programs/sm64ex
|
||||
|
|
1
tests/modules/programs/sagemath/default.nix
Normal file
1
tests/modules/programs/sagemath/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{ sagemath = ./sagemath.nix; }
|
1
tests/modules/programs/sagemath/init-expected.sage
Normal file
1
tests/modules/programs/sagemath/init-expected.sage
Normal file
|
@ -0,0 +1 @@
|
|||
%colors linux
|
20
tests/modules/programs/sagemath/sagemath.nix
Normal file
20
tests/modules/programs/sagemath/sagemath.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ config, ... }:
|
||||
|
||||
{
|
||||
programs.sagemath = {
|
||||
enable = true;
|
||||
configDir = "${config.xdg.configHome}/sage";
|
||||
dataDir = "${config.xdg.dataHome}/sage";
|
||||
initScript = ''
|
||||
%colors linux
|
||||
'';
|
||||
};
|
||||
|
||||
test.stubs.sage = { };
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.config/sage/init.sage
|
||||
assertFileContent home-files/.config/sage/init.sage \
|
||||
${./init-expected.sage}
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue