chore: Change template namespace to 'aux.system'

This commit is contained in:
Andre 2024-06-16 12:52:46 -04:00
parent 79a9fda6b7
commit 4648af5704
15 changed files with 125 additions and 60 deletions

View file

@ -7,8 +7,10 @@ A ready-to-run NixOS template with sane defaults.
1. Install a fresh copy of NixOS and boot into your new system.
2. Download, copy, or clone this repository onto your new system.
3. Run `nixos-generate-config --show-hardware-config` to generate your system's `hardware-configuration.nix` file. Copy this file into the `host` folder, overwriting the existing file.
4. Edit `flake.nix` and set the value of `hostName` to the host name you want to use for this system.
4. Edit the `host/configuration.nix` file to suit your needs. This file contains all of the available options and is fully documented.
4. Edit `flake.nix` and set the following variables:
1. Change `hostName` to the hostname you want to give this system.
2. If your system is running on an architecture other than 64-bit Linux, change `platform` to the architecture that you're using. Details on the various options are documented in `flake.nix`.
4. Edit the `host/configuration.nix` file to suit your needs. This file documents all of the different options available.
5. Run `nixos-rebuild boot --flake .#<your hostname>` and restart.
6. Enjoy your new NixOS system!
@ -48,7 +50,7 @@ To enable Secure Boot support:
...
```
2. Generate a set of Secure Boot keys by running the following command: `sudo sbctl create-keys`. This creates a set of keys in `/etc/secureboot`.
3. Enable Secure Boot in your system configuration by setting `aux.bootloader.secureboot.enable = true;`.
3. Enable Secure Boot in your system configuration by setting `aux.system.bootloader.secureboot.enable = true;`.
4. Rebuild your system using `nixos-rebuild switch --flake .`.
5. Confirm that Secure Boot has been set up properly by running `sudo sbctl verify`:
```sh
@ -79,4 +81,4 @@ To enable Secure Boot support:
#### Disabling Secure Boot
To disable Secure Boot, just set `aux.bootloader.secureboot.enable = false;` and rebuild the system.
To disable Secure Boot, just set `aux.system.bootloader.secureboot.enable = false;` and rebuild the system.

View file

@ -36,14 +36,21 @@
...
}:
let
forAllSystems =
function:
nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
] (system: function nixpkgs.legacyPackages.${system});
###*** IMPORTANT: Please set your system's hostname here ***###
#hostName = builtins.abort "Please set the 'hostName' variable in flake.nix";
hostName = "myHost";
/*
What kind of system are you running NixOS on?
If you're not sure, leave this as the default.
Options are:
x86_64-linux - (Default) 64-bit PCs.
aarch64-linux - 64-bit ARM PCs.
x86_64-darwin - Intel Macs.
aarch64-darwin - M-series Macs.
*/
platform = "x86_64-linux";
baseModules = [
./modules/autoimport.nix
@ -64,8 +71,6 @@
};
}
];
###*** IMPORTANT: Please set your system's hostname here ***###
hostName = builtins.abort "Please set the hostName variable in flake.nix";
in
{
nixosConfigurations."${hostName}" = nixpkgs.lib.nixosSystem {
@ -73,7 +78,10 @@
inherit inputs;
};
modules = baseModules ++ [
{ networking.hostName = hostName; }
{
networking.hostName = hostName;
nixpkgs.hostPlatform = platform;
}
./host/configuration.nix
# NixOS-Hardware
@ -82,6 +90,6 @@
];
};
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
formatter.${platform} = nixpkgs.legacyPackages.${platform}.nixfmt-rfc-style;
};
}

View file

