nix-home/nki-home/configuration.nix

182 lines
5.5 KiB
Nix
Raw Normal View History

# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ lib, config, pkgs, ... }:
2023-04-02 15:35:59 +00:00
with lib;
{
imports =
2021-11-28 02:02:00 +00:00
[
# Include the results of the hardware scan.
./hardware-configuration.nix
2021-11-08 21:21:27 +00:00
# Fonts
../modules/personal/fonts
2022-05-02 18:09:17 +00:00
# Encrypted DNS
../modules/services/edns
2022-05-15 18:21:20 +00:00
# Other services
2022-05-15 18:46:17 +00:00
../modules/personal/u2f.nix
./peertube-runner.nix
];
2024-03-08 03:29:42 +00:00
# Kernel
boot.kernelPackages = pkgs.linuxKernel.packages.linux_xanmod_stable;
2024-06-03 01:33:00 +00:00
# Plasma!
services.desktopManager.plasma6.enable = true;
## Encryption
# Kernel modules needed for mounting USB VFAT devices in initrd stage
2023-04-02 15:35:59 +00:00
common.linux.luksDevices.root = "/dev/disk/by-uuid/7c6e40a8-900b-4f85-9712-2b872caf1892";
2024-08-15 16:37:13 +00:00
common.linux.sops.enable = true;
common.linux.sops.file = ./secrets.yaml;
2024-08-16 12:36:11 +00:00
# Nix cache server
sops.secrets."nix-cache/private-key" = { owner = "nix-serve"; group = "nix-serve"; mode = "0600"; };
nki.services.nix-cache = {
enableServer = true;
privateKeyFile = config.sops.secrets."nix-cache/private-key".path;
};
2023-04-02 15:35:59 +00:00
# Networking
common.linux.networking =
{
hostname = "kagamiPC"; # Define your hostname.
networks = {
"10-wired" = {
match = "enp*";
isRequired = true;
};
"20-wireless".match = "wlan*";
};
dnsServers = [ "127.0.0.1" ];
2023-03-31 08:56:24 +00:00
};
2022-05-02 18:09:17 +00:00
nki.services.edns.enable = true;
nki.services.edns.ipv6 = true;
2023-04-29 14:27:35 +00:00
## DTTH Wireguard
#
sops.secrets."dtth-wg/private-key" = { owner = "root"; group = "systemd-network"; mode = "0640"; };
sops.secrets."dtth-wg/preshared-key" = { owner = "root"; group = "systemd-network"; mode = "0640"; };
systemd.network.netdevs."10-dtth-wg" = {
netdevConfig = {
Kind = "wireguard";
Name = "dtth-wg";
MTUBytes = "1280";
};
wireguardConfig = {
PrivateKeyFile = config.sops.secrets."dtth-wg/private-key".path;
};
wireguardPeers = [{
2024-08-07 12:52:11 +00:00
PublicKey = "+7iI4jwmM1Qr+/DKB1Hv8JgFkGu7lSV0PAoo+O5d3yQ=";
PresharedKeyFile = config.sops.secrets."dtth-wg/preshared-key".path;
AllowedIPs = [ "100.64.0.0/10" "fd00::/106" ];
Endpoint = "vpn.dtth.ch:51820";
PersistentKeepalive = 25;
2023-04-29 14:27:35 +00:00
}];
};
systemd.network.networks."dtth-wg" = {
matchConfig.Name = "dtth-wg";
address = [ "100.73.146.80/32" "fd00::33:105b/128" ];
DHCP = "no";
routes = [
2024-08-07 12:52:11 +00:00
{ Destination = "100.64.0.0/10"; Scope = "link"; }
{ Destination = "fd00::/106"; }
2023-04-29 14:27:35 +00:00
];
};
2023-04-02 15:35:59 +00:00
# Define a user account.
common.linux.username = "nki";
services.getty.autologinUser = "nki";
2023-04-02 15:35:59 +00:00
## Hardware
# Peripherals
hardware.opentabletdriver.enable = true;
2023-04-02 15:35:59 +00:00
# Enable razer daemon
hardware.openrazer.enable = true;
hardware.openrazer.keyStatistics = true;
hardware.openrazer.verboseLogging = true;
2021-11-21 22:41:08 +00:00
# Mounting disks!
fileSystems =
2021-11-28 02:02:00 +00:00
let
ntfsMount = path: {
device = path;
fsType = "ntfs";
2023-03-08 20:23:01 +00:00
options = [ "rw" "uid=${toString config.users.users.nki.uid}" "nofail" ];
2021-11-28 02:02:00 +00:00
};
in
{
"/mnt/Data" = ntfsMount "/dev/disk/by-uuid/A90680F8BBE62FE3";
"/mnt/Stuff" = ntfsMount "/dev/disk/by-uuid/717BF2EE20BB8A62";
"/mnt/Shared" = ntfsMount "/dev/disk/by-uuid/76AC086BAC0827E7";
2024-04-18 12:56:30 +00:00
"/mnt/osu" = ntfsMount "/dev/disk/by-uuid/530D3E1648CD1C26";
2021-11-21 22:41:08 +00:00
};
# PAM
2022-05-15 18:46:17 +00:00
personal.u2f.enable = true;
2021-11-28 02:02:00 +00:00
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.11"; # Did you read the comment?
# tinc network
2021-11-28 02:02:00 +00:00
sops.secrets."tinc/ed25519-private-key" = { };
sops.secrets."tinc/rsa-private-key" = { };
services.my-tinc = {
enable = true;
hostName = "home";
rsaPrivateKey = config.sops.secrets."tinc/rsa-private-key".path;
ed25519PrivateKey = config.sops.secrets."tinc/ed25519-private-key".path;
bindPort = 6565;
};
2022-09-26 18:50:36 +00:00
2022-06-11 19:53:34 +00:00
# Music server
services.navidrome.enable = true;
services.navidrome.settings = {
Address = "11.0.0.2";
MusicFolder = "/mnt/Stuff/Music";
};
systemd.services.navidrome.serviceConfig.BindReadOnlyPaths = lib.mkAfter [ "/etc" ];
2023-10-19 17:59:19 +00:00
networking.firewall.allowedTCPPorts = [ 4533 8000 ];
2022-09-16 15:25:19 +00:00
2022-10-03 08:06:35 +00:00
# Printers
services.printing.enable = true;
2022-09-16 15:25:19 +00:00
# mpd
services.mpd = {
enable = true;
user = "nki";
startWhenNeeded = true;
extraConfig = ''
audio_output {
type "pipewire"
name "pipewire local"
dsd "yes"
}
'';
};
systemd.services.mpd.environment = {
# https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/609
XDG_RUNTIME_DIR = "/run/user/1000"; # User-id 1000 must match above user. MPD will look inside this directory for the PipeWire socket.
};
sops.secrets."scrobble/lastfm" = { };
sops.secrets."scrobble/listenbrainz" = { };
services.mpdscribble = {
enable = true;
endpoints."last.fm" = {
username = "natsukagami";
passwordFile = config.sops.secrets."scrobble/lastfm".path;
};
endpoints."listenbrainz" = {
username = "natsukagami";
passwordFile = config.sops.secrets."scrobble/listenbrainz".path;
};
};
}