Build optimized dash

This commit is contained in:
Username404-59 2026-07-01 17:48:23 +02:00
parent 7ab1f130fa
commit 96fb834e0f
Signed by: Username404-59
GPG Key ID: F3A1878B14F5F0D7
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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};