flake-parts/setups: import the default modules

This commit is contained in:
Gabriel Arazas 2024-01-26 09:38:31 +08:00
parent 670f52ce30
commit c6bc18035a
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
5 changed files with 19 additions and 6 deletions

View File

@ -42,8 +42,7 @@
# This is to be used by the NixOS `home-manager.sharedModules` anyways. # This is to be used by the NixOS `home-manager.sharedModules` anyways.
sharedModules = [ sharedModules = [
# Import our own custom modules from here.. # Import our private modules...
../../modules/home-manager
../../modules/home-manager/_private ../../modules/home-manager/_private
# ...plus a bunch of third-party modules. # ...plus a bunch of third-party modules.

View File

@ -85,8 +85,7 @@
# requirements of a host. On second thought, only on flakes with # requirements of a host. On second thought, only on flakes with
# optional NixOS modules. # optional NixOS modules.
sharedModules = [ sharedModules = [
# Import our custom modules. # Import our private modules.
../../modules/nixos
../../modules/nixos/_private ../../modules/nixos/_private
inputs.nix-index-database.nixosModules.nix-index inputs.nix-index-database.nixosModules.nix-index

View File

@ -3,6 +3,7 @@
let let
cfg = config.setups.home-manager; cfg = config.setups.home-manager;
homeManagerModules = ../../home-manager;
# A thin wrapper around the home-manager configuration function. # A thin wrapper around the home-manager configuration function.
mkHome = { system, nixpkgsBranch ? "nixpkgs", homeManagerBranch ? "home-manager", extraModules ? [ ] }: mkHome = { system, nixpkgsBranch ? "nixpkgs", homeManagerBranch ? "home-manager", extraModules ? [ ] }:
@ -11,7 +12,7 @@ let
in in
inputs.${homeManagerBranch}.lib.homeManagerConfiguration { inputs.${homeManagerBranch}.lib.homeManagerConfiguration {
extraSpecialArgs = { extraSpecialArgs = {
foodogsquaredModulesPath = builtins.toString ../../home-manager; foodogsquaredModulesPath = builtins.toString homeManagerModules;
}; };
inherit pkgs; inherit pkgs;
@ -236,6 +237,9 @@ in
}; };
config = lib.mkIf (cfg.configs != { }) { config = lib.mkIf (cfg.configs != { }) {
# Import our own home-manager modules.
setups.home-manager.sharedModules = [ homeManagerModules ];
flake = flake =
let let
# A quick data structure we can pass through multiple build pipelines. # A quick data structure we can pass through multiple build pipelines.

View File

@ -7,6 +7,7 @@
let let
cfg = config.setups.nixos; cfg = config.setups.nixos;
nixosModules = ../../nixos;
# This is used on a lot of the Nix modules below. # This is used on a lot of the Nix modules below.
partsConfig = config; partsConfig = config;
@ -27,7 +28,7 @@ let
in in
(lib'.makeOverridable nixosSystem) { (lib'.makeOverridable nixosSystem) {
specialArgs = { specialArgs = {
foodogsquaredModulesPath = builtins.toString ../../nixos; foodogsquaredModulesPath = builtins.toString nixosModules;
}; };
lib = lib'; lib = lib';
modules = extraModules ++ [{ modules = extraModules ++ [{
@ -494,6 +495,10 @@ in
config = lib.mkIf (cfg.configs != { }) { config = lib.mkIf (cfg.configs != { }) {
setups.nixos.sharedModules = [ setups.nixos.sharedModules = [
# Import our own public NixOS modules.
nixosModules
# Set the home-manager-related settings.
({ lib, ... }: { ({ lib, ... }: {
home-manager.sharedModules = partsConfig.setups.home-manager.sharedModules; home-manager.sharedModules = partsConfig.setups.home-manager.sharedModules;

View File

@ -9,6 +9,7 @@
let let
cfg = config.setups.nixvim; cfg = config.setups.nixvim;
partsConfig = config; partsConfig = config;
nixvimModules = ../../nixvim;
mkNixvimConfig = { system, nixpkgsBranch, modules ? [] }: mkNixvimConfig = { system, nixpkgsBranch, modules ? [] }:
let let
@ -22,6 +23,9 @@ let
module = { module = {
imports = modules; imports = modules;
}; };
extraSpecialArgs = {
foodogsquaredModulesPath = builtins.toString nixvimModules;
};
}; };
modulesOption = lib.mkOption { modulesOption = lib.mkOption {
@ -97,6 +101,8 @@ in
}; };
config = lib.mkIf (cfg.configs != {}) { config = lib.mkIf (cfg.configs != {}) {
setups.nixvim.sharedModules = [ nixvimModules ];
perSystem = { system, config, lib, ... }: perSystem = { system, config, lib, ... }:
( (
let let