46 lines
1.5 KiB
Nix
46 lines
1.5 KiB
Nix
{
|
|
description = "Calculator with exact arithmetic, unit conversion and a programmer mode, as a CLI and TUI";
|
|
|
|
inputs.nixpkgs.url = "nixpkgs/master";
|
|
|
|
outputs = { self, nixpkgs }:
|
|
let
|
|
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
|
|
|
# Helper to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'.
|
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
|
in
|
|
{
|
|
packages = forAllSystems (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
tally = pkgs.callPackage ./nix/package.nix {
|
|
# Pinned deliberately rather than tracking `pkgs.zig`: build.zig.zon
|
|
# declares 0.16.0 as the minimum, and 0.16 was a large standard
|
|
# library refactor, so a newer default would not build unchanged.
|
|
zig = pkgs.zig_0_16;
|
|
# The git-tracked tree, which keeps .zig-cache, zig-out, zig-pkg and
|
|
# the Android build outputs out of the derivation.
|
|
src = self;
|
|
};
|
|
in
|
|
{
|
|
inherit tally;
|
|
default = tally;
|
|
});
|
|
|
|
devShells = forAllSystems (system:
|
|
let pkgs = nixpkgs.legacyPackages.${system};
|
|
in
|
|
{
|
|
# `nix develop` for the CLI/TUI without mise. The versions here are the
|
|
# same ones .mise.toml pins; the Android toolchain stays with mise.
|
|
default = pkgs.mkShell {
|
|
packages = [
|
|
pkgs.zig_0_16
|
|
pkgs.zls
|
|
];
|
|
};
|
|
});
|
|
};
|
|
}
|