about summary refs log tree commit diff
path: root/nixpkgs/pkgs/desktops/pantheon/update.nix
blob: 7e9aacc0c2b27e3c79351bef3e256c1606f9c366 (plain) (blame)
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
{ runCommand
, nix
, bash
, git
, jq
, nix-prefetch-scripts
, coreutils
, common-updater-scripts
, gnugrep
, gnused
, curl
}:

{ repoName
, attrPath ? repoName
, versionPolicy ? "release"
}:

let
  script = ./update.sh;

  updateScript = runCommand "update.sh" {
    inherit bash git jq nix coreutils gnugrep gnused curl;
    # These weren't being substituted
    nix_prefetch_scripts = nix-prefetch-scripts;
    common_updater_scripts = common-updater-scripts;
  } ''
    substituteAll ${script} $out
    chmod +x $out
  '';

  throwFlag = throw "${versionPolicy} is not a valid versionPolicy - Options are either 'release' or 'master' (defaults to release).";

  versionFlag = { "release" = "-r"; "master" = "-m"; }.${versionPolicy} or throwFlag;

in [ updateScript versionFlag repoName attrPath ]