diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 09e55e93..da9352e4 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -47,11 +47,16 @@ jobs: - name: Build release run: | nix build .#cross-${{ matrix.target }} - nix run .#cross-${{ matrix.target }} -- --version - - name: Upload release artifacts + - name: Upload release uses: actions/upload-artifact@v4 with: name: "himalaya-${{ matrix.target }}" path: | result/bin/himalaya* - result/bin/share + - name: Upload share folder + uses: actions/upload-artifact@v4 + if: matrix.target == "x86_64-linux" + with: + name: "share" + path: | + result/share diff --git a/assets/himalaya.desktop b/assets/himalaya.desktop index c5ed6aa6..c3b0f9ff 100644 --- a/assets/himalaya.desktop +++ b/assets/himalaya.desktop @@ -3,7 +3,7 @@ Type=Application Name=himalaya DesktopName=Himalaya GenericName=Mail Reader -Comment=Command-line interface for email management +Comment=CLI to manage emails Terminal=true Exec=himalaya %U Categories=Application;Network @@ -13,4 +13,4 @@ Actions=Compose [Desktop Action Compose] Name=Compose -Exec=himalaya write %U +Exec=himalaya message write %U diff --git a/default.nix b/default.nix index 35f513d7..f584522b 100644 --- a/default.nix +++ b/default.nix @@ -28,18 +28,12 @@ let ''; }; - himalayaExe = - let ext = lib.optionalString hostPlatform.isWindows ".exe"; - in "${hostPlatform.emulator pkgs} ./himalaya${ext}"; - himalaya = import ./package.nix { inherit lib rustPlatform; fetchFromGitHub = crossPkgs.fetchFromGitHub; stdenv = crossPkgs.stdenv; apple-sdk = if hostPlatform.isx86_64 then crossPkgs.apple-sdk_13 else crossPkgs.apple-sdk_14; - installShellFiles = false; - installShellCompletions = false; - installManPages = false; + installShellFiles = crossPkgs.installShellFiles; notmuch = crossPkgs.notmuch; gpgme = crossPkgs.gpgme; pkg-config = crossPkgs.pkg-config; @@ -54,29 +48,7 @@ himalaya.overrideAttrs (drv: { propagatedBuildInputs = (drv.propagatedBuildInputs or [ ]) ++ lib.optional hostPlatform.isWindows empty-libgcc_eh; - # NOTE: manual wineprefix update is somehow needed: - # - postInstall = (drv.postInstall or "") + lib.optionalString hostPlatform.isWindows '' - export WINEPREFIX="$(${lib.getExe mktemp} -d)" - '' + '' - mkdir -p $out/bin/share/{applications,completions,man,services} - cp assets/himalaya.desktop $out/bin/share/applications/ - cp assets/himalaya-watch@.service $out/bin/share/services/ - - cd $out/bin - ${himalayaExe} man ./share/man - ${himalayaExe} completion bash > ./share/completions/himalaya.bash - ${himalayaExe} completion elvish > ./share/completions/himalaya.elvish - ${himalayaExe} completion fish > ./share/completions/himalaya.fish - ${himalayaExe} completion powershell > ./share/completions/himalaya.powershell - ${himalayaExe} completion zsh > ./share/completions/himalaya.zsh - - ${lib.getExe gnutar} -czf himalaya.tgz himalaya* share - mv himalaya.tgz ../ - - ${lib.getExe zip} -r himalaya.zip himalaya* share - mv himalaya.zip ../ - ''; + postInstall = null; src = crossPkgs.nix-gitignore.gitignoreSource [ ] ./.; diff --git a/package.nix b/package.nix index f557e616..e4c6d131 100644 --- a/package.nix +++ b/package.nix @@ -28,12 +28,6 @@ rustPlatform.buildRustPackage rec { cargoHash = "sha256-YS8IamapvmdrOPptQh2Ef9Yold0IK1XIeGs0kDIQ5b8="; - doCheck = false; - auditable = false; - - # unit tests only - cargoTestFlags = [ "--lib" ]; - nativeBuildInputs = [ pkg-config ] ++ lib.optional (installManPages || installShellCompletions) installShellFiles; @@ -42,15 +36,31 @@ rustPlatform.buildRustPackage rec { ++ lib.optional (builtins.elem "notmuch" buildFeatures) notmuch ++ lib.optional (builtins.elem "pgp-gpg" buildFeatures) gpgme; - postInstall = lib.optionalString installManPages '' - mkdir -p $out/man - $out/bin/himalaya man $out/man - installManPage $out/man/* + doCheck = false; + auditable = false; + + # unit tests only + cargoTestFlags = [ "--lib" ]; + + preInstall = '' + mkdir -p $out/share/applications + cp assets/himalaya.desktop "$out"/share/applications/ + '' + lib.optionalString installManPages '' + mkdir -p "$out"/share/man + "$out"/bin/himalaya man "$out"/share/man '' + lib.optionalString installShellCompletions '' - installShellCompletion --cmd himalaya \ - --bash <($out/bin/himalaya completion bash) \ - --fish <($out/bin/himalaya completion fish) \ - --zsh <($out/bin/himalaya completion zsh) + mkdir -p "$out"/share/completions + "$out"/bin/himalaya completion bash > "$out"/share/completions/himalaya.bash + "$out"/bin/himalaya completion elvish > "$out"/share/completions/himalaya.elvish + "$out"/bin/himalaya completion fish > "$out"/share/completions/himalaya.fish + "$out"/bin/himalaya completion powershell > "$out"/share/completions/himalaya.powershell + "$out"/bin/himalaya completion zsh > "$out"/share/completions/himalaya.zsh + ''; + + postInstall = lib.optionalString installManPages '' + installManPage "$out"/share/man/* + '' + lib.optionalString installShellCompletions '' + installShellCompletion "$out"/share/completions/himalaya.{bash,fish,zsh} ''; meta = {