diff --git a/pkgs/by-name/xo/xonsh/package.nix b/pkgs/by-name/xo/xonsh/package.nix new file mode 100644 index 000000000000..1882a3096635 --- /dev/null +++ b/pkgs/by-name/xo/xonsh/package.nix @@ -0,0 +1,23 @@ +{ lib +, callPackage +, extraPackages ? (ps: [ ]) +, runCommand +}: + +let + xonsh-unwrapped = callPackage ./unwrapped.nix { }; + inherit (xonsh-unwrapped.passthru) python; + + pythonEnv = python.withPackages (ps: [ + (ps.toPythonModule xonsh-unwrapped) + ] ++ extraPackages ps); +in +runCommand "xonsh-${xonsh-unwrapped.version}" +{ + inherit (xonsh-unwrapped) pname version meta passthru; +} '' + mkdir -p $out/bin + for bin in ${lib.getBin xonsh-unwrapped}/bin/*; do + ln -s ${pythonEnv}/bin/$(basename "$bin") $out/bin/ + done +'' diff --git a/pkgs/shells/xonsh/default.nix b/pkgs/by-name/xo/xonsh/unwrapped.nix similarity index 74% rename from pkgs/shells/xonsh/default.nix rename to pkgs/by-name/xo/xonsh/unwrapped.nix index 67896d83632d..fcc46c5b6770 100644 --- a/pkgs/shells/xonsh/default.nix +++ b/pkgs/by-name/xo/xonsh/unwrapped.nix @@ -1,24 +1,40 @@ { lib -, fetchFromGitHub -, python3 -, glibcLocales , coreutils +, fetchFromGitHub , git +, gitUpdater +, glibcLocales +, python3 }: -python3.pkgs.buildPythonApplication rec { +let pname = "xonsh"; - version = "0.14.0"; - format = "pyproject"; + version = "0.14.4"; +in +python3.pkgs.buildPythonApplication { + inherit pname version; + + pyproject = true; # fetch from github because the pypi package ships incomplete tests src = fetchFromGitHub { owner = "xonsh"; repo = "xonsh"; rev = "refs/tags/${version}"; - hash = "sha256-ZrPKKa/vl06QAjGr16ZzKF/DAByFHr6ze2WVOCa+wf8="; + hash = "sha256-7qOEc4RSdOO059LietKnrxY7cy9MfgmfJjdqZZ5ENLU="; }; + nativeBuildInputs = with python3.pkgs; [ + setuptools + wheel + ]; + + propagatedBuildInputs = with python3.pkgs; [ + ply + prompt-toolkit + pygments + ]; + env.LC_ALL = "en_US.UTF-8"; postPatch = '' @@ -32,11 +48,6 @@ python3.pkgs.buildPythonApplication rec { patchShebangs . ''; - nativeBuildInputs = with python3.pkgs; [ - setuptools - wheel - ]; - disabledTests = [ # fails on sandbox "test_colorize_file" @@ -64,25 +75,32 @@ python3.pkgs.buildPythonApplication rec { "tests/completers/test_bash_completer.py" ]; + nativeCheckInputs = [ + git + glibcLocales + ] ++ (with python3.pkgs; [ + pip + pyte + pytest-mock + pytest-subprocess + pytestCheckHook + ]); + preCheck = '' - HOME=$TMPDIR + export HOME=$TMPDIR ''; - nativeCheckInputs = [ glibcLocales git ] ++ - (with python3.pkgs; [ pip pyte pytestCheckHook pytest-mock pytest-subprocess ]); - - propagatedBuildInputs = with python3.pkgs; [ ply prompt-toolkit pygments ]; - - meta = with lib; { - description = "A Python-ish, BASHwards-compatible shell"; - homepage = "https://xon.sh/"; - changelog = "https://github.com/xonsh/xonsh/raw/${version}/CHANGELOG.rst"; - license = licenses.bsd3; - maintainers = with maintainers; [ vrthra ]; - }; - passthru = { shellPath = "/bin/xonsh"; - python = python3; + python = python3; # To the wrapper + updateScript = gitUpdater { }; + }; + + meta = { + homepage = "https://xon.sh/"; + description = "A Python-ish, BASHwards-compatible shell"; + changelog = "https://github.com/xonsh/xonsh/raw/${version}/CHANGELOG.rst"; + license = with lib.licenses; [ bsd3 ]; + maintainers = with lib.maintainers; [ AndersonTorres ]; }; } diff --git a/pkgs/shells/xonsh/wrapper.nix b/pkgs/shells/xonsh/wrapper.nix deleted file mode 100644 index 7868404ca5fb..000000000000 --- a/pkgs/shells/xonsh/wrapper.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ runCommand -, xonsh-unwrapped -, lib -, extraPackages ? (ps: [ ]) -}: - -let - xonsh = xonsh-unwrapped; - inherit (xonsh.passthru) python; - - pythonEnv = python.withPackages (ps: [ - (ps.toPythonModule xonsh) - ] ++ extraPackages ps); - -in -runCommand "${xonsh.pname}-${xonsh.version}" -{ - inherit (xonsh) pname version meta passthru; -} '' - mkdir -p $out/bin - for bin in ${lib.getBin xonsh}/bin/*; do - ln -s ${pythonEnv}/bin/$(basename "$bin") $out/bin/ - done -'' diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index b62a6c88843e..5ac799db2ade 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -1149,6 +1149,7 @@ mapAliases ({ xdg_utils = xdg-utils; # Added 2021-02-01 xineLib = xine-lib; # Added 2021-04-27 xineUI = xine-ui; # Added 2021-04-27 + xonsh-unwrapped = throw "'xonsh-unwrapped' was incorporated into xonsh code; call xonsh directly instead."; # Added 2024-01-20 xtrt = throw "xtrt has been removed due to being abandoned"; # Added 2023-05-25 xulrunner = firefox-unwrapped; # Added 2023-11-03 xvfb_run = xvfb-run; # Added 2021-05-07 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 929c8a1108b7..ad7acee23b37 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15394,9 +15394,6 @@ with pkgs; rush = callPackage ../shells/rush { }; - xonsh = callPackage ../shells/xonsh/wrapper.nix { }; - xonsh-unwrapped = callPackage ../shells/xonsh { }; - zsh = callPackage ../shells/zsh { }; nix-zsh-completions = callPackage ../shells/zsh/nix-zsh-completions { };