flake: use rust-overlay in dev shell
Browse files at this commitb3d4d4eacc88282a5a0f5b5670904e9434ba1a2eParent: a835bdc2 changed files +50 -3
- flake.lock +22 -1
- flake.nix +28 -2
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 | let | 24 | let |
| 17 | inherit (nixpkgs) lib; | 25 | inherit (nixpkgs) lib; |
| @@ -30,11 +38,29 @@ | |||
| 30 | devShells = forAllSystems ( | 38 | devShells = forAllSystems ( |
| 31 | system: | 39 | system: |
| 32 | let | 40 | let |
| 41 | + pkgs = nixpkgsFor.${system}; | ||
| 33 | inherit (self.packages.${system}) niri; | 42 | inherit (self.packages.${system}) niri; |
| 34 | in | 43 | 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; |