diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..8f02876 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[net] +offline = true + diff --git a/default.nix b/default.nix index 1aa23e0..79a8169 100644 --- a/default.nix +++ b/default.nix @@ -27,6 +27,8 @@ mpv, ffmpeg_5-full, # Rust tools + rustPlatform, + # setuptools-rust, rustc, cargo, corrosion @@ -41,7 +43,8 @@ stdenv.mkDerivation rec { src = ./.; - nativeBuildInputs = [ + nativeBuildInputs = with rustPlatform; [ + cargoSetupHook gcc gnumake clang @@ -50,15 +53,15 @@ stdenv.mkDerivation rec { extra-cmake-modules pkg-config wrapQtAppsHook - rustc - cargo - corrosion makeWrapper # gccStdenv # stdenv ]; buildInputs = [ + rustc + cargo + corrosion qtbase qttools qtquickcontrols2 @@ -70,11 +73,15 @@ stdenv.mkDerivation rec { ki18n kcoreaddons mpv - ffmpeg_6-full + ffmpeg_5-full # libsForQt5.kconfig ]; - RUST_BACKTRACE = 1; + cargoDeps = rustPlatform.importCargoLock { + lockFile = ./Cargo.lock; + }; + + RUST_BACKTRACE = "Full"; # preConfigure = '' # "${cargo-download} # ''; diff --git a/flake.lock b/flake.lock index 9a2c57b..24e5924 100644 --- a/flake.lock +++ b/flake.lock @@ -54,12 +54,15 @@ } }, "flake-utils_2": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1680776469, - "narHash": "sha256-3CXUDK/3q/kieWtdsYpDOBJw3Gw4Af6x+2EiSnIkNQw=", + "lastModified": 1681037374, + "narHash": "sha256-XL6X3VGbEFJZDUouv2xpKg2Aljzu/etPLv5e1FPt1q0=", "owner": "numtide", "repo": "flake-utils", - "rev": "411e8764155aa9354dbcd6d5faaeb97e9e3dce24", + "rev": "033b9f258ca96a10e543d4442071f614dc3f8412", "type": "github" }, "original": { @@ -86,11 +89,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1680758185, - "narHash": "sha256-sCVWwfnk7zEX8Z+OItiH+pcSklrlsLZ4TJTtnxAYREw=", + "lastModified": 1680945546, + "narHash": "sha256-8FuaH5t/aVi/pR1XxnF0qi4WwMYC+YxlfdsA0V+TEuQ=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0e19daa510e47a40e06257e205965f3b96ce0ac9", + "rev": "d9f759f2ea8d265d974a6e1259bd510ac5844c5d", "type": "github" }, "original": { @@ -131,6 +134,21 @@ "repo": "rust-overlay", "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", diff --git a/flake.nix b/flake.nix index 6392bc5..55c4914 100644 --- a/flake.nix +++ b/flake.nix @@ -20,15 +20,57 @@ rustVersion = "1.61.0"; 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 { - packages = { - crate = (rustPkgs.workspace.libre-presenter { }).bin; - default = packages.crate; - }; - devShell = import ./shell.nix { inherit pkgs; }; - defaultPackage = pkgs.libsForQt5.callPackage ./default.nix { inherit rustPkgs; }; + # packages = { + # crate = (rustPkgs.workspace.libre-presenter { }).bin; + # default = packages.crate; + # }; + devShell = workspaceShell; + defaultPackage = pkgs.libsForQt5.callPackage ./default.nix { }; } ); }