Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
51c93e0cc3 | |||
9d78035368 |
|
@ -98,7 +98,10 @@
|
|||
localSystem = builtins.currentSystem or platform;
|
||||
crossSystem = platform;
|
||||
overlays = [ self.overlays.default ];
|
||||
config.allowUnsupportedSystem = true;
|
||||
config = {
|
||||
allowUnsupportedSystem = true;
|
||||
replaceStdenv = { pkgs }: self.lib.stdenv pkgs;
|
||||
};
|
||||
});
|
||||
|
||||
packages = eachSystem (system: platform:
|
||||
|
|
42
lib/stdenv.nix
Normal file
42
lib/stdenv.nix
Normal file
|
@ -0,0 +1,42 @@
|
|||
{ ... }: pkgs:
|
||||
|
||||
let
|
||||
inherit (lib) optionalAttrs optionals toList;
|
||||
inherit (pkgs) lib stdenv;
|
||||
inherit (stdenv) targetPlatform;
|
||||
in pkgs.addAttrsToDerivation (prevAttrs: let
|
||||
overrideAlloc = prevAttrs.overrideAlloc or true;
|
||||
|
||||
inputs = optionals overrideAlloc [ pkgs.mimalloc ];
|
||||
|
||||
cflags = [ "-pipe" ];
|
||||
ldflags = [
|
||||
"-O2"
|
||||
"--hash-style=gnu"
|
||||
] ++ optionals overrideAlloc [ "-lmimalloc" ];
|
||||
|
||||
rustflags = [
|
||||
"-C" "opt-level=2"
|
||||
"-C" "linker-flavor=ld.lld"
|
||||
"-C" "lto"
|
||||
"-C" "linker-plugin-lto"
|
||||
"-C" "link-arg=--icf=safe"
|
||||
"-C" "link-arg=--lto-O2"
|
||||
] ++ optionals (targetPlatform.isx86_64 && targetPlatform ? gcc.arch) [
|
||||
"-C" "target-cpu=${targetPlatform.gcc.arch}"
|
||||
] ++ (map (flag: [ "-C" "link-arg=${flag}" ]) ldflags |> lib.flatten);
|
||||
in {
|
||||
buildInputs = prevAttrs.buildInputs or [ ] ++ inputs;
|
||||
|
||||
env = prevAttrs.env or { } // optionalAttrs (!prevAttrs ? NIX_CFLAGS_COMPILE) {
|
||||
NIX_CFLAGS_COMPILE = toList prevAttrs.env.NIX_CFLAGS_COMPILE or [ ] ++ cflags |> toString;
|
||||
} // optionalAttrs (prevAttrs ? env.NIX_LDFLAGS) {
|
||||
NIX_LDFLAGS = toList prevAttrs.NIX_LDFLAGS or [ ] ++ ldflags |> toString;
|
||||
};
|
||||
|
||||
NIX_RUSTFLAGS = prevAttrs.NIX_RUSTFLAGS or [ ] ++ rustflags;
|
||||
} // optionalAttrs (prevAttrs ? NIX_CFLAGS_COMPILE) {
|
||||
NIX_CFLAGS_COMPILE = toList prevAttrs.NIX_CFLAGS_COMPILE or [ ] ++ cflags;
|
||||
} // optionalAttrs (!prevAttrs ? env.NIX_LDFLAGS) {
|
||||
NIX_LDFLAGS = toList prevAttrs.NIX_LDFLAGS or [ ] ++ ldflags;
|
||||
}) stdenv
|
|
@ -7,6 +7,7 @@ nixpkgs.lib.composeManyExtensions [
|
|||
colmena.overlays.default
|
||||
rust-overlay.overlays.default
|
||||
niri.overlays.niri
|
||||
self.overlays.llvm
|
||||
self.overlays.mimalloc
|
||||
self.overlays.modern-minimal
|
||||
self.overlays.fixes
|
||||
|
|
|
@ -4,6 +4,10 @@ let
|
|||
inherit (lib) toList;
|
||||
inherit (prev.stdenv) hostPlatform;
|
||||
in {
|
||||
git = prev.git.overrideAttrs {
|
||||
doInstallCheck = false;
|
||||
};
|
||||
|
||||
numactl = prev.numactl.overrideAttrs (prevAttrs: {
|
||||
patches = prevAttrs.patches or [ ] ++ [
|
||||
(final.fetchpatch {
|
||||
|
|
142
overlay/llvm.nix
Normal file
142
overlay/llvm.nix
Normal file
|
@ -0,0 +1,142 @@
|
|||
{ nixpkgs, ... }: final: prev:
|
||||
|
||||
let
|
||||
inherit (nixpkgs) lib;
|
||||
inherit (lib) optionalAttrs toList;
|
||||
inherit (final.llvmPackages_latest) clangUseLLVM bintools;
|
||||
|
||||
stdenv = final.overrideCC final.stdenv (clangUseLLVM.override { inherit bintools; });
|
||||
cflags = [ "-flto" ];
|
||||
ldflags = [ "--icf=safe" "--lto-O2" ];
|
||||
|
||||
override = pkg: (pkg.overrideAttrs (prevAttrs: {
|
||||
env = prevAttrs.env or { } // optionalAttrs (!prevAttrs ? NIX_CFLAGS_COMPILE) {
|
||||
NIX_CFLAGS_COMPILE = toList prevAttrs.env.NIX_CFLAGS_COMPILE or [ ] ++ cflags |> toString;
|
||||
} // optionalAttrs (prevAttrs ? env.NIX_LDFLAGS) {
|
||||
NIX_LDFLAGS = toList prevAttrs.NIX_LDFLAGS or [ ] ++ ldflags |> toString;
|
||||
};
|
||||
} // optionalAttrs (prevAttrs ? NIX_CFLAGS_COMPILE) {
|
||||
NIX_CFLAGS_COMPILE = toList prevAttrs.env.NIX_CFLAGS_COMPILE or [ ] ++ cflags;
|
||||
} // optionalAttrs (!prevAttrs ? env.NIX_LDFLAGS) {
|
||||
NIX_LDFLAGS = toList prevAttrs.NIX_LDFLAGS or [ ] ++ ldflags;
|
||||
})).override { inherit stdenv; };
|
||||
in lib.genAttrs [
|
||||
"alsa-lib"
|
||||
"at-spi2-atk"
|
||||
"bluez"
|
||||
"cairo"
|
||||
"celt"
|
||||
"colord"
|
||||
"cryptsetup"
|
||||
"cups"
|
||||
"dav1d"
|
||||
"dbus"
|
||||
"dbus-broker"
|
||||
"dconf"
|
||||
"fdk-aac"
|
||||
"ffmpeg"
|
||||
"ffmpeg-headless"
|
||||
"firefox-unwrapped"
|
||||
"flac"
|
||||
"flite"
|
||||
"fontconfig"
|
||||
"freetype"
|
||||
"fribidi"
|
||||
"fprintd"
|
||||
"fwupd"
|
||||
"gdk-pixbuf"
|
||||
"geoclue2"
|
||||
"ghostscript"
|
||||
"giflib"
|
||||
"gjs"
|
||||
"glib"
|
||||
"glslang"
|
||||
"gtk2"
|
||||
"gtk3"
|
||||
"gtk4"
|
||||
"gtkmm"
|
||||
"gumbo"
|
||||
"haproxy"
|
||||
"harfbuzz"
|
||||
"imlib2"
|
||||
"inkscape"
|
||||
"iwd"
|
||||
"jasper"
|
||||
"jbig2dec"
|
||||
"kitty"
|
||||
"ladspa"
|
||||
"lame"
|
||||
"lcms2"
|
||||
"libaom"
|
||||
"libass"
|
||||
"libblockdev"
|
||||
"libde256"
|
||||
"libdrm"
|
||||
"libepoxy"
|
||||
"libevdev"
|
||||
"libevent"
|
||||
"libexif"
|
||||
"libglvnd"
|
||||
"libheif"
|
||||
"libinput"
|
||||
"libjpeg"
|
||||
"libmng"
|
||||
"libmpeg2"
|
||||
"libogg"
|
||||
"libopus"
|
||||
"libnotify"
|
||||
"libpng"
|
||||
"libpng-apng"
|
||||
"libpulseaudio"
|
||||
"librsvg"
|
||||
"libsndfile"
|
||||
"libtheora"
|
||||
"libtiff"
|
||||
"libusb"
|
||||
"libva"
|
||||
"libva-minimal"
|
||||
"libvorbis"
|
||||
"libvpx"
|
||||
"libxkbcommon"
|
||||
"libwebp"
|
||||
"mesa"
|
||||
"mimalloc"
|
||||
"mpv"
|
||||
"nix"
|
||||
"nsncd"
|
||||
"openh264"
|
||||
"openjpeg"
|
||||
"openssh"
|
||||
"pango"
|
||||
"pcre"
|
||||
"pipewire"
|
||||
"pixman"
|
||||
"polkit"
|
||||
"poppler"
|
||||
"qemu-user"
|
||||
"rtkit"
|
||||
"sbc"
|
||||
"sioyek"
|
||||
"speex"
|
||||
"spdlog"
|
||||
"svt-av1"
|
||||
"swaylock"
|
||||
"swaylock-effects"
|
||||
"systemd"
|
||||
"thunderbird-unwrapped"
|
||||
"udisks"
|
||||
"v4l-utils"
|
||||
"vulkan-headers"
|
||||
"vulkan-loader"
|
||||
"waybar"
|
||||
"wayland"
|
||||
"wayland-protocols"
|
||||
"wayland-scanner"
|
||||
"wireplumber"
|
||||
"wlroots"
|
||||
"woff2"
|
||||
"x264"
|
||||
"x265"
|
||||
"xvidcore"
|
||||
] (pkg: override prev.${pkg})
|
||||
|
|
@ -4,6 +4,7 @@ let
|
|||
inherit (nixpkgs) lib;
|
||||
in {
|
||||
mimalloc = (prev.mimalloc.overrideAttrs (prevAttrs: {
|
||||
overrideAlloc = false;
|
||||
postPatch = prevAttrs.postPatch or "" + ''
|
||||
sed -E -i \
|
||||
-e 's/(\{ )1(, UNINIT, MI_OPTION_LEGACY\(purge_decommits,reset_decommits\) \})/\10\2/' \
|
||||
|
@ -33,10 +34,6 @@ in {
|
|||
|
||||
fractal = prev.fractal.overrideAttrs (prevAttrs: {
|
||||
nativeBuildInputs = prevAttrs.nativeBuildInputs or [ ] ++ [ final.makeBinaryWrapper ];
|
||||
buildInputs = prevAttrs.buildInputs or [ ] ++ [ final.mimalloc ];
|
||||
|
||||
NIX_RUSTFLAGS = lib.toList prevAttrs.NIX_RUSTFLAGS or [ ] ++ [ "-C" "link-arg=-lmimalloc" ];
|
||||
|
||||
postInstall = prevAttrs.postInstall or "" + ''
|
||||
wrapProgram "$out/bin/fractal" \
|
||||
--set MIMALLOC_RESERVE_HUGE_OS_PAGES 1
|
||||
|
@ -47,47 +44,8 @@ in {
|
|||
mpv = final.mpv-unwrapped;
|
||||
extraMakeWrapperArgs = [ "--set" "MIMALLOC_RESERVE_HUGE_OS_PAGES" "1" ];
|
||||
};
|
||||
} // lib.genAttrs [
|
||||
"bat"
|
||||
"bottom"
|
||||
"cryptsetup"
|
||||
"dbus-broker"
|
||||
"erlang"
|
||||
"fd"
|
||||
"firefox-unwrapped"
|
||||
"fuzzel"
|
||||
"helix"
|
||||
"kitty"
|
||||
"mako"
|
||||
"mpv-unwrapped"
|
||||
"niri"
|
||||
"nix"
|
||||
"nushell"
|
||||
"openssh"
|
||||
"pipewire"
|
||||
"pueue"
|
||||
"ripgrep"
|
||||
"sd"
|
||||
"sioyek"
|
||||
"sudo-rs"
|
||||
"systemd"
|
||||
"swayidle"
|
||||
"swaylock"
|
||||
"swaylock-effects"
|
||||
"thunderbird-unwrapped"
|
||||
"uutils-coreutils"
|
||||
"uutils-coreutils-noprefix"
|
||||
"waybar"
|
||||
"wirepluber"
|
||||
"xdg-desktop-portal-gnome"
|
||||
"xdg-desktop-portal-gtk"
|
||||
] (pkg: prev.${pkg}.overrideAttrs (prevAttrs: {
|
||||
buildInputs = prevAttrs.buildInputs or [ ] ++ [ final.mimalloc ];
|
||||
env = prevAttrs.env or { } // lib.optionalAttrs (prevAttrs ? env.NIX_LDFLAGS) {
|
||||
NIX_LDFLAGS = toString (lib.toList prevAttrs.env.NIX_LDFLAGS or [ ] ++ [ "-lmimalloc" ]);
|
||||
};
|
||||
|
||||
NIX_RUSTFLAGS = lib.toList prevAttrs.NIX_RUSTFLAGS or [ ] ++ [ "-C" "link-arg=-lmimalloc" ];
|
||||
} // lib.optionalAttrs (!prevAttrs ? env.NIX_LDFLAGS) {
|
||||
NIX_LDFLAGS = lib.toList prevAttrs.NIX_LDFLAGS or [ ] ++ [ "-lmimalloc" ];
|
||||
}))
|
||||
perl = prev.perl.overrideAttrs {
|
||||
overrideAlloc = false;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue