flake.nix: move the imported modules into the shared config

This makes it easier to think about the default shared configurations.
This commit is contained in:
Gabriel Arazas 2023-10-16 23:01:38 +08:00
parent ec216c82d7
commit 1a9960a0f3
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
2 changed files with 25 additions and 35 deletions

View File

@ -144,13 +144,18 @@
# Only use imports as minimally as possible with the absolute
# requirements of a host. On second thought, only on flakes with
# optional NixOS modules.
imports = [
inputs.home-manager.nixosModules.home-manager
inputs.nur.nixosModules.nur
inputs.sops-nix.nixosModules.sops
inputs.guix-overlay.nixosModules.guix
inputs.disko.nixosModules.disko
];
imports =
# Append with our custom NixOS modules from the modules folder.
import ./modules/nixos { inherit lib; isInternal = true; }
# Then, make the most with the modules from the flake inputs.
++ [
inputs.home-manager.nixosModules.home-manager
inputs.nur.nixosModules.nur
inputs.sops-nix.nixosModules.sops
inputs.guix-overlay.nixosModules.guix
inputs.disko.nixosModules.disko
];
# BOOOOOOOOOOOOO! Somebody give me a tomato!
services.xserver.excludePackages = with pkgs; [ xterm ];
@ -178,12 +183,7 @@
# The global configuration for the home-manager module.
home-manager.useUserPackages = lib.mkDefault true;
home-manager.useGlobalPkgs = lib.mkDefault true;
home-manager.sharedModules =
(import ./modules/home-manager {
inherit lib;
isInternal = true;
})
++ [ userSharedConfig ];
home-manager.sharedModules = [ userSharedConfig ];
home-manager.extraSpecialArgs = extraArgs;
# Enabling some things for sops.
@ -204,10 +204,15 @@
# configurations with `nixpkgs.useGlobalPkgs` set to `true` so avoid
# setting nixpkgs-related options here.
userSharedConfig = { pkgs, config, lib, ... }: {
imports = [
inputs.nur.hmModules.nur
inputs.sops-nix.homeManagerModules.sops
];
imports =
# Import our own custom modules from here..
import ./modules/home-manager { inherit lib; isInternal = true; }
# ...plus a bunch of third-party modules.
++ [
inputs.nur.hmModules.nur
inputs.sops-nix.homeManagerModules.sops
];
# Hardcoding this is not really great especially if you consider using
# other locales but its default values are already hardcoded so what

View File

@ -9,12 +9,7 @@
# The system of the NixOS system.
inherit system lib;
specialArgs = extraArgs;
modules =
# Append with our custom NixOS modules from the modules folder.
(import ../modules/nixos { inherit lib; isInternal = true; })
# Our own modules.
++ extraModules;
modules = extraModules;
};
# A wrapper around the home-manager configuration function.
@ -22,12 +17,7 @@
inputs."${home-manager-channel}".lib.homeManagerConfiguration {
inherit lib pkgs;
extraSpecialArgs = extraArgs;
modules =
# Importing our custom home-manager modules.
(import ../modules/home-manager { inherit lib; isInternal = true; })
# Plus our own.
++ extraModules;
modules = extraModules;
};
# A wrapper around the nixos-generators `nixosGenerate` function.
@ -35,12 +25,7 @@
inputs.nixos-generators.nixosGenerate {
inherit pkgs system format lib;
specialArgs = extraArgs;
modules =
# Import all of the NixOS modules.
(import ../modules/nixos { inherit lib; isInternal = true; })
# Our own modules.
++ extraModules;
modules = extraModules;
};
listImagesWithSystems = data: