2023-10-12 19:29:02 +00:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
systems.url = "github:nix-systems/default";
|
|
|
|
|
|
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
2024-03-24 20:31:38 +00:00
|
|
|
# crane.url = "github:ipetkov/crane";
|
|
|
|
# crane.inputs.nixpkgs.follows = "nixpkgs";
|
2023-10-12 19:29:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = inputs:
|
|
|
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
|
|
|
systems = import inputs.systems;
|
|
|
|
|
|
|
|
perSystem = { config, self', pkgs, lib, system, ... }:
|
|
|
|
let
|
|
|
|
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
|
|
|
|
extensions = [
|
|
|
|
"rust-src"
|
|
|
|
"rust-analyzer"
|
|
|
|
"clippy"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
rustBuildInputs = [
|
|
|
|
pkgs.openssl
|
|
|
|
pkgs.libiconv
|
|
|
|
pkgs.pkg-config
|
2024-08-28 14:25:25 +00:00
|
|
|
] ++ lib.optionals pkgs.stdenv.isLinux [
|
2024-06-20 16:08:21 +00:00
|
|
|
pkgs.glib
|
|
|
|
pkgs.gtk3
|
|
|
|
pkgs.libsoup_3
|
|
|
|
pkgs.webkitgtk_4_1
|
|
|
|
pkgs.xdotool
|
2023-10-12 19:29:02 +00:00
|
|
|
] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [
|
|
|
|
IOKit
|
|
|
|
Carbon
|
|
|
|
WebKit
|
|
|
|
Security
|
|
|
|
Cocoa
|
|
|
|
]);
|
|
|
|
|
|
|
|
# This is useful when building crates as packages
|
|
|
|
# Note that it does require a `Cargo.lock` which this repo does not have
|
|
|
|
# craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
_module.args.pkgs = import inputs.nixpkgs {
|
|
|
|
inherit system;
|
|
|
|
overlays = [
|
|
|
|
inputs.rust-overlay.overlays.default
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
|
|
name = "dioxus-dev";
|
|
|
|
buildInputs = rustBuildInputs;
|
|
|
|
nativeBuildInputs = [
|
|
|
|
# Add shell dependencies here
|
|
|
|
rustToolchain
|
|
|
|
];
|
|
|
|
shellHook = ''
|
|
|
|
# For rust-analyzer 'hover' tooltips to work.
|
|
|
|
export RUST_SRC_PATH="${rustToolchain}/lib/rustlib/src/rust/library";
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|