From 51eb7bd0b50dbff14dad227231c1f347e3c83e2f Mon Sep 17 00:00:00 2001 From: a-kenji Date: Sat, 26 Jul 2025 14:00:39 +0200 Subject: [PATCH] pkgs/cli/create: Show less output by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This masks the output of `nix flake update`, since it is quite verbose and takes attention away to usually more interesting and pressing information. Example: ``` unpacking 'https://git.clan.lol/clan/clan-core/archive/main.tar.gz' into the Git cache... warning: creating lock file "/tmp/hoowowo/clan/flake.lock": • Added input 'clan-core': 'https://git.clan.lol/api/v1/repos/clan/clan-core/archive/1d8ac7b1b5aa6bdaf95f07722f1f1ae5c010bf4b.tar.gz?narHash=sha256-eBxi0ZMwaALfMsP70N0FRMlOSq0qePv%2BjebVBHXlOqk%3D' (2025-07-25) • Added input 'clan-core/data-mesher': 'https://git.clan.lol/api/v1/repos/clan/data-mesher/archive/18dfd42bdb2cfff510b8c74206005f733e38d8b9.tar.gz?narHash=sha256-jyoEbaXa8/MwVQ%2BPajUdT63y3gYhgD9o7snO/SLaikw%3D' (2025-07-21) • Added input 'clan-core/data-mesher/flake-parts': follows 'clan-core/flake-parts' • Added input 'clan-core/data-mesher/nixpkgs': follows 'clan-core/nixpkgs' • Added input 'clan-core/data-mesher/treefmt-nix': follows 'clan-core/treefmt-nix' • Added input 'clan-core/disko': 'github:nix-community/disko/545aba02960caa78a31bd9a8709a0ad4b6320a5c?narHash=sha256-7lrVrE0jSvZHrxEzvnfHFE/Wkk9DDqb%2BmYCodI5uuB8%3D' (2025-07-21) • Added input 'clan-core/disko/nixpkgs': follows 'clan-core/nixpkgs' • Added input 'clan-core/flake-parts': 'github:hercules-ci/flake-parts/644e0fc48951a860279da645ba77fe4a6e814c5e?narHash=sha256-TVcTNvOeWWk1DXljFxVRp%2BE0tzG1LhrVjOGGoMHuXio%3D' (2025-07-21) • Added input 'clan-core/flake-parts/nixpkgs-lib': follows 'clan-core/nixpkgs' • Added input 'clan-core/nix-darwin': 'github:nix-darwin/nix-darwin/e04a388232d9a6ba56967ce5b53a8a6f713cdfcf?narHash=sha256-HsJM3XLa43WpG%2B665aGEh8iS8AfEwOIQWk3Mke3e7nk%3D' (2025-06-30) • Added input 'clan-core/nix-darwin/nixpkgs': follows 'clan-core/nixpkgs' • Added input 'clan-core/nix-select': 'https://git.clan.lol/api/v1/repos/clan/nix-select/archive/69d8bf596194c5c35a4e90dd02c52aa530caddf8.tar.gz?narHash=sha256-IVaoOGDIvAa/8I0sdiiZuKptDldrkDWUNf/%2BezIRhyc%3D' (2025-04-18) • Added input 'clan-core/nixos-facter-modules': 'github:nix-community/nixos-facter-modules/14df13c84552a7d1f33c1cd18336128fbc43f920?narHash=sha256-uP9Xxw5XcFwjX9lNoYRpybOnIIe1BHfZu5vJnnPg3Jc%3D' (2025-06-20) • Added input 'clan-core/nixpkgs': 'https://releases.nixos.org/nixpkgs/nixpkgs-25.11pre827262.be9e214982e2/nixexprs.tar.xz?narHash=sha256-lUi%2BsPH7Kuh9uP3PyfgbENcJGReUM8Ffk9GxGBFbSN8%3D' (1980-01-01) • Added input 'clan-core/sops-nix': 'github:Mic92/sops-nix/2c8def626f54708a9c38a5861866660395bb3461?narHash=sha256-GllP7cmQu7zLZTs9z0J2gIL42IZHa9CBEXwBY9szT0U%3D' (2025-07-15) • Added input 'clan-core/sops-nix/nixpkgs': follows 'clan-core/nixpkgs' • Added input 'clan-core/systems': 'github:nix-systems/default/da67096a3b9bf56a91d16901293e51ba5b49a27e?narHash=sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768%3D' (2023-04-09) • Added input 'clan-core/treefmt-nix': 'github:numtide/treefmt-nix/421b56313c65a0815a52b424777f55acf0b56ddf?narHash=sha256-tzbhc4XttkyEhswByk5R38l%2BztN9UDbnj0cTcP6Hp9A%3D' (2025-07-20) • Added input 'clan-core/treefmt-nix/nixpkgs': follows 'clan-core/nixpkgs' • Added input 'flake-parts': 'github:hercules-ci/flake-parts/644e0fc48951a860279da645ba77fe4a6e814c5e?narHash=sha256-TVcTNvOeWWk1DXljFxVRp%2BE0tzG1LhrVjOGGoMHuXio%3D' (2025-07-21) • Added input 'flake-parts/nixpkgs-lib': follows 'clan-core/nixpkgs' • Added input 'nixpkgs': follows 'clan-core/nixpkgs' ``` Those are 48 lines that seldom carry actual useful information. This can be shown on running `clan flakes create` with the `--debug` flag. Closes: #4496 --- pkgs/clan-cli/clan_lib/clan/create.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/clan-cli/clan_lib/clan/create.py b/pkgs/clan-cli/clan_lib/clan/create.py index 4f636b263..20472f251 100644 --- a/pkgs/clan-cli/clan_lib/clan/create.py +++ b/pkgs/clan-cli/clan_lib/clan/create.py @@ -4,7 +4,7 @@ from dataclasses import dataclass from pathlib import Path from clan_lib.api import API -from clan_lib.cmd import RunOpts, run +from clan_lib.cmd import Log, RunOpts, run from clan_lib.dirs import clan_templates from clan_lib.errors import ClanError from clan_lib.flake import Flake @@ -104,7 +104,14 @@ def create_clan(opts: CreateOptions) -> None: run(git_command(dest, "config", "user.email", "clan@example.com")) if opts.update_clan: - run(nix_command(["flake", "update"]), RunOpts(cwd=dest)) + log.info("Updating flake.lock file...") + + debug_logging = Log.STDERR if log.isEnabledFor(logging.DEBUG) else Log.NONE + + run( + nix_command(["flake", "update"]), + RunOpts(cwd=dest, log=debug_logging), + ) flake.invalidate_cache() if opts.setup_git: