mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-21 18:40:19 +00:00
release v1.0.0-beta.4
This commit is contained in:
parent
23ae40e728
commit
10de8e9fb4
10 changed files with 209 additions and 242 deletions
108
.github/workflows/release.yml
vendored
108
.github/workflows/release.yml
vendored
|
@ -22,22 +22,21 @@ jobs:
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
||||||
deploy-unix-releases:
|
deploy-releases:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
needs: create-release
|
needs: create-release
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- target: linux
|
- target: x86_64-linux
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- target: linux-musl
|
- target: arm64-linux
|
||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
- target: macos
|
- target: x86_64-windows
|
||||||
|
os: ubuntu-latest
|
||||||
|
- target: x86_64-macos
|
||||||
os: macos-latest
|
os: macos-latest
|
||||||
# TODO: uncomment once nix build .#windows works
|
|
||||||
# - target: windows
|
|
||||||
# os: ubuntu-latest
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
@ -51,34 +50,18 @@ jobs:
|
||||||
with:
|
with:
|
||||||
name: soywod
|
name: soywod
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
- name: Build release
|
- name: Build release archive
|
||||||
run: nix build -L .#${{ matrix.target }}
|
|
||||||
- name: Copy binary
|
|
||||||
run: |
|
run: |
|
||||||
|
nix build -L .#${{ matrix.target }}
|
||||||
cp result/bin/himalaya* .
|
cp result/bin/himalaya* .
|
||||||
- name: Patch binary interpreter
|
- name: Upload tgz release archive
|
||||||
if: ${{ matrix.target == 'linux' }}
|
|
||||||
run: |
|
|
||||||
nix-shell -p patchelf --command "sudo patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 himalaya"
|
|
||||||
- name: Prepare release archives
|
|
||||||
run: |
|
|
||||||
mkdir -p {man,completions}
|
|
||||||
nix run .#${{ matrix.target }} man ./man
|
|
||||||
nix run .#${{ matrix.target }} completion bash > ./completions/himalaya.bash
|
|
||||||
nix run .#${{ matrix.target }} completion elvish > ./completions/himalaya.elvish
|
|
||||||
nix run .#${{ matrix.target }} completion fish > ./completions/himalaya.fish
|
|
||||||
nix run .#${{ matrix.target }} completion powershell > ./completions/himalaya.powershell
|
|
||||||
nix run .#${{ matrix.target }} completion zsh > ./completions/himalaya.zsh
|
|
||||||
tar -czf himalaya.tgz himalaya* man completions
|
|
||||||
zip -r himalaya.zip himalaya* man completions
|
|
||||||
- name: Upload tarball release archive
|
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
asset_path: himalaya.tgz
|
asset_path: himalaya.tgz
|
||||||
asset_name: himalaya-${{ matrix.target }}.tgz
|
asset_name: himalaya.${{ matrix.target }}.tgz
|
||||||
asset_content_type: application/gzip
|
asset_content_type: application/gzip
|
||||||
- name: Upload zip release archive
|
- name: Upload zip release archive
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
|
@ -87,74 +70,5 @@ jobs:
|
||||||
with:
|
with:
|
||||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
||||||
asset_path: himalaya.zip
|
asset_path: himalaya.zip
|
||||||
asset_name: himalaya-${{ matrix.target }}.zip
|
asset_name: himalaya.${{ matrix.target }}.zip
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
|
|
||||||
# TODO: remove me once nix build .#windows works
|
|
||||||
deploy-windows-release:
|
|
||||||
runs-on: windows-latest
|
|
||||||
needs: create-release
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
profile: minimal
|
|
||||||
- name: Build release
|
|
||||||
uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: build
|
|
||||||
args: --release
|
|
||||||
- name: Copy binary
|
|
||||||
run: |
|
|
||||||
copy target/release/himalaya.exe .
|
|
||||||
- name: Prepare release archives
|
|
||||||
run: |
|
|
||||||
mkdir man
|
|
||||||
mkdir completions
|
|
||||||
./himalaya.exe man ./man
|
|
||||||
./himalaya.exe completion bash > ./completions/himalaya.bash
|
|
||||||
./himalaya.exe completion elvish > ./completions/himalaya.elvish
|
|
||||||
./himalaya.exe completion fish > ./completions/himalaya.fish
|
|
||||||
./himalaya.exe completion powershell > ./completions/himalaya.powershell
|
|
||||||
./himalaya.exe completion zsh > ./completions/himalaya.zsh
|
|
||||||
tar -czf himalaya.tgz himalaya.exe man completions
|
|
||||||
Compress-Archive -Path himalaya.exe,man,completions -DestinationPath himalaya.zip
|
|
||||||
- name: Upload tarball release archive
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
|
||||||
asset_path: himalaya.tgz
|
|
||||||
asset_name: himalaya-windows.tgz
|
|
||||||
asset_content_type: application/gzip
|
|
||||||
- name: Upload zip release archive
|
|
||||||
uses: actions/upload-release-asset@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ needs.create-release.outputs.upload_url }}
|
|
||||||
asset_path: himalaya.zip
|
|
||||||
asset_name: himalaya-windows.zip
|
|
||||||
asset_content_type: application/zip
|
|
||||||
|
|
||||||
publish-crates-io:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: create-release
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install Nix
|
|
||||||
uses: cachix/install-nix-action@v24
|
|
||||||
with:
|
|
||||||
nix_path: nixpkgs=channel:nixos-23.11
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
- name: Publish library to crates.io
|
|
||||||
env:
|
|
||||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
||||||
run: |
|
|
||||||
nix develop -c cargo publish --no-verify --token ${CARGO_REGISTRY_TOKEN}
|
|
||||||
|
|
24
.github/workflows/tests.yml
vendored
24
.github/workflows/tests.yml
vendored
|
@ -1,24 +0,0 @@
|
||||||
name: tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
tests:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Install Nix
|
|
||||||
uses: cachix/install-nix-action@v20
|
|
||||||
with:
|
|
||||||
nix_path: nixpkgs=channel:nixos-23.11
|
|
||||||
extra_nix_config: |
|
|
||||||
experimental-features = nix-command flakes
|
|
||||||
- uses: cachix/cachix-action@v12
|
|
||||||
with:
|
|
||||||
name: soywod
|
|
||||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
||||||
- name: Build then test
|
|
||||||
run: nix build
|
|
|
@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [1.0.0-beta.4] - 2024-04-16
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added systemd service in `assets/` folder.
|
- Added systemd service in `assets/` folder.
|
||||||
|
@ -32,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Fixed watch IMAP envelopes when folder was empty [#179].
|
- Fixed watch IMAP envelopes when folder was empty [#179].
|
||||||
- Prevented parsing of undefined config options [#188].
|
- Prevented parsing of undefined config options [#188].
|
||||||
- Fixed `In-Reply-To` header being skipped from mailto URLs [#194].
|
- Fixed `In-Reply-To` header being skipped from mailto URLs [#194].
|
||||||
|
- Fixed error page out of bounds when filtering envelopes returned an empty result [#195].
|
||||||
|
|
||||||
## [1.0.0-beta.3] - 2024-02-25
|
## [1.0.0-beta.3] - 2024-02-25
|
||||||
|
|
||||||
|
@ -821,3 +824,4 @@ Few major concepts changed:
|
||||||
[#184]: https://todo.sr.ht/~soywod/pimalaya/184
|
[#184]: https://todo.sr.ht/~soywod/pimalaya/184
|
||||||
[#188]: https://todo.sr.ht/~soywod/pimalaya/188
|
[#188]: https://todo.sr.ht/~soywod/pimalaya/188
|
||||||
[#194]: https://todo.sr.ht/~soywod/pimalaya/194
|
[#194]: https://todo.sr.ht/~soywod/pimalaya/194
|
||||||
|
[#195]: https://todo.sr.ht/~soywod/pimalaya/195
|
||||||
|
|
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -1218,9 +1218,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "email-lib"
|
name = "email-lib"
|
||||||
version = "0.24.0"
|
version = "0.24.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "28526bad9d46fcfb2c6385961aeb4b684546c965d18a12e5552ca4af7cf1f35e"
|
checksum = "20eca48c1ae74c6c7ec6ef9a6c2af935e3cc601c50fce1385c24bec5dd5e20e9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"advisory-lock",
|
"advisory-lock",
|
||||||
"async-trait",
|
"async-trait",
|
||||||
|
@ -3948,9 +3948,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.115"
|
version = "1.0.116"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd"
|
checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa",
|
"itoa",
|
||||||
"ryu",
|
"ryu",
|
||||||
|
|
|
@ -45,7 +45,6 @@ pgp-commands = ["email-lib/pgp-commands", "mml-lib/pgp-commands", "pgp"]
|
||||||
pgp-gpg = ["email-lib/pgp-gpg", "mml-lib/pgp-gpg", "pgp"]
|
pgp-gpg = ["email-lib/pgp-gpg", "mml-lib/pgp-gpg", "pgp"]
|
||||||
pgp-native = ["email-lib/pgp-native", "mml-lib/pgp-native", "pgp"]
|
pgp-native = ["email-lib/pgp-native", "mml-lib/pgp-native", "pgp"]
|
||||||
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
ariadne = "0.2"
|
ariadne = "0.2"
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
|
@ -56,7 +55,7 @@ color-eyre = "0.6.3"
|
||||||
console = "0.15.2"
|
console = "0.15.2"
|
||||||
dialoguer = "0.10.2"
|
dialoguer = "0.10.2"
|
||||||
dirs = "4"
|
dirs = "4"
|
||||||
email-lib = { version = "=0.24.0", default-features = false, features = ["derive"] }
|
email-lib = { version = "=0.24.1", default-features = false, features = ["derive"] }
|
||||||
email_address = "0.2.4"
|
email_address = "0.2.4"
|
||||||
erased-serde = "0.3"
|
erased-serde = "0.3"
|
||||||
indicatif = "0.17"
|
indicatif = "0.17"
|
||||||
|
|
28
flake.lock
28
flake.lock
|
@ -8,15 +8,15 @@
|
||||||
"rust-analyzer-src": "rust-analyzer-src"
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1708842026,
|
"lastModified": 1713081044,
|
||||||
"narHash": "sha256-1r+7l66CFPCjRDZEKq6r7aCpfjqhIkrF3ZTQyEFnkTs=",
|
"narHash": "sha256-ZwbJDrizU+nzU7wTgokYuu5yK71wLPmOLukiunm5B6Y=",
|
||||||
"owner": "nix-community",
|
"owner": "soywod",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"rev": "b7fff64b5bc36b1662f8317632b11b15b3839b2a",
|
"rev": "af99e7e9c87389c0a5aaf953478664d7126c2b14",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "soywod",
|
||||||
"repo": "fenix",
|
"repo": "fenix",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
@ -44,11 +44,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703887061,
|
"lastModified": 1709087332,
|
||||||
"narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=",
|
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "gitignore.nix",
|
"repo": "gitignore.nix",
|
||||||
"rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5",
|
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -79,11 +79,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1708702655,
|
"lastModified": 1713145326,
|
||||||
"narHash": "sha256-qxT5jSLhelfLhQ07+AUxSTm1VnVH+hQxDkQSZ/m/Smo=",
|
"narHash": "sha256-m7+IWM6mkWOg22EC5kRUFCycXsXLSU7hWmHdmBfmC3s=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "c5101e457206dd437330d283d6626944e28794b3",
|
"rev": "53a2c32bc66f5ae41a28d7a9a49d321172af621e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -105,11 +105,11 @@
|
||||||
"rust-analyzer-src": {
|
"rust-analyzer-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1708768292,
|
"lastModified": 1712818880,
|
||||||
"narHash": "sha256-IBHMNEe3lspVdIzjpM2OVZiBFmFw1DKtdgVN5G41pRc=",
|
"narHash": "sha256-VDxsvgj/bNypHq48tQWtc3VRbWvzlFjzKf9ZZIVO10Y=",
|
||||||
"owner": "rust-lang",
|
"owner": "rust-lang",
|
||||||
"repo": "rust-analyzer",
|
"repo": "rust-analyzer",
|
||||||
"rev": "4a8d0f7f565b6df45da5522dd7366a4df3460cd7",
|
"rev": "657b33b0cb9bd49085202e91ad5b4676532c9140",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
207
flake.nix
207
flake.nix
|
@ -8,7 +8,7 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
fenix = {
|
fenix = {
|
||||||
url = "github:nix-community/fenix";
|
url = "github:soywod/fenix";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
naersk = {
|
naersk = {
|
||||||
|
@ -25,8 +25,114 @@
|
||||||
let
|
let
|
||||||
inherit (gitignore.lib) gitignoreSource;
|
inherit (gitignore.lib) gitignoreSource;
|
||||||
|
|
||||||
|
staticRustFlags = [ "-Ctarget-feature=+crt-static" ];
|
||||||
|
|
||||||
|
# Map of map matching supported Nix build systems with Rust
|
||||||
|
# cross target systems.
|
||||||
|
crossBuildTargets = {
|
||||||
|
x86_64-linux = {
|
||||||
|
x86_64-linux = {
|
||||||
|
rustTarget = "x86_64-unknown-linux-musl";
|
||||||
|
override = { ... }: { };
|
||||||
|
};
|
||||||
|
|
||||||
|
arm64-linux = rec {
|
||||||
|
rustTarget = "aarch64-unknown-linux-musl";
|
||||||
|
override = { system, pkgs }:
|
||||||
|
let
|
||||||
|
inherit (mkPkgsCross system rustTarget) stdenv;
|
||||||
|
cc = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"; in
|
||||||
|
rec {
|
||||||
|
TARGET_CC = cc;
|
||||||
|
CARGO_BUILD_RUSTFLAGS = staticRustFlags ++ [ "-Clinker=${cc}" ];
|
||||||
|
postInstall = mkPostInstall {
|
||||||
|
inherit pkgs;
|
||||||
|
bin = "${pkgs.qemu}/bin/qemu-aarch64 ./himalaya";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
x86_64-windows = {
|
||||||
|
rustTarget = "x86_64-pc-windows-gnu";
|
||||||
|
override = { system, pkgs }:
|
||||||
|
let
|
||||||
|
inherit (pkgs) pkgsCross zip;
|
||||||
|
inherit (pkgsCross.mingwW64) stdenv windows;
|
||||||
|
cc = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
|
||||||
|
wine = pkgs.wine.override { wineBuild = "wine64"; };
|
||||||
|
postInstall = mkPostInstall {
|
||||||
|
inherit pkgs;
|
||||||
|
bin = "${wine}/bin/wine64 ./himalaya.exe";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
depsBuildBuild = [ stdenv.cc windows.pthreads ];
|
||||||
|
TARGET_CC = cc;
|
||||||
|
CARGO_BUILD_RUSTFLAGS = staticRustFlags ++ [ "-Clinker=${cc}" ];
|
||||||
|
postInstall = ''
|
||||||
|
export WINEPREFIX="$(mktemp -d)"
|
||||||
|
${postInstall}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
x86_64-darwin = {
|
||||||
|
x86_64-macos = {
|
||||||
|
rustTarget = "x86_64-apple-darwin";
|
||||||
|
override = { pkgs, ... }:
|
||||||
|
let inherit (pkgs.darwin.apple_sdk.frameworks) AppKit Cocoa; in
|
||||||
|
{
|
||||||
|
buildInputs = [ Cocoa ];
|
||||||
|
NIX_LDFLAGS = "-F${AppKit}/Library/Frameworks -framework AppKit";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# FIXME: infinite recursion in stdenv?!
|
||||||
|
arm64-macos = {
|
||||||
|
rustTarget = "aarch64-apple-darwin";
|
||||||
|
override = { system, pkgs }:
|
||||||
|
let
|
||||||
|
# inherit (mkPkgsCross system "aarch64-darwin") stdenv;
|
||||||
|
inherit ((mkPkgsCross system "aarch64-darwin").pkgsStatic) stdenv darwin;
|
||||||
|
inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
|
||||||
|
cc = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
|
||||||
|
in
|
||||||
|
rec {
|
||||||
|
buildInputs = [ Cocoa ];
|
||||||
|
NIX_LDFLAGS = "-F${AppKit}/Library/Frameworks -framework AppKit -F${Cocoa}/Library/Frameworks -framework Cocoa";
|
||||||
|
NIX_CFLAGS_COMPILE = "-F${AppKit}/Library/Frameworks -framework AppKit -F${Cocoa}/Library/Frameworks -framework Cocoa";
|
||||||
|
TARGET_CC = cc;
|
||||||
|
CARGO_BUILD_RUSTFLAGS = staticRustFlags ++ [ "-Clinker=${cc}" "-lframework=${Cocoa}/Library/Frameworks" ];
|
||||||
|
postInstall = mkPostInstall {
|
||||||
|
inherit pkgs;
|
||||||
|
bin = "${pkgs.qemu}/bin/qemu-aarch64 ./himalaya";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
mkToolchain = import ./rust-toolchain.nix fenix;
|
mkToolchain = import ./rust-toolchain.nix fenix;
|
||||||
|
|
||||||
|
mkPkgsCross = buildSystem: crossSystem: import nixpkgs {
|
||||||
|
system = buildSystem;
|
||||||
|
crossSystem.config = crossSystem;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkPostInstall = { pkgs, bin ? "./himalaya" }: with pkgs; ''
|
||||||
|
cd $out/bin
|
||||||
|
mkdir -p {man,completions}
|
||||||
|
${bin} man ./man
|
||||||
|
${bin} completion bash > ./completions/himalaya.bash
|
||||||
|
${bin} completion elvish > ./completions/himalaya.elvish
|
||||||
|
${bin} completion fish > ./completions/himalaya.fish
|
||||||
|
${bin} completion powershell > ./completions/himalaya.powershell
|
||||||
|
${bin} completion zsh > ./completions/himalaya.zsh
|
||||||
|
tar -czf himalaya.tgz himalaya* man completions
|
||||||
|
${zip}/bin/zip -r himalaya.zip himalaya* man completions
|
||||||
|
'';
|
||||||
|
|
||||||
mkDevShells = buildPlatform:
|
mkDevShells = buildPlatform:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = buildPlatform; };
|
pkgs = import nixpkgs { system = buildPlatform; };
|
||||||
|
@ -34,27 +140,21 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = pkgs.mkShell {
|
default = pkgs.mkShell {
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [ pkg-config ];
|
||||||
pkg-config
|
|
||||||
];
|
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
# Nix
|
# Nix
|
||||||
rnix-lsp
|
# rnix-lsp
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
|
|
||||||
# Rust
|
# Rust
|
||||||
rust-toolchain
|
rust-toolchain
|
||||||
cargo-watch
|
cargo-watch
|
||||||
|
|
||||||
# OpenSSL
|
# Email env
|
||||||
openssl.dev
|
|
||||||
|
|
||||||
# Notmuch
|
|
||||||
notmuch
|
|
||||||
|
|
||||||
# GPG
|
|
||||||
gnupg
|
gnupg
|
||||||
gpgme
|
gpgme
|
||||||
|
msmtp
|
||||||
|
notmuch
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -71,53 +171,31 @@
|
||||||
package' = {
|
package' = {
|
||||||
name = "himalaya";
|
name = "himalaya";
|
||||||
src = gitignoreSource ./.;
|
src = gitignoreSource ./.;
|
||||||
overrideMain = _: {
|
# overrideMain = _: {
|
||||||
postInstall = ''
|
# postInstall = ''
|
||||||
mkdir -p $out/share/applications/
|
# mkdir -p $out/share/applications/
|
||||||
cp assets/himalaya.desktop $out/share/applications/
|
# cp assets/himalaya.desktop $out/share/applications/
|
||||||
'';
|
# '';
|
||||||
};
|
# };
|
||||||
doCheck = true;
|
doCheck = false;
|
||||||
cargoTestOptions = opts: opts ++ [ "--lib" ];
|
auditable = false;
|
||||||
} // pkgs.lib.optionalAttrs (!isNull targetPlatform) {
|
strictDeps = true;
|
||||||
CARGO_BUILD_TARGET = targetPlatform;
|
CARGO_BUILD_TARGET = targetPlatform;
|
||||||
|
CARGO_BUILD_RUSTFLAGS = staticRustFlags;
|
||||||
|
postInstall = mkPostInstall { inherit pkgs; };
|
||||||
} // package;
|
} // package;
|
||||||
in
|
in
|
||||||
naersk'.buildPackage package';
|
naersk'.buildPackage package';
|
||||||
|
|
||||||
mkPackages = buildPlatform:
|
mkPackages = system:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = buildPlatform; };
|
pkgs = import nixpkgs { inherit system; };
|
||||||
mkPackage' = mkPackage pkgs buildPlatform;
|
mkPackage' = target: package: mkPackage pkgs system package.rustTarget (package.override { inherit system pkgs; });
|
||||||
in
|
in
|
||||||
rec {
|
builtins.mapAttrs mkPackage' crossBuildTargets.${system};
|
||||||
default = if pkgs.stdenv.isDarwin then macos else linux;
|
|
||||||
linux = mkPackage' null { };
|
|
||||||
linux-musl = mkPackage' "x86_64-unknown-linux-musl" (with pkgs.pkgsStatic; {
|
|
||||||
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
|
|
||||||
hardeningDisable = [ "all" ];
|
|
||||||
});
|
|
||||||
macos = mkPackage' null (with pkgs.darwin.apple_sdk.frameworks; {
|
|
||||||
# NOTE: needed to prevent error Undefined symbols
|
|
||||||
# "_OBJC_CLASS_$_NSImage" and
|
|
||||||
# "_LSCopyApplicationURLsForBundleIdentifier"
|
|
||||||
NIX_LDFLAGS = "-F${AppKit}/Library/Frameworks -framework AppKit";
|
|
||||||
buildInputs = [ Cocoa ];
|
|
||||||
});
|
|
||||||
# FIXME: bzlip: fatal error: windows.h: No such file or directory
|
|
||||||
# May be related to SQLite.
|
|
||||||
windows = mkPackage' "x86_64-pc-windows-gnu" {
|
|
||||||
strictDeps = true;
|
|
||||||
depsBuildBuild = with pkgs.pkgsCross.mingwW64; [
|
|
||||||
stdenv.cc
|
|
||||||
windows.pthreads
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mkApp = drv:
|
mkApp = drv:
|
||||||
let exePath = drv.passthru.exePath or "/bin/himalaya";
|
let exePath = drv.passthru.exePath or "/bin/himalaya"; in
|
||||||
in
|
|
||||||
{
|
{
|
||||||
type = "app";
|
type = "app";
|
||||||
program = "${drv}${exePath}";
|
program = "${drv}${exePath}";
|
||||||
|
@ -126,29 +204,16 @@
|
||||||
mkApps = buildPlatform:
|
mkApps = buildPlatform:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = buildPlatform; };
|
pkgs = import nixpkgs { system = buildPlatform; };
|
||||||
|
mkApp' = target: package: mkApp self.packages.${buildPlatform}.${target};
|
||||||
in
|
in
|
||||||
rec {
|
builtins.mapAttrs mkApp' crossBuildTargets.${buildPlatform};
|
||||||
default = if pkgs.stdenv.isDarwin then macos else linux;
|
|
||||||
linux = mkApp self.packages.${buildPlatform}.linux;
|
supportedSystems = builtins.attrNames crossBuildTargets;
|
||||||
linux-musl = mkApp self.packages.${buildPlatform}.linux-musl;
|
mapSupportedSystem = nixpkgs.lib.genAttrs supportedSystems;
|
||||||
macos = mkApp self.packages.${buildPlatform}.macos;
|
|
||||||
windows =
|
|
||||||
let
|
|
||||||
wine = pkgs.wine.override { wineBuild = "wine64"; };
|
|
||||||
himalaya = self.packages.${buildPlatform}.windows;
|
|
||||||
app = pkgs.writeShellScriptBin "himalaya" ''
|
|
||||||
export WINEPREFIX="$(mktemp -d)"
|
|
||||||
${wine}/bin/wine64 ${himalaya}/bin/himalaya.exe $@
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
mkApp app;
|
|
||||||
};
|
|
||||||
supportedSystems = [ "aarch64-linux" "aarch64-darwin" "x86_64-darwin" "x86_64-linux" ];
|
|
||||||
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems f;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
apps = forEachSupportedSystem mkApps;
|
apps = mapSupportedSystem mkApps;
|
||||||
packages = forEachSupportedSystem mkPackages;
|
packages = mapSupportedSystem mkPackages;
|
||||||
devShells = forEachSupportedSystem mkDevShells;
|
devShells = mapSupportedSystem mkDevShells;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
42
install.sh
42
install.sh
|
@ -11,32 +11,44 @@ DESTDIR="${DESTDIR:-}"
|
||||||
PREFIX="${PREFIX:-"$DESTDIR/usr/local"}"
|
PREFIX="${PREFIX:-"$DESTDIR/usr/local"}"
|
||||||
RELEASES_URL="https://github.com/soywod/himalaya/releases"
|
RELEASES_URL="https://github.com/soywod/himalaya/releases"
|
||||||
|
|
||||||
|
binary=himalaya
|
||||||
system=$(uname -s | tr [:upper:] [:lower:])
|
system=$(uname -s | tr [:upper:] [:lower:])
|
||||||
|
machine=$(uname -m | tr [:upper:] [:lower:])
|
||||||
|
|
||||||
case $system in
|
case $system in
|
||||||
msys*|mingw*|cygwin*|win*) system=windows; binary=himalaya.exe;;
|
msys*|mingw*|cygwin*|win*)
|
||||||
linux|freebsd) system=linux; binary=himalaya;;
|
target=x86_64-windows
|
||||||
darwin) system=macos; binary=himalaya;;
|
binary=himalaya.exe;;
|
||||||
*) die "Unsupported system: $system" ;;
|
|
||||||
|
linux|freebsd)
|
||||||
|
case $machine in
|
||||||
|
x86_64) target=x86_64-linux;;
|
||||||
|
arm64|aarch64) target=arm64-linux;;
|
||||||
|
*) die "Unsupported machine $machine for system $system";;
|
||||||
|
esac;;
|
||||||
|
|
||||||
|
darwin)
|
||||||
|
case $machine in
|
||||||
|
x86_64) target=x86_64-macos;;
|
||||||
|
arm64|aarch64) target=arm64-macos;;
|
||||||
|
*) die "Unsupported machine $machine for system $system";;
|
||||||
|
esac;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
die "Unsupported system $system";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
tmpdir=$(mktemp -d) || die "Failed to create tmpdir"
|
tmpdir=$(mktemp -d) || die "Cannot create temporary directory"
|
||||||
trap "rm -rf $tmpdir" EXIT
|
trap "rm -rf $tmpdir" EXIT
|
||||||
|
|
||||||
echo "Downloading latest $system release…"
|
echo "Downloading latest $system release…"
|
||||||
curl -sLo "$tmpdir/himalaya.tar.gz" \
|
curl -sLo "$tmpdir/himalaya.tgz" \
|
||||||
"$RELEASES_URL/latest/download/himalaya-$system.tar.gz"
|
"$RELEASES_URL/latest/download/himalaya.$target.tgz"
|
||||||
|
|
||||||
echo "Installing binary…"
|
echo "Installing binary…"
|
||||||
tar -xzf "$tmpdir/himalaya.tar.gz" -C "$tmpdir"
|
tar -xzf "$tmpdir/himalaya.tgz" -C "$tmpdir"
|
||||||
|
|
||||||
mkdir -p "$PREFIX/bin"
|
mkdir -p "$PREFIX/bin"
|
||||||
cp -f -- "$tmpdir/$binary" "$PREFIX/bin/$binary"
|
cp -f -- "$tmpdir/$binary" "$PREFIX/bin/$binary"
|
||||||
|
|
||||||
# See User Unit Search Path in `man systemd.unit(5)`
|
|
||||||
if [ "$system" = "linux" ] && [ "$PREFIX" = "/usr" ]; then
|
|
||||||
mkdir -p "$PREFIX/lib/systemd/user"
|
|
||||||
sed "s:%install_dir%:$PREFIX/bin:" "$tmpdir/assets/himalaya-watch@.service" \
|
|
||||||
> "$PREFIX/lib/systemd/user/himalaya-watch@.service"
|
|
||||||
fi
|
|
||||||
|
|
||||||
die "$("$PREFIX/bin/$binary" --version) installed!" 0
|
die "$("$PREFIX/bin/$binary" --version) installed!" 0
|
||||||
|
|
|
@ -2,26 +2,23 @@ fenix:
|
||||||
|
|
||||||
let
|
let
|
||||||
file = ./rust-toolchain.toml;
|
file = ./rust-toolchain.toml;
|
||||||
sha256 = "e4mlaJehWBymYxJGgnbuCObVlqMlQSilZ8FljG9zPHY=";
|
sha256 = "+syqAd2kX8KVa8/U2gz3blIQTTsYYt3U63xBWaGOSc8=";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
fromFile = { system }: fenix.packages.${system}.fromToolchainFile {
|
fromFile = { system }: fenix.packages.${system}.fromToolchainFile {
|
||||||
inherit file sha256;
|
inherit file sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
fromTarget = { pkgs, buildPlatform, targetPlatform ? null }:
|
fromTarget = { pkgs, buildPlatform, targetPlatform }:
|
||||||
let
|
let
|
||||||
inherit ((pkgs.lib.importTOML file).toolchain) channel;
|
name = (pkgs.lib.importTOML file).toolchain.channel;
|
||||||
toolchain = fenix.packages.${buildPlatform};
|
fenixPackage = fenix.packages.${buildPlatform};
|
||||||
|
toolchain = fenixPackage.fromToolchainName { inherit name sha256; };
|
||||||
|
targetToolchain = fenixPackage.targets.${targetPlatform}.fromToolchainName { inherit name sha256; };
|
||||||
in
|
in
|
||||||
if
|
fenixPackage.combine [
|
||||||
isNull targetPlatform
|
toolchain.rustc
|
||||||
then
|
toolchain.cargo
|
||||||
fenix.packages.${buildPlatform}.${channel}.toolchain
|
targetToolchain.rust-std
|
||||||
else
|
|
||||||
toolchain.combine [
|
|
||||||
toolchain.${channel}.rustc
|
|
||||||
toolchain.${channel}.cargo
|
|
||||||
toolchain.targets.${targetPlatform}.${channel}.rust-std
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "stable"
|
channel = "1.77.0"
|
||||||
profile = "default"
|
profile = "default"
|
||||||
components = [ "rust-src", "rust-analyzer" ]
|
components = [ "rust-src", "rust-analyzer" ]
|
||||||
|
|
Loading…
Reference in a new issue