flowistry icon indicating copy to clipboard operation
flowistry copied to clipboard

Can't run Flowistry through rust-overlay

Open Baughn opened this issue 2 months ago • 2 comments

It causes this error:

Flowistry could not run because your project failed to build with error:
error: no such command: `+nightly-2025-08-20`

help: invoke `cargo` through `rustup` to handle `+toolchain` directives

Which, fair enough, I'm not using rustup. Can't, actually; any environment in which I have rustup would be an environment in which openssl is not available. Instead I'm using rust-overlay through direnv.

However, I do have the nightly toolchain installed. How do I ask flowistry to stop adding the +nightly bit and just invoke cargo normally?

Baughn avatar Oct 21 '25 13:10 Baughn

skv saya ~/dev/ganbot> direnv exec . rustc --version
direnv: loading ~/dev/ganbot/.envrc
direnv: using flake
direnv: nix-direnv: Using cached dev shell
Ganbot Rust development environment
Rust version: rustc 1.91.0-nightly (523d3999d 2025-08-30)

Baughn avatar Oct 21 '25 13:10 Baughn

skv saya ~/dev/ganbot> cat flake.nix      
{
  description = "Ganbot - Multi-platform bot (Discord & IRC) built in Rust";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    rust-overlay.url = "github:oxalica/rust-overlay";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, rust-overlay, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        overlays = [ (import rust-overlay) ];
        pkgs = import nixpkgs {
          inherit system overlays;
        };

        rustToolchain = pkgs.rust-bin.nightly.latest.default.override {
          extensions = [ "rust-src" "rust-analyzer" ];
        };

        buildInputs = with pkgs; [
          # System dependencies
          pkg-config
          openssl

          # For image processing
          libwebp

          # Development tools
          rustToolchain
          cargo-watch
          cargo-edit
          cargo-outdated
          cargo-audit
          cargo-machete
          cargo-features-manager
          cargo-flamegraph
          bacon

          # JavaScript linting
          nodePackages.eslint
        ];

        nativeBuildInputs = with pkgs; [
          rustToolchain
        ];
      in
      {
        # Development shell
        devShells.default = pkgs.mkShell.override {
          stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv;
        } {
          inherit buildInputs nativeBuildInputs;

          # Environment variables for compilation
          PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
          
          # Rust environment variables
          RUST_BACKTRACE = 1;
          RUST_LOG = "ganbot=debug";

          shellHook = ''
            echo "Ganbot Rust development environment"
            echo "Rust version: $(rustc --version)"
            echo ""
            echo "Available commands:"
            echo "  cargo build    - Build the project"
            echo "  cargo run      - Run the bot"
            echo "  cargo watch    - Watch for changes and rebuild"
            echo "  cargo test     - Run tests"
            echo "  cargo check    - Check for compilation errors"
            echo "  bacon          - Run bacon for continuous checking"
            echo "  cargo machete   - Remove old deps"
            echo "  cargo features prune"
            echo "  eslint         - Lint JavaScript files"
            echo ""
          '';
        };

        # Package definition (for building the bot)
        packages.default = pkgs.rustPlatform.buildRustPackage {
          pname = "ganbot";
          version = "0.1.0";

          src = ./.;

          cargoLock = {
            lockFile = ./Cargo.lock;
          };

          nativeBuildInputs = [ pkgs.pkg-config ];
          buildInputs = with pkgs; [ openssl ];

          # Skip tests during build (run them separately)
          doCheck = false;
        };

        # App for running the bot
        apps.default = flake-utils.lib.mkApp {
          drv = self.packages.${system}.default;
        };
      });
}

Baughn avatar Oct 21 '25 13:10 Baughn