forked from emily/nixfiles
99 lines
2.5 KiB
Nix
99 lines
2.5 KiB
Nix
{ config, inputs, lib, pkgs, ... }: {
|
|
imports = [
|
|
inputs.nixos-hardware.nixosModules.raspberry-pi-4
|
|
../../common
|
|
../../profiles/headless.nix
|
|
];
|
|
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
console.enable = false;
|
|
|
|
deployment = {
|
|
targetHost = "192.168.178.170";
|
|
targetUser = "nixos";
|
|
};
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
kodiPackages.jellyfin
|
|
kodiPackages.keymap
|
|
libcec
|
|
libraspberrypi
|
|
raspberrypi-eeprom
|
|
];
|
|
fileSystems = {
|
|
"/" = {
|
|
device = "/dev/disk/by-label/NIXOS_SD";
|
|
fsType = "ext4";
|
|
options = [ "noatime" ];
|
|
};
|
|
};
|
|
hardware = {
|
|
bluetooth.enable = true;
|
|
deviceTree.enable = true;
|
|
raspberry-pi."4" = {
|
|
audio.enable = false;
|
|
apply-overlays-dtmerge.enable = true;
|
|
fkms-3d.enable = true;
|
|
};
|
|
};
|
|
|
|
kyouma.machine-type.physical = true;
|
|
|
|
nixpkgs.overlays = [
|
|
(self: super: { libcec = super.libcec.override { withLibraspberrypi = true; }; })
|
|
];
|
|
|
|
networking.hostName = "lain";
|
|
networking.networkmanager.enable = true;
|
|
systemd.network.enable = lib.mkForce false;
|
|
|
|
systemd.sockets."cec-client" = {
|
|
after = [ "dev-vchiq.device" ];
|
|
bindsTo = [ "dev-vchiq.device" ];
|
|
wantedBy = [ "sockets.target" ];
|
|
socketConfig = {
|
|
ListenFIFO = "/run/cec.fifo";
|
|
SocketGroup = "video";
|
|
SocketMode = "0660";
|
|
};
|
|
};
|
|
systemd.services."cec-client" = {
|
|
after = [ "dev-vchiq.device" ];
|
|
bindsTo = [ "dev-vchiq.device" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
ExecStart = ''${pkgs.libcec}/bin/cec-client -d 1'';
|
|
ExecStop = ''/bin/sh -c "echo q > /run/cec.fifo"'';
|
|
StandardInput = "socket";
|
|
StandardOutput = "journal";
|
|
Restart="no";
|
|
};
|
|
};
|
|
|
|
services.avahi = {
|
|
enable = true;
|
|
ipv6 = true;
|
|
nssmdns4 = true;
|
|
publish.enable = true;
|
|
publish.userServices = true;
|
|
};
|
|
services.cage = {
|
|
enable = true;
|
|
program = "${pkgs.kodi-wayland}/bin/kodi-standalone";
|
|
user = "kodi";
|
|
};
|
|
services.fstrim.enable = true;
|
|
services.pipewire = {
|
|
enable = true;
|
|
alsa.enable = true;
|
|
pulse.enable = true;
|
|
};
|
|
services.udev.extraRules = ''
|
|
# allow access to raspi cec device for video group (and optionally register it as a systemd device, used below)
|
|
KERNEL=="vchiq", GROUP="video", MODE="0660", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/dev/vchiq"
|
|
'';
|
|
|
|
users.mutableUsers = lib.mkForce true;
|
|
users.users.kodi.extraGroups = [ "video" ];
|
|
users.extraUsers.kodi.isNormalUser = true;
|
|
}
|