2021-10-28 22:15:24 +00:00
|
|
|
|
# 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;
|
2021-10-28 22:15:24 +00:00
|
|
|
|
{
|
|
|
|
|
imports =
|
2021-11-28 02:02:00 +00:00
|
|
|
|
[
|
|
|
|
|
# Include the results of the hardware scan.
|
2021-10-28 22:15:24 +00:00
|
|
|
|
./hardware-configuration.nix
|
|
|
|
|
# secret management
|
|
|
|
|
./secrets
|
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
|
2021-10-28 22:15:24 +00:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
## 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";
|
2021-10-28 22:15:24 +00:00
|
|
|
|
|
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 = [{
|
|
|
|
|
wireguardPeerConfig = {
|
|
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
}];
|
|
|
|
|
};
|
|
|
|
|
systemd.network.networks."dtth-wg" = {
|
|
|
|
|
matchConfig.Name = "dtth-wg";
|
|
|
|
|
address = [ "100.73.146.80/32" "fd00::33:105b/128" ];
|
|
|
|
|
DHCP = "no";
|
|
|
|
|
routes = [
|
|
|
|
|
{ routeConfig = { Destination = "100.64.0.0/10"; Scope = "link"; }; }
|
|
|
|
|
{ routeConfig.Destination = "fd00::/106"; }
|
|
|
|
|
];
|
|
|
|
|
};
|
2023-03-08 23:24:50 +00:00
|
|
|
|
|
2023-04-02 15:35:59 +00:00
|
|
|
|
# Define a user account.
|
|
|
|
|
common.linux.username = "nki";
|
|
|
|
|
services.getty.autologinUser = "nki";
|
2021-10-28 22:15:24 +00:00
|
|
|
|
|
2023-04-02 15:35:59 +00:00
|
|
|
|
## Hardware
|
2021-10-28 22:15:24 +00:00
|
|
|
|
# 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-10-28 22:15:24 +00:00
|
|
|
|
|
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";
|
2021-11-21 22:41:08 +00:00
|
|
|
|
};
|
2021-10-28 22:15:24 +00:00
|
|
|
|
|
|
|
|
|
# PAM
|
2022-05-15 18:46:17 +00:00
|
|
|
|
personal.u2f.enable = true;
|
2021-11-28 02:02:00 +00:00
|
|
|
|
|
2021-10-28 22:15:24 +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. It‘s 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 = "21.05"; # 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" = { };
|
2021-10-28 22:15:24 +00:00
|
|
|
|
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" ];
|
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;
|
|
|
|
|
};
|
|
|
|
|
};
|
2021-10-28 22:15:24 +00:00
|
|
|
|
}
|
|
|
|
|
|