Skip to content

Commit 69d2f6a

Browse files
fix: make Chromium conditional on Linux (not available on macOS)
1 parent c5fa177 commit 69d2f6a

1 file changed

Lines changed: 33 additions & 26 deletions

File tree

flake.nix

Lines changed: 33 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,8 @@
7474
!(builtins.elem baseName ignoredPaths);
7575
};
7676

77-
chromiumPath =
78-
if pkgs.stdenv.isDarwin then
79-
"${pkgs.chromium}/Applications/Chromium.app/Contents/MacOS/Chromium"
80-
else
81-
"${pkgs.chromium}/bin/chromium";
77+
# Chromium is only available on Linux in nixpkgs
78+
chromiumPath = if pkgs.stdenv.isLinux then "${pkgs.chromium}/bin/chromium" else null;
8279

8380
basePnpmAttrs = {
8481
inherit src;
@@ -149,20 +146,24 @@
149146
devShells.default = pkgs.mkShell {
150147
name = "roo-code-dev";
151148

152-
packages = with pkgs; [
153-
nodejs
154-
pnpm
155-
git
156-
python3
157-
pkg-config
158-
gnumake
159-
turbo
160-
chromium
161-
ripgrep
162-
jp2a
163-
nodePackages.typescript-language-server
164-
nil
165-
];
149+
packages =
150+
with pkgs;
151+
[
152+
nodejs
153+
pnpm
154+
git
155+
python3
156+
pkg-config
157+
gnumake
158+
turbo
159+
ripgrep
160+
jp2a
161+
nodePackages.typescript-language-server
162+
nil
163+
]
164+
++ lib.optionals stdenv.isLinux [
165+
chromium
166+
];
166167

167168
buildInputs =
168169
with pkgs;
@@ -175,9 +176,11 @@
175176

176177
env = {
177178
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = "1";
178-
PUPPETEER_EXECUTABLE_PATH = chromiumPath;
179179
RIPGREP_PATH = "${pkgs.ripgrep}/bin/rg";
180180
NODE_ENV = "development";
181+
}
182+
// lib.optionalAttrs pkgs.stdenv.isLinux {
183+
PUPPETEER_EXECUTABLE_PATH = chromiumPath;
181184
};
182185

183186
shellHook = ''
@@ -321,12 +324,16 @@
321324
checks = {
322325
lint = mkPnpmCheck "lint" "lint" { };
323326
typecheck = mkPnpmCheck "typecheck" "check-types" { };
324-
test = mkPnpmCheck "test" "test" {
325-
nativeBuildInputs = basePnpmAttrs.nativeBuildInputs ++ [ pkgs.chromium ];
326-
CI = "true";
327-
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = "1";
328-
PUPPETEER_EXECUTABLE_PATH = chromiumPath;
329-
};
327+
test = mkPnpmCheck "test" "test" (
328+
{
329+
CI = "true";
330+
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = "1";
331+
}
332+
// lib.optionalAttrs pkgs.stdenv.isLinux {
333+
nativeBuildInputs = basePnpmAttrs.nativeBuildInputs ++ [ pkgs.chromium ];
334+
PUPPETEER_EXECUTABLE_PATH = chromiumPath;
335+
}
336+
);
330337

331338
format = pkgs.stdenvNoCC.mkDerivation {
332339
name = "roo-code-format-check";

0 commit comments

Comments
 (0)