dotfiles.nix/nixos/lavender/configuration.nix

181 lines
4.9 KiB
Nix
Raw Normal View History

2023-05-13 23:55:59 +08:00
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{ inputs, outputs, lib, config, pkgs, ... }: {
2023-05-14 22:44:45 +08:00
# You can import other NixOS modules here
imports = [
# If you want to use modules your own flake exports (from modules/nixos):
# outputs.nixosModules.example
# Or modules from other flakes (such as nixos-hardware):
# inputs.hardware.nixosModules.common-cpu-amd
# inputs.hardware.nixosModules.common-ssd
2023-07-01 21:46:27 +08:00
# Import common configurations
../common/system-tools.nix
2023-05-14 22:44:45 +08:00
# Import your generated (nixos-generate-config) hardware configuration
./hardware-configuration.nix
2023-08-06 08:57:14 +08:00
# Setup our 3D printer
./printer
# Import our docker containers
./containers
2023-05-14 22:44:45 +08:00
];
2023-05-13 23:55:59 +08:00
nixpkgs = {
2023-05-14 22:44:45 +08:00
# You can add overlays here
2023-05-13 23:55:59 +08:00
overlays = [
2023-05-14 22:44:45 +08:00
# Add overlays your own flake exports (from overlays and pkgs dir):
2023-05-13 23:55:59 +08:00
outputs.overlays.additions
outputs.overlays.modifications
outputs.overlays.unstable-packages
2023-05-14 22:44:45 +08:00
# You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
2023-05-13 23:55:59 +08:00
];
2023-05-14 22:44:45 +08:00
# Configure your nixpkgs instance
2023-05-13 23:55:59 +08:00
config = {
2023-05-14 22:44:45 +08:00
# Disable if you don't want unfree packages
2023-05-13 23:55:59 +08:00
allowUnfree = true;
};
};
nix = {
gc = {
2023-05-14 22:44:45 +08:00
#Automatically run the garbage collector at a specific time.
2023-05-13 23:55:59 +08:00
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
2023-05-14 22:44:45 +08:00
# This will add each flake input as a registry
# To make nix commands consistent with your flake
2023-05-13 23:55:59 +08:00
registry = lib.mapAttrs (_: value: { flake = value; }) inputs;
2023-05-14 22:44:45 +08:00
# This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome!
2023-05-13 23:55:59 +08:00
nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry;
2023-05-14 22:44:45 +08:00
2023-05-13 23:55:59 +08:00
settings = {
2023-05-14 22:44:45 +08:00
# Enable flakes and new 'nix' command
2023-05-13 23:55:59 +08:00
experimental-features = "nix-command flakes";
2023-05-14 22:44:45 +08:00
# Deduplicate and optimize nix store
2023-05-13 23:55:59 +08:00
auto-optimise-store = true;
};
2023-05-14 22:44:45 +08:00
# Free up to 1GiB whenever there is less than 100MiB left.
extraOptions = ''
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
2023-05-13 23:55:59 +08:00
};
2023-05-14 22:44:45 +08:00
# Select internationalisation properties
i18n.defaultLocale = "en_AU.UTF-8";
# Set timezone
time.timeZone = "Australia/Perth";
2023-05-13 23:55:59 +08:00
boot = {
2023-05-14 22:44:45 +08:00
# Kernel to install
2023-05-24 22:25:12 +08:00
kernelPackages = pkgs.linuxPackages_rpi4;
2023-05-14 22:44:45 +08:00
# ttyAMA0 is the serial console broken out to the GPIO
2023-05-13 23:55:59 +08:00
kernelParams = [
"8250.nr_uarts=1"
"console=ttyAMA0,115200"
"console=tty1"
# A lot of GUI programs need this, nearly all wayland applications
"cma=128M"
];
2023-05-14 22:44:45 +08:00
loader = {
# Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
generic-extlinux-compatible.enable = true;
};
2023-05-13 23:55:59 +08:00
};
2023-05-16 13:57:01 +08:00
hardware = {
# Required for the Wireless firmware
enableRedistributableFirmware = true;
};
2023-05-13 23:55:59 +08:00
networking = {
hostName = "lavender";
2023-05-16 13:57:01 +08:00
domain = "kanto.dev";
2023-05-25 00:54:04 +08:00
networkmanager.enable = true;
2023-07-29 08:30:05 +08:00
firewall = {
enable = true;
2023-07-30 09:13:40 +08:00
allowedTCPPorts = [
53 # pihole-FTL (DNS)
80 # traefik (HTTP)
443 # traefik (HTTPS)
32400 # plex
32372 # qbittorrent
];
allowedUDPPorts = [
53 # pihole-FTL (DNS)
80 # traefik (HTTP)
443 # traefik (HTTPS)
32400 # plex
32372 # qbittorrent
];
2023-07-29 08:30:05 +08:00
};
2023-05-13 23:55:59 +08:00
};
2023-05-16 13:57:01 +08:00
environment = {
2023-08-06 08:57:14 +08:00
# Install packages, prefix with 'unstable' to use overlay.
systemPackages = with pkgs; [
libraspberrypi
raspberrypi-eeprom
];
2023-05-16 13:57:01 +08:00
# Completions for system packages
pathsToLink = [ "/share/zsh" ];
2023-05-14 18:39:26 +08:00
};
2023-05-13 23:55:59 +08:00
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
2023-05-16 13:57:01 +08:00
programs = {
zsh.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
2023-05-14 00:21:03 +08:00
};
2023-05-16 13:57:01 +08:00
2023-05-13 23:55:59 +08:00
# List services that you want to enable:
2023-05-16 13:57:01 +08:00
services = {
# Enable the OpenSSH daemon.
openssh = {
enable = true;
2023-06-04 00:52:58 +08:00
settings = {
# Disable root login.
PermitRootLogin = "no";
# Disable password login (Require keys).
PasswordAuthentication = false;
};
2023-05-14 22:44:45 +08:00
};
2023-05-13 23:55:59 +08:00
};
2023-05-16 13:57:01 +08:00
# Define a user account. Don't forget to set a password with passwd.
users.users.admin = {
isNormalUser = true;
2023-07-27 20:13:14 +08:00
extraGroups = [ "networkmanager" "wheel" "docker" ];
2023-05-16 13:57:01 +08:00
shell = pkgs.zsh;
openssh.authorizedKeys.keyFiles = [ ../fuchsia/id_ed25519_sk.pub ];
};
2023-05-25 00:54:04 +08:00
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = "22.11";
2023-05-13 23:55:59 +08:00
}