2026-02-14 01:42:45 -08:00
|
|
|
{
|
|
|
|
|
lib,
|
|
|
|
|
stdenv,
|
|
|
|
|
fetchFromGitHub,
|
|
|
|
|
callPackage,
|
2026-02-16 12:28:25 -08:00
|
|
|
symlinkJoin,
|
|
|
|
|
pkg-config,
|
2026-02-14 01:42:45 -08:00
|
|
|
ninja,
|
|
|
|
|
git,
|
2026-02-16 12:28:25 -08:00
|
|
|
re2c,
|
2026-02-14 01:42:45 -08:00
|
|
|
cmark,
|
|
|
|
|
which,
|
|
|
|
|
time,
|
|
|
|
|
readline,
|
2026-02-16 12:28:25 -08:00
|
|
|
ncurses,
|
|
|
|
|
zlib,
|
|
|
|
|
libffi,
|
2026-02-14 01:42:45 -08:00
|
|
|
}:
|
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
version = "0.37.0";
|
|
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
|
owner = "oils-for-unix";
|
|
|
|
|
repo = "oils";
|
2026-02-16 12:28:25 -08:00
|
|
|
rev = "release/${version}";
|
2026-02-14 01:42:45 -08:00
|
|
|
hash = "sha256-d2i2P8ZiGb+FYzZIzs0pY2gIRQGGuenLbxrGhafVxVc=";
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-16 12:28:25 -08:00
|
|
|
wedges = callPackage ./wedges.nix { };
|
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
|
pname = "oils-for-unix";
|
|
|
|
|
inherit version src;
|
|
|
|
|
|
2026-02-14 01:42:45 -08:00
|
|
|
nativeBuildInputs = [
|
2026-02-16 12:28:25 -08:00
|
|
|
pkg-config
|
2026-02-14 01:42:45 -08:00
|
|
|
ninja
|
|
|
|
|
git
|
2026-02-16 12:28:25 -08:00
|
|
|
re2c
|
2026-02-14 01:42:45 -08:00
|
|
|
cmark
|
|
|
|
|
which
|
|
|
|
|
time
|
2026-02-16 12:28:25 -08:00
|
|
|
wedges.python2Wedge
|
|
|
|
|
wedges.python3Wedge
|
2026-02-14 01:42:45 -08:00
|
|
|
];
|
|
|
|
|
|
2026-02-16 12:28:25 -08:00
|
|
|
buildInputs = [
|
|
|
|
|
readline
|
|
|
|
|
ncurses
|
|
|
|
|
zlib
|
|
|
|
|
libffi
|
|
|
|
|
];
|
2026-02-14 01:42:45 -08:00
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
|
patchShebangs .
|
|
|
|
|
|
|
|
|
|
substituteInPlace build/dynamic-deps.sh \
|
|
|
|
|
--replace-quiet '/usr/bin/env' "$(command -v env)"
|
|
|
|
|
|
|
|
|
|
substituteInPlace pyext/posixmodule.c \
|
|
|
|
|
--replace-quiet '_PyVerify_fd(fd)' '1'
|
|
|
|
|
|
|
|
|
|
substituteInPlace doctools/cmark.py \
|
|
|
|
|
--replace-quiet "raise AssertionError('bin/cmark not found')" \
|
|
|
|
|
"cmark_path = '${cmark}/bin/cmark'"
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
|
runHook preConfigure
|
2026-02-16 12:28:25 -08:00
|
|
|
|
2026-02-14 01:42:45 -08:00
|
|
|
./configure \
|
|
|
|
|
--datarootdir=$out \
|
|
|
|
|
--with-readline \
|
2026-02-16 12:28:25 -08:00
|
|
|
--readline=${wedges.readline-all}
|
|
|
|
|
|
2026-02-14 01:42:45 -08:00
|
|
|
runHook postConfigure
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
|
runHook preBuild
|
2026-02-16 12:28:25 -08:00
|
|
|
|
|
|
|
|
export PATH="${wedges.python2Wedge}/bin:${wedges.python3Wedge}/bin:$PATH"
|
|
|
|
|
export PATH="${wedges.mypyWedge}/bin:$PATH"
|
|
|
|
|
export PYTHONPATH="${wedges.mypyWedge}/lib/python3.10/site-packages:.:vendor/"
|
|
|
|
|
export LD_LIBRARY_PATH="${wedges.python2Wedge}/lib:${wedges.python3Wedge}/lib:''${LD_LIBRARY_PATH:-}"
|
|
|
|
|
|
2026-02-14 01:42:45 -08:00
|
|
|
build/py.sh configure-for-dev
|
|
|
|
|
build/stamp.sh write-git-commit
|
|
|
|
|
build/py.sh py-source
|
|
|
|
|
build/py.sh py-extensions
|
|
|
|
|
build/doc.sh all-ref
|
|
|
|
|
./NINJA-config.sh
|
|
|
|
|
ninja _bin/cxx-opt/oils-for-unix
|
2026-02-16 12:28:25 -08:00
|
|
|
|
2026-02-14 01:42:45 -08:00
|
|
|
runHook postBuild
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
|
runHook preInstall
|
2026-02-16 12:28:25 -08:00
|
|
|
|
2026-02-14 01:42:45 -08:00
|
|
|
mkdir -p $out/bin
|
|
|
|
|
install -m755 _bin/cxx-opt/oils-for-unix $out/bin/oils-for-unix
|
|
|
|
|
ln -s oils-for-unix $out/bin/osh
|
|
|
|
|
ln -s oils-for-unix $out/bin/ysh
|
2026-02-16 12:28:25 -08:00
|
|
|
|
2026-02-14 01:42:45 -08:00
|
|
|
runHook postInstall
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=incompatible-function-pointer-types";
|
|
|
|
|
|
|
|
|
|
meta = {
|
2026-02-16 12:28:25 -08:00
|
|
|
description = "Oils is our upgrade path from bash to a better language and runtime";
|
|
|
|
|
homepage = "https://www.oilshell.org/";
|
2026-02-14 01:42:45 -08:00
|
|
|
license = lib.licenses.asl20;
|
2026-02-16 12:28:25 -08:00
|
|
|
platforms = lib.platforms.unix;
|
2026-02-14 01:42:45 -08:00
|
|
|
mainProgram = "osh";
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-16 12:28:25 -08:00
|
|
|
passthru = {
|
|
|
|
|
inherit wedges;
|
|
|
|
|
|
|
|
|
|
withSrc = newSrc: finalAttrs.finalPackage.overrideAttrs { src = newSrc; };
|
|
|
|
|
}
|
|
|
|
|
// (
|
2026-02-14 01:42:45 -08:00
|
|
|
let
|
|
|
|
|
mkShell =
|
|
|
|
|
shellName:
|
|
|
|
|
symlinkJoin {
|
2026-02-16 12:28:25 -08:00
|
|
|
name = "oils-for-unix-${shellName}-${version}";
|
2026-02-14 01:42:45 -08:00
|
|
|
paths = [ finalAttrs.finalPackage ];
|
|
|
|
|
passthru.shellPath = "/bin/${shellName}";
|
|
|
|
|
meta = finalAttrs.meta // {
|
|
|
|
|
mainProgram = shellName;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
osh = mkShell "osh";
|
|
|
|
|
ysh = mkShell "ysh";
|
2026-02-16 12:28:25 -08:00
|
|
|
}
|
|
|
|
|
);
|
2026-02-14 01:42:45 -08:00
|
|
|
})
|