Adds a build and output for the dioxus-cli (#4519)
This commit is contained in:
1 parent
e43bf05b69
commit
871998e19e
1 file changed
+68
-10
@@ -9,11 +9,20 @@
|
|||||||
# crane.inputs.nixpkgs.follows = "nixpkgs";
|
# crane.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs:
|
outputs =
|
||||||
|
inputs:
|
||||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
systems = import inputs.systems;
|
systems = import inputs.systems;
|
||||||
|
|
||||||
perSystem = { config, self', pkgs, lib, system, ... }:
|
perSystem =
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
self',
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
||||||
extensions = [
|
extensions = [
|
||||||
@@ -26,19 +35,61 @@
|
|||||||
pkgs.openssl
|
pkgs.openssl
|
||||||
pkgs.libiconv
|
pkgs.libiconv
|
||||||
pkgs.pkg-config
|
pkgs.pkg-config
|
||||||
] ++ lib.optionals pkgs.stdenv.isLinux [
|
]
|
||||||
|
++ lib.optionals pkgs.stdenv.isLinux [
|
||||||
pkgs.glib
|
pkgs.glib
|
||||||
pkgs.gtk3
|
pkgs.gtk3
|
||||||
pkgs.libsoup_3
|
pkgs.libsoup_3
|
||||||
pkgs.webkitgtk_4_1
|
pkgs.webkitgtk_4_1
|
||||||
pkgs.xdotool
|
pkgs.xdotool
|
||||||
] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [
|
]
|
||||||
IOKit
|
++ lib.optionals pkgs.stdenv.isDarwin (
|
||||||
Carbon
|
with pkgs.darwin.apple_sdk.frameworks;
|
||||||
WebKit
|
[
|
||||||
Security
|
IOKit
|
||||||
Cocoa
|
Carbon
|
||||||
]);
|
WebKit
|
||||||
|
Security
|
||||||
|
Cocoa
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
|
|
||||||
|
rustPackage =
|
||||||
|
package:
|
||||||
|
{
|
||||||
|
binary ? package,
|
||||||
|
features ? [ ],
|
||||||
|
}:
|
||||||
|
(pkgs.makeRustPlatform {
|
||||||
|
cargo = rustToolchain;
|
||||||
|
rustc = rustToolchain;
|
||||||
|
}).buildRustPackage
|
||||||
|
{
|
||||||
|
pname = package;
|
||||||
|
version = cargoToml.package.version;
|
||||||
|
src = pkgs.lib.cleanSource ./.;
|
||||||
|
cargoLock.lockFile = ./Cargo.lock;
|
||||||
|
buildInputs = rustBuildInputs;
|
||||||
|
nativeBuildInputs = [
|
||||||
|
rustToolchain
|
||||||
|
pkgs.pkg-config
|
||||||
|
];
|
||||||
|
buildPhase = ''
|
||||||
|
mkdir -p .cargo
|
||||||
|
cp ${./Cargo.lock} Cargo.lock
|
||||||
|
cargo build --release --package ${package} ${
|
||||||
|
lib.concatStringsSep " " (map (f: "--features ${f}") features)
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
ls -alR target/release
|
||||||
|
cp target/release/${binary} $out/bin/
|
||||||
|
'';
|
||||||
|
doCheck = false; # Disable tests to avoid building deps for them
|
||||||
|
};
|
||||||
|
|
||||||
# This is useful when building crates as packages
|
# This is useful when building crates as packages
|
||||||
# Note that it does require a `Cargo.lock` which this repo does not have
|
# Note that it does require a `Cargo.lock` which this repo does not have
|
||||||
@@ -52,6 +103,13 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
packages.dioxus-cli = (
|
||||||
|
rustPackage "dioxus-cli" {
|
||||||
|
binary = "dx";
|
||||||
|
features = [ "no-downloads" ];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShell {
|
||||||
name = "dioxus-dev";
|
name = "dioxus-dev";
|
||||||
buildInputs = rustBuildInputs;
|
buildInputs = rustBuildInputs;
|
||||||
|
|||||||
Reference in new issue
Block a user