Skip to content

Commit

Permalink
Use cargoHash + use install command
Browse files Browse the repository at this point in the history
  • Loading branch information
NewDawn0 committed Dec 15, 2024
1 parent 6817b6a commit 686710a
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 54 deletions.
5 changes: 1 addition & 4 deletions pkgs/by-name/an/ansi-cheatsheet/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ stdenv.mkDerivation {
cacheDir=$(mktemp -d)
zig build --global-cache-dir $cacheDir
'';
installPhase = ''
mkdir -p $out/bin
cp zig-out/bin/ansi $out/bin
'';
installPhase = "install -D zig-out/bin/ansi -t $out/bin";
meta = {
description = "A quick reference guide for ANSI escape codes";
longDescription = ''
Expand Down
6 changes: 2 additions & 4 deletions pkgs/by-name/as/ascii-weather/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ gccStdenv.mkDerivation {
rev = "70bf111647d064c3fcd0fe672b9fa697f4d060e4";
hash = "sha256-Dcosx6iEnvFCMrmUS7gSLg8re5zl1BXWX/Nu6hr4Pgw=";
};
installPhase = ''
mkdir -p $out/bin
cp ascii-weather $out/bin
'';
buildInputs = [ ncurses ];
installPhase = "install -D ascii-weather -t $out/bin";
meta = {
description = "An ASCII-based screensaver that shows various weather conditions";
longDescription = ''
Expand Down
9 changes: 4 additions & 5 deletions pkgs/by-name/cd/cd-up/package.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
fetchFromGitHub,
lib,
runtimeShell,
gccStdenv,
}:
gccStdenv.mkDerivation {
pname = "up-core";
name = "up";
version = "1.0.0";
src = fetchFromGitHub {
owner = "NewDawn0";
Expand All @@ -14,11 +14,10 @@ gccStdenv.mkDerivation {
hash = "sha256-Ll6gHuWh2s7ke9Vqlw0H3tdKHIuvIC13TGHHKllEQ54=";
};
installPhase = ''
mkdir -p $out/bin $out/lib
cp up-core $out/bin
echo "#!/usr/bin/env bash" > $out/lib/SOURCE_ME.sh
install -D up-core -t $out/bin
mkdir -p $out/lib
echo "#!/${runtimeShell}" > $out/lib/SOURCE_ME.sh
$out/bin/up-core --init >> $out/lib/SOURCE_ME.sh
chmod +x $out/lib/SOURCE_ME.sh
'';
shellHook = ''
source $out/lib/SOURCE_ME.sh
Expand Down
28 changes: 15 additions & 13 deletions pkgs/by-name/di/dirstack/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,11 @@
fetchFromGitHub,
fzf,
lib,
runtimeShell,
rustPlatform,
stdenv,
}:
let
src = fetchFromGitHub {
owner = "NewDawn0";
repo = "dirStack";
rev = "8ef0f19ae366868fb046f6acb0d396bc8436ef31";
hash = "sha256-mzw3uDZ0eM81WJM0YNcOlMHs4fNMUBgwxS6VBSS+VS8=";
};
meta = with lib; {
description = "A cd quicklist";
version = "1.0.0";
meta = {
description = "A fast directory navigation tool with a quicklist";
Expand All @@ -29,19 +22,28 @@ let
pkg = rustPlatform.buildRustPackage {
inherit meta version;
pname = "dirStack";
src = fetchFromGitHub {
owner = "NewDawn0";
repo = "dirStack";
rev = "8ef0f19ae366868fb046f6acb0d396bc8436ef31";
hash = "sha256-mzw3uDZ0eM81WJM0YNcOlMHs4fNMUBgwxS6VBSS+VS8=";
};
cargoHash = "sha256-y3ELhG4877X6Cysg9NMaD/QC3SfPBdk2Vh1QeHF1+pU=";
propagatedBuildInputs = [ fzf ];
cargoLock.lockFile = "${src}/Cargo.lock";
};
in
stdenv.mkDerivation {
inherit meta version;
pname = "dirStack-wrapped";
src = null;
dontUnpack = true;
dontBuild = true;
dontConfigure = true;
installPhase = ''
mkdir -p $out/bin $out/lib
cp ${pkg}/bin/dirStack $out/bin/
echo "#!/usr/bin/env bash" > $out/lib/SOURCE_ME.sh
install -D ${pkg}/bin/dirStack -t $out/bin
mkdir -p $out/lib
echo "#!/${runtimeShell}" > $out/lib/SOURCE_ME.sh
$out/bin/dirStack --init >> $out/lib/SOURCE_ME.sh
chmod +x $out/lib/SOURCE_ME.sh
'';
shellHook = ''
source $out/lib/SOURCE_ME.sh
Expand Down
5 changes: 1 addition & 4 deletions pkgs/by-name/ex/extract/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ stdenv.mkDerivation {
unzip
zstd
];
installPhase = ''
mkdir -p "$out/bin";
cp "${src}/ex" $out/bin/ex
'';
installPhase = "install -D -m 755 ${src}/ex -t $out/bin";
meta = {
description = "A command-line wrapper for extracting common archive formats";
longDescription = ''
Expand Down
12 changes: 4 additions & 8 deletions pkgs/by-name/ge/gen/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@
lib,
rustPlatform,
}:
let
rustPlatform.buildRustPackage {
pname = "gen";
version = "1.0.0";
src = fetchFromGitHub {
owner = "NewDawn0";
repo = "gen";
rev = "1b9e403c92de1b80c1e5eae31f09b93609ad3241";
sha256 = "sha256-DNMsuN3NVWiGJL+b2Qa0lNCp3q0xm/6yFxNUHNbURmE=";
};
in
rustPlatform.buildRustPackage {
pname = "gen";
version = "1.0.0";
inherit src;

cargoLock.lockFile = "${src}/Cargo.lock";
cargoHash = "sha256-tSWxKcKbiic+XfD/y51WSdim7T7cb34BSumv8i7m48Y=";
meta = {
description = "A flexible tool for generating customizable project templates";
longDescription = ''
Expand Down
12 changes: 4 additions & 8 deletions pkgs/by-name/ni/nixie-clock/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@
lib,
rustPlatform,
}:
let
rustPlatform.buildRustPackage {
pname = "nixie-clock";
version = "1.0.0";
src = fetchFromGitHub {
owner = "NewDawn0";
repo = "nixieClock";
rev = "e6bde15c65b28da6318877bf0899aad915655b15";
sha256 = "sha256-Lj98eghrucupnzdkMjGCPtGWO8NQ5ipQymsYUAl+XRU=";
};
in
rustPlatform.buildRustPackage {
name = "nixie-clock";
version = "1.0.0";
inherit src;

cargoLock.lockFile = "${src}/Cargo.lock";
cargoHash = "sha256-oqiXeX7ct2miDNoURF7+9lElebX4coVox+qzPgUBbj0=";
meta = {
description = "A CLI clock that displays time in a Nixie tube style";
longDescription = ''
Expand Down
12 changes: 4 additions & 8 deletions pkgs/by-name/tr/translate/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,16 @@
rustPlatform,
stdenv,
}:
let
rustPlatform.buildRustPackage {
pname = "tl";
version = "1.0.0";
src = fetchFromGitHub {
owner = "NewDawn0";
repo = "tl";
rev = "2e104c44e7afeda9d310acbcad1abb6f2571179a";
sha256 = "sha256-WFTB2cQxR8wvdwSzA1yLkEjahrjUWXcJy7tkpRjerBQ=";
};
in
rustPlatform.buildRustPackage {
pname = "tl";
version = "1.0.0";
inherit src;

cargoLock.lockFile = "${src}/Cargo.lock";
cargoHash = "sha256-8XnIFAWMkpiCsEsg7FrRrqrLYzHVA38RmDYt9L6NfCk=";
buildInputs = [
libiconv
] ++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.SystemConfiguration;
Expand Down

0 comments on commit 686710a

Please sign in to comment.