Skip to content

Commit

Permalink
Allow building installers with custom configs
Browse files Browse the repository at this point in the history
    - Move previous config snippets into snippet files, used as default snippets (getCustomOrDefaultSnippet)
    - If a custom snippet is found in customConfigSnippets, it is used instead
  • Loading branch information
FriedrichAltheide authored and Friedrich Altheide committed Sep 10, 2024
1 parent 2d6e267 commit 65e3686
Show file tree
Hide file tree
Showing 41 changed files with 288 additions and 347 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ insert_final_newline = true
indent_style = tab
insert_final_newline = true

[*.snippet]
indent_style = space
indent_size = 2
insert_final_newline = true
Empty file.
16 changes: 16 additions & 0 deletions modules/nixos/defaultConfigs/snippets/audio.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Enable sound with pipewire.
sound.enable = false;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;

# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
3 changes: 3 additions & 0 deletions modules/nixos/defaultConfigs/snippets/autologin.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Enable automatic login for the user.
services.xserver.displayManager.autoLogin.enable = true;
services.xserver.displayManager.autoLogin.user = "@@username@@";
3 changes: 3 additions & 0 deletions modules/nixos/defaultConfigs/snippets/autologingdm.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
systemd.services."getty@tty1".enable = false;
systemd.services."autovt@tty1".enable = false;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/autologintty.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enable automatic login for the user.
services.getty.autologinUser = "@@username@@";
5 changes: 5 additions & 0 deletions modules/nixos/defaultConfigs/snippets/bootbios.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "@@bootdev@@";
boot.loader.grub.useOSProber = true;
boot.tmp.useTmpfs = true;
5 changes: 5 additions & 0 deletions modules/nixos/defaultConfigs/snippets/bootefi.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.configurationLimit = 42;
boot.loader.efi.canTouchEfiVariables = true;
boot.tmp.useTmpfs = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/bootgrubcrypt.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Setup keyfile
boot.initrd.secrets = {
"/boot/crypto_keyfile.bin" = null;
};

boot.loader.grub.enableCryptodisk = true;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/bootnone.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Disable bootloader.
boot.loader.grub.enable = false;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/connman.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enable networking
services.connman.enable = true;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/console.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Configure console keymap
console.keyMap = "@@vconsole@@";
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Budgie Desktop environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.budgie.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Cinnamon Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.cinnamon.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Deepin Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.deepin.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Enlightenment Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.enlightenment.enable = true;

# Enable acpid
services.acpid.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Lumina Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.lumina.enable = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/desktopEnv/lxqt.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the LXQT Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.lxqt.enable = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/desktopEnv/mate.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the MATE Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.mate.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the Pantheon Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.pantheon.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the KDE Plasma Desktop Environment.
services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Enable the X11 windowing system.
# You can disable this if you're only using the Wayland session.
services.xserver.enable = true;

# Enable the KDE Plasma Desktop Environment.
services.displayManager.sddm.enable = true;
services.desktopManager.plasma6.enable = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/desktopEnv/xfce.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Enable the X11 windowing system.
services.xserver.enable = true;

# Enable the XFCE Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.xfce.enable = true;
1 change: 1 addition & 0 deletions modules/nixos/defaultConfigs/snippets/extra.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# intentionally empty
1 change: 1 addition & 0 deletions modules/nixos/defaultConfigs/snippets/firefox.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
programs.firefox.enable = true;
7 changes: 7 additions & 0 deletions modules/nixos/defaultConfigs/snippets/head.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, ... }:

{
5 changes: 5 additions & 0 deletions modules/nixos/defaultConfigs/snippets/imports.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
imports =
[
# Include the results of the hardware scan.
./hardware-configuration.nix
];
5 changes: 5 additions & 0 deletions modules/nixos/defaultConfigs/snippets/keymap.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Configure keymap in X11
services.xserver.xkb = {
layout = "@@kblayout@@";
variant = "@@kbvariant@@";
};
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/locale.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Select internationalisation properties.
i18n.defaultLocale = "@@LANG@@";
11 changes: 11 additions & 0 deletions modules/nixos/defaultConfigs/snippets/localeextra.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
i18n.extraLocaleSettings = {
LC_ADDRESS = "@@LC_ADDRESS@@";
LC_IDENTIFICATION = "@@LC_IDENTIFICATION@@";
LC_MEASUREMENT = "@@LC_MEASUREMENT@@";
LC_MONETARY = "@@LC_MONETARY@@";
LC_NAME = "@@LC_NAME@@";
LC_NUMERIC = "@@LC_NUMERIC@@";
LC_PAPER = "@@LC_PAPER@@";
LC_TELEPHONE = "@@LC_TELEPHONE@@";
LC_TIME = "@@LC_TIME@@";
};
5 changes: 5 additions & 0 deletions modules/nixos/defaultConfigs/snippets/misc.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Enable CUPS to print documents.
services.printing.enable = true;

# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/network.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
networking.hostName = "@@hostname@@"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.

# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
networking.networkmanager.enable = true;
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/nmapplet.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Enable network manager applet
programs.nm-applet.enable = true;
6 changes: 6 additions & 0 deletions modules/nixos/defaultConfigs/snippets/pkgs.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
];
28 changes: 28 additions & 0 deletions modules/nixos/defaultConfigs/snippets/tail.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };

# List services that you want to enable:

# Enable the OpenSSH daemon.
# services.openssh.enable = true;

# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;

# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "@@nixosversion@@"; # Did you read the comment?

}
1 change: 1 addition & 0 deletions modules/nixos/defaultConfigs/snippets/time.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
time.timeZone = "@@timezone@@";
2 changes: 2 additions & 0 deletions modules/nixos/defaultConfigs/snippets/unfree.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
7 changes: 7 additions & 0 deletions modules/nixos/defaultConfigs/snippets/users.snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.@@username@@ = {
isNormalUser = true;
description = "@@fullname@@";
extraGroups = [ @@groups@@ ];
packages = with pkgs; [@@pkgs@@];
};
Loading

0 comments on commit 65e3686

Please sign in to comment.