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