mirror of
https://github.com/pimalaya/himalaya.git
synced 2026-06-17 05:07:55 +08:00
test ci
This commit is contained in:
+70
-12
@@ -1,12 +1,70 @@
|
||||
# This file exists for legacy Nix installs (nix-build & nix-env)
|
||||
# https://nixos.wiki/wiki/Flakes#Using_flakes_project_from_a_legacy_Nix
|
||||
# You generally do *not* have to modify this ever.
|
||||
(import (
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash; }
|
||||
) {
|
||||
src = ./.;
|
||||
}).defaultNix
|
||||
# https://nixos.org/manual/nixpkgs/stable/#sec-cross-usage
|
||||
{ crossSystem ? null }:
|
||||
|
||||
let
|
||||
crossBuildEnabled = !isNull crossSystem;
|
||||
crossSystems = import ./cross-systems.nix;
|
||||
|
||||
buildPkgs = import <nixpkgs> { };
|
||||
hostPkgs = if crossBuildEnabled then import <nixpkgs> { inherit crossSystem; } else buildPkgs;
|
||||
|
||||
inherit (hostPkgs.stdenv) buildPlatform hostPlatform;
|
||||
|
||||
runner = if crossBuildEnabled then crossSystems.${hostPlatform.config}.runner buildPkgs else "./himalaya";
|
||||
|
||||
fenix = import (fetchTarball "https://github.com/soywod/fenix/archive/main.tar.gz") { };
|
||||
|
||||
mkToolchain = import ./rust-toolchain.nix fenix;
|
||||
|
||||
rustToolchain = mkToolchain.fromTarget {
|
||||
pkgs = hostPkgs;
|
||||
targetSystem = buildPlatform.config;
|
||||
};
|
||||
|
||||
rustPlatform = hostPkgs.makeRustPlatform {
|
||||
rustc = rustToolchain;
|
||||
cargo = rustToolchain;
|
||||
};
|
||||
|
||||
himalaya = import ./package.nix {
|
||||
inherit rustPlatform;
|
||||
lib = hostPkgs.lib;
|
||||
fetchFromGitHub = hostPkgs.fetchFromGitHub;
|
||||
pkg-config = hostPkgs.pkg-config;
|
||||
darwin = hostPkgs.darwin;
|
||||
installShellFiles = false;
|
||||
installShellCompletions = false;
|
||||
installManPages = false;
|
||||
notmuch = hostPkgs.notmuch;
|
||||
gpgme = hostPkgs.gpgme;
|
||||
stdenv = hostPkgs.stdenv;
|
||||
};
|
||||
in
|
||||
|
||||
himalaya.overrideAttrs (drv: {
|
||||
version = "1.0.0";
|
||||
postInstall = ''
|
||||
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
|
||||
${runner} man ./share/man
|
||||
${runner} completion bash > ./share/completions/himalaya.bash
|
||||
${runner} completion elvish > ./share/completions/himalaya.elvish
|
||||
${runner} completion fish > ./share/completions/himalaya.fish
|
||||
${runner} completion powershell > ./share/completions/himalaya.powershell
|
||||
${runner} completion zsh > ./share/completions/himalaya.zsh
|
||||
|
||||
tar -czf himalaya.tgz himalaya* share
|
||||
mv himalaya.tgz ../
|
||||
|
||||
${hostPkgs.zip}/bin/zip -r himalaya.zip himalaya* share
|
||||
mv himalaya.zip ../
|
||||
'';
|
||||
src = hostPkgs.nix-gitignore.gitignoreSource [ ] ./.;
|
||||
cargoDeps = rustPlatform.importCargoLock {
|
||||
lockFile = ./Cargo.lock;
|
||||
allowBuiltinFetchGit = true;
|
||||
};
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user