@ -15,18 +15,6 @@ in
system.stateVersion = stateVersion;
###*** Configure your system below this line. ***###
/*
What kind of system are you running NixOS on?
If you're not sure, leave this as the default.
Options are:
x86_64-linux - (Default) 64-bit PCs.
aarch64-linux - 64-bit ARM PCs.
x86_64-darwin - Intel Macs.
aarch64-darwin - M-series Macs.
*/
nixpkgs.hostPlatform = "x86_64-linux";
# Set your time zone.
# To see all available timezones, run `timedatectl list-timezones`.
time.timeZone = "Europe/Amsterdam";
@ -48,10 +36,15 @@ in
home-manager.users.axol = {
# The state version is required and should stay at the version you originally installed.
home.stateVersion = stateVersion;
programs = {
# Let home Manager install and manage itself.
home-manager.enable = true;
};
};
# Configure the system.
aux = {
aux.system = {
# Enable to allow unfree (e.g. closed source) packages.
# https://nixos.org/manual/nixpkgs/stable/#sec-allow-unfree
allowUnfree = false;

View file

@ -1 +1,63 @@
builtins.abort "Please run 'nixos-generate-config --show-hardware-config' and copy the output into hardware-configuration.nix"
#builtins.abort "Please run 'nixos-generate-config --show-hardware-config' and copy the output into hardware-configuration.nix"
# Surface Laptop Go 1st gen
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot = {
initrd = {
availableKernelModules = [
"xhci_pci"
"nvme"
"usb_storage"
"usbhid"
"sd_mod"
];
kernelModules = [ ];
luks.devices."luks-5a91100b-8ed9-4090-b1d8-d8291000fe38".device = "/dev/disk/by-uuid/5a91100b-8ed9-4090-b1d8-d8291000fe38";
};
kernelModules = [ "kvm-intel" ];
extraModulePackages = [ ];
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/76d67291-5aed-4f2a-b71f-1c2871cefe24";
fsType = "btrfs";
options = [ "subvol=@,compress=zstd,discard" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/0C53-A645";
fsType = "vfat";
};
};
swapDevices = [
{
device = "/swapfile";
size = 4096;
}
];
networking = {
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
# Set the hostname.
#hostName = "Dimaga";
};
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -7,12 +7,12 @@
}:
let
cfg = config.aux.bluetooth;
cfg = config.aux.system.bluetooth;
in
{
options = {
aux.bluetooth = {
aux.system.bluetooth = {
enable = lib.mkEnableOption (lib.mdDoc "Enables bluetooth");
};
};

View file

@ -9,12 +9,12 @@
# Bootloader
let
cfg = config.aux.bootloader;
cfg = config.aux.system.bootloader;
in
{
options = {
aux.bootloader = {
aux.system.bootloader = {
enable = lib.mkOption {
description = "Automatically configures the bootloader. Set to false to configure manually.";
type = lib.types.bool;

View file

@ -8,11 +8,11 @@
}:
let
cfg = config.aux.editor;
cfg = config.aux.system.editor;
in
{
options = {
aux.editor = lib.mkOption {
aux.system.editor = lib.mkOption {
description = "Selects the default text editor.";
default = "nano";
type = lib.types.enum [

View file

@ -8,12 +8,12 @@
}:
let
cfg = config.aux;
cfg = config.aux.system;
in
{
options = {
aux.allowUnfree = lib.mkEnableOption (lib.mdDoc "Allow unfree packages to install.");
aux.retentionPeriod = lib.mkOption {
aux.system.allowUnfree = lib.mkEnableOption (lib.mdDoc "Allow unfree packages to install.");
aux.system.retentionPeriod = lib.mkOption {
description = "How long to retain NixOS generations. Defaults to 30 days (30d).";
type = lib.types.str;
default = "30d";

View file

@ -7,11 +7,11 @@
}:
let
cfg = config.aux.ui.audio;
cfg = config.aux.system.ui.audio;
in
{
options = {
aux.ui.audio = {
aux.system.ui.audio = {
enable = lib.mkEnableOption (lib.mdDoc "Enables audio.");
enableLowLatency = lib.mkEnableOption (
lib.mdDoc "Enables low-latency audio (may cause crackling) per https://nixos.wiki/wiki/PipeWire#Low-latency_setup."

View file

@ -6,17 +6,17 @@
...
}:
let
cfg = config.aux.ui.desktops.budgie;
cfg = config.aux.system.ui.desktops.budgie;
in
{
options = {
aux.ui.desktops.budgie.enable = lib.mkEnableOption (
aux.system.ui.desktops.budgie.enable = lib.mkEnableOption (
lib.mdDoc "Enables the Budgie desktop environment."
);
};
config = lib.mkIf cfg.enable {
aux.ui.desktops.enable = true;
aux.system.ui.desktops.enable = true;
services.xserver = {
enable = true;

View file

@ -7,11 +7,11 @@
}:
let
cfg = config.aux.ui.desktops;
cfg = config.aux.system.ui.desktops;
in
{
options = {
aux.ui.desktops = {
aux.system.ui.desktops = {
enable = lib.mkEnableOption (lib.mdDoc "Enables base desktop environment support.");
xkb = lib.mkOption {
description = "The keyboard layout to use by default. Defaults to us.";
@ -25,7 +25,7 @@ in
};
config = lib.mkIf cfg.enable {
aux.ui.audio.enable = true;
aux.system.ui.audio.enable = true;
boot = {
# Enable Plymouth for graphical bootsplash.
@ -48,7 +48,7 @@ in
libinput.enable = true;
# Configure keymap in X11
xkb = config.aux.ui.desktops.xkb;
xkb = config.aux.system.ui.desktops.xkb;
};
};

View file

@ -6,17 +6,17 @@
...
}:
let
cfg = config.aux.ui.desktops.gnome;
cfg = config.aux.system.ui.desktops.gnome;
in
{
options = {
aux.ui.desktops.gnome.enable = lib.mkEnableOption (
aux.system.ui.desktops.gnome.enable = lib.mkEnableOption (
lib.mdDoc "Enables the Gnome Desktop Environment."
);
};
config = lib.mkIf cfg.enable {
aux.ui.desktops.enable = true;
aux.system.ui.desktops.enable = true;
# Enable Gnome
services.xserver = {

View file

@ -6,17 +6,17 @@
...
}:
let
cfg = config.aux.ui.desktops.hyprland;
cfg = config.aux.system.ui.desktops.hyprland;
in
{
options = {
aux.ui.desktops.hyprland.enable = lib.mkEnableOption (
aux.system.ui.desktops.hyprland.enable = lib.mkEnableOption (
lib.mdDoc "Enables the Hyprland desktop environment."
);
};
config = lib.mkIf cfg.enable {
aux.ui.desktops.enable = true;
aux.system.ui.desktops.enable = true;
programs.hyprland = {
enable = true;

View file

@ -7,18 +7,18 @@
}:
let
cfg = config.aux.ui.desktops.kde;
cfg = config.aux.system.ui.desktops.kde;
in
{
options = {
aux.ui.desktops.kde = {
aux.system.ui.desktops.kde = {
enable = lib.mkEnableOption (lib.mdDoc "Enables the KDE Desktop Environment.");
useX11 = lib.mkEnableOption (lib.mdDoc "Uses X11 instead of Wayland.");
};
};
config = lib.mkIf cfg.enable {
aux.ui.desktops.enable = true;
aux.system.ui.desktops.enable = true;
services = {
displayManager.sddm.enable = true;

View file

@ -6,17 +6,17 @@
...
}:
let
cfg = config.aux.ui.desktops.xfce;
cfg = config.aux.system.ui.desktops.xfce;
in
{
options = {
aux.ui.desktops.xfce.enable = lib.mkEnableOption (
aux.system.ui.desktops.xfce.enable = lib.mkEnableOption (
lib.mdDoc "Enables the XFCE desktop environment."
);
};
config = lib.mkIf cfg.enable {
aux.ui.desktops.enable = true;
aux.system.ui.desktops.enable = true;
services.xserver = {
enable = true;