Something went wrong. Try again.
What happens if I push all of nixpkgs
Something went wrong. Try again.
4.1 kB · 144 lines
Nix
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145{ stdenv, lib, writeText, makeWrapper, factor-lang, factor-no-gui, librsvg, gdk-pixbuf,}@initAttrs:
drvArgs:
let flang = factor-lang; # workaround to satisfy nixf-tidyin(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 { }; })