From 759cf488a87ed74b5d7ab0c2ec7eee8b95686eb8 Mon Sep 17 00:00:00 2001 From: John Soo Date: Fri, 3 Jun 2022 15:31:03 -0700 Subject: [PATCH 1/3] maintainers: add jsoo1 --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 377777993059..86449dbe928b 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -6360,6 +6360,12 @@ github = "jsimonetti"; githubId = 5478838; }; + jsoo1 = { + email = "jsoo1@asu.edu"; + github = "jsoo1"; + name = "John Soo"; + githubId = 10039785; + }; jtcoolen = { email = "jtcoolen@pm.me"; name = "Julien Coolen"; From d0cdd897c347d73f98031f5143b0cd872e57874f Mon Sep 17 00:00:00 2001 From: John Soo Date: Fri, 3 Jun 2022 11:13:28 -0700 Subject: [PATCH 2/3] cpulimit: use github sources at 0.2 The sourceforge page of limitCPU says the following: > Update: Mr Marletta has re-launched his CPUlimit project, adding new > features and improving OS X support. The new project is a re-write > and should not be considered drop-in compatible with this > project. The source code of the new CPUlimit project can be found on > github. We here at the LimitCPU project will continue to work with > downstream projects and with the resurrected CPUlimit project so > that both projects may grow and improve. --- pkgs/tools/misc/cpulimit/default.nix | 32 ++++++++++--------- .../misc/cpulimit/get-missing-basename.patch | 12 +++++++ .../misc/cpulimit/remove-sys-sysctl.h.patch | 21 ++++++++++++ 3 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 pkgs/tools/misc/cpulimit/get-missing-basename.patch create mode 100644 pkgs/tools/misc/cpulimit/remove-sys-sysctl.h.patch diff --git a/pkgs/tools/misc/cpulimit/default.nix b/pkgs/tools/misc/cpulimit/default.nix index 7fdaa319619d..a0ee76ec46fa 100644 --- a/pkgs/tools/misc/cpulimit/default.nix +++ b/pkgs/tools/misc/cpulimit/default.nix @@ -1,27 +1,29 @@ -{lib, stdenv, fetchurl}: +{ lib, stdenv, fetchFromGitHub }: stdenv.mkDerivation rec { pname = "cpulimit"; - version = "2.7"; + version = "0.2"; - src = fetchurl { - url = "mirror://sourceforge/limitcpu/${pname}-${version}.tar.gz"; - sha256 = "sha256-HeBApPikDf6MegJf6YB1ZzRo+8P8zMvCMbx0AvYuxKA="; + src = fetchFromGitHub { + owner = "opsengine"; + repo = "cpulimit"; + rev = "v${version}"; + sha256 = "1dz045yhcsw1rdamzpz4bk8mw888in7fyqk1q1b3m1yk4pd1ahkh"; }; - buildFlags = with stdenv; [ ( - if isDarwin then "osx" - else if isFreeBSD then "freebsd" - else "cpulimit" - ) ]; + patches = [ ./remove-sys-sysctl.h.patch ./get-missing-basename.patch ]; - installFlags = [ "PREFIX=$(out)" ]; + + installPhase = '' + mkdir -p $out/bin + cp src/cpulimit $out/bin + ''; meta = with lib; { - homepage = "http://limitcpu.sourceforge.net/"; - description = "A tool to throttle the CPU usage of programs"; - platforms = with platforms; linux ++ freebsd; + homepage = "https://github.com/opsengine/cpulimit"; + description = "CPU usage limiter"; + platforms = platforms.unix; license = licenses.gpl2; - maintainers = [maintainers.rycee]; + maintainers = [ maintainers.jsoo1 ]; }; } diff --git a/pkgs/tools/misc/cpulimit/get-missing-basename.patch b/pkgs/tools/misc/cpulimit/get-missing-basename.patch new file mode 100644 index 000000000000..d27eda0b6fa9 --- /dev/null +++ b/pkgs/tools/misc/cpulimit/get-missing-basename.patch @@ -0,0 +1,12 @@ +diff --git a/src/process_group.c b/src/process_group.c +index 06d73a6..3ca66b0 100644 +--- a/src/process_group.c ++++ b/src/process_group.c +@@ -20,6 +20,7 @@ + */ + + #include ++#include + #include + #include + #include diff --git a/pkgs/tools/misc/cpulimit/remove-sys-sysctl.h.patch b/pkgs/tools/misc/cpulimit/remove-sys-sysctl.h.patch new file mode 100644 index 000000000000..a152cab3acc7 --- /dev/null +++ b/pkgs/tools/misc/cpulimit/remove-sys-sysctl.h.patch @@ -0,0 +1,21 @@ +Remove references to sys/sysctl.h which were deprecated long ago. + +diff --git a/src/cpulimit.c b/src/cpulimit.c +index 50eabea..eba4615 100644 +--- a/src/cpulimit.c ++++ b/src/cpulimit.c +@@ -38,7 +38,9 @@ + #include + #include + #include ++#ifdef __APPLE__ + #include ++#endif + #include + #include + #include + +-#ifdef __APPLE__ || __FREEBSD__ ++#if defined(__APPLE__) || defined(__FREEBSD__) + #include + #endif \ No newline at end of file From 44a2177997c0f3a641956e169dc0628f3b6746ba Mon Sep 17 00:00:00 2001 From: John Soo Date: Fri, 3 Jun 2022 11:15:12 -0700 Subject: [PATCH 3/3] limitcpu: init at 2.7 Renamed from cpulimit. --- pkgs/tools/misc/limitcpu/default.nix | 27 +++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 pkgs/tools/misc/limitcpu/default.nix diff --git a/pkgs/tools/misc/limitcpu/default.nix b/pkgs/tools/misc/limitcpu/default.nix new file mode 100644 index 000000000000..2d7fb55dcd9c --- /dev/null +++ b/pkgs/tools/misc/limitcpu/default.nix @@ -0,0 +1,27 @@ +{lib, stdenv, fetchurl}: + +stdenv.mkDerivation rec { + pname = "limitcpu"; + version = "2.7"; + + src = fetchurl { + url = "mirror://sourceforge/limitcpu/cpulimit-${version}.tar.gz"; + sha256 = "sha256-HeBApPikDf6MegJf6YB1ZzRo+8P8zMvCMbx0AvYuxKA="; + }; + + buildFlags = with stdenv; [ ( + if isDarwin then "osx" + else if isFreeBSD then "freebsd" + else "cpulimit" + ) ]; + + installFlags = [ "PREFIX=$(out)" ]; + + meta = with lib; { + homepage = "http://limitcpu.sourceforge.net/"; + description = "A tool to throttle the CPU usage of programs"; + platforms = with platforms; linux ++ freebsd; + license = licenses.gpl2; + maintainers = [maintainers.rycee]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index da373b207d7a..3f0928daa52c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3941,6 +3941,8 @@ with pkgs; lifeograph = callPackage ../applications/editors/lifeograph { }; + limitcpu = callPackage ../tools/misc/limitcpu { }; + link-grammar = callPackage ../tools/text/link-grammar { }; linuxptp = callPackage ../os-specific/linux/linuxptp { };