···1111 "font-hack-nerd-font" # move this to nix installation
1212 "1password"
1313 "discord" # use this one since nixpkgs doesn't have krisp
1414+ "modrinth"
1415 ];
1516}
+62-44
config/nixos/lithium/default.nix
···11-{ self, inputs, pkgs, hostname, ... }:
11+{ config, pkgs, inputs, lib, hostname,... }:
22{
33- # Force update to the last linux kernel avalaible
44- boot.kernelPackages = pkgs.linuxPackages_latest;
33+ imports = [
44+ # Raspberry Pi 3 hardware module
55+ inputs.hardware.nixosModules.raspberry-pi-3
66+ ];
77+88+ # Disable some modules
99+ disabledModules = [ "profiles/base.nix" ];
1010+1111+ # Used to build image/version
1212+ nixpkgs.hostPlatform.system = "aarch64-linux";
1313+1414+ # Allow licensed firmware to be update
1515+ hardware.enableRedistributableFirmware = true;
51666- # Special hardware config for raspberry
77- hardware = {
88- raspberry-pi."4".apply-overlays-dtmerge.enable = true;
99- raspberry-pi."4".fkms-3d.enable = true; # Enable hardware acceleration
1010- deviceTree = {
1111- enable = true;
1212- filter = "*rpi-4-*.dtb";
1313- };
1414- };
1717+ # Early boot
1818+ boot.initrd.kernelModules = [ "vc4" "bcm2835_dma" "i2c_bcm2835" ];
15191616- # Networking configuration
1717- # networking.networkmanager.enable = true;
2020+ # Network
1821 networking.hostName = hostname;
1919- networking.interfaces."wlan0".useDHCP = true;
2020- networking.wireless = {
2121- enable = true;
2222- interfaces = [ "wlan0" ];
2323- };
24222525- users.users."rpi" = {
2626- isNormalUser = true;
2727- extraGroups = [ "wheel" ];
2828- hashedPassword = "$y$j9T$rg0syrPPtjaLILPTTplI3/$5uykqP9tXjAsvOocbfosUeN6j6dMrHRUtwudKd4QaA5"; # password generated with `mkpasswd` command
2323+ # Time
2424+ time.timeZone = "Europe/Paris";
29253030- # User wide packages
3131- packages = [];
3232- };
2626+ # Enable ssh
2727+ services.openssh.enable = true;
2828+33293434- # System wide packages
3030+ # Auto login to magnetis user on startup
3131+ services.displayManager.autoLogin.enable = true;
3232+ services.displayManager.autoLogin.user = "magnetis";
3333+ services.getty.autologinUser = "magnetis";
3434+3535+ # Environment wide packages
3536 environment.systemPackages = with pkgs; [
3637 libraspberrypi
3737- raspberrypi-eeprom
3838+ git
3839 ];
39404040- # Garbage collector
4141- nix.gc = {
4242- automatic = true;
4343- dates = "weekly";
4444- options = "--delete-older-than 7d";
4141+ # Configure users
4242+ users.mutableUsers = true;
4343+ users.users.cosmeak = {
4444+ isNormalUser = true;
4545+ extraGroups = [ "networkmanager" "wheel" ]; # wheel = admin
4546 };
46474747- nix.settings = {
4848- auto-optimise-store = true; # Related to garbage collector
4949- experimental-features = "nix-command flakes"; # Enable flakes
4848+ # Nix settings
4949+ nix.settings.experimental-features = "nix-command flakes";
5050+5151+ # Perform garbage collection weekly to maintain low disk usage
5252+ gems.system.garbageCollector.enable = true;
5353+ gems.system.autoUpdate.enable = false;
5454+5555+ # Optimize storage
5656+ nix.settings.auto-optimise-store = true;
5757+5858+ # Minecraft Server
5959+ services.minecraft-server = {
6060+ enable = true;
6161+ eula = true;
6262+ openFirewall = true; # Opens the port the server is running on (by default 25565)
6363+ declarative = true;
6464+ serverProperties = {
6565+ difficulty = 3;
6666+ gamemode = 1;
6767+ max-players = 5;
6868+ motd = "NixOS Minecraft server!";
6969+ white-list = false;
7070+ };
5071 };
51725252- # "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" creates a
5353- # disk with this label on first boot. Therefore, we need to keep it. It is the
5454- # only information from the installer image that we need to keep persistent
5555- fileSystems."/" = {
5656- device = "/dev/disk/by-label/NIXOS_SD";
5757- fsType = "ext4";
5858- };
7373+ # Swap file
7474+ swapDevices = [{
7575+ device = "/swapfile";
7676+ size = 1024; # 1GB
7777+ }];
59786079 # This value determines the NixOS release from which the default
6180 # settings for stateful data, like file locations and database versions
···6382 # this value at the release version of the first install of this system.
6483 # Before changing this value read the documentation for this option
6584 # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
6666- # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
6785 system.stateVersion = "24.11"; # Did you read the comment?
6886}