summaryrefslogtreecommitdiffstats
path: root/cli/package.nix
blob: 0f5b7ededd3f1bf795341716f4feb3d585eb689c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{
  lib,
  rustPlatform,
  enableMulticall ? true,
}:
rustPlatform.buildRustPackage (finalAttrs: {
  pname = "hjem-cli";
  version = "0.1.0";

  src = let
    fs = lib.fileset;
    s = ./.;
  in
    fs.toSource {
      root = s;
      fileset = fs.unions [
        (s + /crates)
        (s + /Cargo.lock)
        (s + /Cargo.toml)
      ];
    };

  cargoLock.lockFile = "${finalAttrs.src}/Cargo.lock";
  cargoBuildFlags = ["-p" "hjem"];
  cargoCheckFlags = ["-p" "hjem"];

  postInstall = lib.optionalString enableMulticall ''
    for name in "hjem-standalone" "hjem-internal"; do
      ln -s "$out/bin/hjem" "$out/bin/$name"
    done
  '';

  meta = {
    description = "Hjem standalone CLI";
    license = lib.licenses.mpl20;
    mainProgram = "hjem";
    maintainers = [lib.teams.feel-co];
    platforms = lib.platforms.unix;
  };
})