Browse Source

Complete tasks

main
parent
commit
3562bfff11
Signed by: chris GPG Key ID: 3025DCBD46F81C0F
  1. 571
      README.org
  2. BIN
      docs/daily/2022-03-10.org.gpg
  3. 68
      flake.nix

571
README.org

@ -451,10 +451,10 @@ It's helpful to add the machine hostnames to the networking configuration, so I
#+NAME: host-config-home #+NAME: host-config-home
#+BEGIN_SRC nix #+BEGIN_SRC nix
networking.hosts = { networking.hosts = {
"192.168.3.105" = [ "gamingpc" ];
"192.168.3.163" = [ "acernitro" ];
"192.168.3.182" = [ "raspberry" ];
"192.168.3.183" = [ "homecloud" ];
# "192.168.3.105" = [ "gamingpc" ];
# "192.168.3.163" = [ "acernitro" ];
# "192.168.3.182" = [ "raspberry" ];
# "192.168.3.183" = [ "homecloud" ];
}; };
#+END_SRC #+END_SRC
@ -566,389 +566,6 @@ The file system for this host is a single 24GB =QCOW= file, a format for disk im
} }
#+END_SRC #+END_SRC
** Acernitro
My gaming laptop, the model is an [[https://laptopmedia.com/laptop-specs/acer-nitro-5-an515-53-2][Acer Nitro AN-515-53]]. The Nitro 5 has more in common with the mid-range notebooks rather than the gaming models due to its cooling design, chassis, and overall construction.
Here are the specs:
| Slot | Component |
|---------+---------------------------------------|
| CPU | Intel Core i5-8300H |
| GPU | NVIDIA GeForce GTX 1050Ti (4GB GDDR5) |
| RAM | 16GB DDR4 |
| Display | 15.6" Full HD (1920 x 1080), IPS |
| Storage | 1000GB HDD |
| Weight | 2.48kg (5.5 lbs) |
#+NAME: host-acernitro
#+BEGIN_SRC nix :noweb yes
acernitro = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/acernitro
<<module-x11>>
<<module-ssh>>
<<module-hugo>>
<<module-docker>>
<<module-flakes>>
<<module-cachix>>
<<module-nvidia>>
<<module-firefox>>
<<module-moonlight>>
<<module-teamviewer>>
<<module-home-manager>>
];
};
#+END_SRC
Deploy this configuration with ~nixos-rebuild switch --flake /etc/dotfiles/#acernitro~.
#+BEGIN_SRC nix :noweb yes :tangle hosts/acernitro/default.nix
# <<file-warning>>
{ ... }:
{
imports = [
./configuration.nix
./hardware.nix
];
}
#+END_SRC
*** Configuration
This configuration is nearly identical to the default, except for a few key differences:
+ Enables sound
+ Applies the desired hostname
+ Enables power management daemon
+ It adds support for =UEFI= systems
+ Enables support for wireless networking
#+BEGIN_SRC nix :noweb yes :tangle hosts/acernitro/configuration.nix
# <<file-warning>>
{ config, pkgs, inputs, ... }:
{
time.timeZone = "America/Toronto";
networking.hostName = "acernitro";
networking.firewall.enable = false;
networking.wireless.enable = true;
networking.wireless.userControlled.enable = true;
networking.useDHCP = false;
networking.interfaces.enp6s0f1.useDHCP = true;
networking.interfaces.wlp0s20f3.useDHCP = true;
<<host-config-wifi>>
<<host-config-home>>
<<host-config-ssh>>
services.tlp.enable = true;
services.xserver.dpi = 96;
services.xserver.libinput.touchpad.tapping = false;
services.printing.enable = true;
programs.mtr.enable = true;
programs.fish.enable = true;
programs.gnupg.agent.enable = true;
users.users.chris = {
shell = pkgs.fish;
isNormalUser = true;
extraGroups = [ "wheel" ];
};
}
#+END_SRC
*** Hardware
+ Enables sound via PulseAudio
+ Enables powertop via power management
+ Adds support for the NVIDIA Hybrid GPU
#+BEGIN_SRC nix :noweb yes :tangle hosts/acernitro/hardware.nix
# <<file-warning>>
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
sound.enable = true;
hardware.pulseaudio.enable = true;
hardware.pulseaudio.support32Bit = true;
fileSystems."/" =
{ device = "/dev/disk/by-uuid/2f548eb9-47ce-4280-950f-9c6d1d162852";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5BC3-73F3";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/bef7bf62-d26f-45b1-a1f8-1227c2f8b26a"; }
];
powerManagement.powertop.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}
#+END_SRC
** Raspberry
The [[https://raspberrypi.org/products/raspberry-pi-400/][Raspberry Pi 400]] is your complete personal computer, built into a compact keyboard. It features a quad-core, 64-bit processor, 4GB of RAM, wireless networking, dual-display output, 4k video playback, as well as a 40-pin GPIO header. It's the most powerful Raspberry Pi computer yet.
#+NAME: host-raspberry
#+BEGIN_SRC nix :noweb yes
raspberry = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/raspberry
<<module-x11>>
<<module-ssh>>
<<module-flakes>>
<<module-cachix>>
<<module-home-manager>>
];
};
#+END_SRC
Deploy this configuration with ~sudo nixos-rebuild switch --flake /etc/dotfiles/#raspberry~.
#+BEGIN_SRC nix :noweb yes :tangle hosts/raspberry/default.nix
# <<file-warning>>
{ ... }:
{
imports = [
./configuration.nix
./hardware.nix
];
}
#+END_SRC
*** Configuration
#+BEGIN_SRC nix :noweb yes :tangle hosts/raspberry/configuration.nix
# <<file-warning>>
{ config, pkgs, ... }:
{
time.timeZone = "America/Toronto";
networking.hostName = "raspberry";
networking.firewall.enable = false;
networking.networkmanager.enable = true;
networking.interfaces.eth0.useDHCP = true;
networking.interfaces.wlan0.useDHCP = true;
<<host-config-home>>
<<host-config-ssh>>
environment.systemPackages = [
pkgs.libraspberrypi
pkgs.raspberrypi-eeprom
];
programs.fish.enable = true;
programs.gnupg.agent.enable = true;
users.users.chris = {
shell = pkgs.fish;
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
};
}
#+END_SRC
*** Hardware
This section is very much a work in progress. I have struggled to get this device to boot according to the NixOS documentation / wiki on the subject. It seems that when running with the vendored kernel there's an issue booting from the SD card. Nevertheless, the issue is avoided by using the standard kernel.
#+BEGIN_SRC nix :noweb yes :tangle hosts/raspberry/hardware.nix
# <<file-warning>>
{ config, pkgs, lib, inputs, ... }:
{
# imports = [
# inputs.nixos-hardware.nixosModules.raspberry-pi-4
# ];
# boot.kernelPackages = pkgs.linuxPackages_rpi4;
boot.tmpOnTmpfs = true;
boot.initrd.availableKernelModules = [ "usbhid" "usb_storage" ];
boot.kernelParams = [
"8250.nr_uarts=1"
"console=ttyAMA0,115200"
"console=tty1"
"cma=128M"
];
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
boot.loader.raspberryPi = {
enable = true;
version = 4;
firmwareConfig = ''
hdmi_drive=2
hdmi_force_hotplug=1
dtparam=sd_poll_once=on
dtparam=audio=on
'';
};
# FIXME: Requires GPU support.
services.xserver.videoDrivers = [ "fbdev" ];
sound.enable = true;
hardware.pulseaudio.enable = true;
hardware.enableRedistributableFirmware = true;
# hardware.raspberry-pi."4".fkms-3d.enable = true;
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
fsType = "ext4";
options = [ "noatime" ];
};
};
powerManagement.cpuFreqGovernor = "ondemand";
}
#+END_SRC
** Homecloud
The [[https://www.raspberrypi.org/products/raspberry-pi-4-model-b/][Raspberry Pi Model B-8GB]] is the latest product in the popular Raspberry Pi range of computers. It offers groundbreaking increases in processor speed, multimedia performance, memory, and connectivity compared to the prior generation. On [[https://nixos.org/][NixOS]], the Raspberry Pi family is /only/ supported on the =AArch64= platform, although there is community support for =armv6l= and =armv7l=.
#+NAME: host-homecloud
#+BEGIN_SRC nix :noweb yes
homecloud = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/homecloud
<<module-ssh>>
<<module-flakes>>
<<module-cachix>>
<<module-jellyfin>>
];
};
#+END_SRC
Deploy this configuration with ~sudo nixos-rebuild switch --flake /etc/dotfiles/#homecloud~.
#+BEGIN_SRC nix :noweb yes :tangle hosts/homecloud/default.nix
# <<file-warning>
{ ... }:
{
imports = [
./configuration.nix
./hardware.nix
];
}
#+END_SRC
*** Configuration
#+BEGIN_SRC nix :noweb yes :tangle hosts/homecloud/configuration.nix
# <<file-warning>>
{ config, pkgs, ... }:
{
time.timeZone = "America/Toronto";
networking.hostName = "homecloud";
networking.firewall.enable = false;
networking.networkmanager.enable = true;
networking.interfaces.eth0.useDHCP = true;
networking.interfaces.wlan0.useDHCP = true;
<<host-config-wifi>>
<<host-config-home>>
<<host-config-ssh>>
environment.systemPackages = [
pkgs.libraspberrypi
pkgs.raspberrypi-eeprom
];
programs.fish.enable = true;
programs.mtr.enable = true;
users.users.chris = {
shell = pkgs.fish;
isNormalUser = true;
extraGroups = [ "wheel" "networkmanager" ];
};
}
#+END_SRC
*** Hardware
#+BEGIN_SRC nix :noweb yes :tangle hosts/homecloud/hardware.nix
# <<file-warning>>
{ config, pkgs, lib, inputs, ... }:
{
# imports = [
# inputs.nixos-hardware.nixosModules.raspberry-pi-4
# ];
# boot.kernelPackages = pkgs.linuxPackages_rpi4;
boot.tmpOnTmpfs = true;
boot.initrd.availableKernelModules = [ "usbhid" "usb_storage" ];
boot.kernelParams = [
"8250.nr_uarts=1"
"console=ttyAMA0,115200"
"console=tty1"
"cma=128M"
];
boot.loader.grub.enable = false;
boot.loader.generic-extlinux-compatible.enable = true;
boot.loader.raspberryPi = {
enable = true;
version = 4;
firmwareConfig = ''
hdmi_drive=2
hdmi_force_hotplug=1
dtparam=sd_poll_once=on
dtparam=audio=on
'';
};
# hardware.raspberry-pi."4".fkms-3d.enable = true;
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/44444444-4444-4444-8888-888888888888";
fsType = "ext4";
options = [ "noatime" ];
};
};
powerManagement.cpuFreqGovernor = "ondemand";
}
#+END_SRC
** Android ** Android
This is my [[https://samsung.com/us/mobile/galaxy-s10/buy/][Samsung Galaxy S10+]] running [[https://github.com/t184256/nix-on-droid][Nix On Droid]] with the experimental support for [[https://nixos.wiki/wiki/Flakes][Flakes]] being used to manage the configuration. This is my [[https://samsung.com/us/mobile/galaxy-s10/buy/][Samsung Galaxy S10+]] running [[https://github.com/t184256/nix-on-droid][Nix On Droid]] with the experimental support for [[https://nixos.wiki/wiki/Flakes][Flakes]] being used to manage the configuration.
@ -1165,123 +782,6 @@ in {
} }
#+END_SRC #+END_SRC
** NVIDIA
#+NAME: module-nvidia
#+BEGIN_SRC nix
./modules/nvidia.nix
#+END_SRC
Use the ~lspci~ command to determine the type of graphics card you have, following the guide on NVIDIA at the [[https://nixos.wiki/wiki/Nvidia][NixOS Wiki]].
#+BEGIN_QUOTE
+ MXM / output-providing card (shows as VGA Controller in lspci), i.e. graphics card in desktop computer or in some laptops
+ muxless/non-MXM Optimus cards have no display outputs and show as 3D Controller in lspci output, seen in most modern consumer laptops
MXM cards allow you to use the Nvidia card standalone, in Non-Optimus mode. Non-MXM cards require Optimus, Nvidia's integrated-vs-discrete GPU switching technology.
#+END_QUOTE
Your output should look something like this:
#+BEGIN_EXAMPLE
...
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Mobile)
Subsystem: Acer Incorporated [ALI] Device 1264
Kernel driver in use: i915
Kernel modules: i915
...
01:00.0 VGA compatible controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)
Subsystem: Acer Incorporated [ALI] Device 1265
Kernel driver in use: nouveau
Kernel modules: nvidiafb, nouveau
01:00.1 Audio device: NVIDIA Corporation GP107GL High Definition Audio Controller (rev a1)
Kernel driver in use: snd_hda_intel
Kernel modules: snd_hda_intel
...
#+END_EXAMPLE
This reveals the information needed, which is the information about the two display cards in the laptop:
+ Intel UHD :: This is the dedicated graphics on the CPU
+ NVIDIA GP107M :: This is the /mobile/ version of the GTX 1050ti
#+BEGIN_SRC nix :noweb yes :tangle modules/nvidia.nix
{ lib, config, pkgs, ... }:
let
myIntelBusId = "PCI:0:2:0";
myNvidiaBusId = "PCI:1:0:0";
myNvidiaOffload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec -a "$0" "$@"
'';
in {
# Blacklist the open source driver.
boot.blacklistedKernelModules = [ "nouveau" ];
# Add the offload script to the $PATH.
environment.systemPackages = [ myNvidiaOffload ];
# Configure XDG compliance.
environment.variables = {
__GL_SHADER_DISK_CACHE_PATH = "$XDG_CACHE_HOME/nv";
CUDA_CACHE_PATH = "$XDG_CACHE_HOME/nv";
};
# Enable the NVIDIA drivers.
services.xserver.videoDrivers = [ "nvidia" ];
# Fix screen tearing.
services.xserver.screenSection = ''
Option "metamodes" "nvidia-auto-select +0+0 {ForceFullCompositionPipeline=On}"
Option "AllowIndirectGLXProtocol" "off"
Option "TripleBuffer" "on"
'';
# Fix graphical corruption on suspend.
hardware.nvidia.powerManagement.enable = true;
# Configure `offload-mode'.
hardware.nvidia.prime = {
offload.enable = true;
intelBusId = myIntelBusId;
nvidiaBusId = myNvidiaBusId;
};
# Add OpenGL support.
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages32 = with pkgs; [
pkgsi686Linux.libva
intel-media-driver
vaapiIntel
];
};
# Create an external display setup.
specialisation = {
external-display.configuration = {
system.nixos.tags = [ "external-display" ];
hardware.nvidia.prime.offload.enable = lib.mkForce false;
hardware.nvidia.powerManagement.enable = lib.mkForce false;
};
};
# Add user to video group.
users.users.chris = {
extraGroups = [ "video" ];
};
}
#+END_SRC
** Firefox ** Firefox
#+NAME: module-firefox #+NAME: module-firefox
@ -1303,69 +803,6 @@ in {
} }
#+END_SRC #+END_SRC
** Jellyfin
#+NAME: module-jellyfin
#+BEGIN_SRC nix
./modules/jellyfin.nix
#+END_SRC
[[https://jellyfin.org][Jellyfin]] is a suite of multimedia applications designed to organize, manage, and share digital media files to networked devices. It consists of a server application installed on a machine, and another application running as a client on devices such as Smartphones, Tablets, SmartTVs, Streaming Media Players, Game Consoles, or in a Web Browser. It can also serve media to DLNA and Chromecast enabled devices. It's free and open-source software fork of Emby.
#+BEGIN_SRC nix :noweb yes :tangle modules/jellyfin.nix
# <<file-warning>>
{ config, pkgs, ... }:
{
services.jellyfin = {
enable = true;
};
}
#+END_SRC
** Moonlight
#+NAME: module-moonlight
#+BEGIN_SRC nix
./modules/moonlight.nix
#+END_SRC
[[https://moonlight-stream.org][Moonlight]] is an open-source implementation of NVIDIA's GameStream Protocol. You can stream your collection of PC games from your GameStream-compatible PC to any supported device and play them remotely. Moonlight is perfect for gaming on the go (or on [[https://linux.org][GNU/Linux]]) without sacrificing the graphics and game selection available for the PC.
#+BEGIN_SRC nix :noweb yes :tangle modules/moonlight.nix
# <<file-warning>>
{ pkgs, ... }:
{
environment.systemPackages = [
pkgs.moonlight-qt
];
}
#+END_SRC
** Teamviewer
#+NAME: module-teamviewer
#+BEGIN_SRC nix
./modules/teamviewer.nix
#+END_SRC
The [[https://teamviewer.com][Teamviewer]] remote connectivity cloud platform enables secure remote access to any device, across platforms, from anywhere, anytime. Teamviewer connects computers, smartphones, servers, IoT devices, robots -- anything -- with fast, high performance connections through their global access network. It has been used in outer-space low-bandwidth environments.
#+BEGIN_SRC nix :noweb yes :tangle modules/teamviewer.nix
# <<file-warning>>
{ pkgs, ... }:
{
# NOTE: Neither of these are working!
# services.teamviewer.enable = true;
# environment.systemPackages = [
# pkgs.teamviewer
# ];
}
#+END_SRC
** Home Manager ** Home Manager
[[https://nixos.wiki/wiki/Home_Manager][Home Manager]] includes a =flake.nix= file for compatibility with Nix Flakes, a feature utilized heavily in this project. When using flakes, switching to a new configuration is done /only/ for the entire system, using the command ~nixos-rebuild switch --flake <path>~, instead of ~nixos-rebuild~, and ~home-manager~ seperately. [[https://nixos.wiki/wiki/Home_Manager][Home Manager]] includes a =flake.nix= file for compatibility with Nix Flakes, a feature utilized heavily in this project. When using flakes, switching to a new configuration is done /only/ for the entire system, using the command ~nixos-rebuild switch --flake <path>~, instead of ~nixos-rebuild~, and ~home-manager~ seperately.

BIN
docs/daily/2022-03-10.org.gpg

68
flake.nix

@ -40,71 +40,9 @@
} }
]; ];
}; };
acernitro = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/acernitro
./modules/x11.nix
./modules/ssh.nix
./modules/hugo.nix
./modules/docker.nix
./modules/flakes.nix
./modules/cachix.nix
./modules/nvidia.nix
./modules/firefox.nix
./modules/moonlight.nix
./modules/teamviewer.nix
inputs.home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.chris = {
imports = [
./modules/git.nix
./modules/gpg.nix
./modules/vim.nix
./modules/gtk.nix
./modules/emacs.nix
];
};
}
];
};
raspberry = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/raspberry
./modules/x11.nix
./modules/ssh.nix
./modules/flakes.nix
./modules/cachix.nix
inputs.home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.chris = {
imports = [
./modules/git.nix
./modules/gpg.nix
./modules/vim.nix
./modules/gtk.nix
./modules/emacs.nix
];
};
}
];
};
homecloud = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/homecloud
./modules/ssh.nix
./modules/flakes.nix
./modules/cachix.nix
./modules/jellyfin.nix
];
};
android = (inputs.nix-on-droid.lib.aarch64-linux.nix-on-droid { android = (inputs.nix-on-droid.lib.aarch64-linux.nix-on-droid {
config = ./hosts/android/nix-on-droid.nix; config = ./hosts/android/nix-on-droid.nix;
}).activationPackage; }).activationPackage;

Loading…
Cancel
Save