forge
Explore
Log in

Don't you dare go Hollow

flake: use rust-overlay in dev shell

Browse files at this commit

b3d4d4eacc88282a5a0f5b5670904e9434ba1a2esethParent: a835bdc
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
flake.lockmodified+22 -1
@@ -34,7 +34,28 @@
34 "root": {34 "root": {
35 "inputs": {35 "inputs": {
36 "nix-filter": "nix-filter",36 "nix-filter": "nix-filter",
37- "nixpkgs": "nixpkgs"37+ "nixpkgs": "nixpkgs",
38+ "rust-overlay": "rust-overlay"
39+ }
40+ },
41+ "rust-overlay": {
42+ "inputs": {
43+ "nixpkgs": [
44+ "nixpkgs"
45+ ]
46+ },
47+ "locked": {
48+ "lastModified": 1727663505,
49+ "narHash": "sha256-83j/GrHsx8GFUcQofKh+PRPz6pz8sxAsZyT/HCNdey8=",
50+ "owner": "oxalica",
51+ "repo": "rust-overlay",
52+ "rev": "c2099c6c7599ea1980151b8b6247a8f93e1806ee",
53+ "type": "github"
54+ },
55+ "original": {
56+ "owner": "oxalica",
57+ "repo": "rust-overlay",
58+ "type": "github"
38 }59 }
39 }60 }
40 },61 },
flake.nixmodified+28 -2
@@ -5,6 +5,13 @@
5 inputs = {5 inputs = {
6 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";6 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
7 nix-filter.url = "github:numtide/nix-filter";7 nix-filter.url = "github:numtide/nix-filter";
8+
9+ # NOTE: This is not necessary for end users
10+ # You can omit it with `inputs.rust-overlay.follows = ""`
11+ rust-overlay = {
12+ url = "github:oxalica/rust-overlay";
13+ inputs.nixpkgs.follows = "nixpkgs";
14+ };
8 };15 };
9 16
10 outputs =17 outputs =
@@ -12,6 +19,7 @@
12 self,19 self,
13 nixpkgs,20 nixpkgs,
14 nix-filter,21 nix-filter,
22+ rust-overlay,
15 }:23 }:
16 let24 let
17 inherit (nixpkgs) lib;25 inherit (nixpkgs) lib;
@@ -30,11 +38,29 @@
30 devShells = forAllSystems (38 devShells = forAllSystems (
31 system:39 system:
32 let40 let
41+ pkgs = nixpkgsFor.${system};
33 inherit (self.packages.${system}) niri;42 inherit (self.packages.${system}) niri;
34 in43 in
35 {44 {
36- default = nixpkgsFor.${system}.mkShell {45+ default = pkgs.mkShell {
37- inputsFrom = [ niri ];46+ packages = [
47+ # NOTE: Nixpkgs' Rust toolchain isn't used here as we prefer
48+ # a nightly toolchain for development, and *require* a nightly
49+ # `rustfmt`
50+ rust-overlay.packages.${system}.rust-nightly
51+
52+ pkgs.rust-analyzer
53+ ];
54+
55+ nativeBuildInputs = [
56+ pkgs.clang
57+ pkgs.pkg-config
58+ pkgs.wrapGAppsHook4 # For `niri-visual-tests`
59+ ];
60+
61+ buildInputs = niri.buildInputs ++ [
62+ pkgs.libadwaita # For `niri-visual-tests`
63+ ];
38 64
39 env = {65 env = {
40 inherit (niri) LIBCLANG_PATH;66 inherit (niri) LIBCLANG_PATH;