Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/setup-nix/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ runs:
- name: Setup nix develop env
shell: bash
run: |
echo 'use flake' >.envrc
echo 'use flake .#ci' >.envrc
- uses: HatsuneMiku3939/direnv-action@v1
# and avoid develop env being gc
5 changes: 1 addition & 4 deletions crates/coco-tui/src/e2e_tests/support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,6 @@ fn resolve_coco_bin_from_env() -> Option<PathBuf> {
if let Ok(path) = env::var("COCO_TEST_BIN") {
return Some(PathBuf::from(path));
}
if let Ok(path) = env::var("COCO_TUI_BIN") {
return Some(PathBuf::from(path));
}
if let Ok(path) = env::var("CARGO_BIN_EXE_coco") {
return Some(PathBuf::from(path));
}
Expand All @@ -703,7 +700,7 @@ pub(crate) fn coco_binary() -> PathBuf {
let path = resolve_coco_bin_from_env().unwrap_or_else(resolve_coco_bin_from_target);
assert!(
path.exists(),
"coco binary not found at {:?}; build `cargo build -p coco-tui --bin coco` or set COCO_TUI_BIN/COCO_TEST_BIN",
"coco binary not found at {:?}; build `cargo build -p coco-tui --bin coco` or set COCO_TEST_BIN",
path
);
path
Expand Down
17 changes: 4 additions & 13 deletions crates/coco-tui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,9 @@ impl TryFrom<Commands> for ClientCommand {
command,
},
Commands::Mcp { args } => ClientCommand::Mcp { args },
Commands::Combo(ComboCommands::Run { name, args }) => ClientCommand::ComboRun {
name,
args,
ignore_workspace_scripts: false,
},
Commands::Combo(ComboCommands::Run { name, args }) => {
ClientCommand::ComboRun { name, args }
}
};
Ok(command)
}
Expand Down Expand Up @@ -175,14 +173,7 @@ async fn main() -> Result<()> {

if should_handle_client {
match ClientCommand::try_from(command) {
Ok(mut command) => {
if let ClientCommand::ComboRun {
ignore_workspace_scripts,
..
} = &mut command
{
*ignore_workspace_scripts = args.ignore_workspace_scripts;
}
Ok(command) => {
init_client_logging(&program, &command);
return handle_client_command(&program, &command_name, command)
.await
Expand Down
115 changes: 113 additions & 2 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 66 additions & 21 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";

jail-nix.url = "sourcehut:~alexdavid/jail.nix";
llm-agents.url = "github:numtide/llm-agents.nix";
};

outputs = {
self,
nixpkgs,
utils,
jail-nix,
llm-agents,
...
} @ inputs:
utils.lib.eachDefaultSystem
Expand Down Expand Up @@ -104,18 +109,26 @@
};
};
devShells = let
components = [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
"llvm-tools"
"rust-analyzer"
jail = jail-nix.lib.init pkgs;
commonPackages = with pkgs; [
bashInteractive
curl
wget
jq
git
which
ripgrep
gnugrep
gawkInteractive
ps
findutils
gzip
unzip
gnutar
diffutils
];
packages = with pkgs;
devPackages = with pkgs;
[
# Development
grcov
prek

Expand All @@ -126,21 +139,53 @@
run-test
run-cov
]);
nativeBuildInputs = with pkgs; ([
(fenix.stable.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
"llvm-tools"
"rust-analyzer"
])
]
++ lib.optionals stdenv.isLinux [pkg-config]);
commonJailOptions = with jail.combinators; [
network
time-zone
no-new-session
mount-cwd
];
codex = llm-agents.packages.${system}.codex;
jailed-codex = jail "jailed-codex" codex (with jail.combinators; (
commonJailOptions
++ [
(readwrite (noescape "~/.codex"))
(add-pkg-deps [pkgs.stdenv.cc])
(add-pkg-deps commonPackages)
(add-pkg-deps nativeBuildInputs)
(add-pkg-deps devPackages)
]
));
packages = commonPackages ++ devPackages ++ lib.optionals pkgs.stdenv.isLinux [jailed-codex];
shellHook = ''
# Unset SOURCE_DATE_EPOCH to prevent reproducible build timestamps during development.
# This allows timestamps to reflect the current time, which is useful for development workflows.
unset SOURCE_DATE_EPOCH
'';
in rec {
default = stable;
stable = pkgs.mkShell {
nativeBuildInputs = with pkgs; ([
(fenix.stable.withComponents components)
]
++ lib.optionals stdenv.isLinux [pkg-config]);
ci = pkgs.mkShell {
inherit nativeBuildInputs;
inherit shellHook;

packages = devPackages;
};
stable = pkgs.mkShell {
inherit nativeBuildInputs;
inherit packages;

shellHook = ''
# Unset SOURCE_DATE_EPOCH to prevent reproducible build timestamps during development.
# This allows timestamps to reflect the current time, which is useful for development workflows.
unset SOURCE_DATE_EPOCH
'';
inherit shellHook;
};
};
}
Expand Down
7 changes: 1 addition & 6 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub enum ClientCommand {
ComboRun {
name: String,
args: Vec<String>,
ignore_workspace_scripts: bool,
},
Record {
wrap_result: bool,
Expand Down Expand Up @@ -69,11 +68,7 @@ pub async fn handle_client_command(
ClientCommand::Reply { fields } => crate::cmd::handle_reply(fields)
.await
.whatever_context("failed to handle reply"),
ClientCommand::ComboRun {
name,
args,
ignore_workspace_scripts,
} => crate::cmd::handle_combo_run(name, args, ignore_workspace_scripts)
ClientCommand::ComboRun { name, args } => crate::cmd::handle_combo_run(name, args)
.await
.whatever_context("failed to handle combo run"),
ClientCommand::Record {
Expand Down
Loading