Command stderr: error: syntax error, unexpected '-'
What happened?
I'm installing some system dependencies for my project from a local flake, and it seems that the generated flake reference starts with -, causing the issue.
{
description = "A flake for installing system dependencies required by tauri";
inputs = {
nixpkgs.url = "nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
libraries = with pkgs;[
webkitgtk
gtk3
cairo
gdk-pixbuf
glib
dbus
openssl_3
librsvg
];
packages = with pkgs; [
curl
wget
pkg-config
dbus
openssl_3
glib
gtk3
libsoup
webkitgtk
librsvg
];
in
{
devShell = pkgs.mkShell {
buildInputs = packages;
shellHook =
''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
export XDG_DATA_DIRS=${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS
'';
};
packages.default = pkgs.mkShell { buildInputs = packages; };
defaultPackage.${system} = pkgs.mkShell { buildInputs = packages; };
});
}
Command
install, shell
devbox.json
{
"$schema": "https://raw.githubusercontent.com/jetpack-io/devbox/0.10.4/.schema/devbox.schema.json",
"packages": [
"rustup",
"nodejs@20",
"path:.nix"
],
"env": {
"DEVBOX_COREPACK_ENABLED": "true",
"PROJECT_DIR": "$PWD"
},
"shell": {
"init_hook": [
"rustupHomeDir=\"$(dirname $(readlink -f \"$0\"))\"/.rustup",
"mkdir -p $rustupHomeDir",
"export RUSTUP_HOME=$rustupHomeDir",
"export LIBRARY_PATH=$LIBRARY_PATH:\"${PROJECT_DIR}/.devbox/nix/profile/default/lib\"",
"rustup default stable",
"pnpm install",
"cargo fetch --manifest-path=\"./src-tauri/Cargo.toml\"",
"pnpm run tauri dev"
],
"scripts": {
"test": [
"echo \"Error: no test specified\" && exit 1"
]
}
}
}
Devbox version
0.10.4
Nix version
2.18.1
What system does this bug occur on?
Linux (x86-64)
Debug logs
2024/04/17 18:53:39 Running print-dev-env cmd: /home/bat-erdene-tsogoo/.nix-profile/bin/nix print-dev-env path:/home/bat-erdene-tsogoo/Projects/chronicle/.devbox/gen/flake --extra-experimental-features ca-derivations --option experimental-features nix ✓ Computed the Devbox environment. Error: nix print-dev-env --json "path:/home/bat-erdene-tsogoo/Projects/chronicle/.devbox/gen/flake": exit status 1
2024/04/17 18:53:39 Command stderr: error: syntax error, unexpected '-'
at /nix/store/l0c2qqk0fnj2rvav60qqwl9pfhgh5xky-source/flake.nix:7:6:
6| nixpkgs-75a522.url = "github:NixOS/nixpkgs/75a52265bda7fd25e06e3a67dee3f0354e73243c";
7| -nix-af72be.url = "path:/home/bat-erdene-tsogoo/Projects/chronicle/.nix";
| ^
8| };
cc @gcurtis or @savil
We seem to be transforming "path:.nix" from devbox.json into -nix, because it starts with .
OK the problem is in this function: https://github.com/jetify-com/devbox/blob/main/internal/devpkg/package.go#L191
@batrdn , until this is fixed, you should be able to unblock yourself if you use a different path to your flake that doesn't start with .
@ipince I see, thanks for the help.