aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/populate/default.nix
blob: fe8de4ee7ecc2dd9825812d35c2e3d48f1a2d87d (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
# Populate, which delivers sources to a target directory.  Given populate's
# arguments, it returns the command delivering them.  implementation selects
# how: "shell" generates a script from the arguments, "rust" runs the
# program in this directory with the arguments as JSON.  rustProgram is that
# program, e.g. one built with cargo during development.
{ coreutils, dash, findutils, git, jq, nix, openssh, pass, passage, rsync
, writers
, implementation ? "shell"
, rustPlatform ? null
, rustProgram ? import ./program.nix { inherit rustPlatform; }
}:

if implementation == "shell" then
  import ./shell.nix {
    inherit coreutils dash findutils git jq nix openssh pass passage rsync
      writers;
  }
else if implementation == "rust" then
  import ./rust.nix {
    inherit coreutils findutils git jq nix openssh pass passage rsync writers;
    program = rustProgram;
  }
else
  throw "populate: unknown implementation ${builtins.toJSON implementation}"