mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-02-12 00:18:59 +00:00
modules: restructure private modules directory
This commit is contained in:
parent
23d466dea6
commit
7bb0b0dd1f
@ -8,15 +8,15 @@ let
|
|||||||
config' = import <config> { };
|
config' = import <config> { };
|
||||||
lib = pkgs.lib.extend (import <config/lib/extras/extend-lib.nix>);
|
lib = pkgs.lib.extend (import <config/lib/extras/extend-lib.nix>);
|
||||||
|
|
||||||
modules = import <config/modules/nixos> { inherit lib; isInternal = true; };
|
|
||||||
hmModules = import <config/modules/home-manager> { inherit lib; isInternal = true; };
|
|
||||||
extraArgs = {
|
extraArgs = {
|
||||||
nix-colors = import <nix-colors> { };
|
nix-colors = import <nix-colors> { };
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
import <nixpkgs/nixos/lib/eval-config.nix> {
|
import <nixpkgs/nixos/lib/eval-config.nix> {
|
||||||
inherit lib;
|
inherit lib;
|
||||||
modules = modules ++ extraModules ++ [
|
modules = extraModules ++ [
|
||||||
|
<config/modules/nixos>
|
||||||
|
<config/modules/nixos/_private>
|
||||||
<home-manager/nixos>
|
<home-manager/nixos>
|
||||||
<disko/module.nix>
|
<disko/module.nix>
|
||||||
<sops-nix/modules/sops>
|
<sops-nix/modules/sops>
|
||||||
@ -37,7 +37,9 @@ import <nixpkgs/nixos/lib/eval-config.nix> {
|
|||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
home-manager.sharedModules = hmModules ++ [
|
home-manager.sharedModules = [
|
||||||
|
<config/modules/home-manager>
|
||||||
|
<config/modules/home-manager/_private>
|
||||||
<sops-nix/modules/home-manager/sops.nix>
|
<sops-nix/modules/home-manager/sops.nix>
|
||||||
({ config, lib, ... }: {
|
({ config, lib, ... }: {
|
||||||
_module.args = extraArgs;
|
_module.args = extraArgs;
|
||||||
|
@ -39,12 +39,12 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# 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 own custom modules from here..
|
||||||
import ../../modules/home-manager { inherit lib; isInternal = true; }
|
../../modules/home-manager
|
||||||
|
../../modules/home-manager/_private
|
||||||
|
|
||||||
# ...plus a bunch of third-party modules.
|
# ...plus a bunch of third-party modules.
|
||||||
++ [
|
|
||||||
inputs.sops-nix.homeManagerModules.sops
|
inputs.sops-nix.homeManagerModules.sops
|
||||||
inputs.nix-index-database.hmModules.nix-index
|
inputs.nix-index-database.hmModules.nix-index
|
||||||
|
|
||||||
@ -83,6 +83,6 @@
|
|||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
# Extending home-manager with my custom modules, if anyone cares.
|
# Extending home-manager with my custom modules, if anyone cares.
|
||||||
homeModules.default = import ../../modules/home-manager { inherit lib; };
|
homeModules.default = ../../modules/home-manager;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -88,15 +88,11 @@
|
|||||||
# Only use imports as minimally as possible with the absolute
|
# Only use imports as minimally as possible with the absolute
|
||||||
# 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 = [
|
||||||
# Append with our custom NixOS modules from the modules folder.
|
# Import our custom modules.
|
||||||
import ../../modules/nixos { inherit lib; isInternal = true; }
|
../../modules/nixos
|
||||||
|
../../modules/nixos/_private
|
||||||
|
|
||||||
# Then, make the most with the modules from the flake inputs. Take
|
|
||||||
# note importing some modules such as home-manager are as part of the
|
|
||||||
# declarative host config so be sure to check out
|
|
||||||
# `hostSpecificModule` function as well as the declarative host setup.
|
|
||||||
++ [
|
|
||||||
inputs.nix-index-database.nixosModules.nix-index
|
inputs.nix-index-database.nixosModules.nix-index
|
||||||
inputs.sops-nix.nixosModules.sops
|
inputs.sops-nix.nixosModules.sops
|
||||||
inputs.disko.nixosModules.disko
|
inputs.disko.nixosModules.disko
|
||||||
@ -176,6 +172,6 @@
|
|||||||
|
|
||||||
flake = {
|
flake = {
|
||||||
# Listing my public NixOS modules if anyone cares.
|
# Listing my public NixOS modules if anyone cares.
|
||||||
nixosModules.default = import ../../modules/nixos { inherit lib; };
|
nixosModules.default = ../../modules/nixos;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ It's better that we lay this out with a list of guidelines.
|
|||||||
* Custom modules are typically classified as private and public modules.
|
* Custom modules are typically classified as private and public modules.
|
||||||
Private (or internal) modules are simply modules meant to be used in this project and nowhere else.
|
Private (or internal) modules are simply modules meant to be used in this project and nowhere else.
|
||||||
Public modules are meant to be used by others (but not necessarily mean we have to support or maintain these for them).
|
Public modules are meant to be used by others (but not necessarily mean we have to support or maintain these for them).
|
||||||
|
For convenience, these private modules are stored in `_private` folder of each environment.
|
||||||
|
|
||||||
* As such, public modules are not allowed to use the private library and modules.
|
* As such, public modules are not allowed to use the private library and modules.
|
||||||
Only the private modules can.
|
Only the private modules can.
|
||||||
|
8
modules/home-manager/_private/default.nix
Normal file
8
modules/home-manager/_private/default.nix
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./profiles/desktop.nix
|
||||||
|
./profiles/dev.nix
|
||||||
|
./profiles/editors.nix
|
||||||
|
./profiles/i18n.nix
|
||||||
|
];
|
||||||
|
}
|
@ -1,11 +1,5 @@
|
|||||||
{ lib
|
{
|
||||||
|
imports = [
|
||||||
# Import the private modules
|
|
||||||
, isInternal ? false
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
modules = [
|
|
||||||
./files/mutable-files.nix
|
./files/mutable-files.nix
|
||||||
./programs/pop-launcher.nix
|
./programs/pop-launcher.nix
|
||||||
./services/archivebox.nix
|
./services/archivebox.nix
|
||||||
@ -17,12 +11,4 @@ let
|
|||||||
./services/plover.nix
|
./services/plover.nix
|
||||||
./services/yt-dlp.nix
|
./services/yt-dlp.nix
|
||||||
];
|
];
|
||||||
privateModules = [
|
}
|
||||||
./profiles/desktop.nix
|
|
||||||
./profiles/dev.nix
|
|
||||||
./profiles/editors.nix
|
|
||||||
./profiles/i18n.nix
|
|
||||||
];
|
|
||||||
in
|
|
||||||
modules
|
|
||||||
++ (lib.optionals isInternal privateModules)
|
|
||||||
|
13
modules/nixos/_private/default.nix
Normal file
13
modules/nixos/_private/default.nix
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./profiles/archiving.nix
|
||||||
|
./profiles/browsers.nix
|
||||||
|
./profiles/desktop.nix
|
||||||
|
./profiles/dev.nix
|
||||||
|
./profiles/filesystem.nix
|
||||||
|
./profiles/gaming.nix
|
||||||
|
./profiles/i18n.nix
|
||||||
|
./profiles/server.nix
|
||||||
|
./profiles/vpn.nix
|
||||||
|
];
|
||||||
|
}
|
@ -1,11 +1,5 @@
|
|||||||
{ lib
|
{
|
||||||
|
imports = [
|
||||||
# Include the private modules.
|
|
||||||
, isInternal ? false
|
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
|
||||||
modules = [
|
|
||||||
./programs/blender.nix
|
./programs/blender.nix
|
||||||
./programs/cardboard-wm.nix
|
./programs/cardboard-wm.nix
|
||||||
./programs/distrobox.nix
|
./programs/distrobox.nix
|
||||||
@ -20,17 +14,4 @@ let
|
|||||||
./services/yt-dlp.nix
|
./services/yt-dlp.nix
|
||||||
./workflows
|
./workflows
|
||||||
];
|
];
|
||||||
privateModules = [
|
}
|
||||||
./profiles/archiving.nix
|
|
||||||
./profiles/browsers.nix
|
|
||||||
./profiles/desktop.nix
|
|
||||||
./profiles/dev.nix
|
|
||||||
./profiles/filesystem.nix
|
|
||||||
./profiles/gaming.nix
|
|
||||||
./profiles/i18n.nix
|
|
||||||
./profiles/server.nix
|
|
||||||
./profiles/vpn.nix
|
|
||||||
];
|
|
||||||
in
|
|
||||||
modules
|
|
||||||
++ (lib.optionals isInternal privateModules)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user