2023-03-31 17:40:22 +03:00
|
|
|
|
{ config, pkgs, ... }:
|
2022-08-29 00:18:24 +03:00
|
|
|
|
|
2024-02-18 23:08:50 +03:00
|
|
|
|
|
2022-08-29 00:18:24 +03:00
|
|
|
|
{
|
2022-08-30 04:32:05 +03:00
|
|
|
|
imports = [
|
|
|
|
|
# Include the results of the hardware scan.
|
|
|
|
|
./hardware-configuration.nix
|
2023-03-18 16:47:02 +03:00
|
|
|
|
../../shared/common.nix
|
|
|
|
|
../../shared/sound.nix
|
|
|
|
|
../../shared/window-manager.nix
|
|
|
|
|
../../shared/fonts.nix
|
|
|
|
|
../../shared/gnupg.nix
|
|
|
|
|
../../shared/garbage-collector.nix
|
|
|
|
|
../../shared/networking.secret.nix
|
2023-03-31 17:40:22 +03:00
|
|
|
|
../../shared/ipfs.nix
|
2022-08-30 04:32:05 +03:00
|
|
|
|
];
|
2022-08-29 00:18:24 +03:00
|
|
|
|
|
2022-10-12 02:56:07 +03:00
|
|
|
|
# Configure kernel
|
2022-08-29 00:18:24 +03:00
|
|
|
|
boot = {
|
2023-03-31 17:40:22 +03:00
|
|
|
|
# I cannot use rtl88x2bu driver in stable
|
|
|
|
|
kernelPackages = pkgs.unstable.linuxPackages_6_1;
|
2022-08-29 00:18:24 +03:00
|
|
|
|
extraModulePackages = with config.boot.kernelPackages; [
|
|
|
|
|
rtl88x2bu
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
2022-10-12 02:56:07 +03:00
|
|
|
|
# Use the GRUB 2 boot loader.
|
|
|
|
|
boot.loader.grub = {
|
|
|
|
|
enable = true;
|
|
|
|
|
device = "/dev/sdb";
|
2023-10-18 16:24:02 +03:00
|
|
|
|
# memtest86.enable = true;
|
2022-10-12 02:56:07 +03:00
|
|
|
|
};
|
|
|
|
|
|
2022-08-29 00:18:24 +03:00
|
|
|
|
networking = {
|
|
|
|
|
hostName = "home"; # Define your hostname.
|
|
|
|
|
|
2022-10-12 02:56:07 +03:00
|
|
|
|
useDHCP = false;
|
2022-08-29 00:18:24 +03:00
|
|
|
|
interfaces = {
|
2023-10-18 16:24:02 +03:00
|
|
|
|
wlp3s0.useDHCP = true;
|
|
|
|
|
# wlp11s0f3u2.useDHCP = true;
|
2022-08-29 00:18:24 +03:00
|
|
|
|
};
|
2022-10-12 02:56:07 +03:00
|
|
|
|
|
|
|
|
|
networkmanager.enable = true;
|
2023-07-06 17:03:40 +03:00
|
|
|
|
firewall.allowedTCPPortRanges = [
|
|
|
|
|
{ from = 1300; to = 1400; }
|
|
|
|
|
];
|
2022-08-29 00:18:24 +03:00
|
|
|
|
};
|
|
|
|
|
|
2023-10-18 16:24:02 +03:00
|
|
|
|
# enable bluetooth
|
|
|
|
|
hardware.bluetooth.enable = true;
|
|
|
|
|
|
2024-02-18 23:08:50 +03:00
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
|
local.nix.allowUnfreePackages = [
|
|
|
|
|
"cnijfilter2"
|
|
|
|
|
"memtest86"
|
|
|
|
|
"android-sdk-cmdline-tools"
|
|
|
|
|
];
|
2022-11-13 23:14:04 +03:00
|
|
|
|
|
2023-07-03 23:16:31 +03:00
|
|
|
|
services.openssh.enable = true;
|
|
|
|
|
|
2022-09-11 19:14:43 +03:00
|
|
|
|
services = {
|
|
|
|
|
avahi = {
|
|
|
|
|
enable = true;
|
|
|
|
|
nssmdns = true;
|
|
|
|
|
};
|
|
|
|
|
printing = {
|
|
|
|
|
enable = true;
|
|
|
|
|
drivers = with pkgs; [ gutenprint cnijfilter2 ];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-08-29 00:18:24 +03:00
|
|
|
|
services.xserver = {
|
2022-08-29 16:09:59 +03:00
|
|
|
|
# All monitors in the right order
|
2022-08-31 13:23:54 +03:00
|
|
|
|
# Source: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/x11/xserver.nix#L83
|
2022-08-29 00:18:24 +03:00
|
|
|
|
xrandrHeads = [
|
|
|
|
|
{
|
2024-03-03 14:38:38 +03:00
|
|
|
|
output = "DP-3";
|
2022-08-29 00:18:24 +03:00
|
|
|
|
monitorConfig = ''
|
2022-08-29 16:09:59 +03:00
|
|
|
|
Option "PreferredMode" "1920x1080"
|
2022-08-29 00:18:24 +03:00
|
|
|
|
Option "Rotate" "right"
|
2022-08-29 16:09:59 +03:00
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
{
|
2023-03-17 11:56:38 +03:00
|
|
|
|
output = "DP-1";
|
2022-08-29 16:09:59 +03:00
|
|
|
|
primary = true;
|
|
|
|
|
monitorConfig = ''
|
|
|
|
|
Option "PreferredMode" "2560x1440"
|
2022-08-29 00:18:24 +03:00
|
|
|
|
'';
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
};
|
2022-10-12 02:56:07 +03:00
|
|
|
|
|
2023-03-03 13:36:30 +03:00
|
|
|
|
services.logind.extraConfig = ''
|
|
|
|
|
# don’t shutdown when power button is short-pressed
|
|
|
|
|
HandlePowerKey=ignore
|
|
|
|
|
'';
|
|
|
|
|
|
2022-10-12 02:56:07 +03:00
|
|
|
|
# Enable the Docker
|
|
|
|
|
virtualisation.docker.enable = true;
|
2022-10-13 07:47:31 +03:00
|
|
|
|
|
2023-03-02 16:00:19 +03:00
|
|
|
|
# Additional nix configs
|
2022-10-13 07:47:31 +03:00
|
|
|
|
local.nix.enableMyRegistry = true;
|
2023-03-02 16:00:19 +03:00
|
|
|
|
|
|
|
|
|
# Wireguard client
|
|
|
|
|
age.secrets.wireguard-home-private = {
|
2023-03-18 16:47:02 +03:00
|
|
|
|
file = ../../../secrets/wireguard-home-private.age;
|
2023-03-02 16:00:19 +03:00
|
|
|
|
mode = "0400";
|
|
|
|
|
};
|
|
|
|
|
local.wireguard = {
|
|
|
|
|
enable = true;
|
2023-07-28 17:08:13 +03:00
|
|
|
|
ip = "10.20.30.3/24";
|
2023-03-02 16:00:19 +03:00
|
|
|
|
privateKeyFile = config.age.secrets.wireguard-home-private.path;
|
|
|
|
|
};
|
2023-03-15 10:49:52 +03:00
|
|
|
|
|
|
|
|
|
# Invisible internet project
|
|
|
|
|
services.i2pd = {
|
|
|
|
|
enable = true;
|
|
|
|
|
proto.httpProxy.enable = true;
|
|
|
|
|
proto.http.enable = true;
|
|
|
|
|
};
|
2023-03-15 22:52:13 +03:00
|
|
|
|
|
2023-11-30 14:16:42 +03:00
|
|
|
|
# Torrent client
|
2023-03-15 22:52:13 +03:00
|
|
|
|
services.transmission.enable = true;
|
2024-01-06 14:53:07 +03:00
|
|
|
|
|
|
|
|
|
# 3D printing
|
|
|
|
|
local.octoprint.enable = true;
|
2024-02-18 23:08:50 +03:00
|
|
|
|
|
|
|
|
|
# Android
|
|
|
|
|
programs.adb.enable = true;
|
|
|
|
|
programs.java = {
|
|
|
|
|
enable = true;
|
|
|
|
|
package = pkgs.jdk17;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
nixpkgs.config.android_sdk.accept_license = true;
|
|
|
|
|
|
|
|
|
|
environment.variables =
|
|
|
|
|
let
|
|
|
|
|
buildToolsVersion = "33.0.2";
|
|
|
|
|
androidComposition = pkgs.unstable.androidenv.composeAndroidPackages {
|
|
|
|
|
platformToolsVersion = "34.0.5";
|
|
|
|
|
buildToolsVersions = [ buildToolsVersion ];
|
|
|
|
|
includeEmulator = false;
|
|
|
|
|
emulatorVersion = "34.1.9";
|
|
|
|
|
platformVersions = [ "29" "30" "33" ];
|
|
|
|
|
includeSources = false;
|
|
|
|
|
includeSystemImages = false;
|
|
|
|
|
systemImageTypes = [ "google_apis_playstore" ];
|
|
|
|
|
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
|
|
|
|
|
cmakeVersions = [ "3.10.2" ];
|
|
|
|
|
includeNDK = true;
|
|
|
|
|
ndkVersions = [ "23.2.8568313" ];
|
|
|
|
|
useGoogleAPIs = false;
|
|
|
|
|
useGoogleTVAddOns = false;
|
|
|
|
|
includeExtras = [
|
|
|
|
|
"extras;google;gcm"
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
in
|
|
|
|
|
rec {
|
|
|
|
|
ANDROID_SDK_ROOT = "${androidComposition.androidsdk}/libexec/android-sdk";
|
|
|
|
|
ANDROID_NDK_ROOT = "${ANDROID_SDK_ROOT}/ndk-bundle";
|
|
|
|
|
|
|
|
|
|
# Use the same buildToolsVersion here
|
|
|
|
|
# GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_SDK_ROOT}/build-tools/${buildToolsVersion}/aapt2";
|
|
|
|
|
# JAVA_HOME = pkgs.jdk17.home;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
services.udev.extraRules = ''
|
|
|
|
|
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666", GROUP="plugdev"
|
|
|
|
|
'';
|
2022-08-29 00:18:24 +03:00
|
|
|
|
}
|