on master help sign in
Make profileObRun a directory instead of a binary

pinBuildInputs tries to run binaries when they exist. We don’t want that, so we need to wrap it in a directory with $out/bin/ob-run containing the actual binary.

commit9fb928968ac370c56bc30a437e124044bfd5265e authorMatthew Bauer <mjbauer95@gmail.com> dateMon 24 Feb 2020, 11:37 (7 years ago) parent772b42e
3 files changed+7−5
all-builds.nix+1−2 default.nix+4−1 lib/command/src/Obelisk/Command/Run.hs+2−2
all-builds.nix+1−2
@@ -87,8 +87,7 @@ let
8787 in packages // {
8888 cache = reflex-platform.pinBuildInputs
8989 "obelisk-${system}-${nameSuffix}"
90− # skeletonProfiledObRun is a binary, so can’t be used in pinBuildInputs
91− (collect (builtins.removeAttrs ["skeletonProfiledObRun"] packages));
90+ (collect packages);
9291 };
9392
9493 perProfiling = {
default.nix+4−1
@@ -398,7 +398,10 @@ in rec {
398398 '';
399399 in nixpkgs.runCommand "ob-run" {
400400 buildInputs = [ (profiled.ghc.ghcWithPackages (p: [ p.backend p.frontend])) ];
401− } "ghc -x hs -prof -fno-prof-auto -threaded ${exeSource} -o $out";
401+ } ''
402+ mkdir -p $out/bin/ob-run
403+ ghc -x hs -prof -fno-prof-auto -threaded ${exeSource} -o $out/bin/ob-run
404+ '';
402405
403406 linuxExeConfigurable = linuxExe;
404407 linuxExe = linuxExe dummyVersion;
lib/command/src/Obelisk/Command/Run.hs+2−2
@@ -93,7 +93,7 @@ profile profileBasePattern rtsFlags = withProjectRoot "." $ \root -> do
9393
9494 liftIO $ createDirectoryIfMissing False $ takeDirectory profileBaseName
9595
96− exePath <- nixCmd $ NixCmd_Build $ def
96+ outPath <- nixCmd $ NixCmd_Build $ def
9797 & nixBuildConfig_outLink .~ OutLink_None
9898 & nixCmdConfig_target .~ Target
9999 { _target_path = Just "."
@@ -102,7 +102,7 @@ profile profileBasePattern rtsFlags = withProjectRoot "." $ \root -> do
102102 assets <- findProjectAssets root
103103 putLog Debug $ "Assets impurely loaded from: " <> assets
104104 freePort <- getFreePort
105− (_, _, _, ph) <- createProcess_ "runProfExe" $ setCwd (Just root) $ setDelegateCtlc True $ proc exePath $
105+ (_, _, _, ph) <- createProcess_ "runProfExe" $ setCwd (Just root) $ setDelegateCtlc True $ proc (outPath </> "bin" </> "ob-run") $
106106 [ show freePort
107107 , T.unpack assets
108108 , profileBaseName