Add back vfio, remove postgres

This commit is contained in:
Artemis Tosini 2022-02-01 06:59:17 +00:00
parent cae59cf989
commit 9bda4ce478
Signed by: artemist
GPG key ID: EE5227935FE3FF18
4 changed files with 44 additions and 27 deletions

View file

@ -23,11 +23,11 @@
}, },
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1650522846, "lastModified": 1653463224,
"narHash": "sha256-SxWHXRI3qJwswyXAtzsi6PKVY3KLNNnb072KaJthII8=", "narHash": "sha256-bUxKhqZhki2vPzFTl8HOo1m7pagF7WzY1MZiso8U5ws=",
"owner": "nixos", "owner": "nixos",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "6b4ebea9093c997c5f275c820e679108de4871ab", "rev": "39a7bfc496d2ddfce73fe9542af1f2029ba4fe39",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -38,11 +38,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1652020977, "lastModified": 1653565689,
"narHash": "sha256-9hDlNbrxzD/pLlXmoQ6gzxbYiSAKrj7uHYUWNByLFlI=", "narHash": "sha256-xdJ6bmPxDPIMItZJWsDxopPXUTAFPWMkNkyOOcptWSc=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3c5ae9be1f18c790ea890ef8decbd0946c0b4c04", "rev": "9bc0e974545d5bc4c24e1ed047be0dc4e30e494b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -54,11 +54,11 @@
}, },
"nixpkgs-unstable": { "nixpkgs-unstable": {
"locked": { "locked": {
"lastModified": 1652082323, "lastModified": 1653581809,
"narHash": "sha256-7GSVLvfCJtH9dJ3om9Lg4fsi9UKvoxxR69gUTcx0ol8=", "narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2a3aac479caeba0a65b2ad755fe5f284f1fde74d", "rev": "83658b28fe638a170a19b8933aa008b30640fbd1",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -5,7 +5,7 @@
./boot-config.nix ./boot-config.nix
./hardware-configuration.nix ./hardware-configuration.nix
./scripts.nix ./scripts.nix
./postgres.nix ./vfio.nix
../../sets/builder.nix ../../sets/builder.nix
../../sets/fpga.nix ../../sets/fpga.nix
../../sets/hacking.nix ../../sets/hacking.nix

View file

@ -1,17 +0,0 @@
{ config, pkgs, ... }:
{
services.postgresql = {
enable = true;
package = pkgs.postgresql_14;
extraPlugins = with config.services.postgresql.package.pkgs; [ postgis ];
ensureDatabases = [ "osm" ];
ensureUsers = [{
name = "artemis";
ensurePermissions = {
"DATABASE osm" = "ALL PRIVILEGES";
};
}];
};
}

34
system/starlight/vfio.nix Normal file
View file

@ -0,0 +1,34 @@
{ pkgs, pkgs-unstable, ... }:
# based on https://alexbakker.me/post/nixos-pci-passthrough-qemu-vfio.html
{
environment.systemPackages = [
pkgs-unstable.looking-glass-client
pkgs.scream
];
boot.initrd = {
availableKernelModules = [ "amdgpu" "vfio-pci" ];
preDeviceCommands = ''
echo vfio-pci > /sys/bus/pci/devices/0000:0b:00.0/driver_override
echo vfio-pci > /sys/bus/pci/devices/0000:0b:00.1/driver_override
modprobe -i vfio-pci
'';
};
systemd.tmpfiles.rules = [
"f /dev/shm/scream 0660 artemis qemu-libvirtd -"
"f /dev/shm/looking-glass 0660 artemis qemu-libvirtd -"
];
systemd.user.services.scream-ivshmem = {
enable = true;
description = "Scream IVSHMEM";
serviceConfig = {
ExecStart = "${pkgs.scream}/bin/scream -m /dev/shm/scream -o pulse";
Restart = "always";
};
wantedBy = [ "multi-user.target" ];
requires = [ "pulseaudio.service" ];
};
}