diff --git a/lib/build-clan/module.nix b/lib/build-clan/module.nix index c777fd9e9..c20a28123 100644 --- a/lib/build-clan/module.nix +++ b/lib/build-clan/module.nix @@ -189,6 +189,10 @@ in ./computed-tags.nix ]; + specialArgs = { + self = lib.mkDefault config.self; + }; + # Ready to use configurations # These are only shallow wrapping the 'nixosModules' or 'darwinModules' with # lib.nixosSystem diff --git a/templates/clan/flake-parts/flake.nix b/templates/clan/flake-parts/flake.nix index 303293d1c..2d61576bc 100644 --- a/templates/clan/flake-parts/flake.nix +++ b/templates/clan/flake-parts/flake.nix @@ -22,12 +22,6 @@ clan = { meta.name = "__CHANGE_ME__"; # Ensure this is unique among all clans you want to use. - # This makes flake inputs available in NixOS modules. - specialArgs = { - self = self; - inputs = self.inputs; - }; - inherit self; machines = { # "jon" will be the hostname of the machine diff --git a/templates/clan/flake-parts/modules/shared.nix b/templates/clan/flake-parts/modules/shared.nix index bcd3118ec..5b30638a9 100644 --- a/templates/clan/flake-parts/modules/shared.nix +++ b/templates/clan/flake-parts/modules/shared.nix @@ -1,7 +1,14 @@ -{ clan-core, ... }: +{ + clan-core, + # Optional, if you want to access other flakes: + # self, + ... +}: { imports = [ clan-core.clanModules.sshd clan-core.clanModules.root-password + # You can access other flakes imported in your flake via `self` like this: + # self.inputs.nix-index-database.nixosModules.nix-index ]; } diff --git a/templates/clan/new-clan/flake.nix b/templates/clan/new-clan/flake.nix index 8e4d304de..3459ee14c 100644 --- a/templates/clan/new-clan/flake.nix +++ b/templates/clan/new-clan/flake.nix @@ -3,7 +3,7 @@ inputs.nixpkgs.follows = "clan-core/nixpkgs"; outputs = - { self, clan-core, ... } @ inputs: + { self, clan-core, ... }: let # Usage see: https://docs.clan.lol clan = clan-core.clanLib.buildClan { @@ -11,12 +11,6 @@ # Ensure this is unique among all clans you want to use. meta.name = "__CHANGE_ME__"; - # This makes flake inputs available in NixOS modules. - specialArgs = { - self = self; - inputs = inputs; - }; - # All machines in ./machines will be imported. # Prerequisite: boot into the installer. diff --git a/templates/clan/new-clan/modules/shared.nix b/templates/clan/new-clan/modules/shared.nix index 16a33e373..23f8a3fb3 100644 --- a/templates/clan/new-clan/modules/shared.nix +++ b/templates/clan/new-clan/modules/shared.nix @@ -1,4 +1,10 @@ -{ config, clan-core, ... }: +{ + config, + clan-core, + # Optional, if you want to access other flakes: + # self, + ... +}: { imports = [ # Enables the OpenSSH server for remote access @@ -7,6 +13,9 @@ clan-core.clanModules.root-password clan-core.clanModules.user-password clan-core.clanModules.state-version + + # You can access other flakes imported in your flake via `self` like this: + # self.inputs.nix-index-database.nixosModules.nix-index ]; # Locale service discovery and mDNS