Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ 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 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
```

Pass cbirds options after `--`, for example for sprites in Kitty or Ghostty:

```sh
nix run github:clainstone/cbirds -- --render kitty --hawks 2 --color ice
```

From a local checkout of this repository, use `nix run .`.

### From source

```
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
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"
"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:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = self.packages.${system}.cbirds;

cbirds = pkgs.stdenv.mkDerivation {
pname = "cbirds";
inherit version;
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;
};
};
});
};
}
Loading