flake.nix 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. {
  2. inputs = {
  3. nixpkgs.url = "nixpkgs/nixos-unstable";
  4. fenix = {
  5. url = "github:nix-community/fenix";
  6. inputs.nixpkgs.follows = "nixpkgs";
  7. };
  8. flake-utils.url = "flake-utils";
  9. };
  10. outputs = {self, fenix, flake-utils, nixpkgs}:
  11. let
  12. supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-darwin"];
  13. in flake-utils.lib.eachSystem supportedSystems (system:
  14. let
  15. pkgs = import nixpkgs {
  16. inherit system;
  17. overlays = [(import ./nix/overlay.nix)];
  18. };
  19. parsedSystem = pkgs.lib.systems.parse.mkSystemFromString system;
  20. in {
  21. devShells.default = pkgs.mkShell {
  22. LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
  23. buildInputs = [
  24. (fenix.packages.${system}.complete.withComponents [
  25. "cargo"
  26. "clippy"
  27. "rustc"
  28. "rustfmt"
  29. "rust-src"
  30. ])
  31. pkgs.bacon
  32. pkgs.iconv
  33. pkgs.llvmPackages.clang
  34. pkgs.pkg-config
  35. pkgs.urcrypt
  36. ] ++
  37. (nixpkgs.lib.lists.optional (parsedSystem.kernel.name != "darwin") pkgs.gdb) # nixpkgs won't build gdb for darwin
  38. ++
  39. (nixpkgs.lib.lists.optional (parsedSystem.kernel.name != "darwin" || parsedSystem.cpu.name != "x86_64") pkgs.cargo-watch); # nixpkgs won't build cargo-watch for darwin-x86
  40. };
  41. }
  42. );
  43. }