push sheeet
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

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
{ callPackage, fetchurl }:
callPackage ./unwrapped.nix rec {
version = "0.100";
src = fetchurl {
url = "https://downloads.factorcode.org/releases/${version}/factor-src-${version}.zip";
hash = "sha256-ei1x6mgEoDVe1mKfoWSGC9RgZCONovAPYfIdAlOGi+0=";
};
}

View File

@@ -0,0 +1,9 @@
{ callPackage, fetchurl }:
callPackage ./unwrapped.nix rec {
version = "0.99";
src = fetchurl {
url = "https://downloads.factorcode.org/releases/${version}/factor-src-${version}.zip";
sha256 = "f5626bb3119bd77de9ac3392fdbe188bffc26557fab3ea34f7ca21e372a8443e";
};
}

View File

@@ -0,0 +1,29 @@
diff -ur factor.orig/basis/io/standard-paths/unix/unix-tests.factor factor/basis/io/standard-paths/unix/unix-tests.factor
--- factor.orig/basis/io/standard-paths/unix/unix-tests.factor 2024-02-09 14:38:33.932439180 +0100
+++ factor/basis/io/standard-paths/unix/unix-tests.factor 2024-02-09 15:41:18.529141569 +0100
@@ -1,21 +1,21 @@
! Copyright (C) 2011 Doug Coleman.
! See https://factorcode.org/license.txt for BSD license.
USING: environment io.standard-paths io.standard-paths.unix
-sequences tools.test ;
+kernel sequences tools.test ;
{ f } [ "" find-in-path ] unit-test
{ t } [
- "ls" find-in-path { "/bin/ls" "/usr/bin/ls" } member?
+ "ls" find-in-path not not
] unit-test
{ t } [
"/sbin:" "PATH" os-env append "PATH" [
"ps" find-in-path
- { "/bin/ps" "/sbin/ps" "/usr/bin/ps" } member?
+ not not
] with-os-env
] unit-test
{ t } [
"ls" find-in-standard-login-path
- { "/bin/ls" "/usr/bin/ls" } member?
+ not not
] unit-test

View File

