From 1574570ea1bfd906d677c5651c50708726bde1a5 Mon Sep 17 00:00:00 2001 From: Michael Trommer Date: Sat, 10 Oct 2026 21:42:29 +0200 Subject: [PATCH 1/5] Add Nix flake --- flake.nix | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 flake.nix diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ad5f4d6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,52 @@ +{ + description = "A flock of birds in your terminal"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs }: + let + systems = [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + in + { + packages = forAllSystems (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + default = self.packages.${system}.cbirds; + + cbirds = pkgs.stdenv.mkDerivation { + pname = "cbirds"; + version = "1.6.0"; + src = pkgs.lib.cleanSource self; + + nativeBuildInputs = [ pkgs.installShellFiles ]; + makeFlags = [ "PREFIX=$(out)" ]; + + doCheck = true; + checkTarget = "test"; + + postInstall = '' + installShellCompletion --cmd cbirds \ + --bash <($out/bin/cbirds --completion bash) \ + --zsh <($out/bin/cbirds --completion zsh) \ + --fish <($out/bin/cbirds --completion fish) + ''; + + meta = { + description = "A flock of birds in your terminal"; + homepage = "https://github.com/clainstone/cbirds"; + license = pkgs.lib.licenses.mit; + mainProgram = "cbirds"; + platforms = systems; + }; + }; + }); + }; +} From 24a9f68419deeca0277730731e2d838d022b9d89 Mon Sep 17 00:00:00 2001 From: Michael Trommer Date: Sat, 10 Oct 2026 21:59:01 +0200 Subject: [PATCH 2/5] document running cbirds with Nix flakes --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index e09a948..cbe2af8 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,23 @@ Or just the package, without the repository and so without updates: the `.deb` files are on the [release page](https://github.com/clainstone/cbirds/releases/latest), for `sudo apt install ./cbirds_*.deb`. +### Nix flake + +Linux and macOS, on x86_64 and aarch64. With Nix and the `nix-command` and +`flakes` experimental features enabled, run directly from this fork: + +```sh +nix run github:entropie/cbirds +``` + +Pass cbirds options after `--`, for example for sprites in Kitty or Ghostty: + +```sh +nix run github:entropie/cbirds -- --render kitty --hawks 2 --color ice +``` + +From a local checkout of this fork, use `nix run .`. + ### From source ``` From 83510ab738b37d6a4fa0c7834c34fd2167b5bd61 Mon Sep 17 00:00:00 2001 From: Michael Trommer Date: Sat, 10 Oct 2026 22:01:48 +0200 Subject: [PATCH 3/5] fix: add flake.lock for reproducible builds --- flake.lock | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 flake.lock diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..416bfe1 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1791456040, + "narHash": "sha256-H83yz/do+hjOO0uujHyH8RgtIQP2v7Mw+cLwcZK/xKc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e7439b6b14ad3cc35d05608ebca9bce01a25f5f8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} From 13d1580c3e02db79421f318684e5064a47050a76 Mon Sep 17 00:00:00 2001 From: Michael Trommer Date: Sat, 10 Oct 2026 22:10:49 +0200 Subject: [PATCH 4/5] point Nix commands to upstream repository --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cbe2af8..8403a87 100644 --- a/README.md +++ b/README.md @@ -87,13 +87,13 @@ Linux and macOS, on x86_64 and aarch64. With Nix and the `nix-command` and `flakes` experimental features enabled, run directly from this fork: ```sh -nix run github:entropie/cbirds +nix run github:clainstone/cbirds ``` Pass cbirds options after `--`, for example for sprites in Kitty or Ghostty: ```sh -nix run github:entropie/cbirds -- --render kitty --hawks 2 --color ice +nix run github:clainstone/cbirds -- --render kitty --hawks 2 --color ice ``` From a local checkout of this fork, use `nix run .`. From 1736bb41a20ca8349aed7361909beb1dd897227d Mon Sep 17 00:00:00 2001 From: Alessandro Palliccia <115735120+clainstone@users.noreply.github.com> Date: Tue, 13 Oct 2026 23:10:11 +0000 Subject: [PATCH 5/5] Nix flake: version from boids.c, no Intel macOS, this repository --- README.md | 7 ++++--- flake.nix | 11 +++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8403a87..d88f8a0 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,9 @@ for `sudo apt install ./cbirds_*.deb`. ### Nix flake -Linux and macOS, on x86_64 and aarch64. With Nix and the `nix-command` and -`flakes` experimental features enabled, run directly from this fork: +Linux on x86_64 and aarch64, macOS on Apple silicon. With Nix and the +`nix-command` and `flakes` experimental features enabled, run directly from +this repository: ```sh nix run github:clainstone/cbirds @@ -96,7 +97,7 @@ Pass cbirds options after `--`, for example for sprites in Kitty or Ghostty: nix run github:clainstone/cbirds -- --render kitty --hawks 2 --color ice ``` -From a local checkout of this fork, use `nix run .`. +From a local checkout of this repository, use `nix run .`. ### From source diff --git a/flake.nix b/flake.nix index ad5f4d6..9d08e1b 100644 --- a/flake.nix +++ b/flake.nix @@ -8,10 +8,17 @@ systems = [ "x86_64-linux" "aarch64-linux" - "x86_64-darwin" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs systems; + # The version cbirds --version prints, so it moves with each release + version = nixpkgs.lib.pipe ./boids.c [ + builtins.readFile + (nixpkgs.lib.splitString "\n") + (map (builtins.match "#define CBIRDS_VERSION \"(.*)\"")) + (nixpkgs.lib.findFirst (m: m != null) null) + builtins.head + ]; in { packages = forAllSystems (system: @@ -23,7 +30,7 @@ cbirds = pkgs.stdenv.mkDerivation { pname = "cbirds"; - version = "1.6.0"; + inherit version; src = pkgs.lib.cleanSource self; nativeBuildInputs = [ pkgs.installShellFiles ];