Unverified Commit 2576304f authored by Daniel Woffinden's avatar Daniel Woffinden
Browse files

cgtcalc: init at 0-unstable-2025-10-11

Using upstream 1cf63741ddc0a5070680cb1339ad0abff0b7d69b, which is the
last to build with swift <6.

Not to be confused with cgt-calc, written in python.
parent 31633b82
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
# This file was generated by swiftpm2nix.
{
  workspaceStateFile = ./workspace-state.json;
  hashes = {
    "swift-argument-parser" = "sha256-lWQ9mzfRxHcy00Cqyrsm9rOlQzkpU1lNBmiK7MMp6dU=";
  };
}
+25 −0
Original line number Diff line number Diff line
{
  "object": {
    "artifacts": [],
    "dependencies": [
      {
        "basedOn": null,
        "packageRef": {
          "identity": "swift-argument-parser",
          "kind": "remoteSourceControl",
          "location": "https://github.com/apple/swift-argument-parser",
          "name": "swift-argument-parser"
        },
        "state": {
          "checkoutState": {
            "revision": "f3c9084a71ef4376f2fabbdf1d3d90a49f1fabdb",
            "version": "1.1.2"
          },
          "name": "sourceControlCheckout"
        },
        "subpath": "swift-argument-parser"
      }
    ]
  },
  "version": 6
}
+58 −0
Original line number Diff line number Diff line
{
  fetchFromGitHub,
  lib,
  nix-update-script,
  stdenv,
  swift,
  swiftPackages,
  swiftpm,
  swiftpm2nix,
}:
let
  generated = swiftpm2nix.helpers ./generated;
in
stdenv.mkDerivation (finalAttrs: {
  pname = "cgtcalc";
  version = "0-unstable-2025-10-11";

  src = fetchFromGitHub {
    owner = "mattjgalloway";
    repo = "cgtcalc";
    # Repo has no tags or releases.
    # This is the last commit before requiring Swift 6
    rev = "1cf63741ddc0a5070680cb1339ad0abff0b7d69b";
    hash = "sha256-+qgvl5y9ipVQIZlLZbkzkqb9bO7X9VGDvVsloOLZU/k=";
  };
  nativeBuildInputs = [
    swift
    swiftpm
  ];

  configurePhase = generated.configure;

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp $(swiftpmBinPath)/cgtcalc $out/bin/
    runHook postInstall
  '';

  buildInputs = [
    swiftPackages.XCTest
  ];

  # libIndexStore.so: cannot open shared object file: No such file or directory
  # https://github.com/NixOS/nixpkgs/issues/379859
  doCheck = false;

  passthru.updateScript = nix-update-script { };

  meta = {
    description = "UK capital gains tax calculator written in Swift";
    homepage = "https://github.com/mattjgalloway/cgtcalc";
    license = lib.licenses.mit;
    maintainers = [ lib.maintainers.dwoffinden ];
    mainProgram = "cgtcalc";
    platforms = lib.platforms.all;
  };
})