-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.nix
33 lines (22 loc) · 907 Bytes
/
make.nix
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
{ lib, ... } @ args: let
inherit (builtins) pathExists;
inherit (lib) concatStringsSep throwIf;
in rec {
# Imports a package source and returns a package set.
mkPkgs = sourcePkgs: { system, unfree ? false, overlays ? [ ] }: import sourcePkgs {
inherit system overlays;
config.allowUnfree = unfree;
};
# Imports a package source and returns a package set with unfree packages enabled.
mkUnfreePkgs = sourcePkgs: { system, overlays ? [ ] }: let
unfreePkgs = mkPkgs sourcePkgs {
inherit system overlays;
unfree = true;
};
in unfreePkgs;
# Creates a full path from a source path and a sub path. Throws the given error if the path does not exist.
mkPath = sourcePath: subPath: notFoundError: let
fullPath = concatStringsSep "/" [sourcePath subPath];
isMissing = (! pathExists fullPath);
in (throwIf isMissing notFoundError fullPath);
}