Skip to content

Build against nixos-24.05 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
To use this repository, you have to [install Nix][].

The repository contains a [Nix flake][] with the CARLA simulator and
related tools. An easy way to test it to run:
related tools. An easy way to test it is to run:

nix run github:CTU-IIG/carla-simulator.nix#carla-bin-0_9_15

Expand Down
24 changes: 12 additions & 12 deletions build-env/shell.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
(buildFHSEnv {
pname = "carla-build";
name = "carla-build";
targetPkgs = pkgs: with pkgs; [
# Unreal Engine
#mono
Expand Down Expand Up @@ -34,7 +34,7 @@ with pkgs;
autoconf
automake
rsync
#llvmPackages_10.libcxx llvmPackages_10.libcxxabi
#llvmPackages_12.libcxx llvmPackages_12.libcxxabi
];

# Currently, we rely on nix-ld (https://github.com/Mic92/nix-ld) to
Expand All @@ -59,23 +59,23 @@ with pkgs;
sysroot = pkgs.buildEnv {
name = "carla-sysroot";
paths = [
pkgs.llvmPackages_10.libcxx
pkgs.llvmPackages_10.libcxx.dev
pkgs.llvmPackages_10.libcxxabi
#pkgs.llvmPackages_10.libcxxabi.dev
pkgs.llvmPackages_10.compiler-rt
#pkgs.llvmPackages_10.compiler-rt.dev
pkgs.llvmPackages_12.libcxx
pkgs.llvmPackages_12.libcxx.dev
#pkgs.llvmPackages_12.libcxxabi # merged into libcxx
#pkgs.llvmPackages_12.libcxxabi.dev
pkgs.llvmPackages_12.compiler-rt
#pkgs.llvmPackages_12.compiler-rt.dev
];
};
in ''
export UE4_ROOT=~/src/carla/nix/build-env/UnrealEngine_4.26
cd ~/src/carla/carla
# sed -i -e s,\$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu,${pkgs.llvmPackages_10.clang}, \
# sed -i -e s,\$UE4_ROOT/Engine/Extras/ThirdPartyNotUE/SDKs/HostLinux/Linux_x64/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu,${pkgs.llvmPackages_12.clang}, \
# Util/BuildTools/*.sh

export CC="${pkgs.llvmPackages_10.clang}/bin/clang"
export CXX="${pkgs.llvmPackages_10.clang}/bin/clang++"
export PATH="${pkgs.llvmPackages_10.clang}/bin:$PATH"
export CC="${pkgs.llvmPackages_12.clang}/bin/clang"
export CXX="${pkgs.llvmPackages_12.clang}/bin/clang++"
export PATH="${pkgs.llvmPackages_12.clang}/bin:$PATH"

export LLVM_INCLUDE=${sysroot}/include/c++/v1
export LLVM_LIBPATH=${sysroot}/lib
Expand Down
4 changes: 2 additions & 2 deletions carla-bin/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
, libglvnd
, libusb1
, libxkbcommon
, llvmPackages_9
, llvmPackages
, makeWrapper
, patchelf
, pigz
Expand Down Expand Up @@ -57,7 +57,7 @@ let
buildInputs = [
autoPatchelfHook
makeWrapper
llvmPackages_9.openmp
llvmPackages.openmp
libusb1
zlib
];
Expand Down
8 changes: 4 additions & 4 deletions flake.lock

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

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
description = "Carla simulator";

inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";

outputs = { self, nixpkgs }:
let
Expand Down
79 changes: 54 additions & 25 deletions scenic/default.nix
Original file line number Diff line number Diff line change
@@ -1,48 +1,77 @@
{ python3Packages
, fetchPypi
{ lib
, python3
, fetchFromGitHub
, opencv-python
}:
python3Packages.buildPythonPackage rec {

python3.pkgs.buildPythonPackage rec {
pname = "scenic";
version = "2.1.0";
format = "pyproject";
pyproject = true;

src = fetchPypi {
inherit pname version;
hash = "sha256-vtJHqgHU8f9/6Sp6cXHwDJ2kY5Ro3e8sTd7oiik48uY=";
src = fetchFromGitHub {
owner = "BerkeleyLearnVerify";
repo = "Scenic";
rev = "v${version}";
hash = "sha256-Y3+EM838AvtQgfN6lq/bXaqJbmosoVFW9mppOUxn9Og=";
};

# Scenic seems to work with shapely 2.0 (test suite passes). Use it.
# Otherwise, we have collisions (carla uses shapely too and we
# cannot have different version in a single Python process).
postPatch = ''
substituteInPlace pyproject.toml --replace 'shapely ~= 1.7' 'shapely ~= 2.0'
substituteInPlace pyproject.toml \
--replace-fail 'shapely ~= 1.7' 'shapely ~= 2.0' \
--replace-fail 'pillow ~= 9.1' 'pillow ~= 10.3'
'';

propagatedBuildInputs = with python3Packages; [
nativeBuildInputs = [
python3.pkgs.flit-core
];

propagatedBuildInputs = with python3.pkgs; [
antlr4-python3-runtime
attrs
flit-core
scipy
decorator
dotmap
importlib-metadata
mapbox-earcut
matplotlib
antlr4-python3-runtime
pygame
numpy
opencv-python
pillow
pygame
scipy
shapely
decorator
dotmap
];

doCheck = false; # finds zero tests. why?
passthru.optional-dependencies = with python3.pkgs; {
dev = [
astor
inflect
pygments
pytest-cov
scenic
sphinx
sphinx-rtd-theme
tox
];
guideways = [
pyproj
];
test = [
pytest
pytest-randomly
];
};

nativeCheckInputs = [
python3Packages.pytestCheckHook
python3Packages.tox
python3Packages.pytest
python3Packages.pytest-randomly
];
pythonImportsCheck = [ "scenic" ];

pythonImportsCheck = [
"scenic"
];
meta = with lib; {
description = "A compiler and scene generator for the Scenic scenario description language";
homepage = "https://github.com/BerkeleyLearnVerify/Scenic/tree/2.x";
license = licenses.bsd3;
maintainers = with maintainers; [ ];
mainProgram = "scenic";
};
}