nix build works! 🎉

Finally got nix build to work and thus even make the app installable
again now that I've switched to a mostly rust backend. I needed to add
cargoSetupHook and rustPlatform to the buildInputs.
This commit is contained in:
Chris Cochrun 2023-04-10 05:21:18 -05:00
parent 04928cc5e6
commit 56981a95c6
4 changed files with 88 additions and 18 deletions

3
.cargo/config.toml Normal file
View file

@ -0,0 +1,3 @@
[net]
offline = true

View file

@ -27,6 +27,8 @@
mpv, mpv,
ffmpeg_5-full, ffmpeg_5-full,
# Rust tools # Rust tools
rustPlatform,
# setuptools-rust,
rustc, rustc,
cargo, cargo,
corrosion corrosion
@ -41,7 +43,8 @@ stdenv.mkDerivation rec {
src = ./.; src = ./.;
nativeBuildInputs = [ nativeBuildInputs = with rustPlatform; [
cargoSetupHook
gcc gcc
gnumake gnumake
clang clang
@ -50,15 +53,15 @@ stdenv.mkDerivation rec {
extra-cmake-modules extra-cmake-modules
pkg-config pkg-config
wrapQtAppsHook wrapQtAppsHook
rustc
cargo
corrosion
makeWrapper makeWrapper
# gccStdenv # gccStdenv
# stdenv # stdenv
]; ];
buildInputs = [ buildInputs = [
rustc
cargo
corrosion
qtbase qtbase
qttools qttools
qtquickcontrols2 qtquickcontrols2
@ -70,11 +73,15 @@ stdenv.mkDerivation rec {
ki18n ki18n
kcoreaddons kcoreaddons
mpv mpv
ffmpeg_6-full ffmpeg_5-full
# libsForQt5.kconfig # libsForQt5.kconfig
]; ];
RUST_BACKTRACE = 1; cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
};
RUST_BACKTRACE = "Full";
# preConfigure = '' # preConfigure = ''
# "${cargo-download} # "${cargo-download}
# ''; # '';

30
flake.lock generated
View file

@ -54,12 +54,15 @@
} }
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1680776469, "lastModified": 1681037374,
"narHash": "sha256-3CXUDK/3q/kieWtdsYpDOBJw3Gw4Af6x+2EiSnIkNQw=", "narHash": "sha256-XL6X3VGbEFJZDUouv2xpKg2Aljzu/etPLv5e1FPt1q0=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "411e8764155aa9354dbcd6d5faaeb97e9e3dce24", "rev": "033b9f258ca96a10e543d4442071f614dc3f8412",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -86,11 +89,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1680758185, "lastModified": 1680945546,
"narHash": "sha256-sCVWwfnk7zEX8Z+OItiH+pcSklrlsLZ4TJTtnxAYREw=", "narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "0e19daa510e47a40e06257e205965f3b96ce0ac9", "rev": "d9f759f2ea8d265d974a6e1259bd510ac5844c5d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -131,6 +134,21 @@
"repo": "rust-overlay", "repo": "rust-overlay",
"type": "github" "type": "github"
} }
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -20,15 +20,57 @@
rustVersion = "1.61.0"; rustVersion = "1.61.0";
packageFun = import ./Cargo.nix; packageFun = import ./Cargo.nix;
}; };
# The workspace defines a development shell with all of the dependencies
# and environment settings necessary for a regular `cargo build`.
# Passes through all arguments to pkgs.mkShell for adding supplemental
# dependencies.
workspaceShell = rustPkgs.workspaceShell {
packages = with pkgs; [
gcc
gnumake
gdb
qtcreator
cmake
extra-cmake-modules
pkg-config
libsForQt5.wrapQtAppsHook
makeWrapper
clang-tools
clang
libclang
qt5.qtbase
qt5.qttools
qt5.qtquickcontrols2
qt5.qtx11extras
qt5.qtmultimedia
qt5.qtwayland
libsForQt5.kirigami2
libsForQt5.qqc2-desktop-style
libsForQt5.karchive
mpv
ffmpeg_6-full
# Rust tools
clippy
rustc
cargo
rustfmt
rust-analyzer
corrosion
];
# shellHook = ''
# export PS1="\033[0;31m☠dev-shell☠ $ \033[0m"
# '';
};
in rec in rec
{ {
packages = { # packages = {
crate = (rustPkgs.workspace.libre-presenter { }).bin; # crate = (rustPkgs.workspace.libre-presenter { }).bin;
default = packages.crate; # default = packages.crate;
}; # };
devShell = import ./shell.nix { inherit pkgs; }; devShell = workspaceShell;
defaultPackage = pkgs.libsForQt5.callPackage ./default.nix { inherit rustPkgs; }; defaultPackage = pkgs.libsForQt5.callPackage ./default.nix { };
} }
); );
} }