From c310ca5635c17a93c8dd4e6c62bfe085819406a3 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sat, 7 Feb 2026 23:01:42 +0300 Subject: [PATCH] nix: use rust-overlay for nightly Rust Signed-off-by: NotAShelf Change-Id: I74b2d21496261a3178ce043a5990583d6a6a6964 --- flake.lock | 23 ++++++++++++++++++++++- flake.nix | 19 +++++++++++++++---- nix/tests/api-crud.nix | 5 ++++- nix/tests/auth-rbac.nix | 5 ++++- nix/tests/basic-api.nix | 5 ++++- nix/tests/e2e.nix | 5 ++++- nix/tests/features.nix | 5 ++++- nix/tests/startup.nix | 5 ++++- nix/tests/webhooks.nix | 5 ++++- 9 files changed, 65 insertions(+), 12 deletions(-) diff --git a/flake.lock b/flake.lock index 4462231..c78fdb0 100644 --- a/flake.lock +++ b/flake.lock @@ -34,7 +34,28 @@ "root": { "inputs": { "crane": "crane", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1770433312, + "narHash": "sha256-IaiqGwmLBrR0z67t/oaS6GIFxv9V8mDY7dBTuYVTbKY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "9922ff9f99a6436756cbe6f5d11f9c3630e58cf0", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 7fefcfd..222949c 100644 --- a/flake.nix +++ b/flake.nix @@ -2,12 +2,17 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs?ref=nixpkgs-unstable"; crane.url = "github:ipetkov/crane"; + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = { nixpkgs, crane, self, + rust-overlay, ... }: let inherit (nixpkgs) lib; @@ -20,8 +25,16 @@ }; packages = forAllSystems (system: let - pkgs = nixpkgs.legacyPackages.${system}; - craneLib = crane.mkLib pkgs; + pkgs = nixpkgs.legacyPackages.${system}.extend rust-overlay.overlays.default; + craneLib = (crane.mkLib pkgs).overrideToolchain (p: + # Build tools + # We use the rust-overlay to get the stable Rust toolchain for various targets. + # This is not exactly necessary, but it allows for compiling for various targets + # with the least amount of friction. + p.rust-bin.nightly.latest.default.override { + extensions = ["rustfmt" "rust-analyzer" "clippy"]; + targets = []; + }); src = let fs = lib.fileset; @@ -97,8 +110,6 @@ postgresql_18 taplo - (rustfmt.override {asNightly = true;}) - clippy cargo-nextest ]; }; diff --git a/nix/tests/api-crud.nix b/nix/tests/api-crud.nix index 4f9ab59..8af1685 100644 --- a/nix/tests/api-crud.nix +++ b/nix/tests/api-crud.nix @@ -1,4 +1,7 @@ -{pkgs, self}: +{ + pkgs, + self, +}: pkgs.testers.nixosTest { name = "fc-api-crud"; diff --git a/nix/tests/auth-rbac.nix b/nix/tests/auth-rbac.nix index ade5f2e..5b2e49f 100644 --- a/nix/tests/auth-rbac.nix +++ b/nix/tests/auth-rbac.nix @@ -1,4 +1,7 @@ -{pkgs, self}: +{ + pkgs, + self, +}: pkgs.testers.nixosTest { name = "fc-auth-rbac"; diff --git a/nix/tests/basic-api.nix b/nix/tests/basic-api.nix index 8ad8d3a..1b31d36 100644 --- a/nix/tests/basic-api.nix +++ b/nix/tests/basic-api.nix @@ -1,4 +1,7 @@ -{pkgs, self}: +{ + pkgs, + self, +}: pkgs.testers.nixosTest { name = "fc-basic-api"; diff --git a/nix/tests/e2e.nix b/nix/tests/e2e.nix index 9674f4d..40a4434 100644 --- a/nix/tests/e2e.nix +++ b/nix/tests/e2e.nix @@ -1,4 +1,7 @@ -{pkgs, self}: +{ + pkgs, + self, +}: pkgs.testers.nixosTest { name = "fc-e2e"; diff --git a/nix/tests/features.nix b/nix/tests/features.nix index cc6a920..40e8c12 100644 --- a/nix/tests/features.nix +++ b/nix/tests/features.nix @@ -1,4 +1,7 @@ -{pkgs, self}: +{ + pkgs, + self, +}: pkgs.testers.nixosTest { name = "fc-features"; diff --git a/nix/tests/startup.nix b/nix/tests/startup.nix index 62fc94b..0f1cf07 100644 --- a/nix/tests/startup.nix +++ b/nix/tests/startup.nix @@ -1,4 +1,7 @@ -{pkgs, self}: +{ + pkgs, + self, +}: pkgs.testers.nixosTest { name = "fc-service-startup"; diff --git a/nix/tests/webhooks.nix b/nix/tests/webhooks.nix index f1df1e5..a93e212 100644 --- a/nix/tests/webhooks.nix +++ b/nix/tests/webhooks.nix @@ -1,4 +1,7 @@ -{pkgs, self}: +{ + pkgs, + self, +}: pkgs.testers.nixosTest { name = "fc-webhooks";