about summary refs log tree commit diff
path: root/tools/magrathea/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'tools/magrathea/default.nix')
-rw-r--r--tools/magrathea/default.nix26
1 files changed, 21 insertions, 5 deletions
diff --git a/tools/magrathea/default.nix b/tools/magrathea/default.nix
index fa0a5d89a1..5e8019852a 100644
--- a/tools/magrathea/default.nix
+++ b/tools/magrathea/default.nix
@@ -3,21 +3,37 @@
 # it is a tool for working with monorepos in the style of tvl's depot
 { pkgs, ... }:
 
-pkgs.stdenv.mkDerivation {
+let
+  inherit (pkgs)
+    stdenv
+    chicken
+    chickenPackages
+    makeWrapper
+    git
+    nix
+    lib
+    ;
+
+in
+stdenv.mkDerivation {
   name = "magrathea";
   src = ./.;
   dontInstall = true;
 
-  nativeBuildInputs = [ pkgs.chicken ];
-  buildInputs = with pkgs.chickenPackages.chickenEggs; [
+  nativeBuildInputs = [ chicken makeWrapper ];
+  buildInputs = with chickenPackages.chickenEggs; [
     matchable
     srfi-13
   ];
 
-  propagatedBuildInputs = [ pkgs.git ];
+  propagatedBuildInputs = [ git ];
 
   buildPhase = ''
     mkdir -p $out/bin
-    csc -o $out/bin/mg -static ${./mg.scm}
+    csc -o $out/bin/mg -host -static ${./mg.scm}
+  '';
+
+  fixupPhase = ''
+    wrapProgram $out/bin/mg --prefix PATH ${lib.makeBinPath [ nix ]}
   '';
 }