diff --git a/flake.nix b/flake.nix index aab009d..bc3fa0a 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,6 @@ let pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import mozilla-overlay) ]; }; - # ==== rustPlatform rustManifest = pkgs.fetchurl { url = "https://static.rust-lang.org/dist/2021-01-29/channel-rust-nightly.toml"; sha256 = "sha256-EZKgw89AH4vxaJpUHmIMzMW/80wAFQlfcxRoBD9nz0c="; @@ -26,120 +25,120 @@ rustc = rust; cargo = rust; }); - # ==== rustPlatform / gnutoolchain - gnu-platform = "arm-none-eabi"; - binutils-pkg = { zlib, extraConfigureFlags ? [] }: pkgs.stdenv.mkDerivation rec { - basename = "binutils"; - version = "2.30"; - name = "${basename}-${gnu-platform}-${version}"; - src = pkgs.fetchurl { - url = "https://ftp.gnu.org/gnu/binutils/binutils-${version}.tar.bz2"; - sha256 = "028cklfqaab24glva1ks2aqa1zxa6w6xmc8q34zs1sb7h22dxspg"; - }; - configureFlags = [ - "--enable-deterministic-archives" - "--target=${gnu-platform}" - "--with-cpu=cortex-a9" - "--with-fpu=vfpv3" - "--with-float=hard" - "--with-mode=thumb" - ] ++ extraConfigureFlags; - outputs = [ "out" "info" "man" ]; - depsBuildBuild = [ pkgs.buildPackages.stdenv.cc ]; - buildInputs = [ zlib ]; - enableParallelBuilding = true; - meta = { - description = "Tools for manipulating binaries (linker, assembler, etc.)"; - longDescription = '' - The GNU Binutils are a collection of binary tools. The main - ones are `ld' (the GNU linker) and `as' (the GNU assembler). - They also include the BFD (Binary File Descriptor) library, - `gprof', `nm', `strip', etc. - ''; - homepage = http://www.gnu.org/software/binutils/; - license = pkgs.lib.licenses.gpl3Plus; - /* Give binutils a lower priority than gcc-wrapper to prevent a - collision due to the ld/as wrappers/symlinks in the latter. */ - priority = "10"; - }; + gnu-platform = "arm-none-eabi"; + + binutils-pkg = { zlib, extraConfigureFlags ? [] }: pkgs.stdenv.mkDerivation rec { + basename = "binutils"; + version = "2.30"; + name = "${basename}-${gnu-platform}-${version}"; + src = pkgs.fetchurl { + url = "https://ftp.gnu.org/gnu/binutils/binutils-${version}.tar.bz2"; + sha256 = "028cklfqaab24glva1ks2aqa1zxa6w6xmc8q34zs1sb7h22dxspg"; }; - - gcc-pkg = { gmp, mpfr, libmpc, platform-binutils, extraConfigureFlags ? [] }: pkgs.stdenv.mkDerivation rec { - basename = "gcc"; - version = "9.1.0"; - name = "${basename}-${gnu-platform}-${version}"; - src = pkgs.fetchurl { - url = "https://ftp.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.tar.xz"; - sha256 = "1817nc2bqdc251k0lpc51cimna7v68xjrnvqzvc50q3ax4s6i9kr"; - }; - preConfigure = '' - mkdir build - cd build + configureFlags = [ + "--enable-deterministic-archives" + "--target=${gnu-platform}" + "--with-cpu=cortex-a9" + "--with-fpu=vfpv3" + "--with-float=hard" + "--with-mode=thumb" + ] ++ extraConfigureFlags; + outputs = [ "out" "info" "man" ]; + depsBuildBuild = [ pkgs.buildPackages.stdenv.cc ]; + buildInputs = [ zlib ]; + enableParallelBuilding = true; + meta = { + description = "Tools for manipulating binaries (linker, assembler, etc.)"; + longDescription = '' + The GNU Binutils are a collection of binary tools. The main + ones are `ld' (the GNU linker) and `as' (the GNU assembler). + They also include the BFD (Binary File Descriptor) library, + `gprof', `nm', `strip', etc. ''; - configureScript = "../configure"; - configureFlags = [ - "--target=${gnu-platform}" - "--with-arch=armv7-a" - "--with-tune=cortex-a9" - "--with-fpu=vfpv3" - "--with-float=hard" - "--disable-libssp" - "--enable-languages=c" - "--with-as=${platform-binutils}/bin/${gnu-platform}-as" - "--with-ld=${platform-binutils}/bin/${gnu-platform}-ld" ] ++ extraConfigureFlags; - outputs = [ "out" "info" "man" ]; - hardeningDisable = [ "format" "pie" ]; - propagatedBuildInputs = [ gmp mpfr libmpc platform-binutils ]; - enableParallelBuilding = true; - dontFixup = true; + homepage = http://www.gnu.org/software/binutils/; + license = pkgs.lib.licenses.gpl3Plus; + /* Give binutils a lower priority than gcc-wrapper to prevent a + collision due to the ld/as wrappers/symlinks in the latter. */ + priority = "10"; }; + }; - newlib-pkg = { platform-binutils, platform-gcc }: pkgs.stdenv.mkDerivation rec { - pname = "newlib"; - version = "3.1.0"; - src = pkgs.fetchurl { - url = "ftp://sourceware.org/pub/newlib/newlib-${version}.tar.gz"; - sha256 = "0ahh3n079zjp7d9wynggwrnrs27440aac04340chf1p9476a2kzv"; - }; - nativeBuildInputs = [ platform-binutils platform-gcc ]; - configureFlags = [ - "--target=${gnu-platform}" - - "--with-cpu=cortex-a9" - "--with-fpu=vfpv3" - "--with-float=hard" - "--with-mode=thumb" - "--enable-interwork" - "--disable-multilib" - - "--disable-newlib-supplied-syscalls" - "--with-gnu-ld" - "--with-gnu-as" - "--disable-newlib-io-float" - "--disable-werror" - ]; - dontFixup = true; + gcc-pkg = { gmp, mpfr, libmpc, platform-binutils, extraConfigureFlags ? [] }: pkgs.stdenv.mkDerivation rec { + basename = "gcc"; + version = "9.1.0"; + name = "${basename}-${gnu-platform}-${version}"; + src = pkgs.fetchurl { + url = "https://ftp.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.tar.xz"; + sha256 = "1817nc2bqdc251k0lpc51cimna7v68xjrnvqzvc50q3ax4s6i9kr"; }; - gnutoolchain = rec { - binutils-bootstrap = pkgs.callPackage binutils-pkg { }; - gcc-bootstrap = pkgs.callPackage gcc-pkg { - platform-binutils = binutils-bootstrap; - extraConfigureFlags = [ "--disable-libgcc" ]; - }; - newlib = pkgs.callPackage newlib-pkg { - platform-binutils = binutils-bootstrap; - platform-gcc = gcc-bootstrap; - }; - binutils = pkgs.callPackage binutils-pkg { - extraConfigureFlags = [ "--with-lib-path=${newlib}/arm-none-eabi/lib" ]; - }; - gcc = pkgs.callPackage gcc-pkg { - platform-binutils = binutils; - extraConfigureFlags = [ "--enable-newlib" "--with-headers=${newlib}/arm-none-eabi/include" ]; - }; + preConfigure = '' + mkdir build + cd build + ''; + configureScript = "../configure"; + configureFlags = [ + "--target=${gnu-platform}" + "--with-arch=armv7-a" + "--with-tune=cortex-a9" + "--with-fpu=vfpv3" + "--with-float=hard" + "--disable-libssp" + "--enable-languages=c" + "--with-as=${platform-binutils}/bin/${gnu-platform}-as" + "--with-ld=${platform-binutils}/bin/${gnu-platform}-ld" ] ++ extraConfigureFlags; + outputs = [ "out" "info" "man" ]; + hardeningDisable = [ "format" "pie" ]; + propagatedBuildInputs = [ gmp mpfr libmpc platform-binutils ]; + enableParallelBuilding = true; + dontFixup = true; + }; + + newlib-pkg = { platform-binutils, platform-gcc }: pkgs.stdenv.mkDerivation rec { + pname = "newlib"; + version = "3.1.0"; + src = pkgs.fetchurl { + url = "ftp://sourceware.org/pub/newlib/newlib-${version}.tar.gz"; + sha256 = "0ahh3n079zjp7d9wynggwrnrs27440aac04340chf1p9476a2kzv"; }; - # ==== gnutoolchain/cargo-xbuild + nativeBuildInputs = [ platform-binutils platform-gcc ]; + configureFlags = [ + "--target=${gnu-platform}" + + "--with-cpu=cortex-a9" + "--with-fpu=vfpv3" + "--with-float=hard" + "--with-mode=thumb" + "--enable-interwork" + "--disable-multilib" + + "--disable-newlib-supplied-syscalls" + "--with-gnu-ld" + "--with-gnu-as" + "--disable-newlib-io-float" + "--disable-werror" + ]; + dontFixup = true; + }; + gnutoolchain = rec { + binutils-bootstrap = pkgs.callPackage binutils-pkg { }; + gcc-bootstrap = pkgs.callPackage gcc-pkg { + platform-binutils = binutils-bootstrap; + extraConfigureFlags = [ "--disable-libgcc" ]; + }; + newlib = pkgs.callPackage newlib-pkg { + platform-binutils = binutils-bootstrap; + platform-gcc = gcc-bootstrap; + }; + binutils = pkgs.callPackage binutils-pkg { + extraConfigureFlags = [ "--with-lib-path=${newlib}/arm-none-eabi/lib" ]; + }; + gcc = pkgs.callPackage gcc-pkg { + platform-binutils = binutils; + extraConfigureFlags = [ "--enable-newlib" "--with-headers=${newlib}/arm-none-eabi/include" ]; + }; + }; + cargo-xbuild = rustPlatform.buildRustPackage rec { pname = "cargo-xbuild"; version = "0.6.5"; @@ -159,7 +158,7 @@ maintainers = with maintainers; [ johntitor xrelkd ]; }; }; - # ==== cargo-xbuild/mkbootimage + mkbootimage = pkgs.stdenv.mkDerivation { pname = "mkbootimage"; version = "2.2"; @@ -182,7 +181,7 @@ cp mkbootimage $out/bin ''; }; - # ==== mkbootimage/fsbl + fsbl = { board ? "zc706" }: pkgs.stdenv.mkDerivation { name = "${board}-fsbl"; src = pkgs.fetchFromGitHub { @@ -213,7 +212,7 @@ doCheck = false; dontFixup = true; }; - # ==== fsbl/default + cargoSha256Experiments = "1bvffgr4588bbkjwnhim8rvkjvbnajaiv7hc98b19sr8kb7rcj63"; cargoSha256SZL = "13022ssk6s2fgxmmh5msbx01fzcmk2cj95fjpxcsmfy14k9wd77l";