56 lines
1.2 KiB
Nix
56 lines
1.2 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
# Template for creating new NixOS modules
|
|
# Copy this file and customize for your needs
|
|
|
|
{
|
|
options.custom.example = {
|
|
enable = lib.mkEnableOption "Example feature";
|
|
|
|
# Add more options as needed
|
|
setting1 = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "default value";
|
|
description = "Description of setting1";
|
|
};
|
|
|
|
setting2 = lib.mkOption {
|
|
type = lib.types.listOf lib.types.str;
|
|
default = [ ];
|
|
description = "A list of values";
|
|
};
|
|
};
|
|
|
|
config = let
|
|
cfg = config.custom.example;
|
|
in lib.mkIf cfg.enable {
|
|
|
|
# Your configuration here
|
|
environment.systemPackages = with pkgs; [
|
|
# Add packages needed for this feature
|
|
];
|
|
|
|
# Other NixOS configuration
|
|
# services.myservice.enable = true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
# How to use this module:
|
|
#
|
|
# 1. Save this template as nixos/modules/myfeature.nix
|
|
#
|
|
# 2. Import it in nixos/default.nix:
|
|
# imports = [
|
|
# ./modules/myfeature.nix
|
|
# ];
|
|
#
|
|
# 3. Enable in host config (hosts/laptop/default.nix):
|
|
# custom.myfeature.enable = true;
|
|
# custom.myfeature.setting1 = "my value";
|
|
# custom.myfeature.setting2 = [ "value1" "value2" ];
|
|
#
|
|
# 4. Rebuild:
|
|
# sudo nixos-rebuild switch --flake .#laptop
|