From 4d97a9cc4ce194626e1957e78caef72679d0d708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20DOUIN?= Date: Mon, 12 Jan 2026 20:15:03 +0100 Subject: [PATCH] build(nix): fix postInstall hook --- default.nix | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/default.nix b/default.nix index 6f6b1e7f..9a13052d 100644 --- a/default.nix +++ b/default.nix @@ -1,6 +1,6 @@ { - pimalaya ? import (fetchTarball "https://github.com/pimalaya/nix/archive/master.tar.gz"), nixpkgs ? , + pimalaya ? import (fetchTarball "https://github.com/pimalaya/nix/archive/master.tar.gz"), ... }@args: @@ -16,13 +16,36 @@ pimalaya.mkDefault ( defaultFeatures, features, }: - pkgs.callPackage "${nixpkgs}/pkgs/by-name/hi/himalaya/package.nix" { + (pkgs.callPackage "${nixpkgs}/pkgs/by-name/hi/himalaya/package.nix" { inherit lib rustPlatform; - installShellCompletions = false; - installManPages = false; buildNoDefaultFeatures = !defaultFeatures; buildFeatures = lib.splitString "," features; - } + }) + # HACK: needed until new derivation available on nixpkgs + .overrideAttrs + { + postInstall = + let + inherit (pkgs) stdenv buildPackages; + emulator = stdenv.hostPlatform.emulator buildPackages; + in + '' + mkdir -p $out/share/{applications,completions,man} + cp assets/himalaya.desktop "$out"/share/applications/ + ${emulator} "$out"/bin/himalaya man "$out"/share/man + ${emulator} "$out"/bin/himalaya completion bash > "$out"/share/completions/himalaya.bash + ${emulator} "$out"/bin/himalaya completion elvish > "$out"/share/completions/himalaya.elvish + ${emulator} "$out"/bin/himalaya completion fish > "$out"/share/completions/himalaya.fish + ${emulator} "$out"/bin/himalaya completion powershell > "$out"/share/completions/himalaya.powershell + ${emulator} "$out"/bin/himalaya completion zsh > "$out"/share/completions/himalaya.zsh + '' + + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installManPage "$out"/share/man/* + '' + + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + installShellCompletion "$out"/share/completions/himalaya.{bash,fish,zsh} + ''; + } ); } // removeAttrs args [ "pimalaya" ]