mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-21 18:40:19 +00:00
merge archives packages with regular ones
This commit is contained in:
parent
a066774f22
commit
4590348bf2
2 changed files with 37 additions and 41 deletions
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -34,3 +34,5 @@ jobs:
|
||||||
- name: Run app
|
- name: Run app
|
||||||
run: |
|
run: |
|
||||||
nix run -L .#${{ matrix.target }} -- --version
|
nix run -L .#${{ matrix.target }} -- --version
|
||||||
|
ls result/bin -al
|
||||||
|
ls result/share/applications -al
|
||||||
|
|
76
flake.nix
76
flake.nix
|
@ -86,27 +86,22 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# FIXME: infinite recursion in stdenv?!
|
# FIXME: infinite recursion in stdenv?!
|
||||||
# aarch64-darwin = {
|
aarch64-darwin = {
|
||||||
# rustTarget = "aarch64-apple-darwin";
|
rustTarget = "aarch64-apple-darwin";
|
||||||
# override = { system, pkgs }:
|
runner = { pkgs, himalaya }: "${pkgs.qemu}/bin/qemu-aarch64 ${himalaya}";
|
||||||
# let
|
mkPackage = { system, pkgs }: package:
|
||||||
# # inherit (mkPkgsCross system "aarch64-darwin") stdenv;
|
let
|
||||||
# inherit ((mkPkgsCross system "aarch64-darwin").pkgsStatic) stdenv darwin;
|
inherit ((mkPkgsCross system "aarch64-darwin").pkgsStatic) stdenv darwin;
|
||||||
# inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
|
inherit (darwin.apple_sdk.frameworks) AppKit Cocoa;
|
||||||
# cc = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
|
cc = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
|
||||||
# in
|
in
|
||||||
# {
|
package // {
|
||||||
# buildInputs = [ Cocoa ];
|
buildInputs = [ Cocoa ];
|
||||||
# NIX_LDFLAGS = "-F${AppKit}/Library/Frameworks -framework AppKit -F${Cocoa}/Library/Frameworks -framework Cocoa";
|
NIX_LDFLAGS = "-F${AppKit}/Library/Frameworks -framework AppKit";
|
||||||
# NIX_CFLAGS_COMPILE = "-F${AppKit}/Library/Frameworks -framework AppKit -F${Cocoa}/Library/Frameworks -framework Cocoa";
|
TARGET_CC = cc;
|
||||||
# TARGET_CC = cc;
|
CARGO_BUILD_RUSTFLAGS = package.CARGO_BUILD_RUSTFLAGS ++ [ "-Clinker=${cc}" ];
|
||||||
# CARGO_BUILD_RUSTFLAGS = staticRustFlags ++ [ "-Clinker=${cc}" "-lframework=${Cocoa}/Library/Frameworks" ];
|
};
|
||||||
# postInstall = mkPostInstall {
|
};
|
||||||
# inherit pkgs;
|
|
||||||
# bin = "${pkgs.qemu}/bin/qemu-aarch64 ./himalaya";
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
# };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
aarch64-darwin = {
|
aarch64-darwin = {
|
||||||
|
@ -160,14 +155,29 @@
|
||||||
pkgs = import nixpkgs { system = buildSystem; };
|
pkgs = import nixpkgs { system = buildSystem; };
|
||||||
|
|
||||||
mkPackage = targetSystem: targetConfig:
|
mkPackage = targetSystem: targetConfig:
|
||||||
let mkPackage' = targetConfig.mkPackage or (_: p: p);
|
let
|
||||||
in mkPackage' { inherit pkgs; system = buildSystem; } {
|
mkPackage' = targetConfig.mkPackage or (_: p: p);
|
||||||
|
himalaya = "./himalaya";
|
||||||
|
runner = targetConfig.runner or (_: himalaya) { inherit pkgs himalaya; };
|
||||||
|
in
|
||||||
|
mkPackage' { inherit pkgs; system = buildSystem; } {
|
||||||
name = "himalaya";
|
name = "himalaya";
|
||||||
src = gitignoreSource ./.;
|
src = gitignoreSource ./.;
|
||||||
overrideMain = _: {
|
overrideMain = _: {
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
|
export WINEPREFIX="$(mktemp -d)"
|
||||||
mkdir -p $out/share/applications/
|
mkdir -p $out/share/applications/
|
||||||
cp assets/himalaya.desktop $out/share/applications/
|
cp assets/himalaya.desktop $out/share/applications/
|
||||||
|
cd $out/bin
|
||||||
|
mkdir -p {man,completions}
|
||||||
|
${runner} man ./man
|
||||||
|
${runner} completion bash > ./completions/himalaya.bash
|
||||||
|
${runner} completion elvish > ./completions/himalaya.elvish
|
||||||
|
${runner} completion fish > ./completions/himalaya.fish
|
||||||
|
${runner} completion powershell > ./completions/himalaya.powershell
|
||||||
|
${runner} completion zsh > ./completions/himalaya.zsh
|
||||||
|
tar -czf himalaya.tgz himalaya* man completions
|
||||||
|
${pkgs.zip}/bin/zip -r himalaya.zip himalaya* man completions
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
@ -192,28 +202,11 @@
|
||||||
in
|
in
|
||||||
rust.buildPackage package;
|
rust.buildPackage package;
|
||||||
|
|
||||||
# TODO: move this to postInstall
|
|
||||||
buildArchives = targetSystem:
|
|
||||||
let himalaya = self.apps.${buildSystem}.${targetSystem}.program;
|
|
||||||
in pkgs.writeShellScriptBin "himalaya-archives" ''
|
|
||||||
export WINEPREFIX="$(mktemp -d)"
|
|
||||||
mkdir -p {man,completions}
|
|
||||||
${himalaya} man ./man
|
|
||||||
${himalaya} completion bash > ./completions/himalaya.bash
|
|
||||||
${himalaya} completion elvish > ./completions/himalaya.elvish
|
|
||||||
${himalaya} completion fish > ./completions/himalaya.fish
|
|
||||||
${himalaya} completion powershell > ./completions/himalaya.powershell
|
|
||||||
${himalaya} completion zsh > ./completions/himalaya.zsh
|
|
||||||
tar -czf himalaya.tgz himalaya* man completions
|
|
||||||
${pkgs.zip}/bin/zip -r himalaya.zip himalaya* man completions
|
|
||||||
'';
|
|
||||||
|
|
||||||
defaultPackage = buildPackage buildSystem crossSystems.${buildSystem}.${buildSystem};
|
defaultPackage = buildPackage buildSystem crossSystems.${buildSystem}.${buildSystem};
|
||||||
packages = builtins.mapAttrs buildPackage crossSystems.${buildSystem};
|
packages = builtins.mapAttrs buildPackage crossSystems.${buildSystem};
|
||||||
archives = lib.foldlAttrs (p: k: _: p // { "${k}-archives" = buildArchives k; }) { } crossSystems.${buildSystem};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{ default = defaultPackage; } // packages // archives;
|
{ default = defaultPackage; } // packages;
|
||||||
|
|
||||||
mkApps = buildSystem:
|
mkApps = buildSystem:
|
||||||
let
|
let
|
||||||
|
@ -232,6 +225,7 @@
|
||||||
program = "${wrapper}/bin/himalaya";
|
program = "${wrapper}/bin/himalaya";
|
||||||
};
|
};
|
||||||
mkApp = targetSystem: _: mkAppWrapper { inherit targetSystem; };
|
mkApp = targetSystem: _: mkAppWrapper { inherit targetSystem; };
|
||||||
|
|
||||||
defaultApp = mkApp buildSystem null;
|
defaultApp = mkApp buildSystem null;
|
||||||
apps = builtins.mapAttrs mkApp crossSystems.${buildSystem};
|
apps = builtins.mapAttrs mkApp crossSystems.${buildSystem};
|
||||||
in
|
in
|
||||||
|
|
Loading…
Reference in a new issue