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
This commit is contained in:
seth
2024-09-30 19:13:55 -04:00
committed by Ivan Molodetskikh
parent a835bdc940
commit b3d4d4eacc
2 changed files with 50 additions and 3 deletions
Generated
+22 -1
View File
@@ -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"
}
}
},
+28 -2
View File
@@ -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;