modules: fix consistent nixpkgs and nix-darwin injection
This commit is contained in:
@@ -1,34 +1,34 @@
|
|||||||
clan-core:
|
clan-core:
|
||||||
|
# Downstream flake arguments
|
||||||
{
|
{
|
||||||
|
self,
|
||||||
|
inputs,
|
||||||
config,
|
config,
|
||||||
lib,
|
lib,
|
||||||
self,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib) types;
|
inherit (lib) types;
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# Backwards compatibility
|
# Backwards compatibility
|
||||||
imports = [
|
imports = [
|
||||||
(lib.mkRenamedOptionModule [ "clan" ] [ "flake" "clan" ])
|
(lib.mkRenamedOptionModule [ "clan" ] [ "flake" "clan" ])
|
||||||
];
|
];
|
||||||
# Our module is completely public, so we dont need to map it
|
|
||||||
# Mapped top level outputs
|
|
||||||
options.flake = {
|
options.flake = {
|
||||||
# Backwards compat
|
# CLI compat
|
||||||
clanInternals = lib.mkOption {
|
clanInternals = lib.mkOption {
|
||||||
description = "Internals as needed by the clan cli.";
|
description = "Stable nix interface interacted by the clan cli.";
|
||||||
default = config.flake.clan.clanInternals;
|
default = config.flake.clan.clanInternals;
|
||||||
};
|
};
|
||||||
# The one and only clan module
|
# The clan module
|
||||||
clan = lib.mkOption {
|
clan = lib.mkOption {
|
||||||
description = "The evaluated clan module";
|
description = "Clan module. Define your clan inside here";
|
||||||
default = { };
|
default = { };
|
||||||
type = types.submoduleWith {
|
type = types.submoduleWith {
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit self;
|
inherit self;
|
||||||
|
inherit (inputs) nixpkgs nix-darwin;
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
clan-core.modules.clan.default
|
clan-core.modules.clan.default
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
_module.args = {
|
_module.args = {
|
||||||
inherit clan-core;
|
inherit clan-core;
|
||||||
inherit (clan-core) clanLib;
|
inherit (clan-core) clanLib;
|
||||||
# TODO: This should be set via an option otherwise it is not possible to override
|
|
||||||
inherit (clan-core.inputs) nixpkgs nix-darwin;
|
|
||||||
};
|
};
|
||||||
imports = [
|
imports = [
|
||||||
./module.nix
|
./module.nix
|
||||||
|
|||||||
@@ -165,7 +165,6 @@ in
|
|||||||
config = {
|
config = {
|
||||||
inventory.modules = clan-core.clanModules;
|
inventory.modules = clan-core.clanModules;
|
||||||
inventory._legacyModules = clan-core.clanModules;
|
inventory._legacyModules = clan-core.clanModules;
|
||||||
# Merge the meta attributes from the buildClan function
|
|
||||||
inventory.meta = config.meta;
|
inventory.meta = config.meta;
|
||||||
|
|
||||||
outputs.moduleForMachine = lib.mkMerge [
|
outputs.moduleForMachine = lib.mkMerge [
|
||||||
|
|||||||
@@ -7,18 +7,27 @@
|
|||||||
}:
|
}:
|
||||||
rec {
|
rec {
|
||||||
buildClan =
|
buildClan =
|
||||||
module: lib.warn "'buildClan' is deprecated. Use 'clan-core.lib.clan' instead" (clan module).config;
|
# TODO: Once all templates and docs are migrated add: lib.warn "'buildClan' is deprecated. Use 'clan-core.lib.clan' instead"
|
||||||
|
module: (clan module).config;
|
||||||
|
|
||||||
clan =
|
clan =
|
||||||
{
|
{
|
||||||
self ? lib.warn "Argument: 'self' must be set when using 'buildClan'." null, # Reference to the current flake
|
self ? lib.warn "Argument: 'self' must be set" null, # Reference to the current flake
|
||||||
...
|
...
|
||||||
}@m:
|
}@m:
|
||||||
|
let
|
||||||
|
nixpkgs = self.inputs.nixpkgs or clan-core.inputs.nixpkgs;
|
||||||
|
nix-darwin = self.inputs.nix-darwin or clan-core.inputs.nix-darwin;
|
||||||
|
in
|
||||||
lib.evalModules {
|
lib.evalModules {
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit
|
inherit
|
||||||
self
|
self
|
||||||
;
|
;
|
||||||
|
inherit
|
||||||
|
nixpkgs
|
||||||
|
nix-darwin
|
||||||
|
;
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
m
|
m
|
||||||
|
|||||||
Reference in New Issue
Block a user