diff --git a/flake.nix b/flake.nix index d35a329..3509be3 100644 --- a/flake.nix +++ b/flake.nix @@ -39,19 +39,6 @@ url = "https://github.com/bjorn3/rustc_codegen_cranelift/releases/download/dev/cg_clif-x86_64-unknown-linux-gnu.tar.xz"; flake = false; }; - # # dependencies - # rust_regex ={ - # url = "git+https://github.com/rust-lang/regex.git"; - # flake = false; - # }; - # rust_portable_simd = { - # url = "git+https://github.com/rust-lang/portable-simd.git"; - # flake = false; - # }; - # rust_rand = { - # url = "git+https://github.com/rust-random/rand.git"; - # flake = false; - # }; }; outputs = { @@ -62,129 +49,11 @@ rust-overlay, rustc_cranelift_backend, rustc_cranelift_backend_src, - # rust_regex, - # rust_portable_simd, - # rust_rand, ... }: flake-utils.lib.eachDefaultSystem (system: let - rcb_deps = let - c_rust = pkgs.rust-bin.fromRustupToolchainFile "${rustc_cranelift_backend}/rust-toolchain"; - in - pkgs.stdenv.mkDerivation { - pname = "rustc_cranelift_backend_dependencies"; - version = "1.0"; - nativeBuildInputs = with pkgs; [git curl cacert c_rust]; - src = "${rustc_cranelift_backend}"; - # old implementation {{{ - #"${rust_regex}" "${rust_portable_simd}" "${rust_rand}" - #]; - #sourceRoot = "source"; - # preUnpack = '' - # #set -x; - # unpackCmdHooks=(_defaultUnpack); - # checkForHashToName() { - # case "$1" in - # "regex") - # echo source/download/regex - # ;; - # "portable-simd") - # echo source/download/portable-simd - # ;; - # "rand") - # echo source/download/rand - # ;; - # "rustc_codegen_cranelift") - # echo source - # ;; - # *) - # echo "Warning: Unable to turn hash ($1) to name!" 1>&2 - # echo "Using another method" 1>&2 - # echo null; - # ;; - # esac - # } - # fail() { - # echo "$@"; - # exit 1; - # } - # _defaultUnpack(){ - # local fn="$1" - # local destination - # local finalDestination - # - # # extrem hacky solution to turn the nix hash path to useful names: - # destination="$(sed -n '2p' "$fn/Cargo.toml" | sed 's|name = "||' | sed 's|"||')" - # - # finalDestination="$(checkForHashToName "$destination")" - # if [ "$finalDestination" = "null" ]; then - # if grep "Portable SIMD" "$fn"/README.md > /dev/null 2>&1; then - # destination="portable-simd"; - # else - # echo "Can not grep readme directly" - # fi - # fi - # - # finalDestination="$(checkForHashToName "$destination")" - # if [ "$finalDestination" = "null" ]; then - # fail "No idea how to turn your hash to a name, sorry!"; - # fi - # - # echo "Final destination is '$finalDestination'" - # destination="$finalDestination" - # echo "Copying '$fn' to '$destination'" - # - # mkdir --parents "$destination"; - # # We can't preserve hardlinks because they may have been - # # introduced by store optimization, which might break things - # # in the build. - # cp -pr --reflink=auto -- "$fn"/. "$destination" - # chmod -R u+w "$destination" - # } - # ''; - # }}} - buildPhase = '' - bash ./y.sh prepare - ''; - installPhase = '' - install -d $out/ - cp -r ./. $out/ - ''; - fixupPhase = '' - set -x - ''; # skip it - CARGO = "${c_rust}/bin/cargo"; - RUSTC = "${c_rust}/bin/rustc"; - RUSTDOC = "${c_rust}/bin/rustdoc"; - CARGO_HOME = "/build/cargo"; - - outputHashAlgo = "sha512"; - outputHashMode = "recursive"; - outputHash = "sha512-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="; - }; - rcb = let - c_rust = pkgs.rust-bin.fromRustupToolchainFile "${rustc_cranelift_backend}/rust-toolchain"; - in - pkgs.stdenv.mkDerivation { - pname = "rustc_cranelift_backend"; - version = "1.0"; - nativeBuildInputs = [c_rust]; - src = "${rcb_deps}"; - buildPhase = '' - bash ./y.sh build - ''; - installPhase = '' - install -d $out/ - cp -r ./dist/. $out/ - ''; - CARGO = "${c_rust}/bin/cargo"; - RUSTC = "${c_rust}/bin/rustc"; - RUSTDOC = "${c_rust}/bin/rustdoc"; - CARGO_HOME = "/build/cargo"; - }; c_rust = pkgs.rust-bin.fromRustupToolchainFile "${rustc_cranelift_backend}/rust-toolchain"; - rcb_better = pkgs.stdenv.mkDerivation { + rcb = pkgs.stdenv.mkDerivation { pname = "rustc_cranelift_backend"; version = "1.0"; buildInputs = [c_rust]; @@ -278,8 +147,7 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="; nativeBuildInputs = with pkgs; [ pkg-config mold - rcb_better - #self.packages."${system}".cranelift-deps + rcb ]; buildInputs = with pkgs; [ openssl @@ -294,8 +162,6 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=="; in { packages = { default = craneBuild; - cranelift = rcb_better; - cranelift-deps = c_rust; }; app.default = {