flake: syntax fixup, hash update (nix develop works)

pull/85/head
mwojcik 2022-01-26 15:37:59 +08:00
parent d6e3167e44
commit 8a84d0bbf0
2 changed files with 157 additions and 120 deletions

44
flake.lock Normal file
View File

@ -0,0 +1,44 @@
{
"nodes": {
"mozilla-overlay": {
"flake": false,
"locked": {
"lastModified": 1638887313,
"narHash": "sha256-FMYV6rVtvSIfthgC1sK1xugh3y7muoQcvduMdriz4ag=",
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "7c1e8b1dd6ed0043fb4ee0b12b815256b0b9de6f",
"type": "github"
},
"original": {
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1642961095,
"narHash": "sha256-RLatktZmvwFBOyqdoIk4qdS4OGKB7aKIvvs4ZP2L8D8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "604c44137d97b5111be1ca5c0d97f6e24fbc5c2c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"mozilla-overlay": "mozilla-overlay",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

View File

@ -9,10 +9,9 @@
pkgs = import nixpkgs { system = "x86_64-linux"; overlays = [ (import mozilla-overlay) ]; };
# ==== rustPlatform
let
rustManifest = pkgs.fetchurl {
url = "https://static.rust-lang.org/dist/2021-01-29/channel-rust-nightly.toml";
sha256 = "sha256-T0D0ypXA+nuH7o3AHCokzSBZAvQxvef4x9+XxO3aBao=";
sha256 = "sha256-EZKgw89AH4vxaJpUHmIMzMW/80wAFQlfcxRoBD9nz0c=";
};
targets = [];
rustChannelOfTargets = _channel: _date: targets:
@ -23,14 +22,11 @@
extensions = ["rust-src"];
};
rust = rustChannelOfTargets "nightly" null targets;
in
rustPlatform = pkgs.recurseIntoAttrs (pkgs.makeRustPlatform {
rustc = rust;
cargo = rust;
});
# ==== rustPlatform / gnutoolchain
gnutoolchain = {
let
gnu-platform = "arm-none-eabi";
binutils-pkg = { extraConfigureFlags ? [] }: pkgs.stdenv.mkDerivation rec {
@ -77,14 +73,13 @@
url = "https://ftp.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.tar.xz";
sha256 = "1817nc2bqdc251k0lpc51cimna7v68xjrnvqzvc50q3ax4s6i9kr";
};
preConfigure =
''
preConfigure = ''
mkdir build
cd build
'';
configureScript = "../configure";
configureFlags =
[ "--target=${gnu-platform}"
configureFlags = [
"--target=${gnu-platform}"
"--with-arch=armv7-a"
"--with-tune=cortex-a9"
"--with-fpu=vfpv3"
@ -95,7 +90,7 @@
"--with-ld=${platform-binutils}/bin/${gnu-platform}-ld" ] ++ extraConfigureFlags;
outputs = [ "out" "info" "man" ];
hardeningDisable = [ "format" "pie" ];
propagatedBuildInputs = with pkgs.libs [ gmp mpfr libmpc platform-binutils ];
propagatedBuildInputs = with pkgs.libs; [ gmp mpfr libmpc platform-binutils ];
enableParallelBuilding = true;
dontFixup = true;
};
@ -126,7 +121,7 @@
];
dontFixup = true;
};
in rec {
gnutoolchain = rec {
binutils-bootstrap = pkgs.callPackage binutils-pkg { };
gcc-bootstrap = pkgs.callPackage gcc-pkg {
platform-binutils = binutils-bootstrap;
@ -143,8 +138,7 @@
platform-binutils = binutils;
extraConfigureFlags = [ "--enable-newlib" "--with-headers=${newlib}/arm-none-eabi/include" ];
};
}
}
};
# ==== gnutoolchain/cargo-xbuild
cargo-xbuild = rustPlatform.buildRustPackage rec {
pname = "cargo-xbuild";
@ -156,16 +150,15 @@
rev = "v${version}";
sha256 = "18djvygq9v8rmfchvi2hfj0i6fhn36m716vqndqnj56fiqviwxvf";
};
cargoLock = {
lockFile = [ ./Cargo.lock ]
}
cargoSha256 = "13sj9j9kl6js75h9xq0yidxy63vixxm9q3f8jil6ymarml5wkhx8";
meta = with pkgs.lib; {
description = "Automatically cross-compiles the sysroot crates core, compiler_builtins, and alloc";
homepage = "https://github.com/rust-osdev/cargo-xbuild";
license = with licenses; [ mit asl20 ];
maintainers = with maintainers; [ johntitor xrelkd ];
};
}
};
# ==== cargo-xbuild/mkbootimage
mkbootimage = pkgs.stdenv.mkDerivation {
pname = "mkbootimage";
@ -188,7 +181,7 @@
mkdir -p $out/bin
cp mkbootimage $out/bin
'';
}
};
# ==== mkbootimage/fsbl
fsbl = { board ? "zc706" }: pkgs.stdenv.mkDerivation {
name = "${board}-fsbl";
@ -219,7 +212,7 @@
'';
doCheck = false;
dontFixup = true;
}
};
# ==== fsbl/
in {
packages.x86_64-linux = {
@ -241,8 +234,8 @@
openocd gdb
openssh rsync
llvmPackages_9.clang-unwrapped
mkbootimage
mkbootimage ];
};
defaultPackage.x86_64-linux = zynq-rs;
defaultPackage.x86_64-linux = fsbl { board = "zc706"; };
};
}