From 5d1480fe3b4387a79eb8289dbfc9ab6f95b548c6 Mon Sep 17 00:00:00 2001 From: Andre Date: Sun, 16 Jun 2024 12:52:46 -0400 Subject: [PATCH] chore(system): change template namespace from 'aux' to 'aux.system' --- system/README.md | 10 ++++---- system/flake.nix | 31 +++++++++++++++---------- system/host/configuration.nix | 19 +++++---------- system/modules/system/bluetooth.nix | 4 ++-- system/modules/system/bootloader.nix | 4 ++-- system/modules/system/editor.nix | 4 ++-- system/modules/system/nix.nix | 6 ++--- system/modules/ui/audio.nix | 4 ++-- system/modules/ui/desktops/budgie.nix | 6 ++--- system/modules/ui/desktops/common.nix | 8 +++---- system/modules/ui/desktops/gnome.nix | 6 ++--- system/modules/ui/desktops/hyprland.nix | 6 ++--- system/modules/ui/desktops/kde.nix | 6 ++--- system/modules/ui/desktops/xfce.nix | 6 ++--- 14 files changed, 61 insertions(+), 59 deletions(-) diff --git a/system/README.md b/system/README.md index 1a15e8b..9869f8f 100644 --- a/system/README.md +++ b/system/README.md @@ -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 .#` 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. \ No newline at end of file +To disable Secure Boot, just set `aux.system.bootloader.secureboot.enable = false;` and rebuild the system. \ No newline at end of file diff --git a/system/flake.nix b/system/flake.nix index f22b339..230da04 100644 --- a/system/flake.nix +++ b/system/flake.nix @@ -36,14 +36,20 @@ ... }: 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"; + + /* + 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 +70,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 +77,10 @@ inherit inputs; }; modules = baseModules ++ [ - { networking.hostName = hostName; } + { + networking.hostName = hostName; + nixpkgs.hostPlatform = platform; + } ./host/configuration.nix # NixOS-Hardware @@ -82,6 +89,6 @@ ]; }; - formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); + formatter.${platform} = nixpkgs.legacyPackages.${platform}.nixfmt-rfc-style; }; } diff --git a/system/host/configuration.nix b/system/host/configuration.nix index bedae99..4208adb 100644 --- a/system/host/configuration.nix +++ b/system/host/configuration.nix @@ -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; diff --git a/system/modules/system/bluetooth.nix b/system/modules/system/bluetooth.nix index 76473ce..8eecd22 100644 --- a/system/modules/system/bluetooth.nix +++ b/system/modules/system/bluetooth.nix @@ -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"); }; }; diff --git a/system/modules/system/bootloader.nix b/system/modules/system/bootloader.nix index 5eea015..b6f803a 100644 --- a/system/modules/system/bootloader.nix +++ b/system/modules/system/bootloader.nix @@ -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; diff --git a/system/modules/system/editor.nix b/system/modules/system/editor.nix index 60844aa..0d38083 100644 --- a/system/modules/system/editor.nix +++ b/system/modules/system/editor.nix @@ -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 [ diff --git a/system/modules/system/nix.nix b/system/modules/system/nix.nix index 0bb0eee..6946fae 100644 --- a/system/modules/system/nix.nix +++ b/system/modules/system/nix.nix @@ -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"; diff --git a/system/modules/ui/audio.nix b/system/modules/ui/audio.nix index d895c5f..08b8562 100644 --- a/system/modules/ui/audio.nix +++ b/system/modules/ui/audio.nix @@ -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." diff --git a/system/modules/ui/desktops/budgie.nix b/system/modules/ui/desktops/budgie.nix index a3c3c03..dbfe0ff 100644 --- a/system/modules/ui/desktops/budgie.nix +++ b/system/modules/ui/desktops/budgie.nix @@ -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; diff --git a/system/modules/ui/desktops/common.nix b/system/modules/ui/desktops/common.nix index a6912ae..9811fb8 100644 --- a/system/modules/ui/desktops/common.nix +++ b/system/modules/ui/desktops/common.nix @@ -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; }; }; diff --git a/system/modules/ui/desktops/gnome.nix b/system/modules/ui/desktops/gnome.nix index 9f33718..e7fd89c 100644 --- a/system/modules/ui/desktops/gnome.nix +++ b/system/modules/ui/desktops/gnome.nix @@ -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 = { diff --git a/system/modules/ui/desktops/hyprland.nix b/system/modules/ui/desktops/hyprland.nix index b24ad64..18f06f0 100644 --- a/system/modules/ui/desktops/hyprland.nix +++ b/system/modules/ui/desktops/hyprland.nix @@ -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; diff --git a/system/modules/ui/desktops/kde.nix b/system/modules/ui/desktops/kde.nix index d1bb84c..c1b7d35 100644 --- a/system/modules/ui/desktops/kde.nix +++ b/system/modules/ui/desktops/kde.nix @@ -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; diff --git a/system/modules/ui/desktops/xfce.nix b/system/modules/ui/desktops/xfce.nix index 2d40d0a..c6583b2 100644 --- a/system/modules/ui/desktops/xfce.nix +++ b/system/modules/ui/desktops/xfce.nix @@ -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;