Skip to content

Commit

Permalink
xonsh.xontribs.xontrib-*: init at various
Browse files Browse the repository at this point in the history
Since version 0.14.0, Xonsh moved to including most of its basic
extension functionality in xontribs. Using the existing Xonsh wrapper,
the above listed xontrib packages can now be included with its
extraPackages argument.

xonsh.xontribs.xonsh-direnv: init at 1.6.5
Direnv integration for Xonsh

xonsh.xontribs.xontrib-abbrevs: init at 0.1.0
Command abbreviations. This expands input words as you type.

xonsh.xontribs.xontrib-bashisms: init at 0.0.5
Bash-like interactive mode extensions for the xonsh shell.

xonsh.xontribs.xontrib-debug-tools: init at 0.0.1
Debug tools for xonsh shell.

xonsh.xontribs.xontrib-distributed: init at 0.0.4
Dask Distributed integration for Xonsh

xonsh.xontribs.xontrib-fish-completer: init at 0.0.1
Populate rich completions using fish and remove the default bash based completer

xonsh.xontribs.xontrib-jedi: init at 0.1.1
Improved Xonsh's Python completions using jedi

xonsh.xontribs.xontrib-jupyter: init at 0.3.2
Xonsh jupyter kernel allows to run Xonsh shell code in Jupyter, JupyterLab, Euporia, etc.

xonsh.xontribs.xontrib-vox: init at 0.0.1
A plugin for the xonsh shell allowing manipulation of Python virtual
environments

xonsh.xontribs.xontrib-whole-word-jumping: init at 0.0.1
A plugin for the xonsh shell that adds additional navigation options

Co-authored-by: Infinidoge <[email protected]>
  • Loading branch information
greg-hellings and Infinidoge committed Nov 9, 2024
1 parent 4a8f0d1 commit 144030b
Show file tree
Hide file tree
Showing 14 changed files with 542 additions and 10 deletions.
32 changes: 27 additions & 5 deletions nixos/modules/programs/xonsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
let

cfg = config.programs.xonsh;
package = cfg.package.overridePythonAttrs (old: {
python3 = pkgs.python3.withPackages (ps: cfg.xontribs);
propagatedBuildInputs = old.propagatedBuildInputs ++ cfg.xontribs;
});

in

Expand Down Expand Up @@ -32,6 +36,22 @@ in
type = lib.types.lines;
};

xontribs = lib.mkOption {
default = [];
description = ''
Add the listed xontribs to the package options. Available xontribs are
under xonsh.xontribs.
Take care in using this option along with manually defining the package
option above, as the two can result in conflicting sets of build dependencies.
This option assumes that the package option has an overridable argument
called `extraPackages`, so if you override the package option but also
intend to use this option, be sure that your resulting package still honors
the necessary option.
'';
example = "xontribs = with pkgs.xonsh.xontribs; [ xontrib-vox xontrib-abbrevs ];";
};

};

};
Expand Down Expand Up @@ -64,11 +84,13 @@ in
${cfg.config}
'';

environment.systemPackages = [ cfg.package ];

environment.shells = [
"/run/current-system/sw/bin/xonsh"
"${lib.getExe cfg.package}"
environment.systemPackages = [
package
];

environment.shells =
[ "/run/current-system/sw/bin/xonsh"
"${lib.getExe package}"
];
};
}
13 changes: 8 additions & 5 deletions pkgs/by-name/xo/xonsh/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
}:

let
pythonEnv = python3.withPackages
(ps: [ ps.xonsh ] ++ extraPackages ps);
pythonEnv = python3.withPackages (ps: [ ps.xonsh ] ++ extraPackages ps);
xonsh = python3.pkgs.xonsh;
in
runCommand
"xonsh-${xonsh.version}"
runCommand "xonsh-${xonsh.version}"
{
inherit (xonsh) pname version meta passthru;
inherit (xonsh)
pname
version
meta
passthru
;
}
''
mkdir -p $out/bin
Expand Down
1 change: 1 addition & 0 deletions pkgs/by-name/xo/xonsh/unwrapped.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ let
python = pythonPackages.python; # To the wrapper
wrapper = throw "The top-level xonsh package is now wrapped. Use it directly.";
updateScript = gitUpdater { };
xontribs = import ./xontribs { inherit pythonPackages; };
};

