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.
sharedModules = [
# Import our own custom modules from here..
../../modules/home-manager
# Import our private modules...
../../modules/home-manager/_private
# ...plus a bunch of third-party modules.

View File

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

View File

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

View File

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

View File

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