Skip to content

Commit

Permalink
Update nix flake devShell (#918)
Browse files Browse the repository at this point in the history
* try out building the binary with nix

* simplify to just a dev shell

* update query data

* update query data

* fix recipe to actually generate query data for all targets

---------

Co-authored-by: Maciej Wójcik <[email protected]>
  • Loading branch information
wojcik91 and Maciej Wójcik authored Dec 27, 2024
1 parent 2af97eb commit 4928c95
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ ladle-build
.envrc
.direnv/
*.pem
result/
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ trait-variant = "0.1"
uaparser = "0.6"
# openapi
utoipa = { version = "4", features = ["axum_extras"] }
utoipa-swagger-ui = { version = "7", features = ["axum"] }
utoipa-swagger-ui = { version = "7", features = ["axum", "vendored"] }
uuid = { version = "1.9", features = ["v4"] }
webauthn-authenticator-rs = { version = "0.5" }
webauthn-rs = { version = "0.5", features = [
Expand Down
69 changes: 45 additions & 24 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 31 additions & 12 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,44 @@
description = "Rust development flake";

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

outputs = { nixpkgs, utils, ... }:
utils.lib.eachDefaultSystem (system: let
pkgs = import nixpkgs {inherit system;};
outputs = {
nixpkgs,
flake-utils,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (system: let
overlays = [(import rust-overlay)];
pkgs = import nixpkgs {
inherit system overlays;
};
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = ["rust-analyzer" "rust-src" "rustfmt" "clippy"];
};
# define shared build inputs
nativeBuildInputs = with pkgs; [rustToolchain pkg-config];
buildInputs = with pkgs; [openssl protobuf curl nodejs_22 pnpm];
in {
devShells.default = pkgs.mkShell {
inherit nativeBuildInputs buildInputs;

packages = with pkgs; [
pkg-config
openssl
protobuf
sqlx-cli
cargo
rustc
rust-analyzer
clippy
just
];

# Specify the rust-src path (many editors rely on this)
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
};
});
}
8 changes: 8 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ format:
# lint Rust project
lint:
cargo clippy --all-targets --all-features

# run all migrations
migrate:
sqlx migrate run

# update sqlx query data
query-data:
cargo sqlx prepare -- --all-targets

0 comments on commit 4928c95

Please sign in to comment.