Compare commits

...

6 commits

Author SHA1 Message Date
Mikael Voss 51c93e0cc3
Selectively build packages with LLVM 2024-10-13 20:57:58 +02:00
Mikael Voss 9d78035368
Override stdenv to link against mimalloc 2024-10-13 20:57:56 +02:00
Mikael Voss 5ff4e1b1b8
Separate architecture‐specific fixes 2024-10-13 20:45:31 +02:00
Mikael Voss dbf2bd18a7
umockdev: Disable checks on RISC-V 2024-10-13 20:08:49 +02:00
Mikael Voss 6318693191
elfutils: Disable install checks on RISC-V 2024-10-13 20:08:41 +02:00
Mikael Voss 05fa716ed5
flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/2b13611eaed8326789f76f70d21d06fbb14e3e47' (2024-10-11)
  → 'github:nix-community/home-manager/64c6325b28ebd708653dd41d88f306023f296184' (2024-10-13)
• Updated input 'lanzaboote':
    'github:nix-community/lanzaboote/3326a0b3974fc04d991990f6497fe1a7d9892439' (2024-10-11)
  → 'github:nix-community/lanzaboote/6634ab618862f1d041c286567a58c554e6136068' (2024-10-13)
• Updated input 'niri':
    'github:sodiboo/niri-flake/071151385afd024ce943205a59c6fadc6a9187ee' (2024-10-12)
  → 'github:sodiboo/niri-flake/0a50b261ac5b6cdcc8eb7921a4f022c92b29d1ab' (2024-10-13)
• Updated input 'niri/niri-unstable':
    'github:YaLTeR/niri/859c0be0e5fa5ccf3c59f0ae1764551a930656fd' (2024-10-10)
  → 'github:YaLTeR/niri/d7156df8428cb9e6665a212e66c74bdb25842be8' (2024-10-13)
• Updated input 'niri/nixpkgs-stable':
    'github:NixOS/nixpkgs/c505ebf777526041d792a49d5f6dd4095ea391a7' (2024-10-11)
  → 'github:NixOS/nixpkgs/a3f9ad65a0bf298ed5847629a57808b97e6e8077' (2024-10-12)
• Updated input 'nixos-hardware':
    'github:NixOS/nixos-hardware/ecfcd787f373f43307d764762e139a7cdeb9c22b' (2024-10-07)
  → 'github:NixOS/nixos-hardware/a8dd1b21995964b115b1e3ec639dd6ce24ab9806' (2024-10-12)
• Updated input 'nur':
    'github:nix-community/NUR/b1d7aba2c87bbeabc2ca0ca25f3949c6a66a3d1e' (2024-10-12)
  → 'github:nix-community/NUR/3500d4bc8ccba8c873743e7f8973af51ac1b4aab' (2024-10-13)
• Updated input 'rust-overlay':
    'github:oxalica/rust-overlay/fc1e58ebabe0cef4442eedea07556ff0c9eafcfe' (2024-10-12)
  → 'github:oxalica/rust-overlay/174a8d9cec9e2c23877a7b887c52b68ef0421d8b' (2024-10-13)
2024-10-13 20:02:35 +02:00
9 changed files with 282 additions and 106 deletions

View file

