2024-01-24 20:25:19 -06:00
|
|
|
{
|
2024-01-24 22:02:50 -06:00
|
|
|
pkgs,
|
2024-01-24 20:25:19 -06:00
|
|
|
lib,
|
2024-01-24 21:25:09 -06:00
|
|
|
inputs,
|
2024-01-24 20:25:19 -06:00
|
|
|
outputs,
|
|
|
|
modulesPath,
|
|
|
|
...
|
|
|
|
}: {
|
|
|
|
nixpkgs.hostPlatform = "x86_64-linux";
|
|
|
|
networking.hostName = "htpc";
|
|
|
|
|
|
|
|
imports = with outputs.nixosModules; [
|
|
|
|
(modulesPath + "/installer/scan/not-detected.nix")
|
2024-02-02 22:38:32 -06:00
|
|
|
inputs.hardware.nixosModules.raspberry-pi-4
|
|
|
|
# inputs.hardware.nixosModules.common-cpu-intel-kaby-lake
|
|
|
|
# inputs.hardware.nixosModules.common-pc-ssd
|
|
|
|
# inputs.hardware.nixosModules.common-pc
|
2024-01-24 20:25:19 -06:00
|
|
|
desktop-usage
|
|
|
|
gnome
|
|
|
|
wifi
|
|
|
|
flanfam
|
|
|
|
flanfamkiosk
|
|
|
|
];
|
|
|
|
|
2024-02-02 22:38:32 -06:00
|
|
|
hardware = {
|
|
|
|
raspberry-pi."4".apply-overlays-dtmerge.enable = true;
|
|
|
|
deviceTree = {
|
|
|
|
enable = true;
|
|
|
|
filter = "*rpi-4-*.dtb";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
console.enable = false;
|
|
|
|
|
2024-01-24 21:30:04 -06:00
|
|
|
services.gnome.gnome-remote-desktop.enable = true;
|
|
|
|
|
2024-01-24 20:25:19 -06:00
|
|
|
networking.networkmanager.enable = true;
|
|
|
|
nix.settings.experimental-features = ["nix-command" "flakes"];
|
|
|
|
|
|
|
|
home-manager.users.daniel = {
|
|
|
|
imports = with outputs.homeManagerModules; [linux-desktop];
|
|
|
|
};
|
|
|
|
|
2024-01-24 22:02:50 -06:00
|
|
|
environment.systemPackages = with pkgs;
|
|
|
|
#with pkgs;
|
2024-02-02 22:38:32 -06:00
|
|
|
[
|
|
|
|
libcec
|
|
|
|
variety
|
|
|
|
libraspberrypi
|
|
|
|
raspberrypi-eeprom
|
|
|
|
];
|
2024-01-24 20:25:19 -06:00
|
|
|
|
|
|
|
programs.steam.enable = true;
|
|
|
|
programs.steam.remotePlay.openFirewall = true;
|
|
|
|
|
2024-02-02 22:38:32 -06:00
|
|
|
services.xserver = {
|
|
|
|
enable = true;
|
2024-02-03 10:51:20 -06:00
|
|
|
displayManager = {
|
|
|
|
# lightdm.enable = true;
|
|
|
|
autoLogin.enable = true;
|
|
|
|
autoLogin.user = "daniel";
|
|
|
|
};
|
2024-02-02 22:38:32 -06:00
|
|
|
desktopManager.gnome.enable = true;
|
|
|
|
videoDrivers = ["fbdev"];
|
|
|
|
};
|
|
|
|
|
|
|
|
hardware.raspberry-pi."4".fkms-3d.enable = true;
|
|
|
|
hardware.raspberry-pi."4".audio.enable = true;
|
|
|
|
|
|
|
|
nixpkgs.overlays = [
|
|
|
|
# nixos-22.05
|
|
|
|
# (self: super: { libcec = super.libcec.override { inherit (self) libraspberrypi; }; })
|
|
|
|
# nixos-22.11
|
|
|
|
(self: super: {libcec = super.libcec.override {withLibraspberrypi = true;};})
|
|
|
|
];
|
|
|
|
|
2024-01-24 20:25:19 -06:00
|
|
|
# Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229
|
|
|
|
systemd.services."getty@tty1".enable = false;
|
|
|
|
systemd.services."autovt@tty1".enable = false;
|
|
|
|
|
|
|
|
# hardware
|
|
|
|
systemd.targets.sleep.enable = false;
|
|
|
|
systemd.targets.suspend.enable = false;
|
|
|
|
systemd.targets.hibernate.enable = false;
|
|
|
|
systemd.targets.hybrid-sleep.enable = false;
|
|
|
|
|
|
|
|
powerManagement.enable = false;
|
|
|
|
|
|
|
|
boot.loader.grub.enable = true;
|
|
|
|
boot.loader.grub.device = "/dev/sda";
|
|
|
|
|
|
|
|
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci"];
|
|
|
|
boot.initrd.kernelModules = [];
|
2024-02-02 22:38:32 -06:00
|
|
|
boot.kernelModules = [
|
|
|
|
# "kvm-intel"
|
|
|
|
];
|
2024-01-24 21:13:03 -06:00
|
|
|
boot.extraModulePackages = [];
|
2024-01-24 20:25:19 -06:00
|
|
|
|
|
|
|
fileSystems."/" = {
|
|
|
|
device = "/dev/disk/by-uuid/0f4e5814-0002-43f0-bfab-8368e3fe5b8a";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
|
2024-01-24 21:30:04 -06:00
|
|
|
networking = {
|
|
|
|
# useDHCP = true;
|
|
|
|
|
|
|
|
firewall = {
|
|
|
|
enable = true;
|
|
|
|
allowPing = true;
|
|
|
|
allowedTCPPorts = [22 5900];
|
|
|
|
allowedUDPPorts = [5900];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-02-02 22:38:32 -06:00
|
|
|
services.udev.extraRules = ''
|
|
|
|
# allow access to raspi cec device for video group (and optionally register it as a systemd device, used below)
|
|
|
|
SUBSYSTEM=="vchiq", GROUP="video", MODE="0660", TAG+="systemd", ENV{SYSTEMD_ALIAS}="/dev/vchiq"
|
|
|
|
'';
|
|
|
|
|
2024-01-24 20:25:19 -06:00
|
|
|
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
|
|
|
|
|
2024-02-02 22:38:32 -06:00
|
|
|
# optional: attach a persisted cec-client to `/run/cec.fifo`, to avoid the CEC ~1s startup delay per command
|
|
|
|
# scan for devices: `echo 'scan' > /run/cec.fifo ; journalctl -u cec-client.service`
|
|
|
|
# set pi as active source: `echo 'as' > /run/cec.fifo`
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-01-24 20:25:19 -06:00
|
|
|
system.stateVersion = "23.11";
|
|
|
|
}
|