Skip to content

Commit

Permalink
Try to build ourself
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed Nov 18, 2024
1 parent 51d0e37 commit 34a9efc
Showing 1 changed file with 54 additions and 8 deletions.
62 changes: 54 additions & 8 deletions tools/flox/Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,70 @@ ARG name
ARG version
RUN <<EOF
git clone -q --config advice.detachedHead=false --depth 1 --branch "v${version}" https://github.com/flox/flox .
curl -sSLf https://releases.nixos.org/nix/nix-2.25.2/nix-2.25.2-x86_64-linux.tar.xz \
| tar -xJC /tmp
EOF

# Install nix
RUN <<EOF
/tmp/nix-2.25.2-x86_64-linux/install-multi-user
version=2.25.2
arch=x86_64
curl -sSLf "https://releases.nixos.org/nix/nix-${version}/nix-${version}-${arch}-linux.tar.xz" \
| tar -xJC /tmp
"/tmp/nix-${version}-x86_64-linux/install-multi-user"
EOF
RUN <<EOF

# Use nix to call just to build flox
#RUN <<EOF
#nix develop -L --no-update-lock-file \
# --extra-experimental-features nix-command \
# --extra-experimental-features flakes \
# --command \
# just \
# build-pkgdb \
# build-cli
nix profile install \
--experimental-features "nix-command flakes" \
--accept-flake-config \
github:flox/flox/v${version}
#EOF

# Use nix without repo
#RUN <<EOF
#nix profile install \
# --experimental-features "nix-command flakes" \
# --accept-flake-config \
# github:flox/flox/v${version}
#EOF

# Build ourself
RUN <<EOF
apt-get install -y \
nlohmann-json3-dev \
libargparse-dev \
libsqlite3-dev

mkdir -p /tmp/sqlite3pp
git clone https://github.com/aakropotkin/sqlite3pp /tmp/sqlite3pp
cp -r /tmp/sqlite3pp/include/ /usr/
cp /tmp/sqlite3pp/lib/pkgconfig/sqlite3pp.pc.in /usr/share/pkgconfig/sqlite3pp.pc
sed -E 's|@PREFIX@|/usr|' /usr/share/pkgconfig/sqlite3pp.pc

cd pkgdb
export CXX=gcc
make pkgdb
EOF

RUN <<EOF
cd cli
export CARGO_HOME=/usr/local/cargo
export RUSTUP_HOME=/usr/local/rustup
export RUSTFLAGS='-C target-feature=+crt-static'

NIX_BIN="${nix}/bin/nix"
BUILDENV_NIX="${flox-buildenv}/lib/buildenv.nix"
PKGDB_BIN="${flox-pkgdb}/bin/pkgdb"
FLOX_BIN="${flox-cli}/bin/flox"
WATCHDOG_BIN="${flox-watchdog}/libexec/flox-watchdog"
PROCESS_COMPOSE_BIN="${process-compose}/bin/process-compose"
FLOX_VERSION="${version}"

cargo build --release --target "${arch}-unknown-linux-gnu"
cp "target/${arch}-unknown-linux-gnu/release/foo" "${prefix}/bin/"
EOF

# completion
Expand Down

0 comments on commit 34a9efc

Please sign in to comment.