@ -310,11 +310,11 @@
]
},
"locked": {
"lastModified": 1728685293,
"narHash": "sha256-1WowL96pksT/XCi+ZXHgqiQ9NiU5oxWuNIQYWqOoEYc=",
"lastModified": 1728791962,
"narHash": "sha256-nr5QiXwQcZmf6/auC1UpX8iAtINMtdi2mH+OkqJQVmU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2b13611eaed8326789f76f70d21d06fbb14e3e47",
"rev": "64c6325b28ebd708653dd41d88f306023f296184",
"type": "github"
},
"original": {
@ -337,11 +337,11 @@
]
},
"locked": {
"lastModified": 1728632221,
"narHash": "sha256-LnBVdKPsreziZkYbeFqiSYP7tPFlprt9ej2QGd2aNlw=",
"lastModified": 1728833717,
"narHash": "sha256-GkS9SnKRb/PrdcqptLPNxweDdf3Zx2Lk5szEt07P4mE=",
"owner": "nix-community",
"repo": "lanzaboote",
"rev": "3326a0b3974fc04d991990f6497fe1a7d9892439",
"rev": "6634ab618862f1d041c286567a58c554e6136068",
"type": "github"
},
"original": {
@ -398,11 +398,11 @@
"xwayland-satellite-unstable": "xwayland-satellite-unstable"
},
"locked": {
"lastModified": 1728701596,
"narHash": "sha256-f9+AgUcbJu86nm9ud6YxrvMy9VVXcHitc4FqePjE+3M=",
"lastModified": 1728829629,
"narHash": "sha256-y3fWim/0mDCSLjvqkmylN5mmVOfvwJG9Mt+Z8qIn44U=",
"owner": "sodiboo",
"repo": "niri-flake",
"rev": "071151385afd024ce943205a59c6fadc6a9187ee",
"rev": "0a50b261ac5b6cdcc8eb7921a4f022c92b29d1ab",
"type": "github"
},
"original": {
@ -431,11 +431,11 @@
"niri-unstable": {
"flake": false,
"locked": {
"lastModified": 1728546258,
"narHash": "sha256-iE6O7EBokq/HjjwouHfd7EGmED7TUkB9icSbUfPHWSo=",
"lastModified": 1728822376,
"narHash": "sha256-HQc10OfFNie5YocsrJQCN6BOi+CZ0uuGGHGbJFXjgUI=",
"owner": "YaLTeR",
"repo": "niri",
"rev": "859c0be0e5fa5ccf3c59f0ae1764551a930656fd",
"rev": "d7156df8428cb9e6665a212e66c74bdb25842be8",
"type": "github"
},
"original": {
@ -466,11 +466,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1728269138,
"narHash": "sha256-oKxDImsOvgUZMY4NwXVyUc/c1HiU2qInX+b5BU0yXls=",
"lastModified": 1728729581,
"narHash": "sha256-oazkQ/z7r43YkDLLQdMg8oIB3CwWNb+2ZrYOxtLEWTQ=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "ecfcd787f373f43307d764762e139a7cdeb9c22b",
"rev": "a8dd1b21995964b115b1e3ec639dd6ce24ab9806",
"type": "github"
},
"original": {
@ -525,11 +525,11 @@
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1728627514,
"narHash": "sha256-r+SF9AnHrTg+bk6YszoKfV9lgyw+yaFUQe0dOjI0Z2o=",
"lastModified": 1728740863,
"narHash": "sha256-u+rxA79a0lyhG+u+oPBRtTDtzz8kvkc9a6SWSt9ekVc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c505ebf777526041d792a49d5f6dd4095ea391a7",
"rev": "a3f9ad65a0bf298ed5847629a57808b97e6e8077",
"type": "github"
},
"original": {
@ -557,11 +557,11 @@
},
"nur": {
"locked": {
"lastModified": 1728719926,
"narHash": "sha256-JLucwu9WRQB6z7043wvHyss5/wr4xVZjyJmlb550CNQ=",
"lastModified": 1728841501,
"narHash": "sha256-AXjgkcMoOgckYrSVL71+PSVybvvdNREPvhPDvNws+2M=",
"owner": "nix-community",
"repo": "NUR",
"rev": "b1d7aba2c87bbeabc2ca0ca25f3949c6a66a3d1e",
"rev": "3500d4bc8ccba8c873743e7f8973af51ac1b4aab",
"type": "github"
},
"original": {
@ -672,11 +672,11 @@
]
},
"locked": {
"lastModified": 1728700003,
"narHash": "sha256-Ox1pvEHxLK6lAdaKQW21Zvk65SPDag+cD8YA444R/og=",
"lastModified": 1728786660,
"narHash": "sha256-qY+1e0o6oV5ySlErhj/dsWsPLWjrMKzq4QI7a1t9/Ps=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "fc1e58ebabe0cef4442eedea07556ff0c9eafcfe",
"rev": "174a8d9cec9e2c23877a7b887c52b68ef0421d8b",
"type": "github"
},
"original": {

View file

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

9
overlay/aarch.nix Normal file
View file

@ -0,0 +1,9 @@
{ nixpkgs, ... }: final: prev:
let
inherit (nixpkgs) lib;
inherit (prev.stdenv) hostPlatform;
in lib.optionalAttrs hostPlatform.isAarch ({
umockdev = prev.umockdev.overrideAttrs {
doCheck = false;
};
})

View file

@ -7,7 +7,10 @@ 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
self.overlays.riscv
self.overlays.aarch
] final prev

View file

@ -1,8 +1,13 @@
{ nixpkgs, ... }: final: prev:
let
inherit (nixpkgs.lib) optionalAttrs toList;
inherit (nixpkgs) lib;
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 {
@ -12,9 +17,9 @@ in {
];
});
redis = prev.redis.overrideAttrs ({
redis = prev.redis.overrideAttrs {
doCheck = false;
});
};
python312 = prev.python312.override {
packageOverrides = final: prev: {
@ -22,13 +27,6 @@ in {
doCheck = false;
doInstallCheck = false;
});
} // optionalAttrs hostPlatform.isRiscV64 {
psutil = prev.psutil.overrideAttrs (prevAttrs: {
disabledTests = prevAttrs.disabledTests or [ ] ++ [
"net_if_addrs"
"net_if_stats"
];
});
};
};
@ -45,27 +43,4 @@ in {
--replace-fail 'CACHELINE_SIZE EQUAL "undefined"' 'CACHELINE_SIZE STREQUAL "undefined"'
'';
});
} // optionalAttrs hostPlatform.isRiscV64 ({
boehmgc = prev.boehmgc.overrideAttrs (prevAttrs: {
postPatch = prevAttrs.postPatch or "" + ''
sed -E -i '/^TESTS \+= gctest/d' \
tests/tests.am
'';
});
elfutils = prev.elfutils.overrideAttrs ({
doCheck = false;
});
libseccomp = prev.libseccomp.overrideAttrs ({
doCheck = false;
});
libuv = prev.libuv.overrideAttrs ({
doCheck = false;
});
xdg-utils = prev.xdg-utils.override {
procmail = final.emptyDirectory;
};
})
}

