feat: Simplify imports by importing with specialArgs

This change makes it possible to import the modules that are required
from the flake inputs in the output modules themselves, thus preventing
users from having to manually import those modules.

This simplifies things overall and was made possible by the specialArgs
option that allowed these flake inputs to be passed into our container.
This commit is contained in:
Donovan Glover 2024-04-05 09:36:21 -04:00
parent 267dda3224
commit b368817c52
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
5 changed files with 11 additions and 8 deletions

View File

@ -42,8 +42,6 @@
system = "x86_64-linux";
specialArgs = attrs;
modules = [
home-manager.nixosModules.home-manager
stylix.nixosModules.stylix
./hardware/laptop.nix
{
environment.pathsToLink = [

View File

@ -37,6 +37,11 @@ let
node = "/dev/dri/renderD128";
}
];
specialArgs = {
inherit home-manager;
inherit stylix;
};
};
in
{
@ -50,8 +55,6 @@ in
config = { lib, pkgs, ... }: {
imports = [
stylix.nixosModules.stylix
home-manager.nixosModules.home-manager
../containers/shared.nix
];

View File

@ -1,4 +1,4 @@
{ pkgs, config, lib, ... }:
{ home-manager, stylix, pkgs, config, lib, ... }:
let
inherit (lib) mkEnableOption mkIf mkMerge;
@ -13,6 +13,11 @@ let
cfg = config.modules.desktop;
in
{
imports = attrValues {
inherit (home-manager.nixosModules) home-manager;
inherit (stylix.nixosModules) stylix;
};
options.modules.desktop = {
japanese = mkEnableOption "Japanese support (fcitx, anki, kanjidraw, etc.)";
bloat = mkEnableOption "GUI applications like Logseq";

View File

@ -6,8 +6,6 @@ in (import ./lib.nix) {
nodes.machine = { self, pkgs, ... }: {
imports = attrValues {
inherit (self.inputs.home-manager.nixosModules) home-manager;
inherit (self.inputs.stylix.nixosModules) stylix;
inherit (self.nixosModules) system desktop;
};
};

View File

@ -6,7 +6,6 @@ in (import ./lib.nix) {
nodes.machine = { self, pkgs, ... }: {
imports = attrValues {
inherit (self.inputs.home-manager.nixosModules) home-manager;
inherit (self.nixosModules) system shell;
};
};