refactor: move modules to their own dir

This commit is contained in:
Jalil David Salamé Messina 2025-03-16 16:10:02 +01:00
parent dda72854df
commit addf563bfc
Signed by: jalil
GPG key ID: F016B9E770737A0B
26 changed files with 86 additions and 60 deletions

View file

@ -5,17 +5,18 @@
{ {
packages = packages =
let let
modules = ../modules;
filterVisible = filterVisible =
toplevelOption: option: toplevelOption: option:
option // { visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption; }; option // { visible = option.visible && builtins.elemAt option.loc 0 == toplevelOption; };
home-eval = lib.evalModules { home-eval = lib.evalModules {
modules = [ ../home/options.nix ]; modules = [ (modules + "/hm/options.nix") ];
specialArgs = { specialArgs = {
inherit pkgs; inherit pkgs;
}; };
}; };
nvim-eval = lib.evalModules { modules = [ ../nvim/options.nix ]; }; nvim-eval = lib.evalModules { modules = [ (modules + "/nixvim/options.nix") ]; };
nixos-eval = lib.evalModules { modules = [ ../system/options.nix ]; }; nixos-eval = lib.evalModules { modules = [ (modules + "/nixos/options.nix") ]; };
home-markdown = home-markdown =
(pkgs.nixosOptionsDoc { (pkgs.nixosOptionsDoc {
inherit (home-eval) options; inherit (home-eval) options;

View file

@ -1,27 +1,63 @@
{ inputs, lib, ... }:
{ {
flake.nixosModules = self,
inputs,
lib,
...
}:
let
modules = ../modules;
in
{
flake = {
nixvimModules =
let let
nvim-config = { standalone = modules + "/nixvim/standalone.nix";
homeManager = {
imports = [ imports = [
inputs.nixvim.homeManagerModules.nixvim inputs.nixvim.homeManagerModules.nixvim
../nvim (modules + "/nixvim")
]; ];
}; };
homeManagerModuleSandalone = import ../home { in
inherit nvim-config; {
inherit (inputs) stylix; inherit standalone homeManager;
}; };
homeManagerModuleNixOS = import ../home { inherit nvim-config; }; homeManagerModules =
let
defaultModules = [
self.nixvimModules.homeManager
(modules + "/hm")
];
nixos = {
imports = defaultModules;
};
standalone = {
imports = defaultModules ++ [
inputs.stylix.homeManagerModules.stilyx
(
{ config, ... }:
{
stylix.image = config.jhome.sway.background;
}
)
];
};
in
{
inherit standalone nixos;
};
nixosModules =
let
nixosModule = { nixosModule = {
imports = [ imports = [
(import ../system { inherit (inputs) stylix; }) inputs.stylix.nixosModules.stylix
inputs.home-manager.nixosModules.home-manager inputs.home-manager.nixosModules.home-manager
(modules + "/nixos")
] ++ lib.optional (inputs.lix-module != null) inputs.lix-module.nixosModules.default; ] ++ lib.optional (inputs.lix-module != null) inputs.lix-module.nixosModules.default;
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
sharedModules = [ homeManagerModuleNixOS ]; sharedModules = [ self.homeManagerModules.nixos ];
}; };
# Pin nixpkgs # Pin nixpkgs
nix.registry.nixpkgs.flake = inputs.nixpkgs; nix.registry.nixpkgs.flake = inputs.nixpkgs;
@ -39,7 +75,8 @@
in in
{ {
default = nixosModule; default = nixosModule;
inherit nixosModule homeManagerModuleNixOS homeManagerModuleSandalone; inherit nixosModule;
} }
// machineModules; // machineModules;
};
} }

View file

@ -9,7 +9,7 @@
nvimModule = extraConfig: { nvimModule = extraConfig: {
pkgs = inputs.unstable.legacyPackages.${system}; pkgs = inputs.unstable.legacyPackages.${system};
module = { module = {
imports = [ ../nvim/standalone.nix ]; imports = [ ../modules/nixvim/standalone.nix ];
config = lib.mkMerge [ config = lib.mkMerge [
{ performance.combinePlugins.enable = true; } { performance.combinePlugins.enable = true; }
extraConfig extraConfig

View file

@ -1,7 +1,3 @@
{
nvim-config,
stylix ? null,
}:
{ {
config, config,
pkgs, pkgs,
@ -17,16 +13,10 @@ let
path: default: if osConfig == null then default else lib.attrsets.attrByPath path default osConfig; path: default: if osConfig == null then default else lib.attrsets.attrByPath path default osConfig;
in in
{ {
imports = imports = [
[
nvim-config
./options.nix ./options.nix
./gui ./gui
./users.nix ./users.nix
]
++ lib.optionals (stylix != null) [
stylix.homeManagerModules.stylix
{ stylix.image = cfg.sway.background; }
]; ];
config = lib.mkMerge [ config = lib.mkMerge [

View file

@ -1,4 +1,3 @@
{ stylix }:
{ {
config, config,
pkgs, pkgs,
@ -22,7 +21,6 @@ in
imports = [ imports = [
./options.nix ./options.nix
./gui ./gui
stylix.nixosModules.stylix
{ stylix = import ./stylix-config.nix { inherit config pkgs; }; } { stylix = import ./stylix-config.nix { inherit config pkgs; }; }
]; ];