{"id":13608303,"url":"https://github.com/ners/nix-monitored","last_synced_at":"2025-03-16T15:30:41.328Z","repository":{"id":104277105,"uuid":"581076762","full_name":"ners/nix-monitored","owner":"ners","description":"A transparent wrapper around Nix that pipes its output through Nix Output Monitor","archived":false,"fork":false,"pushed_at":"2024-05-06T17:35:34.000Z","size":48,"stargazers_count":19,"open_issues_count":3,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-12T00:24:04.054Z","etag":null,"topics":["nix","nix-darwin","nixos"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ners.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-12-22T08:00:59.000Z","updated_at":"2024-06-12T22:33:26.000Z","dependencies_parsed_at":"2024-02-17T12:26:20.621Z","dependency_job_id":"999e8d6e-5bac-4ca4-bd9b-03a214506d81","html_url":"https://github.com/ners/nix-monitored","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ners%2Fnix-monitored","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ners%2Fnix-monitored/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ners%2Fnix-monitored/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ners%2Fnix-monitored/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ners","download_url":"https://codeload.github.com/ners/nix-monitored/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221665170,"owners_count":16860187,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["nix","nix-darwin","nixos"],"created_at":"2024-08-01T19:01:26.224Z","updated_at":"2024-10-27T10:49:08.107Z","avatar_url":"https://github.com/ners.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# nix-monitored\n\nPipe Nix through Nix Output Monitor without hassle.\n\n![](https://github.com/maralorn/nix-output-monitor/raw/main/example-screenshot.png)\n\n## Motivation\n\nEveryone I know wants to have nom's pretty output, but no one I know remembers to put `|\u0026 nom` after every command.\nFurther, nix-monitored can integrate with direnv and nixos-rebuild, which is difficult to do without overriding the Nix package.\n\n### Shouldn't this be a shell script / `wrapProgram` / etc.?\n\nThe reasons it is C++ rather than a shell wrapper are:\n - It runs on every Nix invocation, so overhead should be minimal.\n - Building C++ is trivial with `stdenv`.\n - Nix itself is written in C++, so it should be easier to maintain.\n - Bash is notoriously terrible with string / parameter manipulation. The first version of this wrapper was Bash, and I kept running into weird string splitting errors, despite using `\"$@\"`.\n\n### Shouldn't this be upstreamed into Nix?\n\nI don't think so.\n\nThe Nix project has a stated mission of having low a runtime and dependencies. That's why it was authored in C++ and not something more respectable like Haskell. This design goal makes Nix attractive in a wide range of applications, e.g. on embedded devices with limited resources.\n\nNix Output Monitor does not share this design goal, and is therefore more resource heavy. In fact introducing any kind of fanciness in the Nix CLI, even with C++ or Rust, would likely increase Nix' runtime and dependency footprint.\n\nWith a wrapper like this, we can have our cake and eat it too: Nix stays appreciably small, but we can still use Nix Output Monitor on developer workstations if we wish. It's a win-win.\n\n## Usage\n\nOn NixOS and nix-darwin, simply replace your `nix.package`, like so:\n```nix\nnix.package = pkgs.nix-monitored;\n```\n\nTo make it work with `nix-direnv` and `nixos-rebuild`, we can override those packages:\n```nix\nnixpkgs.overlays = [\n  (self: super: {\n    nixos-rebuild = super.nixos-rebuild.override {\n      nix = super.nix-monitored;\n    };\n    nix-direnv = super.nix-direnv.override {\n      nix = super.nix-monitored;\n    };\n  })\n];\n```\n\nIf you're feeling adventurous, you can also simply try to override the Nix package entirely:\n```nix\nnixpkgs.overlays = [\n  (self: super: {\n    nix = super.nix-monitored.override {\n\t  inherit (super) nix;\n    };\n  })\n];\n```\n\nA PR is in the works to bring this to NixOS as a module: [NixOS/nixpkgs#207108](https://github.com/NixOS/nixpkgs/pull/207108).\n\n## Does it work?\n\nThe wrapper should work at least with the following tools:\n - nix commands on the CLI, with and without flakes\n - nix-direnv\n - nixos-rebuild\n\nIt's been tested on both NixOS and macOS.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fners%2Fnix-monitored","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fners%2Fnix-monitored","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fners%2Fnix-monitored/lists"}