Files
nixpkgs/pkgs/by-name/rc/rc/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

110 lines
2.1 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
pkgsStatic,
byacc,
ed,
ncurses,
readline,
installShellFiles,
historySupport ? true,
readlineSupport ? true,
lineEditingLibrary ?
if (stdenv.hostPlatform.isDarwin || stdenv.hostPlatform.isStatic) then "null" else "readline",
}:
assert lib.elem lineEditingLibrary [
"null"
"edit"
"editline"
"readline"
"vrl"
];
assert
!(lib.elem lineEditingLibrary [
"edit"
"editline"
"vrl"
]); # broken
assert (lineEditingLibrary == "readline") -> readlineSupport;
stdenv.mkDerivation (finalAttrs: {
pname = "rc";
version = "unstable-2023-06-14";
src = fetchFromGitHub {
owner = "rakitzis";
repo = "rc";
rev = "4aaba1a9cb9fdbb8660696a87850836ffdb09599";
hash = "sha256-Yql3mt7hTO2W7wTfPje+X2zBGTHiNXGGXYORJewJIM8=";
};
outputs = [
"out"
"man"
];
# TODO: think on a less ugly fixup
postPatch = ''
ed -v -s Makefile << EOS
# - remove reference to now-inexistent git index file
/version.h:/ s| .git/index||
# - manually insert the git revision string
/v=/ c
${"\t"}v=${builtins.substring 0 7 finalAttrs.src.rev}
.
/\.git\/index:/ d
w
q
EOS
'';
nativeBuildInputs = [
byacc
ed
installShellFiles
];
buildInputs = [
ncurses
]
++ lib.optionals readlineSupport [
readline
];
strictDeps = true;
makeFlags = [
"CC=${stdenv.cc.targetPrefix}cc"
"PREFIX=${placeholder "out"}"
"MANPREFIX=${placeholder "man"}/share/man"
"CPPFLAGS=\"-DSIGCLD=SIGCHLD\""
"EDIT=${lineEditingLibrary}"
];
buildFlags = [
"all"
]
++ lib.optionals historySupport [
"history"
];
postInstall = lib.optionalString historySupport ''
installManPage history.1
'';
passthru = {
shellPath = "/bin/rc";
tests.static = pkgsStatic.rc;
};
meta = {
homepage = "https://github.com/rakitzis/rc";
description = "Plan 9 shell";
license = [ lib.licenses.zlib ];
mainProgram = "rc";
maintainers = with lib.maintainers; [ ramkromberg ];
platforms = lib.platforms.unix;
};
})