forge
Explore
Log in

Don't you dare go Hollow

flake: drop most external inputs

Browse files at this commit

3ab3e778abaca67e864f3ab7bbad6ae7c0c16638sethParent: e620331
Previously, inputs like Crane and Fenix were used to only build the
`niri` package. This isn't really required, and can easily be replaced
by nixpkgs' `rustPlatform` -- which will also lead to less dependencies
being pulled into user's lockfiles
flake.lockmodified+0 -90
@@ -1,60 +1,5 @@
1 {1 {
2 "nodes": {2 "nodes": {
3- "crane": {
4- "locked": {
5- "lastModified": 1725409566,
6- "narHash": "sha256-PrtLmqhM6UtJP7v7IGyzjBFhbG4eOAHT6LPYOFmYfbk=",
7- "owner": "ipetkov",
8- "repo": "crane",
9- "rev": "7e4586bad4e3f8f97a9271def747cf58c4b68f3c",
10- "type": "github"
11- },
12- "original": {
13- "owner": "ipetkov",
14- "repo": "crane",
15- "type": "github"
16- }
17- },
18- "fenix": {
19- "inputs": {
20- "nixpkgs": [
21- "nixpkgs"
22- ],
23- "rust-analyzer-src": "rust-analyzer-src"
24- },
25- "locked": {
26- "lastModified": 1725172314,
27- "narHash": "sha256-BtLY9lWu/pe6/ImFwuRRRqMwLacY5AZOKA2hUHUQ64k=",
28- "owner": "nix-community",
29- "repo": "fenix",
30- "rev": "28b42d01f549c38bd165296fbcb4fe66d98fc24f",
31- "type": "github"
32- },
33- "original": {
34- "owner": "nix-community",
35- "ref": "monthly",
36- "repo": "fenix",
37- "type": "github"
38- }
39- },
40- "flake-utils": {
41- "inputs": {
42- "systems": "systems"
43- },
44- "locked": {
45- "lastModified": 1710146030,
46- "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
47- "owner": "numtide",
48- "repo": "flake-utils",
49- "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
50- "type": "github"
51- },
52- "original": {
53- "owner": "numtide",
54- "repo": "flake-utils",
55- "type": "github"
56- }
57- },
58 "nix-filter": {3 "nix-filter": {
59 "locked": {4 "locked": {
60 "lastModified": 1710156097,5 "lastModified": 1710156097,
@@ -88,44 +33,9 @@
88 },33 },
89 "root": {34 "root": {
90 "inputs": {35 "inputs": {
91- "crane": "crane",
92- "fenix": "fenix",
93- "flake-utils": "flake-utils",
94 "nix-filter": "nix-filter",36 "nix-filter": "nix-filter",
95 "nixpkgs": "nixpkgs"37 "nixpkgs": "nixpkgs"
96 }38 }
97- },
98- "rust-analyzer-src": {
99- "flake": false,
100- "locked": {
101- "lastModified": 1725094379,
102- "narHash": "sha256-TBujPMMIv8RG6BKlsBEpCln1ePmWz79xTcJOQpU2L18=",
103- "owner": "rust-lang",
104- "repo": "rust-analyzer",
105- "rev": "914a1caab54e48a028b2407d0fe6fade89532f67",
106- "type": "github"
107- },
108- "original": {
109- "owner": "rust-lang",
110- "ref": "nightly",
111- "repo": "rust-analyzer",
112- "type": "github"
113- }
114- },
115- "systems": {
116- "locked": {
117- "lastModified": 1681028828,
118- "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
119- "owner": "nix-systems",
120- "repo": "default",
121- "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
122- "type": "github"
123- },
124- "original": {
125- "owner": "nix-systems",
126- "repo": "default",
127- "type": "github"
128- }
129 }39 }
130 },40 },
131 "root": "root",41 "root": "root",
flake.nixmodified+108 -76
@@ -4,107 +4,139 @@
4 4
5 inputs = {5 inputs = {
6 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";6 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
7- crane.url = "github:ipetkov/crane";
8- flake-utils.url = "github:numtide/flake-utils";
9 nix-filter.url = "github:numtide/nix-filter";7 nix-filter.url = "github:numtide/nix-filter";
10- fenix = {
11- url = "github:nix-community/fenix/monthly";
12- inputs.nixpkgs.follows = "nixpkgs";
13- };
14 };8 };
15 9
16 outputs =10 outputs =
17 {11 {
18 self,12 self,
19 nixpkgs,13 nixpkgs,
20- crane,
21 nix-filter,14 nix-filter,
22- flake-utils,
23- fenix,
24 ...15 ...
25 }:16 }:
26 let17 let
18+ inherit (nixpkgs) lib;
27 systems = [19 systems = [
28 "aarch64-linux"20 "aarch64-linux"
29 "x86_64-linux"21 "x86_64-linux"
30 ];22 ];
23+
24+ forAllSystems = lib.genAttrs systems;
25+ nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system});
31 in26 in
32- flake-utils.lib.eachSystem systems (27+ {
33- system:28+ checks = forAllSystems (system: {
34- let29+ inherit (self.packages.${system}) niri;
35- pkgs = nixpkgs.legacyPackages.${system};30+ });
36- toolchain = fenix.packages.${system}.complete.toolchain;
37- craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
38 31
39- craneArgs = {32+ devShells = forAllSystems (
40- pname = "niri";33+ system:
41- version = self.rev or "dirty";34+ let
35+ inherit (self.packages.${system}) niri;
36+ in
37+ {
38+ default = nixpkgsFor.${system}.mkShell {
39+ inputsFrom = [ niri ];
42 40
43- src = nixpkgs.lib.cleanSourceWith {41+ env = {
44- src = craneLib.path ./.;42+ LD_LIBRARY_PATH = lib.makeLibraryPath niri.buildInputs;
45- filter =43+ inherit (niri.env) LIBCLANG_PATH;
46- path: type:44+ };
47- (builtins.match "resources" path == null)
48- || ((craneLib.filterCargoSources path type) && (builtins.match "niri-visual-tests" path == null));
49 };45 };
46+ }
47+ );
50 48
51- nativeBuildInputs = with pkgs; [49+ formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
52- pkg-config
53- autoPatchelfHook
54- clang
55- gdk-pixbuf
56- graphene
57- gtk4
58- libadwaita
59- ];
60 50
61- buildInputs = with pkgs; [51+ packages = forAllSystems (system: {
62- wayland52+ niri = nixpkgsFor.${system}.callPackage (
63- systemd # For libudev53+ {
64- seatd # For libseat54+ cairo,
65- libxkbcommon55+ clang,
66- libdisplay-info56+ fontconfig,
67- libinput57+ gdk-pixbuf,
68- mesa # For libgbm58+ glib,
69- fontconfig59+ graphene,
70- stdenv.cc.cc.lib60+ gtk4,
71- pipewire61+ libadwaita,
72- pango62+ libclang,
73- cairo63+ libdisplay-info,
74- glib64+ libglvnd,
75- pixman65+ libinput,
76- ];66+ libxkbcommon,
67+ mesa,
68+ pango,
69+ pipewire,
70+ pixman,
71+ pkg-config,
72+ rustPlatform,
73+ seatd,
74+ stdenv,
75+ systemd,
76+ wayland,
77+ xorg,
78+ }:
79+ rustPlatform.buildRustPackage rec {
80+ pname = "niri";
81+ version = self.shortRev or self.dirtyShortRev or "unknown";
77 82
78- runtimeDependencies = with pkgs; [83+ cargoLock = {
79- wayland84+ # NOTE: This is only used for Git dependencies
80- mesa85+ allowBuiltinFetchGit = true;
81- libglvnd # For libEGL86+ lockFile = ./Cargo.lock;
82- xorg.libXcursor87+ };
83- xorg.libXi
84- libxkbcommon
85- ];
86 88
87- LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";89+ src = nix-filter.lib.filter {
88- LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath craneArgs.runtimeDependencies; # Needed for tests to find libxkbcommon90+ root = self;
89- };91+ include = [
92+ "niri-config"
93+ "niri-ipc"
94+ "resources"
95+ "src"
96+ ];
97+ };
90 98
91- cargoArtifacts = craneLib.buildDepsOnly craneArgs;99+ nativeBuildInputs = [
92- niri = craneLib.buildPackage (craneArgs // { inherit cargoArtifacts; });100+ clang
93- in101+ gdk-pixbuf
94- {102+ graphene
95- formatter = pkgs.nixfmt-rfc-style;103+ gtk4
104+ libadwaita
105+ pkg-config
106+ ];
96 107
97- checks.niri = niri;108+ buildInputs = [
98- packages.default = niri;109+ cairo
110+ fontconfig
111+ glib
112+ libdisplay-info
113+ libinput
114+ libxkbcommon
115+ mesa # For libgbm
116+ pango
117+ pipewire
118+ pixman
119+ seatd # For libseat
120+ stdenv.cc.cc.lib
121+ systemd # For libudev
122+ wayland
123+ ];
99 124
100- devShells.default = craneLib.devShell {125+ runtimeDependencies = [
101- inputsFrom = [ niri ];126+ libglvnd # For libEGL
127+ libxkbcommon
128+ mesa
129+ wayland
130+ xorg.libXcursor
131+ xorg.libXi
132+ ];
102 133
103- LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (134+ LD_LIBRARY_PATH = lib.makeLibraryPath runtimeDependencies;
104- craneArgs.runtimeDependencies ++ craneArgs.nativeBuildInputs ++ craneArgs.buildInputs135+ LIBCLANG_PATH = lib.getLib libclang + "/lib";
105- );136+ }
106- inherit (niri) LIBCLANG_PATH;137+ ) { };
107- };138+
108- }139+ default = self.packages.${system}.niri;
109- );140+ });
141+ };
110 }142 }