mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
factor-lang: Improve application deployment
Build staging images ahead of time for re-use during application deployment.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
makeBinaryWrapper,
|
||||
factor-lang,
|
||||
factor-no-gui,
|
||||
staging-images,
|
||||
librsvg,
|
||||
gdk-pixbuf,
|
||||
}@initAttrs:
|
||||
@@ -113,6 +114,9 @@ in
|
||||
vocabBaseName=$(basename "$vocabName")
|
||||
mkdir -p "$out/lib/factor" "$TMPDIR/.cache"
|
||||
export XDG_CACHE_HOME="$TMPDIR/.cache"
|
||||
mkdir "$XDG_CACHE_HOME/factor"
|
||||
cp -r "${staging-images}"/lib/factor/staging.* "$XDG_CACHE_HOME/factor"
|
||||
chmod -R u+w "$XDG_CACHE_HOME/factor"
|
||||
|
||||
# Deploy script writes the deploy path to to $PWD/deploy-path.txt
|
||||
factor "${deployScript}" "./$vocabName" "$out/lib/factor"
|
||||
|
||||
29
pkgs/development/compilers/factor-lang/staging.nix
Normal file
29
pkgs/development/compilers/factor-lang/staging.nix
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
factor-unwrapped,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "factor-staging-images";
|
||||
inherit (factor-unwrapped) version meta;
|
||||
|
||||
dontUnpack = true;
|
||||
|
||||
preBuild = ''
|
||||
# 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
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
${factor-unwrapped}/lib/factor/factor -script -e='USING: kernel system tools.deploy.backend ; "compiler" "hello-world" [ deploy-config config>profile make-staging-image ] bi@'
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/lib/factor
|
||||
cp -r $XDG_CACHE_HOME/factor/staging.* $out/lib/factor
|
||||
'';
|
||||
}
|
||||
@@ -32,6 +32,8 @@ let
|
||||
enableDefaults = false;
|
||||
};
|
||||
|
||||
staging-images = callPackage ../development/compilers/factor-lang/staging.nix { };
|
||||
|
||||
# Vocabularies
|
||||
bresenham = callPackage ../development/factor-vocabs/bresenham { };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user