-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.nix
31 lines (27 loc) · 1.05 KB
/
utils.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
nixpkgs:
let
inherit (nixpkgs) lib;
# Caution! arch may be mismatched, but only use to get meta.platforms is fine
inherit (nixpkgs.legacyPackages.aarch64-darwin) callPackage;
in
rec {
ls = dir: builtins.attrNames (builtins.readDir dir);
pureName = pathList:
map (path: lib.strings.removeSuffix ".nix" path) pathList;
mkFileHierarchyAttrset = basedir: dirName:
lib.genAttrs (pureName (ls /.${basedir}/${dirName})) (path:
if builtins.pathExists /.${basedir}/${dirName}/${path}.nix then
import /.${basedir}/${dirName}/${path}.nix
else if builtins.pathExists
/.${basedir}/${dirName}/${path}/default.nix then
import /.${basedir}/${dirName}/${path}
else
mkFileHierarchyAttrset /.${basedir}/${dirName} path);
packagelist = pureName (ls ./pkgs);
getPkgPlatforms = name: (callPackage ./pkgs/${name} { }).meta.platforms;
getArchPkgs = arch:
builtins.filter
(name: builtins.any (platform: platform == arch) (getPkgPlatforms name))
packagelist;
oracle-serverlist = [ "jp1" "jp2" "us" "de" ];
}