{"id":38746261,"url":"https://github.com/canalguada/nicy","last_synced_at":"2026-01-17T11:45:50.583Z","repository":{"id":52921405,"uuid":"347027375","full_name":"canalguada/nicy","owner":"canalguada","description":"Set the execution environment and configure the resources that spawned and running processes are allowed to share.","archived":false,"fork":false,"pushed_at":"2024-04-26T17:18:57.000Z","size":348,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-06-20T09:17:16.897Z","etag":null,"topics":["cgroups","cli","go","golang","jq","linux","scheduling","systemd"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/canalguada.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-12T10:29:09.000Z","updated_at":"2024-04-26T17:14:21.000Z","dependencies_parsed_at":"2024-04-26T18:29:18.352Z","dependency_job_id":"abca603f-1846-4374-a1d4-94c9f4747048","html_url":"https://github.com/canalguada/nicy","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/canalguada/nicy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canalguada%2Fnicy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canalguada%2Fnicy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canalguada%2Fnicy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canalguada%2Fnicy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canalguada","download_url":"https://codeload.github.com/canalguada/nicy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canalguada%2Fnicy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T10:25:30.148Z","status":"ssl_error","status_checked_at":"2026-01-17T10:25:29.718Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cgroups","cli","go","golang","jq","linux","scheduling","systemd"],"created_at":"2026-01-17T11:45:49.452Z","updated_at":"2026-01-17T11:45:50.570Z","avatar_url":"https://github.com/canalguada.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nicy (WIP)\n## About\nSet the execution environment and configure the available resources for spawned and running processes.\n\n## Why\nLow-end hardware quickly turns nasty, running up to date \"resource hungry\" programs. But controlling the resources that they request help keeping that hardware serviceable.\n\nI write nicy because, sometimes, I need to control the available resources per program according to some more context, in other words adding options in a command line, not editing a configuration file as a privileged user. Something that [Ananicy](https://github.com/Nefelim4ag/Ananicy), an auto nice daemon, with community rules support, that relies too on the Linux Control Groups ([Cgroups](https://en.wikipedia.org/wiki/Cgroups)), does not provide.\n\nnicy was first implemented as a [shell script](https://github.com/canalguada/nicy/tree/sh#start-of-content), but now that it is implemented in Go langage, nicy can gain capabilities at install and run time. User does not need superuser privileges in order to run most of commands in an non-interactive context.\n\n## Description\nnicy relies on existing system utilities and can be used to ease the control upon the execution environment of the managed processes and to configure the resources available to them: with renice(1), can alter their scheduling priority; with chrt(1), can set their real-time scheduling attributes and with ionice(1) their I/O scheduling class and priority; with choom(1), can adjust their Out-Of-Memory killer score setting.\n\nnicy can also create and start a transient systemd scope unit and either run the specified command and its spawned processes in it with systemd-run(1), or move yet running processes inside it.\n\nWhen used to launch commands, nicy can also automatically change some environment variables and add command arguments.\n\nnicy manages the processes applying them generic or specific presets stored in YAML format.\n\n## Usage\n```\n$ nicy run --dry-run apt upgrade\nnicy: run: dry-run: /usr/bin/renice -n 19 -p 15325\nnicy: run: dry-run: /usr/bin/chrt --idle -a -p 0 15325\nnicy: run: dry-run: /usr/bin/ionice -c 3 -p 15325\nnicy: run: dry-run: /usr/bin/systemctl --user start nicy-cpu33.slice\nnicy: run: dry-run: /usr/bin/systemctl --user --runtime set-property nicy-cpu33.slice CPUQuota=33%\nnicy: run: dry-run: /usr/bin/systemd-run --user -G -d --no-ask-password --quiet --scope --unit=apt-cpu33-15325 --slice=nicy-cpu33.slice /usr/bin/apt upgrade\n\n```\n```\n$ NICY_SHELL=/usr/bin/zsh nicy show nvim\n#!/usr/bin/zsh\n(( $UID )) \u0026\u0026 SUDO=$SUDO || unset SUDO\n$SUDO renice -n -3 -p $$ \u003e/dev/null\n(( $UID )) \u0026\u0026 user_or_system=--user || user_or_system=--system\nsystemctl ${user_or_system} start nicy-cpu80.slice \u003e/dev/null\nsystemctl ${user_or_system} --runtime set-property nicy-cpu80.slice CPUQuota=80% \u003e/dev/null\nexec systemd-run ${user_or_system} -G -d --no-ask-password --quiet --scope --unit=nvim-cpu80-$$ --slice=nicy-cpu80.slice -E SHELL=/bin/bash /usr/bin/nvim --listen /tmp/nvimsocket \"$@\"\n```\n```\n# nicy control --dry-run --system\nnicy: control: dry-run: cupsd[465]: cgroup:cups.service pids:[465]\nnicy: control: dry-run: cupsd[465]: /usr/bin/renice -n 19 -g 465\nnicy: control: dry-run: cupsd[465]: /usr/bin/ionice -c 3 -P 465\nnicy: control: dry-run: cupsd[465]: /usr/bin/chrt --idle -a -p 0 465\nnicy: control: dry-run: cups-browsed[538]: cgroup:cups-browsed.service pids:[538]\nnicy: control: dry-run: cups-browsed[538]: /usr/bin/renice -n 19 -g 538\nnicy: control: dry-run: cups-browsed[538]: /usr/bin/ionice -c 3 -P 538\nnicy: control: dry-run: cups-browsed[538]: /usr/bin/chrt --idle -a -p 0 538\nnicy: control: dry-run: apache2[916]: cgroup:apache2.service pids:[916 917 919 920]\nnicy: control: dry-run: apache2[916]: /usr/bin/renice -n 19 -g 916\nnicy: control: dry-run: apache2[916]: /usr/bin/ionice -c 2 -n 7 -P 916\n\n```\n```\n$ nicy control --dry-run --user\nnicy: control: dry-run: pulseaudio[1299]: cgroup:pulseaudio.service pids:[1299]\nnicy: control: dry-run: pulseaudio[1299]: /usr/bin/ionice -c 1 -P 1299\nnicy: control: dry-run: pulseaudio[1299]: /usr/bin/chrt --rr -a -p 1 1299\nnicy: control: dry-run: nvim[2270]: cgroup:nvim-2270.scope pids:[2270]\nnicy: control: dry-run: nvim[2270]: /usr/bin/systemctl --user start nicy-cpu33.slice\nnicy: control: dry-run: nvim[2270]: /usr/bin/systemctl --user --runtime set-property nicy-cpu33.slice CPUQuota=33%\nnicy: control: dry-run: nvim[2270]: /usr/bin/busctl call --quiet --user org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager StartTransientUnit ssa(sv)a(sa(sv)) nvim-2270.scope fail 2 PIDs au 1 2270 Slice s nicy-cpu33.slice 0\nnicy: control: dry-run: cmus[2274]: cgroup:session-1.scope pids:[2274]\nnicy: control: dry-run: cmus[2274]: /usr/bin/renice -n -3 -g 2274\nnicy: control: dry-run: cmus[2274]: /usr/bin/ionice -c 1 -P 2274\n```\n\n## Requirements\n* [systemd](https://systemd.io/) and [systemd-run](https://www.freedesktop.org/software/systemd/man/systemd-run.html)\n\nrenice, chrt, ionice and choom system utilities are provided by essential packages, at least on Debian (bsdutils and util-linux).\n\nMost of cgroup settings are supported only with the unified control group hierarchy, the new version of kernel control group interface. See [Control Groups v2](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html).\n\n## Installation\n### From source\nBuild:\n```\n$ make\n```\nInstall in /usr/local:\n```\n$ sudo make install\n```\nInstall in /usr:\n```\n$ sudo make prefix=/usr install\n```\n### Building Debian package\nRequire [debmake](https://manpages.debian.org/buster/debmake/debmake.1.en.html) and [debuild](https://manpages.debian.org/buster-backports/devscripts/debuild.1.fr.html):\n```\n$ make deb\n```\n\n## Configuration\nSee [CONFIGURATION.md](https://github.com/canalguada/nicy/blob/master/CONFIGURATION.md) file.\n\n## TODO\n* Implement `install` missing subcommand.\n* Fix Debian and Archlinux packaging.\n* Provide tests and document code.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanalguada%2Fnicy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanalguada%2Fnicy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanalguada%2Fnicy/lists"}