dotfiles
My PC Dotfiles & Websitegit clone https://github.com/maydayv7/dotfiles
modules/core/nixos.nix (1411B)
1{
2 lib,
3 config,
4 ...
5}: let
6 inherit (config) util flake;
7in {
8 options.configurations.nixos = lib.mkOption {
9 type = lib.types.lazyAttrsOf util.types.configuration;
10 default = {};
11 };
12
13 config.flake = {
14 nixosConfigurations =
15 lib.mapAttrs (
16 name: {
17 module,
18 system,
19 defaults,
20 }:
21 lib.nixosSystem {
22 modules =
23 [
24 module
25 {
26 networking.hostName = name;
27 nixpkgs.pkgs = flake.legacyPackages.${system};
28 }
29 ]
30 ++
31 # Default Modules
32 lib.optionals defaults (util.map.array [
33 "base"
34 "boot"
35 "filesystem"
36 "cpu"
37 "gpu"
38 "nix"
39 "user"
40 "secrets"
41 "shell"
42 "theme"
43 "fonts"
44 ]
45 flake.modules.nixos);
46 }
47 )
48 config.configurations.nixos;
49
50 checks = lib.mkMerge (
51 lib.mapAttrsToList (
52 name: {system, ...}: {
53 ${system} = {
54 "configurations:nixos:${name}" =
55 flake.nixosConfigurations.${name}.config.system.build.toplevel;
56 };
57 }
58 )
59 config.configurations.nixos
60 );
61 };
62}