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
61 changes: 61 additions & 0 deletions flake.lock

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

109 changes: 109 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
description = "CodexMonitor Tauri app for orchestrating Codex agents";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
packageJson = builtins.fromJSON (builtins.readFile ./package.json);

linuxPackages = pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.gtk3
pkgs.libxkbcommon
pkgs.librsvg
pkgs.libsoup_3
pkgs.webkitgtk_4_1
];

frontend = pkgs.buildNpmPackage {
pname = "codex-monitor-frontend";
version = packageJson.version;
src = ./.;
nodejs = pkgs.nodejs_20;
npmDepsHash = "sha256-TT9Po/VVzuObcqAkv4HoRSo41IMvouorlPnPTabxcTA=";
npmBuildScript = "build";
installPhase = ''
mkdir -p $out
cp -R dist $out/
'';
};

tauriConfig = builtins.toJSON {
build = {
frontendDist = "dist";
devUrl = null;
};
};

appPackage = pkgs.rustPlatform.buildRustPackage {
pname = "codex-monitor";
version = packageJson.version;
src = ./src-tauri;

cargoLock = {
lockFile = ./src-tauri/Cargo.lock;
outputHashes = {
"fix-path-env-0.0.0" = "sha256-UygkxJZoiJlsgp8PLf1zaSVsJZx1GGdQyTXqaFv3oGk=";
};
};

nativeBuildInputs = [
pkgs.cargo-tauri
pkgs.cmake
pkgs.pkg-config
];

buildInputs = [
pkgs.openssl
] ++ linuxPackages;

TAURI_CONFIG = tauriConfig;

preBuild = ''
mkdir -p dist
cp -R ${frontend}/dist/. dist
'';

cargoBuildFlags = [
"--features"
"custom-protocol"
];

installPhase = ''
mkdir -p $out/bin
target_dir="target/${pkgs.stdenv.hostPlatform.rust.rustcTarget}"
cp "$target_dir/release/codex-monitor" $out/bin/
'';
};
in
{
devShells.default = pkgs.mkShell {
packages = [
pkgs.cargo
pkgs.clang
pkgs.cmake
pkgs.git
pkgs.nodejs_20
pkgs.openssl
pkgs.pkg-config
pkgs.rust-analyzer
pkgs.rustc
pkgs.rustfmt
pkgs.rustPlatform.rustLibSrc
] ++ linuxPackages;

shellHook = ''
export RUST_SRC_PATH=${pkgs.rustPlatform.rustLibSrc}
'';
};

formatter = pkgs.alejandra;

packages.default = appPackage;
});
}
3 changes: 3 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ default-run = "codex-monitor"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
custom-protocol = ["tauri/custom-protocol"]

[lib]
# The `_lib` suffix may seem redundant but it is necessary
# to make the lib name unique and wouldn't conflict with the bin name.
Expand Down