mirror of
https://github.com/soywod/himalaya.git
synced 2025-04-19 15:53:39 +00:00
clean all
This commit is contained in:
parent
d7c565cadc
commit
69e66b307a
4 changed files with 53 additions and 81 deletions
51
.github/workflows/pre-release.yml
vendored
51
.github/workflows/pre-release.yml
vendored
|
@ -10,33 +10,34 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# - system: aarch64-macos
|
||||
# target: aarch64-apple-darwin
|
||||
# os: macos-14
|
||||
# - system: aarch64-linux
|
||||
# target: aarch64-unknown-linux-musl
|
||||
# os: ubuntu-latest
|
||||
# - system: armv6l-linux
|
||||
# target: armv6l-unknown-linux-musleabihf
|
||||
# os: ubuntu-latest
|
||||
# - system: armv7l-linux
|
||||
# target: armv7l-unknown-linux-musleabihf
|
||||
# os: ubuntu-latest
|
||||
# - system: i686-linux
|
||||
# target: i686-unknown-linux-musl
|
||||
# os: ubuntu-latest
|
||||
- system: i686-windows
|
||||
target: i686-w64-mingw32
|
||||
- system: aarch64-macos-14
|
||||
target: aarch64-apple-darwin
|
||||
os: macos-14
|
||||
- system: aarch64-linux
|
||||
target: aarch64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
# - system: x86_64-macos
|
||||
# target: x86_64-apple-darwin
|
||||
# os: macos-13
|
||||
# - system: x86_64-linux
|
||||
# target: x86_64-unknown-linux-musl
|
||||
# os: ubuntu-latest
|
||||
# - system: x86_64-windows
|
||||
# target: x86_64-w64-mingw32
|
||||
- system: armv6l-linux
|
||||
target: armv6l-unknown-linux-musleabihf
|
||||
os: ubuntu-latest
|
||||
- system: armv7l-linux
|
||||
target: armv7l-unknown-linux-musleabihf
|
||||
os: ubuntu-latest
|
||||
- system: i686-linux
|
||||
target: i686-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
# FIXME
|
||||
# - system: i686-windows
|
||||
# target: i686-w64-mingw32
|
||||
# os: ubuntu-latest
|
||||
- system: x86_64-macos-13
|
||||
target: x86_64-apple-darwin
|
||||
os: macos-13
|
||||
- system: x86_64-linux
|
||||
target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
- system: x86_64-windows
|
||||
target: x86_64-w64-mingw32
|
||||
os: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
|
41
default.nix
41
default.nix
|
@ -1,5 +1,5 @@
|
|||
{ target ? null
|
||||
, isStatic ? true
|
||||
, isStatic ? false
|
||||
, defaultFeatures ? true
|
||||
, features ? ""
|
||||
}:
|
||||
|
@ -17,28 +17,30 @@ let
|
|||
}
|
||||
);
|
||||
|
||||
systems = import ./systems.nix;
|
||||
system = if isNull target then null else systems.${target};
|
||||
|
||||
inherit (pkgs) lib hostPlatform;
|
||||
|
||||
fenix = import (fetchTarball "https://github.com/soywod/fenix/archive/main.tar.gz") { };
|
||||
|
||||
mkToolchain = import ./rust-toolchain.nix fenix;
|
||||
|
||||
rustToolchain = mkToolchain.fromTarget {
|
||||
inherit lib;
|
||||
target = if isNull system then null else system.rustTarget;
|
||||
};
|
||||
|
||||
rustTarget = if isNull target then null else hostPlatform.rust.rustcTarget;
|
||||
rustToolchain = mkToolchain.fromTarget { inherit lib; target = rustTarget; };
|
||||
rustPlatform = pkgs.makeRustPlatform {
|
||||
rustc = rustToolchain;
|
||||
cargo = rustToolchain;
|
||||
};
|
||||
|
||||
# HACK: https://github.com/NixOS/nixpkgs/issues/177129
|
||||
empty-libgcc_eh = stdenv.mkDerivation {
|
||||
pname = "empty-libgcc_eh";
|
||||
version = "0";
|
||||
dontUnpack = true;
|
||||
installPhase = ''
|
||||
mkdir -p "$out"/lib
|
||||
"${lib.getExe' binutils "ar"}" r "$out"/lib/libgcc_eh.a
|
||||
'';
|
||||
};
|
||||
|
||||
himalayaExe =
|
||||
let ext = lib.optionalString hostPlatform.isWindows ".exe";
|
||||
in "${(system.emulator or hostPlatform.emulator) buildPackages} ./himalaya${ext}";
|
||||
in "${hostPlatform.emulator buildPackages} ./himalaya${ext}";
|
||||
|
||||
himalaya = import ./package.nix {
|
||||
inherit lib rustPlatform;
|
||||
|
@ -55,24 +57,13 @@ let
|
|||
buildNoDefaultFeatures = !defaultFeatures;
|
||||
buildFeatures = lib.strings.splitString "," features;
|
||||
};
|
||||
|
||||
# HACK: https://github.com/NixOS/nixpkgs/issues/177129
|
||||
empty-libgcc_eh = stdenv.mkDerivation {
|
||||
pname = "empty-libgcc_eh";
|
||||
version = "0";
|
||||
dontUnpack = true;
|
||||
installPhase = ''
|
||||
mkdir -p "$out"/lib
|
||||
"${lib.getExe' binutils "ar"}" r "$out"/lib/libgcc_eh.a
|
||||
'';
|
||||
};
|
||||
in
|
||||
|
||||
himalaya.overrideAttrs (drv: {
|
||||
version = "1.0.0";
|
||||
|
||||
propagatedBuildInputs = (drv.propagatedBuildInputs or [ ])
|
||||
++ lib.optional false empty-libgcc_eh;
|
||||
++ lib.optional hostPlatform.isWindows empty-libgcc_eh;
|
||||
|
||||
postInstall = (drv.postInstall or "") + lib.optionalString hostPlatform.isWindows ''
|
||||
export WINEPREFIX="$(${lib.getExe' mktemp "mktemp"} -d)"
|
||||
|
|
13
package.nix
13
package.nix
|
@ -29,18 +29,10 @@ rustPlatform.buildRustPackage rec {
|
|||
|
||||
cargoHash = "sha256-YS8IamapvmdrOPptQh2Ef9Yold0IK1XIeGs0kDIQ5b8=";
|
||||
|
||||
# NIX_LDFLAGS = lib.optionals (stdenv.hostPlatform.isWindows && stdenv.hostPlatform.isi686) [
|
||||
# "-L${windows.mcfgthreads}/lib"
|
||||
# "-L${libunwind}/lib"
|
||||
# # "-L${windows.mingwrt}/lib"
|
||||
# #"-L${windows.w32api}/lib"
|
||||
# "-lmcfgthread"
|
||||
# "-lunwind"
|
||||
# ];
|
||||
|
||||
# unit tests only
|
||||
doCheck = false;
|
||||
auditable = false;
|
||||
|
||||
# unit tests only
|
||||
cargoTestFlags = [ "--lib" ];
|
||||
|
||||
nativeBuildInputs = [ pkg-config ]
|
||||
|
@ -48,7 +40,6 @@ rustPlatform.buildRustPackage rec {
|
|||
|
||||
buildInputs = [ ]
|
||||
++ lib.optional stdenv.hostPlatform.isDarwin apple-sdk
|
||||
# ++ lib.optional (stdenv.hostPlatform.isWindows && stdenv.hostPlatform.isi686) windows.mcfgthreads
|
||||
++ lib.optional (builtins.elem "notmuch" buildFeatures) notmuch
|
||||
++ lib.optional (builtins.elem "pgp-gpg" buildFeatures) gpgme;
|
||||
|
||||
|
|
|
@ -5,31 +5,20 @@ let
|
|||
sha256 = "+syqAd2kX8KVa8/U2gz3blIQTTsYYt3U63xBWaGOSc8=";
|
||||
in
|
||||
|
||||
rec {
|
||||
fromFile = { buildSystem }: fenix.packages.${buildSystem}.fromToolchainFile {
|
||||
inherit file sha256;
|
||||
};
|
||||
|
||||
toRustTarget = target: {
|
||||
x86_64-w64-mingw32 = "x86_64-pc-windows-gnu";
|
||||
i686-w64-mingw32 = "i686-pc-windows-gnu";
|
||||
armv6l-unknown-linux-musleabihf = "arm-unknown-linux-musleabihf";
|
||||
armv7l-unknown-linux-musleabihf = "armv7-unknown-linux-musleabihf";
|
||||
}.${target} or target;
|
||||
|
||||
crossRustStd = name: target:
|
||||
let
|
||||
rustTarget = toRustTarget target;
|
||||
crossToolchain = fenix.targets.${rustTarget}.fromToolchainName { inherit name sha256; };
|
||||
in
|
||||
crossToolchain.rust-std;
|
||||
{
|
||||
# fromFile = { buildSystem }: fenix.packages.${buildSystem}.fromToolchainFile {
|
||||
# inherit file sha256;
|
||||
# };
|
||||
|
||||
fromTarget = { lib, target ? null }:
|
||||
let
|
||||
name = (lib.importTOML file).toolchain.channel;
|
||||
toolchain = fenix.fromToolchainName { inherit name sha256; };
|
||||
specs = { inherit name sha256; };
|
||||
toolchain = fenix.fromToolchainName specs;
|
||||
crossToolchain = fenix.targets.${target}.fromToolchainName specs;
|
||||
components = [ toolchain.rustc toolchain.cargo ]
|
||||
++ lib.optional (!isNull target) (crossRustStd name target);
|
||||
++ lib.optional (!isNull target) crossToolchain;
|
||||
in
|
||||
|
||||
fenix.combine components;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue