dotfiles.nix/nixos/lavender/configuration.nix

203 lines
6 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
# You can also split up your configuration and import pieces of it here:
# 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
tmp.useTmpfs = true;
2023-05-13 23:55:59 +08:00
initrd.availableKernelModules = [ "usbhid" "usb_storage" ];
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
};
# Required for the Wireless firmware
hardware.enableRedistributableFirmware = true;
networking = {
hostName = "lavender";
networkmanager = {
enable = true;
};
};
2023-05-14 22:44:45 +08:00
# Install docker
virtualisation.docker = {
enable = true;
# Reduce container downtime due to daemon crashes
liveRestore = false;
};
2023-05-13 23:55:59 +08:00
# Configure keymap in X11
# services.xserver.layout = "us";
# services.xserver.xkbOptions = {
# "eurosign:e";
# "caps:escape" # map caps to escape.
# };
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
# services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
2023-05-14 18:39:26 +08:00
users.users.admin = {
isNormalUser = true;
2023-05-14 22:44:45 +08:00
extraGroups = [ "docker" "wheel" ]; # Enable sudo for the user.
2023-05-14 18:39:26 +08:00
shell = pkgs.zsh;
openssh.authorizedKeys.keyFiles = [ ../fuchsia/id_ed25519_sk.pub ];
};
2023-05-13 23:55:59 +08:00
# 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
git
home-manager
2023-05-14 22:44:45 +08:00
docker-compose
2023-05-13 23:55:59 +08:00
];
2023-05-14 18:39:26 +08:00
environment.pathsToLink = [ "/share/zsh" ];
2023-05-13 23:55:59 +08:00
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
2023-05-14 18:39:26 +08:00
programs.zsh.enable = true;
2023-05-14 00:21:03 +08:00
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
2023-05-13 23:55:59 +08:00
# List services that you want to enable:
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
2023-05-14 22:44:45 +08:00
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
};
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;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
# 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 = "22.11"; # Did you read the comment?
}