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
pin = pins.rat;
pname = "rat"; pname = "rat";
version = "1.1"; version = "2.0.1";
in
stdenv.mkDerivation {
inherit pname version;
src = fetchurl { src = fetchFromGitHub {
url = "https://github.com/Mcharlsto/rat/releases/download/${version}/rat"; inherit (pin.repository) owner repo;
sha256 = "sha256-93sspjvXFPocGFPeCF1AWoWYx5hI7vMltx9SQ7x25z4="; 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 = ''
mkdir -p $out/bin runHook preInstall
mkdir -p $out/bin
install -Dm755 ./bin/rat -t "$out/bin/"
runHook postInstall
'';
cp $src $out/bin/rat meta = {
description = "rat";
chmod +x $out/bin/rat homepage = "https://github.com/thinkingsand/rat";
maintainers = with lib.maintainers; [NotAShelf];
sed -i '1 s/^.*$/#\/usr\/bin\/env bash/' $out/bin/rat };
''; }
postInstall = ''
wrapProgram $out/bin/rat \
--prefix PATH : ${lib.makeBinPath (with pkgs; [sharutils opusfile sox bash])}
'';
}