Modularize config

This commit is contained in:
jalr 2021-11-08 21:55:47 +00:00 committed by Jakob Lechner
parent f5730508de
commit 8368189fbf
29 changed files with 361 additions and 451 deletions

View file

@ -1,24 +0,0 @@
{ config, pkgs, ... }:
let cfg = config.autologin;
in
{
options = {
autologin.username = pkgs.lib.mkOption {
description = "Username of user to be automatically logged in at tty1";
};
};
config = {
systemd.services."autovt@tty1".description = "Autologin at the TTY1";
systemd.services."autovt@tty1".after = [ "systemd-logind.service" ]; # without it user session not started and xorg can't be run from this tty
systemd.services."autovt@tty1".wantedBy = [ "multi-user.target" ];
systemd.services."autovt@tty1".serviceConfig = {
ExecStart = [
"" # override upstream default with an empty ExecStart
"@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login --autologin '${cfg.username}' --noclear %I $TERM"
];
Restart = "always";
Type = "idle";
};
};
}

View file

@ -1,9 +0,0 @@
{ config, lib, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
unstable.fish
];
programs.fish.enable = true;
}

View file

@ -53,7 +53,7 @@
modules = [
(./machines + "/${hostname}/configuration.nix")
./modules
{
_module.args.inputs = inputs;
}

View file

@ -1,9 +0,0 @@
{ config, lib, pkgs, ... }:
{
services.printing.enable = true;
services.printing.drivers = [
pkgs.brlaser
];
}

View file

@ -1,4 +0,0 @@
{ config, lib, pkgs, ... }:
{
}

View file

@ -1,4 +0,0 @@
{ config, lib, pkgs, ... }:
{
}

View file

@ -1,15 +0,0 @@
{ config, lib, pkgs, ... }:
{
boot.initrd.availableKernelModules = [
"i915"
];
environment.systemPackages = with pkgs; [
intel-media-driver
libva
libva-utils
libva1
];
hardware.opengl.extraPackages = lib.singleton pkgs.vaapiIntel;
}

View file

@ -1,51 +1,10 @@
# 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).
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
../../hardware/cadmium.nix
../../sway.nix
../../unstable.nix
../../fish.nix
../../autologin.nix
../../obs.nix
../../pipewire.nix
];
hardware.cpu.intel.updateMicrocode = true;
powerManagement.cpuFreqGovernor = "performance";
nix.autoOptimiseStore = true;
nix.useSandbox = true;
boot = {
kernelParams = [ "radeon.dpm=1" ];
loader = {
systemd-boot.enable = true;
efi.efiSysMountPoint = "/boot";
efi.canTouchEfiVariables = true;
};
initrd = {
availableKernelModules = [
"aes_generic"
"cryptd"
"nvme"
"xhci_pci"
];
luks.devices = {
pvcrypt = {
device = "/dev/disk/by-uuid/b706883f-3979-41ea-b72e-497c0ada5092";
preLVM = true;
allowDiscards = true;
};
};
};
};
imports = [
./hardware-configuration.nix
../../home-manager/users/jalr.nix
];
networking = {
hostName = "cadmium";
@ -63,18 +22,10 @@
];
};
extraHosts = ''
#10.10.10.10 example.com
#10.10.10.10 example.com
'';
};
i18n.defaultLocale = "de_DE.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "neo";
};
time.timeZone = "UTC";
environment.systemPackages = with pkgs; [
file
fzf
@ -94,14 +45,6 @@
virt-manager
];
xdg.icons.enable = true;
fonts.fonts = with pkgs; [
powerline-fonts
roboto
font-awesome
];
environment.variables.EDITOR = "nvim";
nixpkgs.overlays = [
@ -116,9 +59,9 @@
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "gnome3";
};
enable = true;
pinentryFlavor = "gnome3";
};
hardware.bluetooth.enable = true;
services.blueman.enable = true;
@ -152,22 +95,11 @@
security.polkit.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.jalr = {
isNormalUser = true;
extraGroups = [
"dialout"
"docker"
"libvirtd"
"networkmanager"
"video"
"wheel"
]; # Enable sudo for the user.
shell = pkgs.fish;
myConfig = {
gui.enable = true;
autologin.enable = true;
};
autologin.username = "jalr";
# 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

View file

@ -1,33 +1,58 @@
{ config, lib, pkgs, modulesPath, ... }:
{ modulesPath, ... }:
{
imports = [
"${modulesPath}/installer/scan/not-detected.nix"
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot = {
initrd = {
availableKernelModules = [
"aes_generic"
"ahci"
"cryptd"
"ehci_pci"
"nvme"
"sd_mod"
"sr_mod"
"usb_storage"
"usbhid"
"xhci_pci"
];
kernelModules = [ "dm-snapshot" ];
luks.devices = {
pvcrypt = {
device = "/dev/disk/by-uuid/b706883f-3979-41ea-b72e-497c0ada5092";
preLVM = true;
allowDiscards = true;
};
};
};
kernelModules = [ "kvm-amd" ];
kernelParams = [ "radeon.dpm=1" ];
loader = {
systemd-boot.enable = true;
efi.efiSysMountPoint = "/boot";
efi.canTouchEfiVariables = true;
};
};
fileSystems."/" =
#{ device = "/dev/disk/by-uuid/d6302c3c-1100-4cc4-86d7-fc3a84db9a37";
{ device = "/dev/disk/by-uuid/6de83731-af29-4ba2-a0b2-48d3a1f5537e";
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/6de83731-af29-4ba2-a0b2-48d3a1f5537e";
fsType = "ext4";
};
fileSystems."/boot" =
#{ device = "/dev/disk/by-uuid/BBF2-C8B1";
{ device = "/dev/disk/by-uuid/D384-54D8";
"/boot" = {
device = "/dev/disk/by-uuid/D384-54D8";
fsType = "vfat";
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/f14ae966-ac3f-467f-9263-ba9136967782";
"/home" = {
device = "/dev/disk/by-uuid/f14ae966-ac3f-467f-9263-ba9136967782";
fsType = "ext4";
noCheck = true;
};
};
swapDevices = [ ];
nix.maxJobs = lib.mkDefault 8;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
nix.maxJobs = 8;
powerManagement.cpuFreqGovernor = "powersave";
}

View file

@ -1,36 +1,10 @@
# 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).
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
../../hardware/t14.nix
../../sway.nix
../../unstable.nix
../../fish.nix
../../autologin.nix
../../obs.nix
../../lxc.nix
../../pipewire.nix
];
nix.autoOptimiseStore = true;
nix.useSandbox = true;
# Use the systemd-boot EFI boot loader.
boot = {
loader = {
systemd-boot.enable = true;
efi = {
efiSysMountPoint = "/boot/efi";
canTouchEfiVariables = true;
};
};
};
imports = [
./hardware-configuration.nix
../../home-manager/users/jal.nix
];
networking = {
hostName = "hafnium";
@ -52,26 +26,29 @@
];
};
extraHosts = ''
#10.10.10.10 example.com
#10.158.228.70 support.demo.core.tradebyte.com
#10.158.228.28 demo.core.tradebyte.com
#10.158.227.210 supporttest.tradebyte.com
#10.158.227.132 test.tradebyte.com
#10.158.227.23 sandbox.tradebyte.com
#10.158.227.89 supportsandbox.tradebyte.com
10.158.226.157 staging.tradebyte.com
10.158.226.209 supportstaging.tradebyte.com
#10.10.10.10 example.com
#10.158.228.70 support.demo.core.tradebyte.com
#10.158.228.28 demo.core.tradebyte.com
#10.158.227.210 supporttest.tradebyte.com
#10.158.227.132 test.tradebyte.com
#10.158.227.23 sandbox.tradebyte.com
#10.158.227.89 supportsandbox.tradebyte.com
10.158.226.157 staging.tradebyte.com
10.158.226.209 supportstaging.tradebyte.com
'';
};
i18n.defaultLocale = "de_DE.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "neo";
# Use the systemd-boot EFI boot loader.
boot = {
loader = {
systemd-boot.enable = true;
efi = {
efiSysMountPoint = "/boot/efi";
canTouchEfiVariables = true;
};
};
};
time.timeZone = "UTC";
environment.systemPackages = with pkgs; [
brightnessctl
file
@ -93,14 +70,6 @@
virt-manager
];
xdg.icons.enable = true;
fonts.fonts = with pkgs; [
powerline-fonts
roboto
font-awesome
];
environment.variables.EDITOR = "nvim";
nixpkgs.overlays = [
@ -113,10 +82,10 @@
];
programs.mtr.enable = true;
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "gnome3";
enable = true;
pinentryFlavor = "gnome3";
};
hardware.bluetooth.enable = true;
@ -124,7 +93,7 @@
services.ofono.enable = true;
services.udisks2.enable = true;
services.openssh.enable = true;
services.udev.extraRules = ''
@ -149,22 +118,13 @@
security.polkit.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.jal = {
isNormalUser = true;
extraGroups = [
"dialout"
"docker"
"libvirtd"
"networkmanager"
"video"
"wheel"
]; # Enable sudo for the user.
shell = pkgs.fish;
myConfig = {
gui.enable = true;
autologin.enable = true;
autologin.username = "jal";
tradebyte.enable = true;
};
autologin.username = "jal";
networking.wg-quick.interfaces.tbcore = {
address = [
"172.27.27.16/32"

View file

@ -1,14 +1,21 @@
{ config, lib, pkgs, modulesPath, ... }:
{ modulesPath, ... }:
{
imports = [
"${modulesPath}/installer/scan/not-detected.nix"
];
boot.initrd.availableKernelModules = [ "nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" ];
boot.extraModulePackages = [ ];
boot = {
initrd.availableKernelModules = [
"nvme"
"ehci_pci"
"xhci_pci"
"usb_storage"
"sd_mod"
"rtsx_pci_sdmmc"
];
kernelModules = [ "kvm-amd" ];
};
fileSystems = {
"/" = {
@ -18,7 +25,7 @@
"discard=async"
"noatime"
"subvol=/nixos"
"compress=zstd:12"
"compress=zstd:6"
];
};
"/boot" = {
@ -35,7 +42,4 @@
device = "/dev/disk/by-uuid/d9b120c1-5e80-4893-92fe-497e5b44c25b";
allowDiscards = true;
};
swapDevices = [ ];
}

View file

@ -1,69 +1,17 @@
# 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).
{ config, pkgs, ... }:
{
imports =
[
./hardware-configuration.nix
../../hardware/t520.nix
../../hardware/brother/hl3172cdw.nix
../../sway.nix
../../unstable.nix
../../fish.nix
../../autologin.nix
../../hardware/brother/p-touch_p700.nix
../../obs.nix
];
nix = {
autoOptimiseStore = true;
trustedUsers = [
"@wheel"
];
package = pkgs.nixUnstable; # FIXME: can be removed with NixOS 21.11
extraOptions = ''
experimental-features = nix-command flakes
'';
};
hardware.cpu.intel.updateMicrocode = true;
boot.loader.grub = {
enable = true;
version = 2;
device = "/dev/sda";
};
boot.initrd.availableKernelModules = [
"aes_generic"
"aesni_intel"
"cryptd"
imports = [
./hardware-configuration.nix
../../home-manager/users/jalr.nix
];
boot.initrd.luks.devices = {
pvcrypt = {
device = "/dev/disk/by-uuid/3a1a8fec-b028-45c0-8432-7fcbe4615f44";
preLVM = true;
};
};
networking = {
hostName = "jalr-t520";
networkmanager.enable = true;
useDHCP = false;
};
i18n.defaultLocale = "de_DE.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "neo";
};
time.timeZone = "UTC";
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
@ -80,14 +28,6 @@
virt-manager
];
xdg.icons.enable = true;
fonts.fonts = with pkgs; [
powerline-fonts
roboto
font-awesome
];
environment.variables.EDITOR = "nvim";
nixpkgs.overlays = [
@ -101,20 +41,12 @@
programs.mtr.enable = true;
programs.wireshark.enable = true;
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "gnome3";
enable = true;
pinentryFlavor = "gnome3";
};
sound.enable = true;
hardware.pulseaudio.enable = true;
hardware.pulseaudio.extraModules = [ pkgs.pulseaudio-modules-bt ];
obs.kernel.packages = pkgs.linuxPackages_latest;
boot.kernelPackages = pkgs.linuxPackages_latest;
hardware.bluetooth.enable = true;
hardware.sane.enable = true;
@ -152,25 +84,11 @@
security.polkit.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users.users.jalr = {
isNormalUser = true;
extraGroups = [
"dialout"
"docker"
"libvirtd"
"lp"
"networkmanager"
"scanner"
"video"
"wheel"
"wireshark"
]; # Enable sudo for the user.
shell = pkgs.fish;
myConfig = {
gui.enable = true;
autologin.enable = true;
};
autologin.username = "jalr";
networking.wg-quick.interfaces.wgkalle = {
address = [
"172.16.254.5/24"

View file

@ -1,27 +1,63 @@
{ config, lib, pkgs, modulesPath, ... }:
{ lib, pkgs, modulesPath, ... }:
{
imports = [
"${modulesPath}/installer/scan/not-detected.nix"
];
boot.initrd.availableKernelModules = [ "ehci_pci" "ahci" "firewire_ohci" "usb_storage" "usbhid" "sd_mod" "sdhci_pci" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
boot = {
loader.grub = {
enable = true;
version = 2;
device = "/dev/sda";
};
initrd = {
availableKernelModules = [
"aes_generic"
"aesni_intel"
"ahci"
"cryptd"
"ehci_pci"
"firewire_ohci"
"i915"
"sd_mod"
"sdhci_pci"
"usb_storage"
"usbhid"
];
kernelModules = [ "dm-snapshot" ];
luks.devices = {
pvcrypt = {
device = "/dev/disk/by-uuid/3a1a8fec-b028-45c0-8432-7fcbe4615f44";
preLVM = true;
};
};
};
kernelModules = [ "kvm-intel" ];
};
fileSystems."/" =
{ device = "/dev/disk/by-uuid/62e31097-dc6e-4f91-a043-1a6b8a154201";
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/62e31097-dc6e-4f91-a043-1a6b8a154201";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/c4df83d7-8985-47df-b5cd-bf18bd490a50";
"/boot" = {
device = "/dev/disk/by-uuid/c4df83d7-8985-47df-b5cd-bf18bd490a50";
fsType = "ext2";
};
};
swapDevices = [ ];
nix.maxJobs = 4;
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode = true;
powerManagement.cpuFreqGovernor = "performance";
environment.systemPackages = with pkgs; [
intel-media-driver
libva
libva-utils
libva1
];
hardware.opengl.extraPackages = lib.singleton pkgs.vaapiIntel;
}

31
modules/autologin.nix Normal file
View file

@ -0,0 +1,31 @@
{ config, lib, pkgs, ... }:
let
cfg = config.myConfig;
in
{
options.myConfig = {
autologin = {
enable = pkgs.lib.mkEnableOption "Enable tty1 autologin";
username = pkgs.lib.mkOption {
type = lib.types.str;
description = "Username of user to be automatically logged in at tty1";
};
};
};
config = lib.mkIf cfg.autologin.enable {
systemd.services."autovt@tty1" = {
description = "Autologin at the TTY1";
after = [ "systemd-logind.service" ]; # without it user session not started and xorg can't be run from this tty
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = [
"" # override upstream default with an empty ExecStart
"@${pkgs.utillinux}/sbin/agetty agetty --login-program ${pkgs.shadow}/bin/login --autologin '${cfg.autologin.username}' --noclear %I $TERM"
];
Restart = "always";
Type = "idle";
};
};
};
}

20
modules/default.nix Normal file
View file

@ -0,0 +1,20 @@
{ lib, ... }:
{
options.myConfig = {
gui.enable = lib.mkEnableOption "GUI";
};
imports = [
./autologin.nix
./fonts.nix
./localization.nix
./nix.nix
./obs.nix
./pipewire.nix
./printers
./sdr.nix
./sway.nix
./tradebyte
];
}

10
modules/fonts.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, ... }:
{
console.font = "Lat2-Terminus16";
fonts.fonts = with pkgs; lib.mkIf config.myConfig.gui.enable [
powerline-fonts
roboto
font-awesome
];
}

19
modules/localization.nix Normal file
View file

@ -0,0 +1,19 @@
{
i18n = {
defaultLocale = "en_GB.UTF-8";
extraLocaleSettings = {
LC_MONETARY = "de_DE.UTF-8";
};
};
console.keyMap = "neo";
time.timeZone = "UTC";
location = {
latitude = 49.5;
longitude = 10.5;
};
}

17
modules/nix.nix Normal file
View file

@ -0,0 +1,17 @@
{ pkgs, ... }:
{
nix = {
trustedUsers = [ "@wheel" ];
package = pkgs.nixUnstable; # FIXME: can be removed with NixOS 21.11
extraOptions = ''
experimental-features = nix-command flakes
'';
daemonNiceLevel = 19;
daemonIONiceLevel = 7;
autoOptimiseStore = true;
};
}

View file

@ -1,23 +1,22 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, ... }:
{
lib.mkIf config.myConfig.gui.enable {
boot = {
kernelPackages = pkgs.linuxPackages_latest;
extraModulePackages = [
(pkgs.linuxPackages_latest.v4l2loopback.overrideAttrs ({ ... }: {
src = pkgs.fetchFromGitHub {
owner = "umlaeute";
repo = "v4l2loopback";
# master 2020-04-17
rev = "10b1c7e6bda4255fdfaa187ce2b3be13433416d2";
sha256 = "0xsn4yzj7lwdg0n7q3rnqpz07i9i011k2pwn06hasd45313zf8j2";
};
}))
];
kernelModules = [ "v4l2loopback" ];
extraModprobeConfig = ''
options v4l2loopback exclusive_caps=1 card_label=OBS video_nr=10
'';
extraModulePackages = [
(pkgs.linuxPackages.v4l2loopback.overrideAttrs ({ ... }: {
src = pkgs.fetchFromGitHub {
owner = "umlaeute";
repo = "v4l2loopback";
rev = "edf0f10bc079e5e3922bddbb8185dc626ab14a1b";
sha256 = "nHwC6/miECn8RuAeWoOxYv+9NWcBeeGHlcr0ai827Uo=";
fetchSubmodules = false;
};
}))
];
};
environment.systemPackages = with pkgs; [
v4l-utils

View file

@ -1,5 +1,12 @@
{ config, lib, pkgs, ... }:
{
lib.mkIf config.myConfig.gui.enable {
sound.enable = true;
hardware.pulseaudio.enable = false;
# FIXME
#hardware.pulseaudio.extraModules = [ pkgs.pulseaudio-modules-bt ];
services.pipewire = {
enable = true;
pulse = {
@ -18,9 +25,4 @@
pavucontrol
pulseaudio # pacmd and pactl
];
xdg.portal = {
enable = true;
extraPortals = [pkgs.xdg-desktop-portal-wlr];
};
}

View file

@ -0,0 +1,7 @@
{
imports = [
./hl3172cdw.nix
./p-touch_p700.nix
];
}

View file

@ -0,0 +1,9 @@
{ config, lib, pkgs, ... }:
lib.mkIf config.myConfig.gui.enable {
services.printing = {
enable = true;
drivers = [ pkgs.brlaser ];
};
}

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, ... }:
{
services.udev.extraRules = ''

19
modules/sdr.nix Normal file
View file

@ -0,0 +1,19 @@
{ config, lib, pkgs, ... }:
let
cfg = config.myConfig;
in
{
options.myConfig = {
sdr = {
enable = pkgs.lib.mkEnableOption "Enable software defined radio";
};
};
config = lib.mkIf cfg.sdr.enable {
services.udev.extraRules = ''
# rad10
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="cc15", GROUP="users", MODE="0660"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="1d50", ATTRS{idProduct}=="6089", GROUP="users", MODE="0660"
'';
};
}

View file

@ -1,24 +1,9 @@
{ config, lib, pkgs, ... }:
{
# environment.systemPackages = with pkgs; [
# sway
# ];
# nixpkgs.overlays = [
# (self: super: {
# sway = super.neovim.override {
# extraOptions = [
# "--unsupported-gpu"
# ];
# };
# })
# ];
lib.mkIf config.myConfig.gui.enable {
programs.sway = {
enable = true;
# extraOptions = [
# "--unsupported-gpu"
# ];
# FIXME: move to home manager
extraPackages = with pkgs; [
alacritty
grim
@ -32,15 +17,22 @@
wofi
xwayland
];
extraSessionCommands =
''
export XKB_DEFAULT_LAYOUT=de
export XKB_DEFAULT_VARIANT=neo
extraSessionCommands = ''
export XKB_DEFAULT_LAYOUT=de # TODO: test if we need it
export XKB_DEFAULT_VARIANT=neo # TODO: test if we need it
export QT_QPA_PLATFORM=wayland
export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
export ELM_ENGINE=wayland_shm
export GDK_BACKEND=wayland
export _JAVA_AWT_WM_NONREPARENTING=1
'';
'';
};
xdg = {
portal = {
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-wlr ];
};
icons.enable = true;
};
}

View file

@ -0,0 +1,12 @@
{ lib, ... }:
{
options.myConfig = {
tradebyte.enable = lib.mkEnableOption "TB.config";
};
imports = [
./lxc.nix
];
}

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
dnsmasq = pkgs.dnsmasq;
@ -19,7 +19,7 @@ let
server=127.0.0.1
'';
in
{
lib.mkIf config.myConfig.tradebyte.enable {
virtualisation = {
lxc.enable = true;
lxc.defaultConfig = ''
@ -50,39 +50,34 @@ in
};
firewall.extraCommands = ''
iptables -t mangle -A POSTROUTING -o lxcbr0 -p udp -j CHECKSUM --checksum-fill
'';
networkmanager.unmanaged = ["lxcbr0"];
'';
networkmanager.unmanaged = [ "lxcbr0" ];
nat = {
enable = true;
internalInterfaces = ["lxcbr0"];
internalIPs = ["10.0.3.1"];
internalInterfaces = [ "lxcbr0" ];
internalIPs = [ "10.0.3.1" ];
};
};
systemd.services."dnsmasq-lxc" = {
description = "Dnsmasq Daemon for LXC";
after = [ "network.target" "systemd-resolved.service" ];
wantedBy = [ "multi-user.target" ];
path = [ dnsmasq ];
preStart = ''
mkdir -m 755 -p ${stateDir}
touch ${stateDir}/dnsmasq-lxc.leases
dnsmasq --test -C ${dnsmasqConf}
'';
#chown -R dnsmasq ${stateDir}
#touch /etc/dnsmasq-{conf,resolv}.conf
serviceConfig = {
Type = "dbus";
BusName = "uk.org.thekelleys.dnsmasq-lxc";
ExecStart = "${dnsmasq}/bin/dnsmasq -k --enable-dbus --user=dnsmasq -C ${dnsmasqConf}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
PrivateTmp = true;
ProtectSystem = true;
ProtectHome = true;
Restart = "on-failure";
};
#restartTriggers = [ config.environment.etc.hosts.source ];
description = "Dnsmasq Daemon for LXC";
after = [ "network.target" "systemd-resolved.service" ];
wantedBy = [ "multi-user.target" ];
path = [ dnsmasq ];
preStart = ''
mkdir -m 755 -p ${stateDir}
touch ${stateDir}/dnsmasq-lxc.leases
dnsmasq --test -C ${dnsmasqConf}
'';
serviceConfig = {
Type = "dbus";
BusName = "uk.org.thekelleys.dnsmasq-lxc";
ExecStart = "${dnsmasq}/bin/dnsmasq -k --enable-dbus --user=dnsmasq -C ${dnsmasqConf}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
PrivateTmp = true;
ProtectSystem = true;
ProtectHome = true;
Restart = "on-failure";
};
};
boot.kernelModules = [ "fuse" "kvm-intel" "coretemp" ];
}

View file

@ -1,16 +0,0 @@
{ config, lib, pkgs, ... }:
let
tap-plugins = pkgs.callPackage pkgs/tap-plugins/default.nix {};
enable_bluetooth = config.hardware.bluetooth.enable;
in {
sound.enable = true;
hardware.pulseaudio = {
enable = true;
extraModules = if enable_bluetooth then [pkgs.pulseaudio-modules-bt] else [];
};
systemd.user.services.pulseaudio.environment = {
LD_LIBRARY_PATH = "${tap-plugins}/lib/ladspa";
};
}

View file

@ -1,16 +0,0 @@
{ config, pkgs, ... }:
let
unstableTarball =
fetchTarball
https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz;
in
{
nixpkgs.config = {
packageOverrides = pkgs: {
unstable = import unstableTarball {
config = config.nixpkgs.config;
};
};
};
}