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