nix: reuse build derivation from nixpkgs
diff --git a/flake.lock b/flake.lock
index 451ac988..96eba900 100644
--- a/flake.lock
+++ b/flake.lock
@@ -22,11 +22,11 @@
},
"nixpkgs": {
"locked": {
- "lastModified": 1711668574,
- "narHash": "sha256-u1dfs0ASQIEr1icTVrsKwg2xToIpn7ZXxW3RHfHxshg=",
+ "lastModified": 1712310679,
+ "narHash": "sha256-XgC/a/giEeNkhme/AV1ToipoZ/IVm1MV2ntiK4Tm+pw=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "219951b495fc2eac67b1456824cc1ec1fd2ee659",
+ "rev": "72da83d9515b43550436891f538ff41d68eecc7f",
"type": "github"
},
"original": {
@@ -38,11 +38,11 @@
},
"nixpkgs-unstable": {
"locked": {
- "lastModified": 1712090461,
- "narHash": "sha256-PAfFp+YEKpkzwz6ruXQMvTa1puO4ySSu2G4Sp/jkCc8=",
+ "lastModified": 1712388808,
+ "narHash": "sha256-9ogU4c3vUmuMDoRlbQCeq3OKx0XJmgHcLZ4XywJNYWI=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "e976fa8f49c35cf28496301a1ef2aa23ad576b56",
+ "rev": "fe4295b9ecd88764c1abf6179e03b1a828ca0e9a",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index d9b6f820..49fb3853 100644
--- a/flake.nix
+++ b/flake.nix
@@ -23,7 +23,11 @@
perSystem = { config, pkgs, ... }:
let
keep-directory-diff = pkgs.callPackage ./nix/keep-directory-diff.nix { };
- limine = pkgs.callPackage ./nix/build.nix { inherit keep-directory-diff; };
+ limine = pkgs.callPackage ./nix/build.nix {
+ inherit keep-directory-diff;
+ # TODO: Remove once 24.05 (which has pkgs.limine) is released.
+ limine = nixpkgs-unstable.legacyPackages.${pkgs.system}.limine;
+ };
in
{
devShells = {
diff --git a/nix/build.nix b/nix/build.nix
index a159e96e..ae56e5c9 100644
--- a/nix/build.nix
+++ b/nix/build.nix
@@ -13,8 +13,8 @@
{
# Helpers
fd
-, lib
, keep-directory-diff
+, limine # derivation from nixpkgs
, nix-gitignore
, stdenv
@@ -23,9 +23,6 @@
, automake
, cacert
, git
-, llvmPackages
-, mtools
-, nasm
}:
let
@@ -105,28 +102,13 @@ let
outputHashMode = "recursive";
outputHash = bootstrappedSrcHash;
};
-
- # Common build dependencies apart from the compiler toolchain.
- commonBuildDeps = [
- autoconf
- automake
-
- mtools
- nasm
- ];
in
-stdenv.mkDerivation {
+# Reuse the build-derivation from nixpkgs but with the current repo source.
+limine.overrideAttrs({
pname = "limine-dev";
version = "0.0.0";
src = bootstrappedSrc;
- nativeBuildInputs = commonBuildDeps ++ [
- # gcc is used to build the host tools and clang to (cross)compile all
- # the bootloader files
- llvmPackages.bintools
- llvmPackages.clang
- llvmPackages.lld
- ];
- enableParallelBuilding = true;
+ nativeBuildInputs = [ autoconf automake ] ++ limine.nativeBuildInputs;
preConfigure = ''
# The default input source of this derivation is what we aggregated
# from `./bootstrap`. As this derivation holds all files but we are only
@@ -146,6 +128,4 @@ stdenv.mkDerivation {
# TODO, we could also do this in ./bootstrap but add a special flag.
autoreconf -fvi -Wall
'';
- configureFlags = [ "--enable-all" ];
- outputs = [ "out" "doc" "dev" "man" ];
-}
+})
