aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseth <getchoo@tuta.io>2024-09-30 19:13:55 -0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-10-05 12:09:24 -0700
commitb3d4d4eacc88282a5a0f5b5670904e9434ba1a2e (patch)
tree76a38cf18f1f8e62c83cfbcb09aec41ccdeab5c3
parenta835bdc940885d73ee1b633cf95562fd8c3c5360 (diff)
downloadniri-b3d4d4eacc88282a5a0f5b5670904e9434ba1a2e.tar.gz
niri-b3d4d4eacc88282a5a0f5b5670904e9434ba1a2e.tar.bz2
niri-b3d4d4eacc88282a5a0f5b5670904e9434ba1a2e.zip
flake: use rust-overlay in dev shell
This allows `niri-visual-tests` to still be built and run in the dev shell where it's necessary, as well as brings back the nightly `rustfmt` used by the project We can't use `fenix` again though as it doesn't wrap `ld` like nixpkgs and rust-overlay do; without it, the way we link `dlopen()`'d libraries breaks
-rw-r--r--flake.lock23
-rw-r--r--flake.nix30
2 files changed, 50 insertions, 3 deletions
diff --git a/flake.lock b/flake.lock
index f685c8f4..3ff73531 100644
--- a/flake.lock
+++ b/flake.lock
@@ -34,7 +34,28 @@
"root": {
"inputs": {
"nix-filter": "nix-filter",
- "nixpkgs": "nixpkgs"
+ "nixpkgs": "nixpkgs",
+ "rust-overlay": "rust-overlay"
+ }
+ },
+ "rust-overlay": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1727663505,
+ "narHash": "sha256-83j/GrHsx8GFUcQofKh+PRPz6pz8sxAsZyT/HCNdey8=",
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "rev": "c2099c6c7599ea1980151b8b6247a8f93e1806ee",
+ "type": "github"
+ },
+ "original": {
+ "owner": "oxalica",
+ "repo": "rust-overlay",
+ "type": "github"
}
}
},
diff --git a/flake.nix b/flake.nix
index 5b9361d0..9ef68722 100644
--- a/flake.nix
+++ b/flake.nix
@@ -5,6 +5,13 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nix-filter.url = "github:numtide/nix-filter";
+
+ # NOTE: This is not necessary for end users
+ # You can omit it with `inputs.rust-overlay.follows = ""`
+ rust-overlay = {
+ url = "github:oxalica/rust-overlay";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
};
outputs =
@@ -12,6 +19,7 @@
self,
nixpkgs,
nix-filter,
+ rust-overlay,
}:
let
inherit (nixpkgs) lib;
@@ -30,11 +38,29 @@
devShells = forAllSystems (
system:
let
+ pkgs = nixpkgsFor.${system};
inherit (self.packages.${system}) niri;
in
{
- default = nixpkgsFor.${system}.mkShell {
- inputsFrom = [ niri ];
+ default = pkgs.mkShell {
+ packages = [
+ # NOTE: Nixpkgs' Rust toolchain isn't used here as we prefer
+ # a nightly toolchain for development, and *require* a nightly
+ # `rustfmt`
+ rust-overlay.packages.${system}.rust-nightly
+
+ pkgs.rust-analyzer
+ ];
+
+ nativeBuildInputs = [
+ pkgs.clang
+ pkgs.pkg-config
+ pkgs.wrapGAppsHook4 # For `niri-visual-tests`
+ ];
+
+ buildInputs = niri.buildInputs ++ [
+ pkgs.libadwaita # For `niri-visual-tests`
+ ];
env = {
inherit (niri) LIBCLANG_PATH;