1
0

flake.nix 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. {
  2. inputs = {
  3. nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
  4. flake-parts.url = "github:hercules-ci/flake-parts";
  5. systems.url = "github:nix-systems/default";
  6. rust-overlay.url = "github:oxalica/rust-overlay";
  7. # crane.url = "github:ipetkov/crane";
  8. # crane.inputs.nixpkgs.follows = "nixpkgs";
  9. };
  10. outputs = inputs:
  11. inputs.flake-parts.lib.mkFlake { inherit inputs; } {
  12. systems = import inputs.systems;
  13. perSystem = { config, self', pkgs, lib, system, ... }:
  14. let
  15. rustToolchain = pkgs.rust-bin.stable.latest.default.override {
  16. extensions = [
  17. "rust-src"
  18. "rust-analyzer"
  19. "clippy"
  20. ];
  21. };
  22. rustBuildInputs = [
  23. pkgs.openssl
  24. pkgs.libiconv
  25. pkgs.pkg-config
  26. pkgs.glib
  27. pkgs.gtk3
  28. pkgs.libsoup_3
  29. pkgs.webkitgtk_4_1
  30. pkgs.xdotool
  31. ] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [
  32. IOKit
  33. Carbon
  34. WebKit
  35. Security
  36. Cocoa
  37. ]);
  38. # This is useful when building crates as packages
  39. # Note that it does require a `Cargo.lock` which this repo does not have
  40. # craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;
  41. in
  42. {
  43. _module.args.pkgs = import inputs.nixpkgs {
  44. inherit system;
  45. overlays = [
  46. inputs.rust-overlay.overlays.default
  47. ];
  48. };
  49. devShells.default = pkgs.mkShell {
  50. name = "dioxus-dev";
  51. buildInputs = rustBuildInputs;
  52. nativeBuildInputs = [
  53. # Add shell dependencies here
  54. rustToolchain
  55. ];
  56. shellHook = ''
  57. # For rust-analyzer 'hover' tooltips to work.
  58. export RUST_SRC_PATH="${rustToolchain}/lib/rustlib/src/rust/library";
  59. '';
  60. };
  61. };
  62. };
  63. }