complete-computing-environment/nixos-settop.org

175 lines
5.9 KiB
Org Mode

:PROPERTIES:
:ID: 20220131T152041.472624
:ROAM_ALIASES: "NixOS Kodi Machine" "NixOS Settop Box"
:END:
#+title: NixOS Set Top Box
#+FILETAGS: :CCE:
#+ARCOLOGY_KEY: cce/settop
#+ARCOLOGY_ALLOW_CRAWL: t
I want a machine I can hook to a TV that has a web browser which can play YouTube at high resolution, an ad blocker, and kodi. I'd like to not do that for a thousand dollars.
* Past Attempts
** Thinkpad t480s
This is a work computer that got "lost" from asset tracking and anyways they told me they'd just e-waste it. I ran kodi on it until the CPU fan died.
** Intel NUC
This piece of shit stopped booting one day. They're expensive, noisy, and full screen videos tear when there is moderate CPU load even with the i5 model. I ran kodi on it until the CPU fan died
** aborted attempts for Linux on ODROID N2+ with hardware acceleration
:PROPERTIES:
:ID: 20220131T204513.935859
:END:
[[https://wiki.odroid.com/odroid-n2/odroid-n2][ODROID N2]] is a pretty powerful [[roam:ARM Single Board Computer]]. It comes without an OS out of the box, and has some pretty poor support for OS images -- right now it runs Android TV on it and can't stream 1080p from the NAS upstairs.
Basically all I want to work on it is KODI and Firefox
- CoreELEC will probably work great, but no web browser
- Official Ubuntu image didn't work well:
#+begin_quote
- No EGL/GPU Acceleration on X11 (You have to use Minimal image to have a HW GPU acceleration on the framebuffer)
- Chromium web rendering performance is quite slow while FireFox can play YouTube 1080p videos.[fn:1:this was not true, actually]
#+end_quote
- DietPi was X11 based, same issue.
- [[https://forum.odroid.com/viewtopic.php?f=179&t=39696][these guys]] funroll their loops
- [[https://forum.odroid.com/viewtopic.php?f=52&t=42300][Ubuntu 21.04 for ODROID-N2/C4/HC4]]
- =apt install kubuntu-desktop kwin-wayland=
- from the forum post:[fn:2:love to install random software builds lol. it's a settop box for ublock'd youtube and lichess, idc.]
#+begin_src shell
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E6A17451DC058F40
sudo add-apt-repository -S deb http://ppa.launchpad.net/saiarcot895/chromium-beta/ubuntu/ groovy main
sudo apt update
sudo apt-get install chromium-browser chromium-codecs-ffmpeg-extra
#+end_src
didn't set up the 'add this line to "cat /etc/chromium-browser/default"' tho.
kodi isn't really installing well there, i'm going to try to install the 20.04 install next with the same steps.
** AndroidTV on the ODROID N2+
That thing mostly worked decently and i used it for a while between experiments above. Kodi couldn't stream and play 1080p video. I thought it was Android's fault, but as you can see above it's more a limitation of the hardware's unsupported/undersupported graphics hardware.
* Back to the "thinkpad until the CPU fan dies"
[[id:cce/morph-tres-ebow][Tres Ebow]] is a computer which I unfortunately had a lot of bad luck with. I guess the CPU fan will die eventually. I've already replaced it once.
** Building a simple Set Top box with [[id:arroyo/nixos][Arroyo NixOS Generator]]
:PROPERTIES:
:ID: 20220201T201728.302360
:END:
#+begin_src nix :tangle ~/arroyo-nix/roles/settop/default.nix :mkdirp yes :noweb yes
{ pkgs, lib, ... }:
let
endpointCfg = ./default.nix; # this file
in
rec {
imports = [ ./hardware-configuration.nix ./generated.nix ] # (ref:imports)
++ [
<<arroyo_nixos_imports()>>
];
environment.etc."nixos/configuration.nix".source = endpointCfg;
}
#+end_src
#+NAME: arroyo_nixos_imports
#+begin_src emacs-lisp
(->>
(arroyo-nixos-imports "settop")
(--map (format "../../%s" it))
(s-join "\n"))
#+end_src
#+results: arroyo_nixos_imports
#+begin_example
../../nixos/laptop.nix
../../nixos/audio.nix
../../nixos/fonts.nix
../../nixos/settop.nix
../../nixos/tailscale.nix
../../nixos/nix-path.nix
../../nixos/gnupg-pam.nix
../../nixos/nixpkgs.nix
../../nixos/syncthing.nix
../../nixos/ssh_client.nix
../../nixos/boot.nix
../../nixos/home-manager.nix
../../nixos/mopidy.nix
../../nixos/cachix.nix
../../nixos/location.nix
../../nixos/zfs.nix
../../nixos/ccache.nix
../../nixos/rrix.nix
#+end_example
- I am providing a stub =hardware-configuration.nix= and =generated.nix=. I don't like this at all, it makes me nervous, I know some day I'll accidentally clobber these settings on my remote and end up without a bootloader or some hilarious nonsense. sigh. here we go![fn:3: this is taken verbatim from [[id:cce/my_nixos_configuration][My NixOS configuration]]]
#+begin_src nix :tangle ~/arroyo-nix/roles/settop/hardware-configuration.nix :noweb yes
{}
#+end_src
#+begin_src nix :tangle ~/arroyo-nix/roles/settop/generated.nix :noweb yes
{}
#+end_src
** Set Top Box [[id:arroyo/nixos][Arroyo NixOS]] module
:PROPERTIES:
:ID: 20220201T201733.313676
:END:
#+ARROYO_NIXOS_MODULE: nixos/settop.nix
#+ARROYO_SYSTEM_ROLE: settop
#+begin_src nix :tangle ~/arroyo-nix/nixos/settop.nix :mkdirp yes
{ pkgs, ... }:
{
services.xserver.desktopManager.kodi = {
enable = true;
};
services.xserver.desktopManager.plasma5 = {
enable = true;
};
users.groups.humans = {
name = "humans";
gid = 1000;
};
users.users.doomguy = {
isNormalUser = true;
home = "/home/doomguy";
description = "Doom Guy";
extraGroups = [ "audio" "wheel" "networkmanager" "adbusers" "systemd-journal" ];
uid = 1001;
group = "humans";
initialPassword = "doomguyjohnson";
openssh.authorizedKeys.keys = pkgs.lib.publicKeys.rrix;
};
users.users.root.openssh.authorizedKeys.keys = pkgs.lib.publicKeys.rrix;
services.xserver.enable = true;
services.xserver.displayManager = {
autoLogin.enable = true;
autoLogin.user = "doomguy";
defaultSession = "plasma";
lightdm.enable = true;
};
services.ntp.enable = true;
environment.systemPackages = with pkgs; [
htop
pavucontrol
firefox
];
programs.kdeconnect.enable = true;
}
#+end_src