about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/xo
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-02-13 12:25:07 +0100
committerAlyssa Ross <hi@alyssa.is>2024-02-13 12:25:07 +0100
commita5e1520e4538e29ecfbd4b168306f890566d7bfd (patch)
tree28099c268b5d4b1e33c2b29f0714c45f0b961382 /nixpkgs/pkgs/by-name/xo
parent822f7c15c04567fbdc27020e862ea2b70cfbf8eb (diff)
parent3560d1c8269d0091b9aae10731b5e85274b7bbc1 (diff)
downloadnixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.gz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.bz2
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.lz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.xz
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.tar.zst
nixlib-a5e1520e4538e29ecfbd4b168306f890566d7bfd.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/nixos/modules/services/mail/rss2email.nix
	nixpkgs/pkgs/build-support/go/module.nix
Diffstat (limited to 'nixpkgs/pkgs/by-name/xo')
-rw-r--r--nixpkgs/pkgs/by-name/xo/xonsh/package.nix23
-rw-r--r--nixpkgs/pkgs/by-name/xo/xonsh/unwrapped.nix106
2 files changed, 129 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/xo/xonsh/package.nix b/nixpkgs/pkgs/by-name/xo/xonsh/package.nix
new file mode 100644
index 000000000000..1882a3096635
--- /dev/null
+++ b/nixpkgs/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/nixpkgs/pkgs/by-name/xo/xonsh/unwrapped.nix b/nixpkgs/pkgs/by-name/xo/xonsh/unwrapped.nix
new file mode 100644
index 000000000000..fcc46c5b6770
--- /dev/null
+++ b/nixpkgs/pkgs/by-name/xo/xonsh/unwrapped.nix
@@ -0,0 +1,106 @@
+{ lib
+, coreutils
+, fetchFromGitHub
+, git
+, gitUpdater
+, glibcLocales
+, python3
+}:
+
+let
+  pname = "xonsh";
+  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-7qOEc4RSdOO059LietKnrxY7cy9MfgmfJjdqZZ5ENLU=";
+  };
+
+  nativeBuildInputs = with python3.pkgs; [
+    setuptools
+    wheel
+  ];
+
+  propagatedBuildInputs = with python3.pkgs; [
+    ply
+    prompt-toolkit
+    pygments
+  ];
+
+  env.LC_ALL = "en_US.UTF-8";
+
+  postPatch = ''
+    sed -ie "s|/bin/ls|${coreutils}/bin/ls|" tests/test_execer.py
+    sed -ie "s|SHELL=xonsh|SHELL=$out/bin/xonsh|" tests/test_integrations.py
+
+    sed -ie 's|/usr/bin/env|${coreutils}/bin/env|' tests/test_integrations.py
+    sed -ie 's|/usr/bin/env|${coreutils}/bin/env|' scripts/xon.sh
+    find scripts -name 'xonsh*' -exec sed -i -e "s|env -S|env|" {} \;
+    find -name "*.xsh" | xargs sed -ie 's|/usr/bin/env|${coreutils}/bin/env|'
+    patchShebangs .
+  '';
+
+  disabledTests = [
+    # fails on sandbox
+    "test_colorize_file"
+    "test_loading_correctly"
+    "test_no_command_path_completion"
+    "test_bsd_man_page_completions"
+    "test_xonsh_activator"
+    # fails on non-interactive shells
+    "test_capture_always"
+    "test_casting"
+    "test_command_pipeline_capture"
+    "test_dirty_working_directory"
+    "test_man_completion"
+    "test_vc_get_branch"
+    "test_bash_and_is_alias_is_only_functional_alias"
+  ];
+
+  disabledTestPaths = [
+    # fails on sandbox
+    "tests/completers/test_command_completers.py"
+    "tests/test_ptk_highlight.py"
+    "tests/test_ptk_shell.py"
+    # fails on non-interactive shells
+    "tests/prompt/test_gitstatus.py"
+    "tests/completers/test_bash_completer.py"
+  ];
+
+  nativeCheckInputs = [
+    git
+    glibcLocales
+  ] ++ (with python3.pkgs; [
+    pip
+    pyte
+    pytest-mock
+    pytest-subprocess
+    pytestCheckHook
+  ]);
+
+  preCheck = ''
+    export HOME=$TMPDIR
+  '';
+
+  passthru = {
+    shellPath = "/bin/xonsh";
+    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 ];
+  };
+}