142
overlay/llvm.nix Normal file
View 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})

View file

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

44
overlay/riscv.nix Normal file
View file

@ -0,0 +1,44 @@
{ nixpkgs, ... }: final: prev:
let
inherit (nixpkgs) lib;
inherit (prev.stdenv) hostPlatform;
in lib.optionalAttrs hostPlatform.isRiscV ({
python312 = prev.python312.override {
packageOverrides = final: prev: {
psutil = prev.psutil.overrideAttrs (prevAttrs: {
disabledTests = prevAttrs.disabledTests or [ ] ++ [
"net_if_addrs"
"net_if_stats"
];
});
};
};
boehmgc = prev.boehmgc.overrideAttrs (prevAttrs: {
postPatch = prevAttrs.postPatch or "" + ''
sed -E -i '/^TESTS \+= gctest/d' \
tests/tests.am
'';
});
elfutils = prev.elfutils.overrideAttrs {
doCheck = false;
doInstallCheck = false;
};
libseccomp = prev.libseccomp.overrideAttrs {
doCheck = false;
};
libuv = prev.libuv.overrideAttrs {
doCheck = false;
};
umockdev = prev.umockdev.overrideAttrs {
doCheck = false;
};
xdg-utils = prev.xdg-utils.override {
procmail = final.emptyDirectory;
};
})