/ modules / nixos / rpi.nix
rpi.nix
 1  
 2  # # This is your nixos configuration.
 3  # # For home configuration, see /modules/home/*
 4  # { flake, inputs, ... }:
 5  # {
 6  #   imports = [
 7  #       flake.inputs.nixos-raspberrypi.lib.nixosSystem {
 8  #         specialArgs = inputs;
 9  #         modules = [
10  #           {
11  #             imports = with flake.inputs.nixos-raspberrypi.nixosModules; [
12  #               default
13  #               trusted-nix-caches
14  #               bootloader
15  #               usb-gadget-ethernet
16  #               raspberry-pi-5.base
17  #               raspberry-pi-5.display-vc4
18  #               raspberry-pi-5.bluetooth
19  #               # lib.int.default-nixos-raspberrypi-config
20  #               nixpkgs-rpi
21  #               ./pi5-configtext.nix
22  #             ];
23  #           }
24  #           (
25  #             {
26  #               config,
27  #               pkgs,
28  #               lib,
29  #               ...
30  #             }:
31  #             {
32  #               # system.nixos.tags =
33  #               #   let
34  #               #     cfg = config.boot.loader.raspberryPi;
35  #               #   in
36  #               #   [
37  #               #     "raspberry-pi-${cfg.variant}"
38  #               #     cfg.bootloader
39  #               #     config.boot.kernelPackages.kernel.version
40  #               #   ];
41  
42  #               networking = {
43  #                 hostName = "rpi5";
44  #                 # Use networkd instead of the pile of shell scripts
45  #                 # NOTE: SK: is it safe to combine with NetworkManager on desktops?
46  #                 useNetworkd = true;
47  #                 # Keep dmesg/journalctl -k output readable by NOT logging
48  #                 # each refused connection on the open internet.
49  #                 firewall.logRefusedConnections = false;
50  #               };
51  
52  #               systemd = {
53  #                 network.wait-online.enable = false;
54  #                 services = {
55  #                   # The notion of "online" is a broken concept
56  #                   # https://github.com/systemd/systemd/blob/e1b45a756f71deac8c1aa9a008bd0dab47f64777/NEWS#L13
57  #                   # https://github.com/NixOS/nixpkgs/issues/247608
58  #                   NetworkManager-wait-online.enable = false;
59  #                   # Do not take down the network for too long when upgrading,
60  #                   # This also prevents failures of services that are restarted instead of stopped.
61  #                   # It will use `systemctl restart` rather than stopping it with `systemctl stop`
62  #                   # followed by a delayed `systemctl start`.
63  #                   systemd-networkd.stopIfChanged = false;
64  #                   # Services that are only restarted might be not able to resolve when resolved is stopped before
65  #                   systemd-resolved.stopIfChanged = false;
66  #                 };
67  #               };
68  
69  #               services.udev.extraRules = ''
70  #                 # Ignore partitions with "Required Partition" GPT partition attribute
71  #                 # On our RPis this is firmware (/boot/firmware) partition
72  #                 ENV{ID_PART_ENTRY_SCHEME}=="gpt", \
73  #                 ENV{ID_PART_ENTRY_FLAGS}=="0x1", \
74  #                 ENV{UDISKS_IGNORE}="1"
75  #               '';
76  #               fileSystems = {
77  #                 "/boot/firmware" = {
78  #                   device = "/dev/disk/by-uuid/2175-794E";
79  #                   fsType = "vfat";
80  #                   options = [
81  #                     "noatime"
82  #                     "noauto"
83  #                     "x-systemd.automount"
84  #                     "x-systemd.idle-timeout=1min"
85  #                   ];
86  #                 };
87  #                 "/" = {
88  #                   device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
89  #                   fsType = "ext4";
90  #                   options = [ "noatime" ];
91  #                 };
92  #               };
93  
94  #             }
95  #           )
96  #         ];
97  #       };
98  #   ];
99  # }