@@ -0,0 +1,244 @@
{
lib,
stdenv,
cairo,
curl,
fetchurl,
freealut,
gdk-pixbuf,
git,
glib,
gnome2,
graphviz,
gtk2-x11,
interpreter,
libGL,
libGLU,
libogg,
librsvg,
libvorbis,
makeWrapper,
ncurses,
openal,
openssl,
pango,
pcre,
runCommand,
runtimeShell,
tzdata,
udis86,
unzip,
writeScriptBin,
zlib,
}:
let
runtimeLibs = [
cairo
freealut
gdk-pixbuf
glib
gnome2.gtkglext
graphviz
gtk2-x11
libGL
libGLU
libogg
libvorbis
openal
openssl
pango
pcre
udis86
zlib
];
wrapFactorScript =
{
from,
to ? false,
runtimeLibs,
}:
''
# Set Gdk pixbuf loaders file to the one from the build dependencies here
unset GDK_PIXBUF_MODULE_FILE
# Defined in gdk-pixbuf setup hook
findGdkPixbufLoaders "${librsvg}"
${if (builtins.isString to) then "makeWrapper ${from} ${to}" else "wrapProgram ${from}"} \
--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
--argv0 factor \
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:${lib.makeLibraryPath runtimeLibs} \
--prefix PATH : ${lib.makeBinPath [ graphviz ]}
'';
wrapFactor =
runtimeLibs:
runCommand (lib.appendToName "with-libs" interpreter).name
{
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ gdk-pixbuf ];
passthru.runtimeLibs = runtimeLibs ++ interpreter.runtimeLibs;
}
(wrapFactorScript {
from = "${interpreter}/lib/factor/.factor-wrapped";
to = "$out/bin/factor";
runtimeLibs = (runtimeLibs ++ interpreter.runtimeLibs);
});
# Development helper for use in nix shell
wrapLocalFactor = writeScriptBin "wrapFactor" ''
#!${runtimeShell}
${wrapFactorScript {
from = "./factor";
inherit runtimeLibs;
}}
ln -sf factor.image .factor-wrapped.image
'';
rev = "e10b64dbc53a8583098e73580a1eb9ff4ce0c709";
version = "0.99";
in
stdenv.mkDerivation {
pname = "factor-lang";
inherit version;
src = fetchurl {
url = "https://downloads.factorcode.org/releases/${version}/factor-src-${version}.zip";
sha256 = "f5626bb3119bd77de9ac3392fdbe188bffc26557fab3ea34f7ca21e372a8443e";
};
patches = [
./staging-command-line-0.99-pre.patch
./workdir-0.99-pre.patch
./adjust-paths-in-unit-tests.patch
];
nativeBuildInputs = [
git
makeWrapper
curl
unzip
wrapLocalFactor
];
buildInputs = runtimeLibs;
postPatch = ''
sed -i -e '4i GIT_LABEL = heads/master-${rev}' GNUmakefile
# There is no ld.so.cache in NixOS so we patch out calls to that completely.
# This should work as long as no application code relies on `find-library*`
# to return a match, which currently is the case and also a justified assumption.
sed -i -e "s#/sbin/ldconfig -p#cat $out/lib/factor/ld.so.cache#g" \
basis/alien/libraries/finder/linux/linux.factor
# Some other hard-coded paths to fix:
sed -i 's#/usr/share/zoneinfo/#${tzdata}/share/zoneinfo/#g' \
extra/tzinfo/tzinfo.factor
sed -i 's#/usr/share/terminfo#${ncurses.out}/share/terminfo#g' \
extra/terminfo/terminfo.factor
# De-memoize xdg-* functions, otherwise they break the image.
sed -i -e 's/^MEMO:/:/' basis/xdg/xdg.factor
# update default paths in factor-listener.el for fuel mode
substituteInPlace misc/fuel/fuel-listener.el \
--replace '(defcustom fuel-factor-root-dir nil' "(defcustom fuel-factor-root-dir \"$out/lib/factor\""
'';
buildPhase = ''
runHook preBuild
# Necessary here, because ld.so.cache is needed in its final location during rebuild.
mkdir -p $out/bin $out/lib/factor
patchShebangs ./build.sh
# Factor uses XDG_CACHE_HOME for cache during compilation.
# We can't have that. So, set it to $TMPDIR/.cache
export XDG_CACHE_HOME=$TMPDIR/.cache && mkdir -p $XDG_CACHE_HOME
# There is no ld.so.cache in NixOS so we construct one
# out of known libraries. The side effect is that find-lib
# will work only on the known libraries. There does not seem
# to be a generic solution here.
find $(echo ${lib.makeLibraryPath runtimeLibs} | sed -e 's#:# #g') -name \*.so.\* > $TMPDIR/so.lst
(echo $(cat $TMPDIR/so.lst | wc -l) "libs found in cache \`/etc/ld.so.cache'";
for l in $(<$TMPDIR/so.lst); do
echo " $(basename $l) (libc6,x86-64) => $l";
done)> $out/lib/factor/ld.so.cache
make -j$NIX_BUILD_CORES linux-x86-64
printf "First build from upstream boot image\n" >&2
./build.sh bootstrap
printf "Rebuild boot image\n" >&2
./factor -script -e='"unix-x86.64" USING: system bootstrap.image memory ; make-image save 0 exit'
printf "Second build from local boot image\n" >&2
./build.sh bootstrap
runHook postBuild
'';
# For now, the check phase runs, but should always return 0. This way the logs
# contain the test failures until all unit tests are fixed. Then, it should
# return 1 if any test failures have occurred.
doCheck = false;
checkPhase = ''
runHook preCheck
set +e
./factor -e='USING: tools.test zealot.factor sequences namespaces formatting ;
zealot-core-vocabs "compiler" suffix [ test ] each :test-failures
test-failures get length "Number of failed Tests: %d\n" printf'
[ $? -eq 0 ] || {
mkdir -p "$out/nix-support"
touch "$out/nix-support/failed"
}
set -e
runHook postCheck
'';
installPhase = ''
runHook preInstall
cp -r factor factor.image LICENSE.txt README.md basis core extra misc $out/lib/factor
# Create a wrapper in bin/ and lib/factor/
${wrapFactorScript {
from = "$out/lib/factor/factor";
inherit runtimeLibs;
}}
mv $out/lib/factor/factor.image $out/lib/factor/.factor-wrapped.image
cp $out/lib/factor/factor $out/bin/
# Emacs fuel expects the image being named `factor.image` in the factor base dir
ln -s $out/lib/factor/.factor-wrapped.image $out/lib/factor/factor.image
# install fuel mode for emacs
mkdir -p $out/share/emacs/site-lisp
ln -s $out/lib/factor/misc/fuel/*.el $out/share/emacs/site-lisp/
runHook postInstall
'';
passthru = {
inherit runtimeLibs wrapFactorScript;
withLibs = wrapFactor;
};
meta = with lib; {
homepage = "https://factorcode.org/";
description = "Concatenative, stack-based programming language";
longDescription = ''
The Factor programming language is a concatenative, stack-based
programming language with high-level features including dynamic types,
extensible syntax, macros, and garbage collection. On a practical side,
Factor has a full-featured library, supports many different platforms, and
has been extensively documented.
The implementation is fully compiled for performance, while still
supporting interactive development. Factor applications are portable
between all common platforms. Factor can deploy stand-alone applications
on all platforms. Full source code for the Factor project is available
under a BSD license.
'';
license = licenses.bsd2;
maintainers = with maintainers; [ spacefrogg ];
platforms = lib.intersectLists platforms.x86_64 platforms.linux;
mainProgram = "factor";
};
}

View File

@@ -0,0 +1,27 @@
diff -ur factor.orig/basis/alien/libraries/finder/linux/linux.factor factor/basis/alien/libraries/finder/linux/linux.factor
--- factor.orig/basis/alien/libraries/finder/linux/linux.factor 2024-02-09 14:38:33.966439078 +0100
+++ factor/basis/alien/libraries/finder/linux/linux.factor 2024-02-09 14:41:16.775938179 +0100
@@ -2,7 +2,7 @@
! See https://factorcode.org/license.txt for BSD license
USING: accessors alien.libraries.finder arrays assocs
combinators.short-circuit environment io io.encodings.utf8
-io.launcher kernel make sequences sets splitting system
+io.files io.launcher kernel make sequences sets splitting system
unicode ;
IN: alien.libraries.finder.linux
@@ -25,8 +25,12 @@
] map ;
: load-ldconfig-cache ( -- seq )
- "/sbin/ldconfig -p" utf8 [ read-lines ] with-process-reader*
- 2drop [ f ] [ rest parse-ldconfig-lines ] if-empty ;
+ "FACTOR_LD_SO_CACHE" os-env [
+ utf8 [ read-lines ] with-file-reader
+ ] [
+ { } clone
+ ] if*
+ [ f ] [ rest parse-ldconfig-lines ] if-empty ;
: ldconfig-arch ( -- str )
mach-map cpu of { "libc6" } or ;

View File

@@ -0,0 +1,144 @@
{
stdenv,
lib,
writeText,
makeWrapper,
factor-lang,
factor-no-gui,
librsvg,
gdk-pixbuf,
}@initAttrs:
drvArgs:
let
flang = factor-lang; # workaround to satisfy nixf-tidy
in
(stdenv.mkDerivation drvArgs).overrideAttrs (
finalAttrs:
{
name ? "${finalAttrs.pname}-${finalAttrs.version}",
factor-lang ? if enableUI then flang else factor-no-gui,
enableUI ? false,
# Allow overriding the path to the deployed vocabulary name. A
# $vocabName.factor file must exist!
vocabName ? finalAttrs.pname or name,
# Allow overriding the binary name
binName ? lib.last (lib.splitString "/" vocabName),
# Extra libraries needed
extraLibs ? [ ],
# Extra binaries in PATH
extraPaths ? [ ],
# Extra vocabularies needed by this application
extraVocabs ? [ ],
deployScriptText ? ''
USING: command-line io io.backend io.pathnames kernel namespaces sequences
tools.deploy tools.deploy.config tools.deploy.backend vocabs.loader ;
IN: deploy-me
: load-and-deploy ( path/vocab -- )
normalize-path [
parent-directory add-vocab-root
] [
file-name dup reload deploy
] bi ;
: deploy-vocab ( path/vocab path/target -- )
normalize-path deploy-directory set
f open-directory-after-deploy? set
load-and-deploy ;
: deploy-me ( -- )
command-line get dup length 2 = [
first2 deploy-vocab
] [
drop
"usage: deploy-me <PATH-TO-VOCAB> <TARGET-DIR>" print
nl
] if ;
MAIN: deploy-me
'',
...
}@attrs:
let
deployScript = writeText "deploy-me.factor" finalAttrs.deployScriptText;
wrapped-factor = finalAttrs.factor-lang.override {
inherit (finalAttrs) extraLibs extraVocabs;
doInstallCheck = false;
};
runtimePaths = with finalAttrs.wrapped-factor; defaultBins ++ binPackages ++ finalAttrs.extraPaths;
in
{
inherit
enableUI
vocabName
deployScriptText
extraLibs
extraPaths
extraVocabs
binName
factor-lang
wrapped-factor
;
nativeBuildInputs = [
makeWrapper
(lib.hiPrio finalAttrs.wrapped-factor)
]
++ attrs.nativeBuildInputs or [ ];
buildInputs = (lib.optional enableUI gdk-pixbuf) ++ attrs.buildInputs or [ ];
buildPhase =
attrs.buildPhase or ''
runHook preBuild
vocabBaseName=$(basename "$vocabName")
mkdir -p "$out/lib/factor" "$TMPDIR/.cache"
export XDG_CACHE_HOME="$TMPDIR/.cache"
factor "${deployScript}" "./$vocabName" "$out/lib/factor"
cp "$TMPDIR/factor-temp"/*.image "$out/lib/factor/$vocabBaseName"
runHook postBuild
'';
__structuredAttrs = true;
installPhase =
attrs.installPhase or (
''
runHook preInstall
''
+ (lib.optionalString finalAttrs.enableUI ''
# Set Gdk pixbuf loaders file to the one from the build dependencies here
unset GDK_PIXBUF_MODULE_FILE
# Defined in gdk-pixbuf setup hook
findGdkPixbufLoaders "${librsvg}"
appendToVar makeWrapperArgs --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE"
appendToVar makeWrapperArgs --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib
'')
+ (lib.optionalString (wrapped-factor.runtimeLibs != [ ])) ''
appendToVar makeWrapperArgs --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath wrapped-factor.runtimeLibs}"
''
+ ''
mkdir -p "$out/bin"
makeWrapper "$out/lib/factor/$vocabBaseName/$vocabBaseName" \
"$out/bin/$binName" \
--prefix PATH : "${lib.makeBinPath runtimePaths}" \
"''${makeWrapperArgs[@]}"
runHook postInstall
''
);
passthru = {
vocab = finalAttrs.src;
}
// attrs.passthru or { };
meta = {
platforms = wrapped-factor.meta.platforms;
mainProgram = finalAttrs.binName;
}
// attrs.meta or { };
}
)

View File

@@ -0,0 +1,59 @@
{
stdenv,
}@initAttrs:
drvArgs:
(stdenv.mkDerivation drvArgs).overrideAttrs (
finalAttrs:
{
name ? "${finalAttrs.pname}-${finalAttrs.version}",
vocabName ? finalAttrs.pname or name,
vocabRoot ? "extra",
# Runtime libraries needed to run this vocab, handed to runtime wrapper
extraLibs ? [ ],
# Extra vocabularies, handed to runtime wrapper
extraVocabs ? [ ],
# Extra binaries in PATH, handed to runtime wrapper
extraPaths ? [ ],
...
}@attrs:
{
inherit vocabName vocabRoot;
installPhase =
# Default installer
# 1. If lib/factor/<vocabRoot>/<vocabName> exists, copy all vocab roots
# under lib/factor/* to out/.
# 2. If <vocabName> exists, copy all directories next to <vocabName> to
# out/.
# These two carry over package-defined vocabs that the name-giving vocab
# depends on.
# 3. Otherwise, copy all .factor and .txt files to out/. For simple
# single-vocab packages.
attrs.installPhase or ''
runHook preInstall
mkdir -p "$out/lib/factor/${finalAttrs.vocabRoot}/${finalAttrs.vocabName}"
if [ -d "lib/factor/${finalAttrs.vocabRoot}/${finalAttrs.vocabName}" ]; then
find lib/factor -mindepth 1 -maxdepth 1 -type d -exec \
cp -r -t "$out/lib/factor" {} \+
elif [ -d "${finalAttrs.vocabName}" ]; then
fname="${finalAttrs.vocabName}"
base=$(basename "${finalAttrs.vocabName}")
root=''${fname%$base}
root=''${root:-.}
find "$root" -mindepth 1 -maxdepth 1 -type d \
-not \( -name bin -or -name doc -or -name lib \) -exec \
cp -r -t "$out/lib/factor/${finalAttrs.vocabRoot}" {} \+
else
cp *.factor *.txt "$out/lib/factor/${finalAttrs.vocabRoot}/${finalAttrs.vocabName}"
fi
runHook postInstall
'';
passthru = {
inherit extraLibs extraVocabs extraPaths;
};
meta = attrs.meta or { };
}
)

View File

@@ -0,0 +1,13 @@
diff --git a/basis/tools/deploy/backend/backend.factor b/basis/tools/deploy/backend/backend.factor
index cfcca0d..87a2b01 100644
--- a/basis/tools/deploy/backend/backend.factor
+++ b/basis/tools/deploy/backend/backend.factor
@@ -72,7 +72,7 @@ ERROR: can't-deploy-library-file library ;
[ staging-image-name "-output-image=" prepend , ]
[ join-words "-include=" prepend , ] bi
] [
- input-image-name "-i=" prepend ,
+ input-image-name resource-path "-i=" prepend ,
"-resource-path=" "" resource-path append ,
"-run=tools.deploy.restage" ,
] bi

View File

@@ -0,0 +1,110 @@
{
lib,
stdenv,
fetchurl,
makeWrapper,
curl,
git,
ncurses,
tzdata,
unzip,
# Version-specific attributes
version,
src,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "factor-lang";
inherit src version;
patches = [
# Use full path to image while bootstrapping
./staging-command-line-0.99-pre.patch
# Point work vocabulary root to a writable location
./workdir-0.99-pre.patch
# Patch hard-coded FHS paths
./adjust-paths-in-unit-tests.patch
# Avoid using /sbin/ldconfig
./ld.so.cache-from-env.patch
];
nativeBuildInputs = [
git
makeWrapper
curl
unzip
];
postPatch = ''
sed -ie '4i GIT_LABEL = heads/master-'$(< git-id) GNUmakefile
# Some other hard-coded paths to fix:
substituteInPlace extra/tzinfo/tzinfo.factor \
--replace-fail '/usr/share/zoneinfo' '${tzdata}/share/zoneinfo'
substituteInPlace extra/terminfo/terminfo.factor \
--replace-fail '/usr/share/terminfo' '${ncurses.out}/share/terminfo'
# update default paths in fuel-listener.el for fuel mode
substituteInPlace misc/fuel/fuel-listener.el \
--replace-fail '(defcustom fuel-factor-root-dir nil' "(defcustom fuel-factor-root-dir \"$out/lib/factor\""
'';
dontConfigure = true;
preBuild = ''
patchShebangs ./build.sh
# Factor uses XDG_CACHE_HOME for cache during compilation.
# We can't have that. So, set it to $TMPDIR/.cache
export XDG_CACHE_HOME=$TMPDIR/.cache
mkdir -p $XDG_CACHE_HOME
'';
makeTarget = "linux-x86-64";
postBuild = ''
printf "First build from upstream boot image\n" >&2
./build.sh bootstrap
printf "Rebuild boot image\n" >&2
./factor -script -e='"unix-x86.64" USING: system bootstrap.image memory ; make-image save 0 exit'
printf "Second build from local boot image\n" >&2
./build.sh bootstrap
'';
installPhase = ''
runHook preInstall
mkdir -p $out/lib/factor $out/share/emacs/site-lisp
cp -r factor factor.image libfactor.a libfactor-ffi-test.so \
boot.*.image LICENSE.txt README.md basis core extra misc \
$out/lib/factor
# install fuel mode for emacs
ln -r -s $out/lib/factor/misc/fuel/*.el $out/share/emacs/site-lisp
runHook postInstall
'';
meta = with lib; {
homepage = "https://factorcode.org/";
description = "Concatenative, stack-based programming language";
longDescription = ''
The Factor programming language is a concatenative, stack-based
programming language with high-level features including dynamic types,
extensible syntax, macros, and garbage collection. On a practical side,
Factor has a full-featured library, supports many different platforms, and
has been extensively documented.
The implementation is fully compiled for performance, while still
supporting interactive development. Factor applications are portable
between all common platforms. Factor can deploy stand-alone applications
on all platforms. Full source code for the Factor project is available
under a BSD license.
'';
license = licenses.bsd2;
maintainers = with maintainers; [
vrthra
spacefrogg
];
platforms = [ "x86_64-linux" ];
};
})

View File

@@ -0,0 +1,13 @@
diff --git a/core/io/pathnames/pathnames.factor b/core/io/pathnames/pathnames.factor
index a172fe4..40858bc 100644
--- a/core/io/pathnames/pathnames.factor
+++ b/core/io/pathnames/pathnames.factor
@@ -166,6 +166,8 @@ GENERIC: absolute-path ( path -- path' )
M: string absolute-path
{
+ { [ "resource:work" ?head ]
+ [ trim-head-separators "/var/lib/factor" prepend-path absolute-path ] }
{ [ "resource:" ?head ] [ trim-head-separators resource-path absolute-path ] }
{ [ "vocab:" ?head ] [ trim-head-separators vocab-path absolute-path ] }
{ [ "~" ?head ] [ trim-head-separators home prepend-path absolute-path ] }

View File

@@ -0,0 +1,184 @@
{
lib,
stdenv,
makeWrapper,
buildEnv,
factor-unwrapped,
cairo,
freealut,
gdk-pixbuf,
glib,
gnome2,
gtk2-x11,
libGL,
libGLU,
librsvg,
graphviz,
libogg,
libvorbis,
openal,
openssl,
pango,
pcre,
udis86,
zlib,
# Enable factor GUI support
guiSupport ? true,
# Libraries added to ld.so.cache
extraLibs ? [ ],
# Packages added to path (and ld.so.cache)
binPackages ? [ ],
# Extra vocabularies added to out/lib/factor
extraVocabs ? [ ],
# Enable default libs and bins to run most of the standard library code.
enableDefaults ? true,
doInstallCheck ? true,
}:
let
inherit (lib) optional optionals optionalString;
# missing from lib/strings
escapeNixString = s: lib.escape [ "$" ] (builtins.toJSON s);
toFactorArgs = x: lib.concatStringsSep " " (map escapeNixString x);
defaultLibs = optionals enableDefaults [
libogg
libvorbis
openal
openssl
pcre
udis86
zlib
];
defaultBins = optionals enableDefaults [ graphviz ];
runtimeLibs =
defaultLibs
++ extraLibs
++ binPackages
++ (lib.flatten (map (v: v.extraLibs or [ ]) extraVocabs))
++ optionals guiSupport [
cairo
freealut
gdk-pixbuf
glib
gnome2.gtkglext
gtk2-x11
libGL
libGLU
pango
];
bins = binPackages ++ defaultBins ++ (lib.flatten (map (v: v.extraPaths or [ ]) extraVocabs));
vocabTree = buildEnv {
name = "${factor-unwrapped.pname}-vocabs";
ignoreCollisions = true;
pathsToLink = map (r: "/lib/factor/${r}") [
"basis"
"core"
"extra"
];
paths = [ factor-unwrapped ] ++ extraVocabs;
};
in
stdenv.mkDerivation (finalAttrs: {
pname = "${factor-unwrapped.pname}-env";
inherit (factor-unwrapped) version;
nativeBuildInputs = [ makeWrapper ];
buildInputs = optional guiSupport gdk-pixbuf;
dontUnpack = true;
installPhase = ''
runHook preInstall
''
+ optionalString guiSupport ''
# Set Gdk pixbuf loaders file to the one from the build dependencies here
unset GDK_PIXBUF_MODULE_FILE
# Defined in gdk-pixbuf setup hook
findGdkPixbufLoaders "${librsvg}"
makeWrapperArgs+=(--set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE")
''
+ ''
makeWrapperArgs+=(
--prefix LD_LIBRARY_PATH : /run/opengl-driver/lib:${lib.makeLibraryPath runtimeLibs}
--prefix PATH : ${lib.makeBinPath bins})
mkdir -p "$out/bin" "$out/share"
cp -r "${factor-unwrapped}/lib" "$out/"
cp -r "${factor-unwrapped}/share/emacs" "$out/share/"
chmod -R u+w "$out/lib" "$out/share"
(
cd ${vocabTree}
for f in "lib/factor/"* ; do
rm -r "$out/$f"
ln -s "${vocabTree}/$f" "$out/$f"
done
)
# There is no ld.so.cache in NixOS so we construct one
# out of known libraries. The side effect is that find-lib
# will work only on the known libraries. There does not seem
# to be a generic solution here.
find $(echo ${
lib.makeLibraryPath ([ stdenv.cc.libc ] ++ runtimeLibs)
} | sed -e 's#:# #g') -name \*.so.\* > $TMPDIR/so.lst
(echo $(cat $TMPDIR/so.lst | wc -l) "libs found in cache \`/etc/ld.so.cache'";
for l in $(<$TMPDIR/so.lst); do
echo " $(basename $l) (libc6,x86-64) => $l";
done)> $out/lib/factor/ld.so.cache
# Create a wrapper in bin/ and lib/factor/
wrapProgram "$out/lib/factor/factor" \
--argv0 factor \
--set FACTOR_LD_SO_CACHE "$out/lib/factor/ld.so.cache" \
"''${makeWrapperArgs[@]}"
mv $out/lib/factor/factor.image $out/lib/factor/.factor-wrapped.image
cp $out/lib/factor/factor $out/bin/
# Emacs fuel expects the image being named `factor.image` in the factor base dir
ln -rs $out/lib/factor/.factor-wrapped.image $out/lib/factor/factor.image
# Update default paths in fuel-listener.el to new output
sed -E -i -e 's#(\(defcustom fuel-factor-root-dir ").*(")#'"\1$out/lib/factor\2#" \
"$out/share/emacs/site-lisp/fuel-listener.el"
runHook postInstall
'';
inherit doInstallCheck;
disabledTests = toFactorArgs [
"io.files.info.unix"
"io.launcher.unix"
"io.ports"
"io.sockets"
"io.sockets.unix"
"io.sockets.secure.openssl"
"io.sockets.secure.unix"
];
installCheckPhase = ''
runHook preInstallCheck
export HOME=$TMPDIR
$out/bin/factor -e='USING: tools.test tools.test.private
zealot.factor sequences namespaces formatting ;
zealot-core-vocabs
{ ${finalAttrs.disabledTests} } without
"compiler" suffix
[ test-vocab ] each :test-failures
test-failures get length "Number of failed tests: %d\n" printf'
runHook postInstallCheck
'';
passthru = {
inherit
defaultLibs
defaultBins
extraLibs
runtimeLibs
binPackages
extraVocabs
;
};
meta = factor-unwrapped.meta // {
mainProgram = "factor";
};
})