1
0
Fork 0
it-infra/nixops/rpi.nix

75 lines
2.3 KiB
Nix
Raw Permalink Normal View History

2020-09-08 13:34:36 +08:00
{ host, rpi4, experimental-users ? false }:
2020-06-20 17:54:21 +08:00
{ config, pkgs, ... }:
let
2022-05-26 19:30:23 +08:00
artiq = builtins.getFlake git+https://github.com/m-labs/artiq.git;
2020-06-20 17:54:21 +08:00
in
{
deployment.targetHost = host;
2021-06-02 08:56:36 +08:00
deployment.hasFastConnection = true;
2020-12-12 15:01:38 +08:00
nix.nixPath = [ "nixpkgs=${pkgs.path}" ];
2021-03-29 14:01:46 +08:00
programs.command-not-found.dbPath = "${pkgs.path}/programs.sqlite";
2020-06-20 17:54:21 +08:00
nixpkgs.system = "aarch64-linux";
boot.loader.grub.enable = false;
2021-03-28 20:42:59 +08:00
boot.loader.generic-extlinux-compatible.enable = true;
2021-04-24 17:13:05 +08:00
boot.kernelParams = if rpi4 then ["cma=64M"] else []; # work around https://github.com/raspberrypi/linux/issues/3208
2021-06-02 08:57:07 +08:00
boot.initrd.includeDefaultModules = false;
2021-03-28 20:42:59 +08:00
fileSystems = {
2020-06-20 17:54:21 +08:00
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
};
services.openssh.enable = true;
2024-06-02 14:04:02 +08:00
services.openssh.authorizedKeysInHomedir = false;
2023-05-24 12:48:41 +08:00
services.openssh.settings.PasswordAuthentication = false;
services.openssh.settings.GatewayPorts = "clientspecified";
2020-07-15 12:32:57 +08:00
services.openssh.extraConfig =
''
StreamLocalBindUnlink yes
'';
2020-07-18 10:16:03 +08:00
programs.mosh.enable = true;
2020-06-20 17:54:21 +08:00
networking.hostName = host;
2021-01-23 18:56:22 +08:00
2020-06-20 17:54:21 +08:00
time.timeZone = "Asia/Hong_Kong";
users.extraGroups.plugdev = { };
users.mutableUsers = false;
users.defaultUserShell = pkgs.fish;
2024-02-16 18:10:05 +08:00
users.extraUsers = (import ./common-users.nix { inherit pkgs; }) // {
2021-08-04 10:24:18 +08:00
nixbld = {
isNormalUser = true;
extraGroups = ["plugdev" "dialout"];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGJGICdNM9mHHAa1Cxk9Wz3YLkIEeqrIQGxM0aoy1g5O"
2021-08-04 10:24:18 +08:00
];
};
2020-06-20 17:54:21 +08:00
};
security.sudo.wheelNeedsPassword = false;
services.udev.packages = [ artiq.packages.aarch64-linux.openocd-bscanspi ];
2020-09-11 15:27:01 +08:00
services.udev.extraRules = (import ./extra-udev.nix);
2020-06-20 17:54:21 +08:00
documentation.enable = false;
environment.systemPackages = with pkgs; [
2022-05-26 19:30:23 +08:00
psmisc wget vim git sshfs usbutils uhubctl lm_sensors file mosh tmux
artiq.packages.aarch64-linux.openocd-bscanspi
2022-06-17 16:06:16 +08:00
xc3sprog
2022-05-26 19:30:23 +08:00
screen gdb minicom picocom
2020-06-20 17:54:21 +08:00
];
2023-05-23 19:53:48 +08:00
programs.zsh.enable = true;
2020-06-20 17:54:21 +08:00
programs.fish.enable = true;
programs.wireshark.enable = true;
2022-11-29 10:14:26 +08:00
nix.settings.trusted-public-keys = ["nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc="];
2023-03-14 11:17:25 +08:00
nix.settings.substituters = ["https://nixbld.m-labs.hk?priority=10"];
2022-11-29 10:14:26 +08:00
nix.settings.trusted-users = ["root" "sb"];
2021-12-01 22:09:51 +08:00
nix.extraOptions = ''
experimental-features = nix-command flakes impure-derivations
2021-12-01 22:09:51 +08:00
'';
2020-06-20 17:54:21 +08:00
}