Reorganise configuration.nix to be easier to navigate

This commit is contained in:
Jez Cope 2020-10-29 18:53:36 +00:00
parent bbe93cb148
commit 041d598a77
2 changed files with 81 additions and 90 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
hardware-configuration.nix
/local.nix

View File

@ -2,117 +2,107 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
let
hostname = lib.strings.fileContents /etc/hostname;
host-config = ./machines + "/${hostname}.nix";
optionalPath = path: lib.lists.optional (builtins.pathExists path) path;
in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
./local.nix
]
++ optionalPath host-config;
system.stateVersion = "20.03"; # Leave this alone (see configuration.nix(5))
# Use the systemd-boot EFI boot loader.
#boot.loader.systemd-boot.enable = true;
boot.supportedFilesystems = ["zfs"];
boot.loader = {
efi = {
canTouchEfiVariables = false;
efiSysMountPoint = "/boot/efi";
};
grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
# Users ####################################################################
users.users.jez = {
isNormalUser = true;
group = "jez";
extraGroups = [ "wheel" "video" ];
shell = pkgs.zsh;
};
# Networking ###############################################################
networking = {
useDHCP = false;
interfaces.enp39s0.useDHCP = true;
networkmanager.enable = true;
firewall.enable = true;
};
services.avahi = {
enable = true;
nssmdns = true;
};
services.openssh.enable = true;
# Security #################################################################
security.wrappers = {
ping = {
source = "${pkgs.iputils.out}/bin/ping";
owner = "nobody";
group = "nogroup";
capabilities = "cap_net_raw+ep";
};
};
networking.hostName = "erwin"; # Define your hostname.
networking.hostId = "007f0101";
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
# networking.interfaces.net0.useDHCP = true;
# networking.interfaces.virbr0.useDHCP = true;
# networking.interfaces.virbr0-nic.useDHCP = true;
# networking.interfaces.wifi0.useDHCP = true;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
networking.networkmanager.enable = true;
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# };
# Set your time zone.
# Localisation #############################################################
time.timeZone = "Europe/London";
i18n.defaultLocale = "en_GB.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
# List packages installed in system profile. To search, run:
# $ nix search wget
# General ##################################################################
environment.systemPackages = with pkgs; [
wget vim
wget vim git tree iputils
refind
];
# 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;
# pinentryFlavor = "gnome3";
# };
documentation = {
man.generateCaches = true;
dev.enable = true;
};
# List services that you want to enable:
# Desktop environment ####################################################
hardware.opengl.driSupport32Bit = true;
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
services.xserver = {
enable = true;
layout = "us";
libinput.enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome3.enable = true;
};
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
services.dbus.packages = [ pkgs.gnome3.dconf ];
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
services.printing.enable = true;
# Enable CUPS to print documents.
# services.printing.enable = true;
sound.enable = true;
hardware.pulseaudio.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Services #################################################################
services.pcscd = {
enable = true;
plugins = [ pkgs.ccid ]; # Needed for GPG + Yubikey
};
# Enable the X11 windowing system.
# services.xserver.enable = true;
# services.xserver.layout = "us";
# services.xserver.xkbOptions = "eurosign:e";
virtualisation.docker.enable = true;
virtualisation.libvirtd.enable = true;
users.groups.libvirtd.members = [ "jez" ];
# Enable touchpad support.
# services.xserver.libinput.enable = true;
# Enable the KDE Desktop Environment.
# services.xserver.displayManager.sddm.enable = true;
# services.xserver.desktopManager.plasma5.enable = true;
# Define a user account. Don't forget to set a password with passwd.
# users.users.jane = {
# isNormalUser = true;
# extraGroups = [ "wheel" ]; # Enable sudo for the user.
# };
# 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. Its 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 = "20.03"; # Did you read the comment?
services.netdata.enable = true;
}