Completely reformat to satisfy nixfmt
This commit is contained in:
+36
-36
@@ -4,7 +4,8 @@ let
|
||||
cfg = config.programs.xonsh;
|
||||
|
||||
in
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
options = {
|
||||
programs.xonsh = {
|
||||
enable = mkEnableOption "Enable the xonsh program";
|
||||
@@ -12,34 +13,36 @@ with lib; {
|
||||
sessionVariables = mkOption {
|
||||
type = types.attrs;
|
||||
default = { };
|
||||
example = { XONSH_TRACE_SUBPROC = true; };
|
||||
example = {
|
||||
XONSH_TRACE_SUBPROC = true;
|
||||
};
|
||||
description = ''
|
||||
Environment variables that will be set for the Xonsh session.
|
||||
'';
|
||||
Environment variables that will be set for the Xonsh session.
|
||||
'';
|
||||
};
|
||||
|
||||
aliases = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
ll = "ls -l";
|
||||
la = "ls -a";
|
||||
}
|
||||
'';
|
||||
{
|
||||
ll = "ls -l";
|
||||
la = "ls -a";
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
An attribute set that maps aliases (the top level attribute names in
|
||||
this option) to command strings or directly to build outputs.
|
||||
'';
|
||||
An attribute set that maps aliases (the top level attribute names in
|
||||
this option) to command strings or directly to build outputs.
|
||||
'';
|
||||
};
|
||||
|
||||
configHeader = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = literalExpression ''
|
||||
import os
|
||||
import sys
|
||||
'';
|
||||
import os
|
||||
import sys
|
||||
'';
|
||||
description = "An arbitrary string to put at the top of the config file";
|
||||
};
|
||||
|
||||
@@ -47,11 +50,11 @@ with lib; {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = literalExpression ''
|
||||
def _some_method(args):
|
||||
do_command()
|
||||
some_other_thing()
|
||||
aliases['some_method'] = _some_method
|
||||
'';
|
||||
def _some_method(args):
|
||||
do_command()
|
||||
some_other_thing()
|
||||
aliases['some_method'] = _some_method
|
||||
'';
|
||||
description = "An arbitrary string to put at the end of the config file";
|
||||
};
|
||||
};
|
||||
@@ -59,29 +62,26 @@ with lib; {
|
||||
|
||||
config =
|
||||
let
|
||||
shortAliases = concatStringsSep "\n" (
|
||||
mapAttrsToList (k: v: "aliases['${k}']=r'${v}'") cfg.aliases
|
||||
);
|
||||
shortAliases = concatStringsSep "\n" (mapAttrsToList (k: v: "aliases['${k}']=r'${v}'") cfg.aliases);
|
||||
|
||||
listToPythonList =
|
||||
let
|
||||
listInternals = args:
|
||||
concatStringsSep "\n" (map (v: "'${v}'") args);
|
||||
listInternals = args: concatStringsSep "\n" (map (v: "'${v}'") args);
|
||||
in
|
||||
list: "[${listInternals list}]";
|
||||
|
||||
sessionVars = concatStringsSep "\n" (
|
||||
mapAttrsToList
|
||||
(k: v:
|
||||
if builtins.typeOf v == "string" then
|
||||
"\$${k} = '${v}'"
|
||||
else if builtins.typeOf v == "list" then
|
||||
"\$${k} = ${listToPythonList}"
|
||||
else if builtins.typeOf v == "int" then
|
||||
"\$${k} = ${toString v}"
|
||||
else ""
|
||||
)
|
||||
cfg.sessionVariables
|
||||
mapAttrsToList (
|
||||
k: v:
|
||||
if builtins.typeOf v == "string" then
|
||||
"\$${k} = '${v}'"
|
||||
else if builtins.typeOf v == "list" then
|
||||
"\$${k} = ${listToPythonList}"
|
||||
else if builtins.typeOf v == "int" then
|
||||
"\$${k} = ${toString v}"
|
||||
else
|
||||
""
|
||||
) cfg.sessionVariables
|
||||
);
|
||||
|
||||
in
|
||||
|
||||
Reference in New Issue
Block a user