initial commit

This commit is contained in:
Yuka 2021-08-21 18:47:21 +02:00
commit 70b89988a9
Signed by: Yuka
GPG key ID: B95AE06334AFF6BA
15 changed files with 485 additions and 0 deletions

View file

@ -0,0 +1,25 @@
{ ... }:
{
imports = [
./hardware-configuration.nix
../../common
# services
./pulseaudio.nix
./nfs-server.nix
./mpd.nix
./ympd.nix
./spotifyd.nix
./desktop.nix
./vnc.nix
./webserver.nix
];
networking.hostName = "nuc";
networking.domain = "c3h";
boot.loader.systemd-boot.enable = true;
system.stateVersion = "21.05";
}

25
hosts/nuc/desktop.nix Normal file
View file

@ -0,0 +1,25 @@
{ pkgs, ... }:
{
users.mutableUsers = false;
users.users.nuc = {
isNormalUser = true;
password = "c3h";
extraGroups = [ "wheel" ];
packages = with pkgs; [ chromium firefox mpv youtube-dl ];
};
services.xserver = {
enable = true;
layout = "de";
videoDrivers = [ "modesetting" ];
useGlamor = true;
displayManager.lightdm.enable = true;
displayManager.autoLogin.enable = true;
displayManager.autoLogin.user = "nuc";
desktopManager.mate.enable = true;
};
}

View file

@ -0,0 +1,34 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "uas" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/ccb84984-fae9-4bfc-8c0d-3f5a98022103";
fsType = "xfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/5DE4-9727";
fsType = "vfat";
};
fileSystems."/mnt" =
{ device = "/dev/disk/by-uuid/ff18a6f9-ee3b-452c-8671-38b74508a74c";
fsType = "btrfs";
};
swapDevices = [ ];
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
}

18
hosts/nuc/mpd.nix Normal file
View file

@ -0,0 +1,18 @@
{ config, ... }:
{
services.mpd = {
enable = true;
musicDirectory = "/mnt/Music";
network.listenAddress = "any";
extraConfig = ''
audio_output {
type "pulse"
name "pulse audio"
server "localhost"
}
'';
};
networking.firewall.allowedTCPPorts = [ config.services.mpd.network.port ];
}

17
hosts/nuc/nfs-server.nix Normal file
View file

@ -0,0 +1,17 @@
{ ... }:
{
services.nfs.server = {
enable = true;
exports = ''
/mnt 10.23.42.0/24(rw,fsid=0,insecure,no_subtree_check)
'';
statdPort = 4000;
lockdPort = 4001;
mountdPort = 4002;
};
networking.firewall.interfaces.enp3s0.allowedTCPPorts = [ 2049 4000 4001 4002 111 ];
networking.firewall.interfaces.enp3s0.allowedUDPPorts = [ 2049 4000 4001 4002 111 ];
}

11
hosts/nuc/pulseaudio.nix Normal file
View file

@ -0,0 +1,11 @@
{ pkgs, ... }:
{
networking.firewall.allowedTCPPorts = [ 4713 ];
sound.enable = true;
hardware.pulseaudio.enable = true;
hardware.pulseaudio.systemWide = true;
hardware.pulseaudio.package = pkgs.pulseaudio;
hardware.pulseaudio.tcp.enable = true;
hardware.pulseaudio.tcp.anonymousClients.allowedIpRanges = [ "127.0.0.0/8" "::/64" "10.23.42.0/24" ];
}

12
hosts/nuc/spotifyd.nix Normal file
View file

@ -0,0 +1,12 @@
{ ... }:
{
services.spotifyd = {
enable = true;
config = ''
zeroconf_port = 18572
'';
};
networking.firewall.allowedTCPPorts = [ 18572 ];
}

15
hosts/nuc/vnc.nix Normal file
View file

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
systemd.user.services.x11vnc = {
wantedBy = [ "graphical-session.target" ];
requires = [ "graphical-session-pre.target" ];
after = [ "graphical-session-pre.target" ];
serviceConfig = {
ExecStart = "${pkgs.x11vnc}/bin/x11vnc -rfbport 5900 -forever -shared";
};
};
networking.firewall.allowedTCPPorts = [ 5900 ];
}

9
hosts/nuc/webserver.nix Normal file
View file

@ -0,0 +1,9 @@
{ ... }:
{
services.nginx = {
enable = true;
};
networking.firewall.allowedTCPPorts = [ 80 ];
}

30
hosts/nuc/ympd.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, pkgs, ... }:
let
# well-maintained fork
ympd = pkgs.ympd.overrideAttrs (old: {
version = "unstable-2021-05-21";
src = pkgs.fetchFromGitHub {
owner = "SuperBFG7";
repo = "ympd";
rev = "9d1a3ccfb25d011890bb90fe4ff6aaed51ffa2c4";
sha256 = "0is2fwfmacm91yq5b22184hjyhb6i49f35dik0v3vnqkk49v565c";
};
});
in {
systemd.services.ympd = {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
DynamicUser = true;
ExecStart = "${ympd}/bin/ympd --host localhost --port ${toString config.services.mpd.network.port} --webport 8062";
};
};
services.nginx.virtualHosts.default = {
locations."/ympd/" = {
proxyPass = "http://localhost:8062/";
proxyWebsockets = true;
};
};
}