configs
1# Generated by lon. Do not modify!
2let
3
4 lock = builtins.fromJSON (builtins.readFile ./lon.lock);
5
6 # Override with a path defined in an environment variable. If no variable is
7 # set, the original path is used.
8 overrideFromEnv =
9 name: path:
10 let
11 replacement = builtins.getEnv "LON_OVERRIDE_${name}";
12 in
13 if replacement == "" then
14 path
15 else
16 # this turns the string into an actual Nix path (for both absolute and
17 # relative paths)
18 if builtins.substring 0 1 replacement == "/" then
19 /. + replacement
20 else
21 /. + builtins.getEnv "PWD" + "/${replacement}";
22
23 fetchSource =
24 args@{ fetchType, ... }:
25 if fetchType == "git" then
26 builtins.fetchGit (
27 {
28 url = args.url;
29 ref = args.branch;
30 rev = args.revision;
31 narHash = args.hash;
32 submodules = args.submodules;
33 }
34 // (
35 if args ? lastModified then
36 {
37 inherit (args) lastModified;
38 shallow = true;
39 }
40 else
41 { }
42 )
43 )
44 else if fetchType == "tarball" then
45 builtins.fetchTarball {
46 url = args.url;
47 sha256 = args.hash;
48 }
49 else
50 builtins.throw "Unsupported source type ${fetchType}";
51
52in
53builtins.mapAttrs (name: args: overrideFromEnv name (fetchSource args)) lock.sources