feat: alias rm with trash-d

This commit is contained in:
matt1432 2023-12-23 22:57:43 -05:00
parent b0e5eebafc
commit b0710205e6
3 changed files with 44 additions and 0 deletions

View file

@ -67,6 +67,7 @@
nur.hmModules.nur
./home
./home/trash-d
./pkgs
];

View file

@ -0,0 +1,7 @@
{pkgs, ...}: let
trash = pkgs.callPackage ./trash-d.nix pkgs;
in {
home.packages = [trash];
programs.bash.shellAliases.rm = "trash";
}

View file

@ -0,0 +1,36 @@
{
stdenv,
fetchFromGitHub,
dmd,
dub,
ronn,
...
}:
stdenv.mkDerivation {
name = "trash";
version = "unstable";
src = fetchFromGitHub {
owner = "rushsteve1";
repo = "trash-d";
rev = "d88bb672612761c8e299e717857bf9c85a903e99";
hash = "sha256-oPxeoEqOYf6DCg5rJxINqAIlMbxqzAJcZDUY/EzADzY=";
};
buildInputs = [dub dmd ronn];
buildPhase = ''
# https://github.com/svanderburg/node2nix/issues/217#issuecomment-751311272
export HOME=$(mktemp -d)
dub build
'';
installPhase = ''
mkdir -p $out/bin $out/man/man1
cp -a ./build/trash $out/bin/
ronn --roff --pipe MANUAL.md > $out/man/man1/trash.1
'';
}