2019-10-22 20:09:56 +08:00
|
|
|
{ host, rpi4 }:
|
2019-10-21 21:26:44 +08:00
|
|
|
|
2019-10-22 20:09:56 +08:00
|
|
|
{ config, pkgs, ... }:
|
2019-03-20 19:58:30 +08:00
|
|
|
let
|
2019-10-22 20:09:56 +08:00
|
|
|
m-labs = import (fetchTarball https://nixbld.m-labs.hk/channel/custom/artiq/full/artiq-full/nixexprs.tar.xz) { inherit pkgs; };
|
2019-03-20 19:58:30 +08:00
|
|
|
in
|
|
|
|
{
|
2019-10-21 21:26:44 +08:00
|
|
|
deployment.targetHost = host;
|
|
|
|
nixpkgs.system = "aarch64-linux";
|
2019-10-22 20:09:56 +08:00
|
|
|
|
2019-03-20 19:58:30 +08:00
|
|
|
boot.loader.grub.enable = false;
|
2019-10-21 21:26:44 +08:00
|
|
|
|
2019-10-22 20:09:56 +08:00
|
|
|
boot.loader.generic-extlinux-compatible.enable = !rpi4;
|
|
|
|
boot.loader.raspberryPi = pkgs.lib.mkIf rpi4 {
|
|
|
|
enable = true;
|
|
|
|
version = 4;
|
|
|
|
};
|
|
|
|
boot.kernelPackages = pkgs.lib.mkIf rpi4 pkgs.linuxPackages_rpi4;
|
|
|
|
|
|
|
|
fileSystems = if rpi4 then {
|
|
|
|
"/boot" = {
|
|
|
|
device = "/dev/disk/by-label/FIRMWARE";
|
|
|
|
fsType = "vfat";
|
|
|
|
};
|
|
|
|
"/" = {
|
|
|
|
device = "/dev/disk/by-label/NIXOS_SD";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
} else {
|
2019-03-20 19:58:30 +08:00
|
|
|
"/" = {
|
|
|
|
device = "/dev/disk/by-label/NIXOS_SD";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.openssh.enable = true;
|
2020-05-09 21:52:00 +08:00
|
|
|
services.openssh.passwordAuthentication = false;
|
2019-03-20 19:58:30 +08:00
|
|
|
|
2019-10-21 21:26:44 +08:00
|
|
|
networking.hostName = host;
|
2019-03-20 19:58:30 +08:00
|
|
|
time.timeZone = "Asia/Hong_Kong";
|
|
|
|
|
2019-11-01 09:27:31 +08:00
|
|
|
programs.wireshark.enable = true;
|
|
|
|
|
2019-03-20 19:58:30 +08:00
|
|
|
users.extraGroups.plugdev = { };
|
2019-04-08 23:45:30 +08:00
|
|
|
security.sudo.wheelNeedsPassword = false;
|
2020-05-09 21:52:00 +08:00
|
|
|
users.extraUsers = (import ./common-users.nix) // {
|
|
|
|
nix = {
|
|
|
|
isNormalUser = true;
|
|
|
|
};
|
2020-05-07 12:55:08 +08:00
|
|
|
};
|
2019-03-20 19:58:30 +08:00
|
|
|
services.udev.packages = [ m-labs.openocd ];
|
|
|
|
|
2019-04-14 18:08:39 +08:00
|
|
|
documentation.enable = false;
|
2019-03-20 19:58:30 +08:00
|
|
|
environment.systemPackages = with pkgs; [
|
2020-01-02 18:53:46 +08:00
|
|
|
psmisc wget vim git usbutils lm_sensors file telnet mosh tmux xc3sprog m-labs.openocd screen gdb minicom picocom
|
2019-03-20 19:58:30 +08:00
|
|
|
];
|
2020-04-16 13:06:23 +08:00
|
|
|
programs.fish.enable = true;
|
|
|
|
users.defaultUserShell = pkgs.fish;
|
2019-03-20 19:58:30 +08:00
|
|
|
|
|
|
|
nix.binaryCachePublicKeys = ["nixbld.m-labs.hk-1:5aSRVA5b320xbNvu30tqxVPXpld73bhtOeH6uAjRyHc="];
|
|
|
|
nix.binaryCaches = ["https://cache.nixos.org" "https://nixbld.m-labs.hk"];
|
2019-04-08 23:45:30 +08:00
|
|
|
nix.trustedUsers = ["root" "nix"];
|
2019-03-20 19:58:30 +08:00
|
|
|
}
|