General: turn templates into actual templates
This commit is contained in:
parent
992a479496
commit
d47f242103
12
flake.nix
12
flake.nix
|
@ -73,7 +73,7 @@
|
|||
};
|
||||
in
|
||||
lib.mkFlake {
|
||||
# Configure Nix channels
|
||||
# Allow unfree packages in Nix config
|
||||
channels-config.allowUnfree = true;
|
||||
|
||||
# Define systems
|
||||
|
@ -103,10 +103,6 @@
|
|||
|
||||
# Individual host configurations
|
||||
hosts = {
|
||||
Dimaga.modules = with inputs; [
|
||||
nixos-hardware.nixosModules.common-cpu-intel
|
||||
];
|
||||
|
||||
Hevana.modules = with inputs; [
|
||||
nixos-hardware.nixosModules.common-cpu-amd-pstate
|
||||
nixos-hardware.nixosModules.common-gpu-amd
|
||||
|
@ -126,6 +122,12 @@
|
|||
};
|
||||
};
|
||||
|
||||
# Define .nix file templates
|
||||
templates = {
|
||||
module.description = "Template for creating a new module.";
|
||||
systems.description = "Template for defining a new system.";
|
||||
};
|
||||
|
||||
# Use treefmt to format project repo
|
||||
outputs-builder =
|
||||
channels:
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# Extra utility functions
|
||||
{
|
||||
lib,
|
||||
}:
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
# This is an example of a blank module.
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.${namespace}.services.myModule;
|
||||
|
@ -23,9 +28,9 @@ in
|
|||
type = lib.types.listOf lib.types.int;
|
||||
description = "An example of a list (of integers) option.";
|
||||
};
|
||||
enum = mkOption {
|
||||
enum = lib.mkOption {
|
||||
default = "one";
|
||||
type = types.enum [
|
||||
type = lib.types.enum [
|
||||
"one"
|
||||
"two"
|
||||
];
|
||||
|
@ -36,14 +41,14 @@ in
|
|||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# Add changes applied by this module here.
|
||||
# Define the changes applied by this module here.
|
||||
};
|
||||
|
||||
systemd.services = {
|
||||
# Forces systemd to wait for the module's configuration directory to be available before starting the service.
|
||||
# Tell systemd to wait for the module's configuration directory to be available before starting the service.
|
||||
myModule.unitConfig.RequiresMountsFor = cfg.home;
|
||||
|
||||
# Tells Nginx to wait for the service to be available before coming online.
|
||||
# Tell Nginx to wait for the service to be available before coming online.
|
||||
nginx.wants = [ config.systemd.services.myModule.name ];
|
||||
};
|
||||
}
|
|
@ -1,16 +1,11 @@
|
|||
# Template file for configuring a new host
|
||||
{
|
||||
pkgs,
|
||||
home-manager,
|
||||
lib,
|
||||
config,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# Do not change this value! This tracks when NixOS was installed on your system.
|
||||
stateVersion = "24.11";
|
||||
|
||||
# The hostname for this system.
|
||||
hostName = "myHost";
|
||||
in
|
||||
|
@ -22,7 +17,7 @@ in
|
|||
system.stateVersion = stateVersion;
|
||||
networking.hostName = hostName;
|
||||
|
||||
# Configure the system here.
|
||||
# Main system configuration happens here.
|
||||
config.${namespace} = {
|
||||
apps = {
|
||||
# Define applications here
|
||||
|
@ -39,5 +34,5 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
# Additional host-specific configuration options go here
|
||||
# Additional configuration options go here
|
||||
}
|
|
@ -1,8 +1,7 @@
|
|||
# Template for setting a new host's hardware configuration
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
modulesPath,
|
||||
namespace,
|
||||
...
|
||||
}:
|
||||
let
|
Loading…
Reference in a new issue