mirror of
https://github.com/soywod/himalaya.git
synced 2024-11-25 12:30:22 +00:00
clean remaining parts
This commit is contained in:
parent
087a0821bc
commit
095d519dd0
1 changed files with 54 additions and 62 deletions
116
flake.nix
116
flake.nix
|
@ -125,14 +125,11 @@
|
||||||
mkApp = { pkgs, buildSystem, targetSystem ? buildSystem }:
|
mkApp = { pkgs, buildSystem, targetSystem ? buildSystem }:
|
||||||
let
|
let
|
||||||
himalaya = lib.getExe self.packages.${buildSystem}.${targetSystem};
|
himalaya = lib.getExe self.packages.${buildSystem}.${targetSystem};
|
||||||
wrapper = crossSystems.${buildSystem}.${targetSystem}.runner or (_: himalaya) {
|
wrapper = crossSystems.${buildSystem}.${targetSystem}.runner or (_: himalaya) { inherit pkgs himalaya; };
|
||||||
inherit pkgs himalaya;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
type = "app";
|
|
||||||
program = lib.getExe (pkgs.writeShellScriptBin "himalaya" "${wrapper} $@");
|
program = lib.getExe (pkgs.writeShellScriptBin "himalaya" "${wrapper} $@");
|
||||||
};
|
app = { inherit program; type = "app"; };
|
||||||
|
in
|
||||||
|
app;
|
||||||
|
|
||||||
mkApps = buildSystem:
|
mkApps = buildSystem:
|
||||||
let
|
let
|
||||||
|
@ -143,64 +140,59 @@
|
||||||
in
|
in
|
||||||
apps // { default = defaultApp; };
|
apps // { default = defaultApp; };
|
||||||
|
|
||||||
|
mkPackage = { pkgs, buildSystem, targetSystem ? buildSystem }:
|
||||||
|
let
|
||||||
|
targetConfig = crossSystems.${buildSystem}.${targetSystem};
|
||||||
|
toolchain = mkToolchain.fromTarget {
|
||||||
|
inherit pkgs buildSystem;
|
||||||
|
targetSystem = targetConfig.rustTarget;
|
||||||
|
};
|
||||||
|
rust = naersk.lib.${buildSystem}.override {
|
||||||
|
cargo = toolchain;
|
||||||
|
rustc = toolchain;
|
||||||
|
};
|
||||||
|
mkPackage' = targetConfig.mkPackage or (_: p: p);
|
||||||
|
himalaya = "./himalaya";
|
||||||
|
runner = targetConfig.runner or (_: himalaya) { inherit pkgs himalaya; };
|
||||||
|
package = mkPackage' { inherit pkgs; system = buildSystem; } {
|
||||||
|
name = "himalaya";
|
||||||
|
src = gitignoreSource ./.;
|
||||||
|
strictDeps = true;
|
||||||
|
doCheck = false;
|
||||||
|
auditable = false;
|
||||||
|
nativeBuildInputs = with pkgs; [ pkg-config ];
|
||||||
|
CARGO_BUILD_TARGET = targetConfig.rustTarget;
|
||||||
|
CARGO_BUILD_RUSTFLAGS = [ "-Ctarget-feature=+crt-static" ];
|
||||||
|
postInstall = ''
|
||||||
|
export WINEPREFIX="$(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
|
||||||
|
${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
|
||||||
|
${pkgs.zip}/bin/zip -r himalaya.zip himalaya* share
|
||||||
|
|
||||||
|
mv share ../
|
||||||
|
mv himalaya.tgz himalaya.zip ../
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
rust.buildPackage package;
|
||||||
|
|
||||||
mkPackages = buildSystem:
|
mkPackages = buildSystem:
|
||||||
let
|
let
|
||||||
pkgs = import nixpkgs { system = buildSystem; };
|
pkgs = import nixpkgs { system = buildSystem; };
|
||||||
|
mkPackage' = targetSystem: _: mkPackage { inherit pkgs buildSystem targetSystem; };
|
||||||
mkPackage = targetSystem: targetConfig:
|
defaultPackage = mkPackage { inherit pkgs buildSystem; };
|
||||||
let
|
packages = builtins.mapAttrs mkPackage' crossSystems.${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";
|
|
||||||
src = gitignoreSource ./.;
|
|
||||||
strictDeps = true;
|
|
||||||
doCheck = false;
|
|
||||||
auditable = false;
|
|
||||||
nativeBuildInputs = with pkgs; [ pkg-config ];
|
|
||||||
CARGO_BUILD_TARGET = targetConfig.rustTarget;
|
|
||||||
CARGO_BUILD_RUSTFLAGS = [ "-Ctarget-feature=+crt-static" ];
|
|
||||||
postInstall = ''
|
|
||||||
export WINEPREFIX="$(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
|
|
||||||
${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
|
|
||||||
${pkgs.zip}/bin/zip -r himalaya.zip himalaya* share
|
|
||||||
|
|
||||||
mv share ../
|
|
||||||
mv himalaya.tgz himalaya.zip ../
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
buildPackage = targetSystem: targetConfig:
|
|
||||||
let
|
|
||||||
toolchain = mkToolchain.fromTarget {
|
|
||||||
inherit pkgs buildSystem;
|
|
||||||
targetSystem = targetConfig.rustTarget;
|
|
||||||
};
|
|
||||||
rust = naersk.lib.${buildSystem}.override {
|
|
||||||
cargo = toolchain;
|
|
||||||
rustc = toolchain;
|
|
||||||
};
|
|
||||||
package = mkPackage targetSystem targetConfig;
|
|
||||||
in
|
|
||||||
rust.buildPackage package;
|
|
||||||
|
|
||||||
defaultPackage = buildPackage buildSystem crossSystems.${buildSystem}.${buildSystem};
|
|
||||||
packages = builtins.mapAttrs buildPackage crossSystems.${buildSystem};
|
|
||||||
|
|
||||||
in
|
in
|
||||||
packages // { default = defaultPackage; };
|
packages // { default = defaultPackage; };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue