Merge pull request #7 from NotAShelf/rat-c

pkgs/rat: rebase
This commit is contained in:
raf 2024-02-13 06:53:34 +03:00 committed by GitHub
commit 67f373d4f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 52 additions and 28 deletions

View file

@ -48,6 +48,20 @@
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.05pre583579.2d627a2a7047/nixexprs.tar.xz", "url": "https://releases.nixos.org/nixpkgs/nixpkgs-24.05pre583579.2d627a2a7047/nixexprs.tar.xz",
"hash": "0w8nm2bfcdcbb5c6qmhkr33pxkh0f3gn2y4cds97kiy20bikg5nx" "hash": "0w8nm2bfcdcbb5c6qmhkr33pxkh0f3gn2y4cds97kiy20bikg5nx"
}, },
"rat": {
"type": "GitRelease",
"repository": {
"type": "GitHub",
"owner": "thinkingsand",
"repo": "rat"
},
"pre_releases": false,
"version_upper_bound": null,
"version": "2.0.1",
"revision": "03d2e16ea0ebe280d7dd472612ced8b4ee71960f",
"url": "https://api.github.com/repos/thinkingsand/rat/tarball/2.0.1",
"hash": "1lvqr06z2vs48a9hckim12268zfa2d0sckynpn4b0d7lv9hkn2hi"
},
"rofi-calc": { "rofi-calc": {
"type": "GitRelease", "type": "GitRelease",
"repository": { "repository": {

View file

@ -1,37 +1,47 @@
{ {
stdenv,
fetchurl,
gnused,
makeWrapper,
pkgs,
lib,
pins, pins,
lib,
disableHardening ? true,
fetchFromGitHub,
stdenv,
unixtools,
}: }:
stdenv.mkDerivation rec { assert disableHardening -> lib.warn "nyxpkgs/rat disables hardening to avoid segfaults. You may want to consider overriding the package if this is undesirable" true; let
pname = "rat"; pin = pins.rat;
version = "1.1";
src = fetchurl { pname = "rat";
url = "https://github.com/Mcharlsto/rat/releases/download/${version}/rat"; version = "2.0.1";
sha256 = "sha256-93sspjvXFPocGFPeCF1AWoWYx5hI7vMltx9SQ7x25z4="; in
stdenv.mkDerivation {
inherit pname version;
src = fetchFromGitHub {
inherit (pin.repository) owner repo;
sha256 = pin.hash;
rev = pin.revision;
}; };
buildInputs = [gnused makeWrapper]; # the code is so unsafe, it doesn't work with even one of hardening flags
# lol
hardeningDisable = lib.optionals disableHardening ["all"];
phases = ["installPhase" "postInstall"]; buildInputs = [unixtools.xxd];
buildPhase = ''
runHook preBuild
make linux_audio
runHook postBuild
'';
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p $out/bin mkdir -p $out/bin
install -Dm755 ./bin/rat -t "$out/bin/"
cp $src $out/bin/rat runHook postInstall
chmod +x $out/bin/rat
sed -i '1 s/^.*$/#\/usr\/bin\/env bash/' $out/bin/rat
''; '';
postInstall = '' meta = {
wrapProgram $out/bin/rat \ description = "rat";
--prefix PATH : ${lib.makeBinPath (with pkgs; [sharutils opusfile sox bash])} homepage = "https://github.com/thinkingsand/rat";
''; maintainers = with lib.maintainers; [NotAShelf];
} };
}