This repository provides a Nix flake for developing, building, running, and installing Bottles Next.
The flake currently supports x86_64-linux.
Bottles Next uses Git submodules for its Cargo workspace crates. The flake enables automatic submodule handling through:
inputs.self.submodules = true;A recent Nix version is therefore required. Nix 2.27 or newer is recommended.
Clone the repository:
git clone https://github.com/bottlesdevs/bottles-next.git
cd bottles-nextInitialize all Git submodules:
git submodule update --init --recursiveAlternatively, clone the repository and its submodules in one command:
git clone --recurse-submodules \
https://github.com/bottlesdevs/bottles-next.git
cd bottles-nextVerify the submodules:
git submodule statusA line beginning with - means that the corresponding submodule has not been initialized.
Enter the development shell:
nix developThe development shell includes:
- Rust and Cargo
- rust-analyzer
- rustfmt and Clippy
- protobuf and gRPC tools
- pkg-config
- CMake and Make
- OpenSSL
- the MinGW cross compiler
- the
x86_64-pc-windows-gnuRust target
The development shell supports building both the native Linux components and the Windows Wine bridge.
Build the complete project as a Nix package:
nix buildThe default package contains:
bin/bottles-cli
bin/bottles-server
libexec/bottles-next/bottles-winebridge.exe
The build output is available through the result symlink:
ls -R resultBuild the package explicitly by name:
nix build .#bottles-nextShow the complete build log:
nix build --print-build-logsRun the default application:
nix runThe default application is bottles-cli.
Run the CLI explicitly:
nix run .#bottles-cliRun the server:
nix run .#bottles-serverPass arguments after --:
nix run .#bottles-cli -- --helpnix run .#bottles-server -- --helpBuild and validate all checks exposed by the flake:
nix flake checkShow complete build logs:
nix flake check --print-build-logsThe checks verify that:
- the complete package builds;
bottles-cliis installed;bottles-serveris installed;bottles-winebridge.exeis installed;- the installed files use the expected paths.
Format the Nix files:
nix fmtThe repository uses Git submodules.
For reliable remote builds, use the generic Git fetcher and enable submodules explicitly:
nix build \
'git+https://github.com/bottlesdevs/bottles-next.git?submodules=1'Do not use the shorter github: reference for remote builds. Depending on the installed Nix version, the GitHub-specific fetcher may return the parent repository without the contents of its submodules.
nix develop \
'git+https://github.com/bottlesdevs/bottles-next.git?submodules=1'nix run \
'git+https://github.com/bottlesdevs/bottles-next.git?submodules=1'nix run \
'git+https://github.com/bottlesdevs/bottles-next.git?submodules=1#bottles-cli'nix run \
'git+https://github.com/bottlesdevs/bottles-next.git?submodules=1#bottles-server'Arguments can be passed after --:
nix run \
'git+https://github.com/bottlesdevs/bottles-next.git?submodules=1#bottles-cli' \
-- --helpBuild a specific branch:
nix build \
'git+https://github.com/bottlesdevs/bottles-next.git?ref=main&submodules=1'Build a fork:
nix build \
'git+https://github.com/hotplugindev/bottles-next.git?ref=branch-name&submodules=1'Build an exact commit:
nix build \
'git+https://github.com/bottlesdevs/bottles-next.git?rev=COMMIT_HASH&submodules=1'Using an exact commit gives the most predictable remote build.
Add Bottles Next as an explicit Git input with submodules enabled:
{
inputs = {
bottles-next = {
type = "git";
url = "https://github.com/bottlesdevs/bottles-next.git";
submodules = true;
};
};
}It is recommended to make Bottles Next use the same Nixpkgs input as the consuming configuration:
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
bottles-next = {
type = "git";
url = "https://github.com/bottlesdevs/bottles-next.git";
submodules = true;
inputs.nixpkgs.follows = "nixpkgs";
};
};
}When testing a fork or branch:
{
inputs = {
bottles-next = {
type = "git";
url = "https://github.com/hotplugindev/bottles-next.git";
ref = "branch-name";
submodules = true;
inputs.nixpkgs.follows = "nixpkgs";
};
};
}After adding or changing the input, update the lock file:
nix flake update bottles-nextOn older Nix versions:
nix flake lock --update-input bottles-nextInstall the package directly from the flake:
{ inputs, pkgs, ... }:
{
home.packages = [
inputs.bottles-next.packages.${pkgs.stdenv.hostPlatform.system}.default
];
}Because Bottles Next currently supports only x86_64-linux, it can also be referenced explicitly:
{ inputs, ... }:
{
home.packages = [
inputs.bottles-next.packages.x86_64-linux.default
];
}Install the package system-wide:
{ inputs, pkgs, ... }:
{
environment.systemPackages = [
inputs.bottles-next.packages.${pkgs.stdenv.hostPlatform.system}.default
];
}It can also be referenced explicitly:
{ inputs, ... }:
{
environment.systemPackages = [
inputs.bottles-next.packages.x86_64-linux.default
];
}Rebuild the system:
sudo nixos-rebuild switch --flake .#your-hostnameFor example:
sudo nixos-rebuild switch --flake ~/nixos#pcThe flake exposes a default Nixpkgs overlay.
Add it to the consuming configuration:
{ inputs, ... }:
{
nixpkgs.overlays = [
inputs.bottles-next.overlays.default
];
}Bottles Next can then be installed through pkgs:
{ pkgs, ... }:
{
environment.systemPackages = [
pkgs.bottles-next
];
}The same works with Home Manager:
{ pkgs, ... }:
{
home.packages = [
pkgs.bottles-next
];
}Use either the package output directly or the overlay. Using both is unnecessary.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
bottles-next = {
type = "git";
url = "https://github.com/bottlesdevs/bottles-next.git";
submodules = true;
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
bottles-next,
...
}:
{
nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{
environment.systemPackages = [
bottles-next.packages.x86_64-linux.default
];
}
];
};
};
}{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
bottles-next = {
type = "git";
url = "https://github.com/bottlesdevs/bottles-next.git";
submodules = true;
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
bottles-next,
...
}:
{
nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(
{ pkgs, ... }:
{
nixpkgs.overlays = [
bottles-next.overlays.default
];
environment.systemPackages = [
pkgs.bottles-next
];
}
)
];
};
};
}Update all flake inputs:
nix flake updateUpdate only Nixpkgs:
nix flake update nixpkgsUpdate only the Rust overlay:
nix flake update rust-overlayAfter updating inputs, verify the project:
nix flake check --print-build-logsnix build --print-build-logsReview and commit changes to flake.lock together with the corresponding project changes.
Nix may show:
warning: Git tree is dirty
This means that the repository contains uncommitted changes.
It does not normally prevent the flake from building.
Inspect the changes with:
git statusCommit or discard the changes before publishing a release so that the release refers to a clean repository state.
For example:
failed to read crates/download-manager/Cargo.toml
No such file or directory
Initialize all submodules:
git submodule update --init --recursiveVerify them:
git submodule statusThen retry:
nix buildUse the generic Git fetcher rather than the github: shorthand:
nix build \
'git+https://github.com/bottlesdevs/bottles-next.git?submodules=1'For a NixOS or Home Manager input, use:
bottles-next = {
type = "git";
url = "https://github.com/bottlesdevs/bottles-next.git";
submodules = true;
};The flake requires a recent Nix version for automatic local submodule handling.
Check the installed version:
nix --versionNix 2.27 or newer is recommended.
On NixOS, a recent Nix package can be selected with:
nix.package = pkgs.nixVersions.latest;Rebuild the system and verify the version before using the flake.
Remote Nix builds should not depend on SSH authentication.
All public submodules should use HTTPS URLs in .gitmodules, for example:
[submodule "crates/download-manager"]
path = crates/download-manager
url = https://github.com/bottlesdevs/download-manager.gitAfter changing a submodule URL:
git submodule sync --recursive
git submodule update --init --recursive