ark/lib/flake.nix

82 lines
1.8 KiB
Nix
Raw Normal View History

2021-04-02 05:10:24 +03:00
{
description = "DevOS environment configuriguration library.";
inputs =
{
deploy.url = "github:serokell/deploy-rs";
deploy.inputs = {
2021-04-19 01:23:27 +03:00
utils.follows = "utils";
2021-04-02 05:10:24 +03:00
};
devshell.url = "github:numtide/devshell";
2021-04-19 01:23:27 +03:00
utils.url = "github:numtide/flake-utils";
2021-04-02 05:10:24 +03:00
};
2021-04-19 01:23:27 +03:00
outputs = inputs@{ self, nixpkgs, deploy, devshell, utils, ... }: let
2021-04-02 05:10:24 +03:00
inherit (nixpkgs) lib;
# We work with a combined lib, internally ...
combinedLib = lib.extend (final: prev:
let callLibs = file: import file
({
lib = final;
2021-04-18 04:46:20 +03:00
userFlakeInputs = {}; # TODO: Erm, this must become a proper argument to mkFlake
2021-04-02 05:10:24 +03:00
} // inputs);
in
with final;
2021-04-19 01:40:57 +03:00
let
attrs = callLibs ./attrs.nix;
lists = callLibs ./lists.nix;
strings = callLibs ./strings.nix;
in
2021-04-02 05:10:24 +03:00
{
inherit callLibs;
os = callLibs ./devos;
mkFlake = {
__functor = callLibs ./mkFlake;
evalArgs = callLibs ./mkFlake/evalArgs.nix;
evalOldArgs = callLibs ./mkFlake/evalOldArgs.nix;
};
pkgs-lib = callLibs ./pkgs-lib;
inherit (attrs) mapFilterAttrs genAttrs' safeReadDir
pathsToImportedAttrs concatAttrs filterPackages;
inherit (lists) pathsIn;
inherit (strings) rgxToString;
});
2021-04-19 01:23:27 +03:00
in
{
2021-04-02 05:10:24 +03:00
# ... but don't force that choice onto the user
lib = {
mkFlake = combinedLib.mkFlake;
pkgs-lib = combinedLib.pkgs-lib;
};
2021-04-19 01:23:27 +03:00
}
//
utils.lib.eachDefaultSystem (system:
let
nixpkgs' = import nixpkgs { inherit system; overlays = []; config = {}; };
2021-04-02 05:10:24 +03:00
in
{
2021-04-19 01:23:27 +03:00
checks = {
tests = import ./tests {
inherit (nixpkgs') pkgs;
lib = combinedLib;
};
2021-04-02 05:10:24 +03:00
};
}
2021-04-19 01:23:27 +03:00
);
2021-04-02 05:10:24 +03:00
}