oh-my-fish: refactor

This commit is contained in:
Anderson Torres 2023-11-23 16:38:50 -03:00
parent 33d2a40d67
commit a95272e67f
2 changed files with 24 additions and 18 deletions

View File

@ -3,7 +3,7 @@
, fetchFromGitHub , fetchFromGitHub
, fish , fish
, runtimeShell , runtimeShell
, writeShellScript , substituteAll
}: }:
stdenv.mkDerivation (finalAttrs: { stdenv.mkDerivation (finalAttrs: {
@ -11,41 +11,41 @@ stdenv.mkDerivation (finalAttrs: {
version = "unstable-2022-03-27"; version = "unstable-2022-03-27";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = finalAttrs.pname; owner = "oh-my-fish";
repo = finalAttrs.pname; repo = "oh-my-fish";
rev = "d428b723c8c18fef3b2a00b8b8b731177f483ad8"; rev = "d428b723c8c18fef3b2a00b8b8b731177f483ad8";
hash = "sha256-msItKEPe7uSUpDAfCfdYZjt5NyfM3KtOrLUTO9NGqlg="; hash = "sha256-msItKEPe7uSUpDAfCfdYZjt5NyfM3KtOrLUTO9NGqlg=";
}; };
strictDeps = true;
buildInputs = [ buildInputs = [
fish fish
]; ];
strictDeps = true;
dontConfigure = true; dontConfigure = true;
dontBuild = true; dontBuild = true;
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -pv $out/bin $out/share/${finalAttrs.pname} mkdir -pv $out/bin $out/share/oh-my-fish
cp -vr * $out/share/${finalAttrs.pname} cp -vr * $out/share/oh-my-fish
cat << EOF > $out/bin/omf-install cp -v ${substituteAll {
#!${runtimeShell} name = "omf-install";
src = ./omf-install;
OMF = placeholder "out";
inherit fish runtimeShell;
}} $out/bin/omf-install
${fish}/bin/fish \\
$out/share/${finalAttrs.pname}/bin/install \\
--noninteractive \\
--offline=$out/share/${finalAttrs.pname}
EOF
chmod +x $out/bin/omf-install chmod +x $out/bin/omf-install
cat $out/bin/omf-install
runHook postInstall runHook postInstall
''; '';
meta = with lib; { meta = {
homepage = "https://github.com/oh-my-fish/oh-my-fish"; homepage = "https://github.com/oh-my-fish/oh-my-fish";
description = "The Fish Shell Framework"; description = "The Fish Shell Framework";
longDescription = '' longDescription = ''
@ -53,10 +53,10 @@ stdenv.mkDerivation (finalAttrs: {
which extend or modify the look of your shell. It's fast, extensible and which extend or modify the look of your shell. It's fast, extensible and
easy to use. easy to use.
''; '';
license = licenses.mit; license = lib.licenses.mit;
maintainers = with maintainers; [ AndersonTorres ]; maintainers = with lib.maintainers; [ AndersonTorres ];
mainProgram = "omf-install"; mainProgram = "omf-install";
platforms = fish.meta.platforms; inherit (fish.meta) platforms;
}; };
}) })
# TODO: customize the omf-install script # TODO: customize the omf-install script

View File

@ -0,0 +1,6 @@
#!@runtimeShell@
@fish@/bin/fish \
@OMF@/share/oh-my-fish/bin/install \
--noninteractive \
--offline=@OMF@/share/oh-my-fish