Login
1 branch 0 tags
Ben (Desktop/Arch) Added MIT license 098069c 25 days ago 3 Commits
gb-rs / flake.nix
{
  description = "RubHub";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
  };

  outputs = { self, nixpkgs }:
    let
      # Target system(s) — adjust if you need macOS or other
      systems = [ "x86_64-linux" "aarch64-linux" ];
      forAllSystems = nixpkgs.lib.genAttrs systems;
    in
      {
        devShells = forAllSystems (system:
          let
            pkgs = nixpkgs.legacyPackages.${system};
            runtimeLibs = with pkgs; [
              libx11
              libxcb
              libxkbcommon
              libxcursor
              libxi
              libxrandr
              libxinerama
              libxxf86vm

              # OpenGL loader / drivers
              mesa
              libglvnd

              # Audio/fonts often needed by frameworks
              alsa-lib
              fontconfig
            ];
          in
            {
              default = pkgs.mkShell {
                strictDeps = true;
                nativeBuildInputs = with pkgs; [
                  rustc
                  cargo
                  rustfmt
                  clippy
                  rust-analyzer
                  bacon
                  mold
                  clang
                  tokei

                  libxcb
                  libx11
                  alsa-lib
                  fontconfig
                  cmake
                ];

                buildInputs = runtimeLibs;
                LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath runtimeLibs;

                RUSTFLAGS = "-C link-arg=-fuse-ld=mold";
                LD = "${pkgs.mold}/bin/mold";
                CC = "${pkgs.llvmPackages.clang}/bin/clang";
                CXX = "${pkgs.llvmPackages.clang}/bin/clang++";
              };
            });
      };
}