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
|
|
|
|
|
|
|
|
|
|
# You can also split up your configuration and import pieces of it here:
|
|
|
|
|
|
2023-05-16 13:57:01 +08:00
|
|
|
|
# Containers
|
|
|
|
|
./containers/homepage.nix
|
2023-05-16 15:52:55 +08:00
|
|
|
|
./containers/pihole.nix
|
|
|
|
|
|
|
|
|
|
# Media server containers
|
2023-05-16 13:57:01 +08:00
|
|
|
|
./containers/jellyfin.nix
|
|
|
|
|
./containers/sonarr.nix
|
|
|
|
|
./containers/radarr.nix
|
2023-05-16 14:08:47 +08:00
|
|
|
|
./containers/prowlarr.nix
|
|
|
|
|
./containers/qbittorrent.nix
|
2023-05-16 13:57:01 +08:00
|
|
|
|
|
2023-05-14 22:44:45 +08:00
|
|
|
|
# Import your generated (nixos-generate-config) hardware configuration
|
|
|
|
|
./hardware-configuration.nix
|
|
|
|
|
];
|
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-13 23:55:59 +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-16 13:57:01 +08:00
|
|
|
|
|
|
|
|
|
# Mount a tmpfs on /tmp during boot
|
|
|
|
|
tmpOnTmpfs = 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-13 23:55:59 +08:00
|
|
|
|
networkmanager = {
|
|
|
|
|
enable = true;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2023-05-16 13:57:01 +08:00
|
|
|
|
environment = {
|
|
|
|
|
systemPackages = with pkgs; [
|
|
|
|
|
# System tools
|
|
|
|
|
vim wget git home-manager
|
|
|
|
|
|
|
|
|
|
# Developer tools
|
|
|
|
|
docker-compose
|
|
|
|
|
|
|
|
|
|
arion docker-client
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# 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;
|
|
|
|
|
permitRootLogin = "no";
|
|
|
|
|
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;
|
|
|
|
|
extraGroups = [ "docker" "networkmanager" "wheel" ];
|
|
|
|
|
shell = pkgs.zsh;
|
|
|
|
|
openssh.authorizedKeys.keyFiles = [ ../fuchsia/id_ed25519_sk.pub ];
|
|
|
|
|
};
|
|
|
|
|
|
2023-05-13 23:55:59 +08:00
|
|
|
|
# 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 = "22.11"; # Did you read the comment?
|
|
|
|
|
}
|
|
|
|
|
|