From 0b2452f41add22786939312e4ae7005689664022 Mon Sep 17 00:00:00 2001
From: Gabriel de Perthuis <g2p.code@gmail.com>
Date: Sun, 23 Mar 2025 12:55:11 +0000
Subject: [PATCH] nix: Reduce util-linux dependencies through overlays

This aims to reduce CI build time.

Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
---
 flake.nix | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/flake.nix b/flake.nix
index 62ff2989..c83a3b8b 100644
--- a/flake.nix
+++ b/flake.nix
@@ -55,9 +55,20 @@
           inherit (lib.lists) findFirst;
           inherit (lib.strings) hasPrefix removePrefix substring;
 
+          myOverlays = [
+            (import rust-overlay)
+            (_: prev: {
+              util-linux = prev.util-linux.override {
+                ncursesSupport = false;
+                nlsSupport = false;
+                pamSupport = false;
+                systemdSupport = false;
+              };
+            })
+          ];
           pkgs = import nixpkgs {
             inherit system;
-            overlays = [ (import rust-overlay) ];
+            overlays = myOverlays;
           };
 
           cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
@@ -196,7 +207,7 @@
                   localSystem = system;
                   pkgs' = import nixpkgs {
                     inherit crossSystem localSystem;
-                    overlays = [ (import rust-overlay) ];
+                    overlays = myOverlays;
                   };
 
                   common = pkgs'.callPackage mkCommon { inherit crane; };