on master help sign in
Fix ob command's autocompleter
a1db872Madeline Haraj
default.nix+15−10
@@ -88,7 +88,20 @@ let
88 obelisk-asset-serve-snap = self.callCabal2nix "obelisk-asset-serve-snap" (hackGet ./lib/asset + "/serve-snap") {};
88 obelisk-asset-serve-snap = self.callCabal2nix "obelisk-asset-serve-snap" (hackGet ./lib/asset + "/serve-snap") {};
89 obelisk-backend = self.callCabal2nix "obelisk-backend" (cleanSource ./lib/backend) {};
89 obelisk-backend = self.callCabal2nix "obelisk-backend" (cleanSource ./lib/backend) {};
90 obelisk-cliapp = self.callCabal2nix "obelisk-cliapp" (cleanSource ./lib/cliapp) {};
90 obelisk-cliapp = self.callCabal2nix "obelisk-cliapp" (cleanSource ./lib/cliapp) {};
91− obelisk-command = (self.callCabal2nix "obelisk-command" (cleanSource ./lib/command) {});
91+ obelisk-command = (self.callCabal2nix "obelisk-command" (cleanSource ./lib/command) {}).overrideAttrs
92+ (drv: {
93+ buildInputs = drv.buildInputs ++ [ pkgs.makeWrapper ];
94+ postInstall = ''
95+ ${drv.postInstall or ""}
96+ # Install migrations
97+ cp -r ${./migration} $out/migration;
98+ '';
99+ postFixup = ''
100+ ${drv.postFixup or ""}
101+ # Make `ob` reference its runtime dependencies.
102+ wrapProgram "$out"/bin/ob --prefix PATH : ${pkgs.lib.makeBinPath (commandRuntimeDeps pkgs)}
103+ '';
104+ });
92 obelisk-executable-config = executableConfig.haskellPackage self;
105 obelisk-executable-config = executableConfig.haskellPackage self;
93 obelisk-executable-config-inject = executableConfig.platforms.web.inject self;
106 obelisk-executable-config-inject = executableConfig.platforms.web.inject self;
94 obelisk-frontend = self.callCabal2nix "obelisk-frontend" (cleanSource ./lib/frontend) {};
107 obelisk-frontend = self.callCabal2nix "obelisk-frontend" (cleanSource ./lib/frontend) {};
@@ -111,15 +124,7 @@ rec {
111 pathGit = ./.; # Used in CI by the migration graph hash algorithm to correctly ignore files.
124 pathGit = ./.; # Used in CI by the migration graph hash algorithm to correctly ignore files.
112 path = reflex-platform.filterGit ./.;
125 path = reflex-platform.filterGit ./.;
113 obelisk = ghcObelisk;
126 obelisk = ghcObelisk;
114− commandWithMigration = ghcObelisk.obelisk-command.overrideAttrs (drv: {
127+ command = ghcObelisk.obelisk-command;
115− postInstall = (drv.postInstall or "") +
116− ''cp -r ${./migration} $out/migration;'';
117− });
118− command = pkgs.runCommand commandWithMigration.name { nativeBuildInputs = [pkgs.makeWrapper]; } ''
119− mkdir -p "$out/bin"
120− ln -s '${commandWithMigration}/bin/ob' "$out/bin/ob"
121− wrapProgram "$out"/bin/ob --prefix PATH : ${pkgs.lib.makeBinPath (commandRuntimeDeps pkgs)}
122− '';
123 shell = pinBuildInputs "obelisk-shell" ([command] ++ commandRuntimeDeps pkgs) [];
128 shell = pinBuildInputs "obelisk-shell" ([command] ++ commandRuntimeDeps pkgs) [];
124
129
125 selftest = pkgs.writeScript "selftest" ''
130 selftest = pkgs.writeScript "selftest" ''
lib/command/src/Obelisk/Command/Project.hs+1−1
@@ -110,7 +110,7 @@ initProject source = withSystemTempDirectory "ob-init" $ \tmpDir -> do
110--TODO: Allow the user to ignore our security concerns
110--TODO: Allow the user to ignore our security concerns
111-- | Find the Obelisk implementation for the project at the given path
111-- | Find the Obelisk implementation for the project at the given path
112findProjectObeliskCommand :: MonadObelisk m => FilePath -> m (Maybe FilePath)
112findProjectObeliskCommand :: MonadObelisk m => FilePath -> m (Maybe FilePath)
113−findProjectObeliskCommand target = withSpinnerNoTrail "Locating project obelisk" $ do
113+findProjectObeliskCommand target = do
114 myUid <- liftIO getRealUserID
114 myUid <- liftIO getRealUserID
115 targetStat <- liftIO $ getFileStatus target
115 targetStat <- liftIO $ getFileStatus target
116 (result, insecurePaths) <- flip runStateT [] $ walkToProjectRoot target targetStat myUid >>= \case
116 (result, insecurePaths) <- flip runStateT [] $ walkToProjectRoot target targetStat myUid >>= \case