|
9 | 9 | pkgs = import nixpkgs {
|
10 | 10 | inherit system;
|
11 | 11 | };
|
12 |
| - msys2-env = pkgs.stdenvNoCC.mkDerivation rec { |
13 |
| - name = "msys2-env"; |
| 12 | + msys2-image = pkgs.stdenvNoCC.mkDerivation rec { |
| 13 | + name = "msys2-image"; |
14 | 14 | srcs = import ./msys2_packages.nix { inherit pkgs; };
|
15 |
| - buildInputs = [ pkgs.gnutar pkgs.zstd pkgs.p7zip ]; |
| 15 | + base_srcs = import ./msys2_base_packages.nix { inherit pkgs; }; |
| 16 | + mirrors = pkgs.fetchurl { |
| 17 | + url = "https://mirror.msys2.org/msys/x86_64/pacman-mirrors-20240210-1-any.pkg.tar.zst"; |
| 18 | + name = "pacman-mirrors"; |
| 19 | + sha256 = "0sjj38fkiaixv2vkmivb0l9isv3fbvpq44ml0wyc7jq59k75pp2s"; |
| 20 | + }; |
| 21 | + |
| 22 | + ca_certs = pkgs.fetchurl { |
| 23 | + url = "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-ca-certificates-20240203-1-any.pkg.tar.zst"; |
| 24 | + name = "mingw-w64-x86_64-ca-certificates"; |
| 25 | + sha256 = "092wq5mainz3insakm9lacqa348p3ya6xnf2c3s65x7c6hw0702v"; |
| 26 | + }; |
| 27 | + src = ./.; |
| 28 | + buildInputs = [ pkgs.gnutar pkgs.zstd pkgs.pacman pkgs.fakeroot ]; |
16 | 29 | phases = [ "installPhase" ];
|
17 |
| - installPhase = (pkgs.lib.strings.concatStringsSep "\n" (["mkdir $out"] ++ (map (p: "tar xvf ${p} -C $out") srcs) ++ |
18 |
| - ["printf \"\n[artiq]\nSigLevel = Optional TrustAll\nServer = https://msys2.m-labs.hk/artiq-beta\n\" >> $out/etc/pacman.conf"])); |
| 30 | + |
| 31 | + installPhase = '' |
| 32 | + ls -al $src |
| 33 | + mkdir -p $out/tmp |
| 34 | + mkdir -p $out/tmp/etc $out/tmp/var/lib/pacman $out/tmp/msys/etc |
| 35 | +
|
| 36 | + cp $src/pacman.conf . |
| 37 | + #cp pacman.conf tmp/etc/pacman.conf |
| 38 | + ls -al . |
| 39 | + ls -al $out/tmp/etc/ |
| 40 | + tar xvf ${mirrors} -C $out/tmp |
| 41 | + tar xvf ${ca_certs} -C $out/tmp |
| 42 | + ${pkgs.lib.strings.concatStringsSep "\n" (map (p: "tar xvf ${p} -C $out/tmp") base_srcs)} |
| 43 | + ${pkgs.lib.strings.concatStringsSep "\n" (map (p: "tar xvf ${p} -C $out/tmp") srcs)} |
| 44 | + tar xvf ${ca_certs} -C $out/tmp |
| 45 | + cat pacman.conf | sed -e "s|/etc/pacman.d|$out/tmp/etc/pacman.d|g" -e "s|SigLevel = Required|SigLevel = Never|g" > $out/tmp/etc/pacman.conf |
| 46 | + #fakeroot pacman --root $out/tmp --config $out/tmp/etc/pacman.conf -Syy |
| 47 | +
|
| 48 | + mkdir -p $out/var/lib/pacman $out/msys/etc |
| 49 | + tar xvf ${mirrors} -C $out |
| 50 | + cp $src/pacman.conf $out/etc/pacman.conf |
| 51 | + #fakeroot pacman --root $out --config $out/tmp/etc/pacman.conf -Syy |
| 52 | + ls -al / |
| 53 | + #ln -s /proc/mounts /etc/mtab |
| 54 | + ls -al /etc |
| 55 | + ls -al /proc |
| 56 | +
|
| 57 | +
|
| 58 | + #fakeroot pacman -U --noconfirm --cachedir $out/tmp/msys/cache --config $out/tmp/etc/pacman.conf --root $out ${pkgs.lib.concatStringsSep " " (map (p: "${p}") base_srcs)} |
| 59 | + #fakeroot pacman -U --noconfirm --cachedir $out/tmp/msys/cache --config $out/tmp/etc/pacman.conf --root $out ${pkgs.lib.concatStringsSep " " (map (p: "${p}") srcs)} |
| 60 | + rm -rf $out/tmp |
| 61 | + ''; |
19 | 62 | };
|
20 |
| - msys2-qt = pkgs.stdenvNoCC.mkDerivation rec { |
21 |
| - name = "msys2-qt"; |
22 |
| - srcs = import ./msys2_qt_packages.nix { inherit pkgs; }; |
| 63 | + msys2-qt-ifw = pkgs.stdenvNoCC.mkDerivation rec { |
| 64 | + name = "msys2-qt-ifw"; |
| 65 | + srcs = import ./msys2_qt_ifw_packages.nix { inherit pkgs; }; |
23 | 66 | buildInputs = [ pkgs.gnutar pkgs.zstd ];
|
24 | 67 | phases = [ "installPhase" ];
|
25 | 68 | installPhase = (pkgs.lib.strings.concatStringsSep "\n" (["mkdir $out"] ++ (map (p: "tar xvf ${p} -C $out") srcs)));
|
26 | 69 | };
|
27 | 70 |
|
28 | 71 | buildMsys2Installer = pkgs.stdenv.mkDerivation {
|
29 | 72 | name = "msys2-installer";
|
30 |
| - __networked = true; |
31 | 73 | buildInputs = with pkgs; [ curl pacman fakeroot p7zip wine64 ];
|
32 | 74 | src = ./.;
|
33 | 75 | phases = [ "buildPhase" "installPhase" ];
|
|
39 | 81 | find qt-ifw \( -name "package.xml" -or -name "config.xml" \) -exec sed -i "s|@DATE@|$(date +'%Y-%m-%d')|g" "{}" \;
|
40 | 82 | find qt-ifw \( -name "package.xml" -or -name "config.xml" \) -exec sed -i "s|@VERSION@|$(date +'%Y%m%d')|g" "{}" \;
|
41 | 83 |
|
42 |
| - 7z a -mx9 -md128m "qt-ifw/packages/com.msys2.root/data/msys64.7z" "${msys2-env}/"* |
43 |
| - ${pkgs.wineWowPackages.stable}/bin/wine64 ${msys2-qt}/mingw64/bin/binarycreator.exe \ |
44 |
| - -t "${msys2-qt}/mingw64/bin/installerbase.exe" \ |
| 84 | + 7z a -mx9 -md128m "qt-ifw/packages/com.msys2.root/data/msys64.7z" "${msys2-image}/"* |
| 85 | + ${pkgs.wineWowPackages.stable}/bin/wine64 ${msys2-qt-ifw}/mingw64/bin/binarycreator.exe \ |
| 86 | + -t "${msys2-qt-ifw}/mingw64/bin/installerbase.exe" \ |
45 | 87 | -p "qt-ifw/packages" \
|
46 | 88 | -c "qt-ifw/config/config.xml" \
|
47 | 89 | --offline-only \
|
|
51 | 93 | installPhase = ''
|
52 | 94 | mkdir -p $out
|
53 | 95 | cp msys2-x86_64.exe $out/
|
| 96 | + for i in $out/*.*; do |
| 97 | + echo file binary-dist $i >> $out/nix-support/hydra-build-products |
| 98 | + done |
54 | 99 | '';
|
55 | 100 | };
|
56 | 101 | in
|
|
0 commit comments