Merge pull request 'lib: move modules into a toplevel folder' (#5610) from lib-modules into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/5610
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
clanServices/.* @pinpox @kenji
|
||||
|
||||
lib/test/container-test-driver/.* @DavHau @mic92
|
||||
lib/modules/inventory/.* @hsjobeki
|
||||
lib/modules/inventoryClass/.* @hsjobeki
|
||||
lib/inventory/.* @hsjobeki
|
||||
lib/inventoryClass/.* @hsjobeki
|
||||
|
||||
modules/.* @hsjobeki
|
||||
|
||||
pkgs/clan-app/ui/.* @hsjobeki @brianmcgee
|
||||
pkgs/clan-app/clan_app/.* @qubasa @hsjobeki
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
(
|
||||
{ ... }:
|
||||
{
|
||||
debug = true;
|
||||
clan = {
|
||||
meta.name = "clan-core";
|
||||
inventory = {
|
||||
@@ -98,6 +99,7 @@
|
||||
./lib/filter-clan-core/flake-module.nix
|
||||
./lib/flake-module.nix
|
||||
./lib/flake-parts/clan-nixos-test.nix
|
||||
./modules/flake-module.nix
|
||||
./nixosModules/clanCore/vars/flake-module.nix
|
||||
./nixosModules/flake-module.nix
|
||||
./pkgs/clan-cli/clan_cli/tests/flake-module.nix
|
||||
|
||||
@@ -16,10 +16,10 @@ lib.fix (
|
||||
*/
|
||||
callLib = file: args: import file ({ inherit lib clanLib; } // args);
|
||||
|
||||
evalService = clanLib.callLib ./modules/inventory/distributed-service/evalService.nix { };
|
||||
evalService = clanLib.callLib ./evalService.nix { };
|
||||
# ------------------------------------
|
||||
# ClanLib functions
|
||||
inventory = clanLib.callLib ./modules/inventory { };
|
||||
inventory = clanLib.callLib ./inventory { };
|
||||
test = clanLib.callLib ./test { };
|
||||
flake-inputs = clanLib.callLib ./flake-inputs.nix { };
|
||||
# Custom types
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
lib ? import <nixpkgs/lib>,
|
||||
}:
|
||||
let
|
||||
clanLibOrig = (import ./.. { inherit lib; }).__unfix__;
|
||||
clanLibOrig = (import ./. { inherit lib; }).__unfix__;
|
||||
clanLibWithFs =
|
||||
{ virtual_fs }:
|
||||
lib.fix (
|
||||
@@ -11,19 +11,19 @@ let
|
||||
let
|
||||
clan-core = {
|
||||
clanLib = final;
|
||||
modules.clan.default = lib.modules.importApply ./clan { inherit clan-core; };
|
||||
modules.clan.default = lib.modules.importApply ../modules/clan { inherit clan-core; };
|
||||
|
||||
# Note: Can add other things to "clan-core"
|
||||
# ... Not needed for this test
|
||||
};
|
||||
in
|
||||
{
|
||||
clan = import ../clan {
|
||||
clan = import ./clan {
|
||||
inherit lib clan-core;
|
||||
};
|
||||
|
||||
# Override clanLib.fs for unit-testing against a virtual filesystem
|
||||
fs = import ../clanTest/virtual-fs.nix { inherit lib; } {
|
||||
fs = import ./clanTest/virtual-fs.nix { inherit lib; } {
|
||||
inherit rootPath virtual_fs;
|
||||
# Example of a passthru
|
||||
# passthru = [
|
||||
@@ -17,9 +17,9 @@ lib.evalModules {
|
||||
specialArgs._ctx = prefix;
|
||||
modules = [
|
||||
# Base module
|
||||
./service-module.nix
|
||||
./inventory/distributed-service/service-module.nix
|
||||
# Feature modules
|
||||
(lib.modules.importApply ./api-feature.nix {
|
||||
(lib.modules.importApply ./inventory/distributed-service/api-feature.nix {
|
||||
inherit clanLib prefix;
|
||||
})
|
||||
]
|
||||
@@ -10,12 +10,11 @@ in
|
||||
rec {
|
||||
# TODO: automatically generate this from the directory conventions
|
||||
imports = [
|
||||
./modules/flake-module.nix
|
||||
./clanTest/flake-module.nix
|
||||
./introspection/flake-module.nix
|
||||
./modules/inventory/flake-module.nix
|
||||
./jsonschema/flake-module.nix
|
||||
./types/flake-module.nix
|
||||
./inventory/flake-module.nix
|
||||
];
|
||||
flake.clanLib =
|
||||
let
|
||||
@@ -78,9 +77,6 @@ rec {
|
||||
../lib
|
||||
(lib.fileset.fileFilter (file: file.name == "flake-module.nix") ../.)
|
||||
../flakeModules
|
||||
# ../../nixosModules/clanCore
|
||||
# ../../machines
|
||||
# ../../inventory.json
|
||||
];
|
||||
};
|
||||
in
|
||||
@@ -101,6 +97,36 @@ rec {
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
|
||||
# Run: nix-unit --extra-experimental-features flakes --flake .#legacyPackages.x86_64-linux.evalTests-build-clan
|
||||
legacyPackages.evalTests-build-clan = import ./tests.nix {
|
||||
inherit lib;
|
||||
clan-core = self;
|
||||
};
|
||||
checks = {
|
||||
eval-lib-build-clan = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
|
||||
export HOME="$(realpath .)"
|
||||
|
||||
nix-unit --eval-store "$HOME" \
|
||||
--extra-experimental-features flakes \
|
||||
--show-trace \
|
||||
${inputOverrides} \
|
||||
--flake ${
|
||||
self.filter {
|
||||
include = [
|
||||
"flakeModules"
|
||||
"inventory.json"
|
||||
"lib"
|
||||
"machines"
|
||||
"nixosModules"
|
||||
"modules"
|
||||
];
|
||||
}
|
||||
}#legacyPackages.${system}.evalTests-build-clan
|
||||
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ in
|
||||
inventoryModule = {
|
||||
_file = "clanLib.inventory.module";
|
||||
imports = [
|
||||
../inventoryClass/inventory.nix
|
||||
../../modules/inventoryClass/inventory.nix
|
||||
];
|
||||
_module.args = { inherit clanLib; };
|
||||
};
|
||||
@@ -13,16 +13,17 @@ in
|
||||
let
|
||||
# Common filtered source for inventory tests
|
||||
inventoryTestsSrc = lib.fileset.toSource {
|
||||
root = ../../../..;
|
||||
root = ../../..;
|
||||
fileset = lib.fileset.unions [
|
||||
../../../../flake.nix
|
||||
../../../../flake.lock
|
||||
(lib.fileset.fileFilter (file: file.name == "flake-module.nix") ../../../..)
|
||||
../../../../flakeModules
|
||||
../../../../lib
|
||||
../../../../nixosModules/clanCore
|
||||
../../../../machines
|
||||
../../../../inventory.json
|
||||
../../../flake.nix
|
||||
../../../flake.lock
|
||||
(lib.fileset.fileFilter (file: file.name == "flake-module.nix") ../../..)
|
||||
../../../flakeModules
|
||||
../../../lib
|
||||
../../../nixosModules/clanCore
|
||||
../../../machines
|
||||
../../../inventory.json
|
||||
../../../modules
|
||||
];
|
||||
};
|
||||
in
|
||||
@@ -1,58 +0,0 @@
|
||||
{
|
||||
self,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inputOverrides = self.clanLib.flake-inputs.getOverrides inputs;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./clan/flake-module.nix
|
||||
];
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
system,
|
||||
...
|
||||
}:
|
||||
let
|
||||
jsonDocs = import ./eval-docs.nix {
|
||||
inherit pkgs lib;
|
||||
clan-core = self;
|
||||
};
|
||||
in
|
||||
{
|
||||
legacyPackages.clan-options = jsonDocs.optionsJSON;
|
||||
|
||||
# Run: nix-unit --extra-experimental-features flakes --flake .#legacyPackages.x86_64-linux.evalTests-build-clan
|
||||
legacyPackages.evalTests-build-clan = import ./tests.nix {
|
||||
inherit lib;
|
||||
clan-core = self;
|
||||
};
|
||||
checks = {
|
||||
eval-lib-build-clan = pkgs.runCommand "tests" { nativeBuildInputs = [ pkgs.nix-unit ]; } ''
|
||||
export HOME="$(realpath .)"
|
||||
|
||||
nix-unit --eval-store "$HOME" \
|
||||
--extra-experimental-features flakes \
|
||||
--show-trace \
|
||||
${inputOverrides} \
|
||||
--flake ${
|
||||
self.filter {
|
||||
include = [
|
||||
"flakeModules"
|
||||
"inventory.json"
|
||||
"lib"
|
||||
"machines"
|
||||
"nixosModules"
|
||||
];
|
||||
}
|
||||
}#legacyPackages.${system}.evalTests-build-clan
|
||||
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -62,6 +62,9 @@
|
||||
# Core libraries
|
||||
(root + "/lib")
|
||||
|
||||
# modules directory
|
||||
(root + "/modules")
|
||||
|
||||
# User-provided fileset
|
||||
fileset
|
||||
];
|
||||
|
||||
@@ -105,7 +105,7 @@ in
|
||||
self = {
|
||||
inputs = { };
|
||||
};
|
||||
directory = ../../.;
|
||||
directory = ../.;
|
||||
meta.name = "test-clan-core";
|
||||
};
|
||||
in
|
||||
@@ -123,7 +123,7 @@ in
|
||||
self = {
|
||||
inputs = { };
|
||||
};
|
||||
directory = ../../.;
|
||||
directory = ../.;
|
||||
meta.name = "test-clan-core";
|
||||
};
|
||||
in
|
||||
24
modules/flake-module.nix
Normal file
24
modules/flake-module.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
self,
|
||||
...
|
||||
}:
|
||||
{
|
||||
imports = [
|
||||
./clan/flake-module.nix
|
||||
];
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
jsonDocs = import ./eval-docs.nix {
|
||||
inherit pkgs lib;
|
||||
clan-core = self;
|
||||
};
|
||||
in
|
||||
{
|
||||
legacyPackages.clan-options = jsonDocs.optionsJSON;
|
||||
};
|
||||
}
|
||||
@@ -21,6 +21,7 @@
|
||||
"clanModules"
|
||||
"flakeModules"
|
||||
"lib"
|
||||
"modules"
|
||||
"nixosModules"
|
||||
"flake.lock"
|
||||
"templates"
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
_file = "docs flake-module";
|
||||
imports = [
|
||||
{ _module.args = { inherit clanLib; }; }
|
||||
(import ../../lib/modules/inventoryClass/roles-interface.nix {
|
||||
(import ../../modules/inventoryClass/roles-interface.nix {
|
||||
nestedSettingsOption = mkOption {
|
||||
type = types.raw;
|
||||
description = ''
|
||||
|
||||
Reference in New Issue
Block a user