meta = {
Expand Down
27 changes: 27 additions & 0 deletions pkgs/by-name/xo/xonsh/xontribs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
pythonPackages,
}:
let
inherit (pythonPackages) callPackage;
in
{
xonsh-direnv = callPackage ./xonsh-direnv { };

xontrib-abbrevs = callPackage ./xontrib-abbrevs { };

xontrib-bashisms = callPackage ./xontrib-bashisms { };

xontrib-debug-tools = callPackage ./xontrib-debug-tools { };

xontrib-distributed = callPackage ./xontrib-distributed { };

xontrib-fish-completer = callPackage ./xontrib-fish-completer { };

xontrib-jedi = callPackage ./xontrib-jedi { };

xontrib-jupyter = callPackage ./xontrib-jupyter { };

xontrib-vox = callPackage ./xontrib-vox { };

xontrib-whole-word-jumping = callPackage ./xontrib-whole-word-jumping { };
}
35 changes: 35 additions & 0 deletions pkgs/by-name/xo/xonsh/xontribs/xonsh-direnv/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
buildPythonPackage,
lib,
fetchFromGitHub,

direnv,
setuptools,
}:

buildPythonPackage rec {
pname = "xonsh-direnv";
version = "1.6.5";

src = fetchFromGitHub {
owner = "74th";
repo = pname;
rev = version;
hash = "sha256-huBJ7WknVCk+WgZaXHlL+Y1sqsn6TYqMP29/fsUPSyU=";
};

propagatedBuildInputs = [
direnv
];

nativeBuildInputs = [
setuptools
];

meta = with lib; {
description = "Direnv support for Xonsh";
homepage = "https://github.com/74th/xonsh-direnv/";
license = licenses.mit;
maintainers = with maintainers; [ greg ];
};
}
56 changes: 56 additions & 0 deletions pkgs/by-name/xo/xonsh/xontribs/xontrib-abbrevs/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
buildPythonPackage,
lib,
fetchFromGitHub,

setuptools,
setuptools-scm,
poetry-core,
prompt-toolkit,
pytestCheckHook,
xonsh,
}:

buildPythonPackage rec {
pname = "xontrib-abbrevs";
version = "0.1.0";
format = "pyproject";

src = fetchFromGitHub {
owner = "xonsh";
repo = "xontrib-abbrevs";
rev = "v${version}";
hash = "sha256-JxH5b2ey99tvHXSUreU5r6fS8nko4RrS/1c8psNbJNc=";
};

prePatch = ''
substituteInPlace pyproject.toml \
--replace '"xonsh>=0.12.5", ' ""
'';

nativeBuildInputs = [
setuptools
setuptools-scm
poetry-core
];

propagatedBuildInputs = [
prompt-toolkit
];

preCheck = ''
export HOME=$TMPDIR
'';

checkInputs = [
pytestCheckHook
xonsh
];

meta = with lib; {
description = "Command abbreviations. This expands input words as you type.";
homepage = "https://github.com/xonsh/xontrib-abbrevs";
license = licenses.mit;
maintainers = [ maintainers.greg ];
};
}
47 changes: 47 additions & 0 deletions pkgs/by-name/xo/xonsh/xontribs/xontrib-bashisms/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
buildPythonPackage,
lib,
fetchFromGitHub,

setuptools,
pytestCheckHook,
xonsh,
}:

