From 96fb834e0f255ee7c626e4ad10f515117db9a8aa Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Wed, 1 Jul 2026 17:48:23 +0200 Subject: [PATCH] Build optimized dash --- configuration.nix | 6 ++++-- modules/system-packages.nix | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configuration.nix b/configuration.nix index 4312ecd..495c817 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, functions, ... }: /* This should be in /etc/nixos/ together with the rest. @@ -157,7 +157,9 @@ in # networking.firewall.enable = false; # Replaces /bin/sh with dash (which is faster than bash) - environment.binsh = "${pkgs.dash}/bin/dash"; + environment.binsh = "${ + (functions.mkWithCFlags pkgs.dash "-Ofast -flto -fwhole-program -fno-unroll-loops") + }/bin/dash"; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions diff --git a/modules/system-packages.nix b/modules/system-packages.nix index f3b445b..c61e8e1 100644 --- a/modules/system-packages.nix +++ b/modules/system-packages.nix @@ -17,6 +17,12 @@ let }); mkPatchedAuto = pkg: mkPatched pkg [ nixtamal.${pkg.pname + "-patch"} ]; + mkWithCFlags = pkg: flags: (pkg.override { + stdenv = pkgs.fastStdenv; # Faster GCC + }).overrideAttrs (old: { + NIX_CFLAGS_COMPILE = (old.NIX_CFLAGS_COMPILE or "") + " ${flags}"; # https://gcc.gnu.org/onlinedocs/gcc-16.1.0/gcc/Optimize-Options.html + }); + importFlake = flakeRef: let src = nixtamal.${flakeRef};