buildPythonPackage rec {
pname = "xontrib-bashisms";
version = "0.0.5";
format = "pyproject";

src = fetchFromGitHub {
owner = "xonsh";
repo = "xontrib-bashisms";
rev = version;
hash = "sha256-R1DCGMrRCJLnz/QMk6QB8ai4nx88vvyPdaCKg3od5/I=";
};

prePatch = ''
substituteInPlace pyproject.toml \
--replace '"xonsh>=0.12.5"' ""
'';

preCheck = ''
export HOME=$TMPDIR
'';

nativeBuildInputs = [
setuptools
];

checkInputs = [
pytestCheckHook
xonsh
];

meta = with lib; {
description = "Bash-like interactive mode extensions for the xonsh shell. ";
homepage = "https://github.com/xonsh/xontrib-bashisms";
license = licenses.mit;
maintainers = [ maintainers.greg ];
};
}
41 changes: 41 additions & 0 deletions pkgs/by-name/xo/xonsh/xontribs/xontrib-debug-tools/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
buildPythonPackage,
lib,
fetchFromGitHub,

pytestCheckHook,
xonsh,
}:

buildPythonPackage rec {
pname = "xontrib-debug-tools";
version = "0.0.1";

src = fetchFromGitHub {
owner = "xonsh";
repo = "xontrib-debug-tools";
rev = version;
hash = "sha256-Z8AXKk94NxmF5rO2OMZzNX0GIP/Vj+mOtYUaifRX1cw=";
};

prePatch = ''
substituteInPlace pyproject.toml \
--replace '"xonsh>=0.12.5"' ""
'';

preCheck = ''
export HOME=$TMPDIR
'';

checkInputs = [
pytestCheckHook
xonsh
];

meta = with lib; {
description = "Debug tools for xonsh shell.";
homepage = "https://github.com/xonsh/xontrib-debug-tools";
license = licenses.mit;
maintainers = [ maintainers.greg ];
};
}
51 changes: 51 additions & 0 deletions pkgs/by-name/xo/xonsh/xontribs/xontrib-distributed/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
buildPythonPackage,
lib,
fetchFromGitHub,

distributed,
poetry-core,
pytestCheckHook,
xonsh,
}:

buildPythonPackage rec {
pname = "xontrib-distributed";
version = "0.0.4";
format = "pyproject";

src = fetchFromGitHub {
owner = "xonsh";
repo = "xontrib-distributed";
rev = "v${version}";
hash = "sha256-Hb7S3PqHi0w6zb9ki8ADMtgdYVv8O5WQZMgJzKF74qE=";
};

prePatch = ''
substituteInPlace pyproject.toml \
--replace 'xonsh = ">=0.12"' ""
'';

nativeBuildInputs = [
poetry-core
];

propagatedBuildInputs = [
distributed
];

# v0.0.4 has no tests associated with it
doCheck = false;

checkInputs = [
pytestCheckHook
xonsh
];

meta = with lib; {
description = "Dask Distributed integration for Xonsh";
homepage = "https://github.com/xonsh/xontrib-distributed";
license = licenses.mit;
maintainers = [ maintainers.greg ];
};
}
47 changes: 47 additions & 0 deletions pkgs/by-name/xo/xonsh/xontribs/xontrib-fish-completer/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
buildPythonPackage,
lib,
fetchFromGitHub,

pytestCheckHook,
pytest-subprocess,
xonsh,
}:

buildPythonPackage rec {
pname = "xontrib-fish-completer";
version = "0.0.1";

src = fetchFromGitHub {
owner = "xonsh";
repo = "xontrib-fish-completer";
rev = version;
hash = "sha256-PhhdZ3iLPDEIG9uDeR5ctJ9zz2+YORHBhbsiLrJckyA=";
};

prePatch = ''
substituteInPlace pyproject.toml \
--replace '"xonsh>=0.12.5"' ""
'';

preCheck = ''
export HOME=$TMPDIR
'';

disabledTests = [
"test_interpreter"
];

checkInputs = [
pytestCheckHook
pytest-subprocess
xonsh
];

meta = with lib; {
description = "Populate rich completions using fish and remove the default bash based completer";
homepage = "https://github.com/xonsh/xontrib-fish-completer";
license = licenses.mit;
maintainers = [ maintainers.greg ];
};
}
Loading

0 comments on commit 144030b

Please sign in to comment.