reformat all the nix files

using
    nix run -f channel:nixos-unstable nixfmt -c nixfmt $(git ls-files *.nix)
This commit is contained in:
Raphael Borun Das Gupta 2020-04-05 19:05:38 +02:00
parent a7f51f92f1
commit bf0be939cc
14 changed files with 312 additions and 312 deletions

View file

@ -4,16 +4,19 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = imports = [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix> ];
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.loader.grub.extraConfig = " boot.loader.grub.extraConfig =
serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1 "\n serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1\n terminal_input serial\n terminal_output serial\n ";
terminal_input serial boot.initrd.availableKernelModules = [
terminal_output serial "xhci_pci"
"; "ahci"
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "ehci_pci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; "ehci_pci"
"usbhid"
"usb_storage"
"sd_mod"
"sdhci_pci"
];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" "virtio" "tun" ]; boot.kernelModules = [ "kvm-amd" "virtio" "tun" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
@ -21,6 +24,5 @@
hardware.cpu.amd.updateMicrocode = true; hardware.cpu.amd.updateMicrocode = true;
nix.maxJobs = lib.mkDefault 4; nix.maxJobs = lib.mkDefault 4;
} }

View file

@ -4,11 +4,10 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = imports = [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix> ];
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "e1000e" "virtio-pci"]; boot.initrd.availableKernelModules =
[ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "e1000e" "virtio-pci" ];
boot.initrd.kernelModules = [ ]; boot.initrd.kernelModules = [ ];
# boot.kernelModules = [ "kvm-intel" "virtio" "tun" ]; # boot.kernelModules = [ "kvm-intel" "virtio" "tun" ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];

View file

@ -1,5 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }: {
{
boot.kernelPatches = [{ boot.kernelPatches = [{
name = "ath10k-override-eeprom-regulatory-domain"; name = "ath10k-override-eeprom-regulatory-domain";
patch = ./wle900vx/ath10k-override-eeprom-regulatory-domain.patch; patch = ./wle900vx/ath10k-override-eeprom-regulatory-domain.patch;

View file

@ -4,7 +4,8 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let routerConfig = { let
routerConfig = {
wanInterface = "wwp0s19u1u3i12"; wanInterface = "wwp0s19u1u3i12";
wireless = { wireless = {
wleInterface = "wlp5s0"; wleInterface = "wlp5s0";
@ -23,12 +24,9 @@ let routerConfig = {
}; };
}; };
in in {
{ imports = [
imports =
[
../hardware/apu.nix ../hardware/apu.nix
../hardware/wle900vx.nix ../hardware/wle900vx.nix
../role/base ../role/base
@ -36,15 +34,14 @@ in
(import ../role/router routerConfig) (import ../role/router routerConfig)
]; ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/360a6bc9-fc4e-4803-bd53-69320ac32ac5"; device = "/dev/disk/by-uuid/360a6bc9-fc4e-4803-bd53-69320ac32ac5";
fsType = "btrfs"; fsType = "btrfs";
options = [ "defaults" "subvol=nixos" "noatime" ]; options = [ "defaults" "subvol=nixos" "noatime" ];
}; };
swapDevices = swapDevices =
[ { device = "/dev/disk/by-uuid/73f91e99-d856-4504-b6b2-d60f855d6d95"; } [{ device = "/dev/disk/by-uuid/73f91e99-d856-4504-b6b2-d60f855d6d95"; }];
];
services.wwan = { services.wwan = {
enable = true; enable = true;
@ -61,7 +58,8 @@ in
# Define on which hard drive you want to install Grub. # Define on which hard drive you want to install Grub.
boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
networking.hostName = routerConfig.lanNetwork.routerHostName; # Define your hostname. networking.hostName =
routerConfig.lanNetwork.routerHostName; # Define your hostname.
#networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. #networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
#networking.wireless.networks = { #networking.wireless.networks = {
# yummi = { # yummi = {

View file

@ -5,22 +5,20 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = imports = [
[
../hardware/apu.nix ../hardware/apu.nix
../role/base ../role/base
# ../role/router.nix #TODO # ../role/router.nix #TODO
]; ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/16efc5db-0697-4f39-b64b-fc18ac318625"; device = "/dev/disk/by-uuid/16efc5db-0697-4f39-b64b-fc18ac318625";
fsType = "btrfs"; fsType = "btrfs";
options = [ "defaults" "subvol=nixos" "noatime" ]; options = [ "defaults" "subvol=nixos" "noatime" ];
}; };
swapDevices = swapDevices =
[ { device = "/dev/disk/by-uuid/b5104a7c-4a4a-4048-a9f8-44ddb0082632"; } [{ device = "/dev/disk/by-uuid/b5104a7c-4a4a-4048-a9f8-44ddb0082632"; }];
];
# Use the GRUB 2 boot loader. # Use the GRUB 2 boot loader.
boot.loader.grub.enable = true; boot.loader.grub.enable = true;

View file

@ -5,14 +5,10 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = imports = [ ../hardware/apu.nix ../role/base ];
[
../hardware/apu.nix
../role/base
];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/ab5a598b-6609-465f-8ab8-b894b8a5e32a"; device = "/dev/disk/by-uuid/ab5a598b-6609-465f-8ab8-b894b8a5e32a";
fsType = "btrfs"; fsType = "btrfs";
options = [ "defaults" "noatime" ]; options = [ "defaults" "noatime" ];
}; };

View file

@ -6,12 +6,14 @@
{ {
imports = imports = [
[
../hardware/nuc.nix ../hardware/nuc.nix
../role/base ../role/base
../role/dropbear ../role/dropbear
(import ../role/backup { systemdMount = "var-backup.mount"; borgArchiveFolder = "/var/backup/montalin";}) (import ../role/backup {
systemdMount = "var-backup.mount";
borgArchiveFolder = "/var/backup/montalin";
})
]; ];
boot.initrd.luks.devices = { boot.initrd.luks.devices = {
@ -21,9 +23,21 @@
}; };
fileSystems = { fileSystems = {
"/" = { device = "/dev/mapper/root"; fsType = "btrfs"; options = [ "defaults" "noatime" ]; }; "/" = {
"/var/backup" = { device = "/dev/mapper/backup"; fsType = "ext4"; options = [ "defaults" "noauto" "noatime" ]; }; device = "/dev/mapper/root";
"/boot" = { device = "/dev/disk/by-uuid/0065-E4EA"; fsType = "vfat"; options = [ "defaults" "noatime" ]; }; fsType = "btrfs";
options = [ "defaults" "noatime" ];
};
"/var/backup" = {
device = "/dev/mapper/backup";
fsType = "ext4";
options = [ "defaults" "noauto" "noatime" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/0065-E4EA";
fsType = "vfat";
options = [ "defaults" "noatime" ];
};
}; };
swapDevices = [{ device = "/dev/mapper/swap"; }]; swapDevices = [{ device = "/dev/mapper/swap"; }];

View file

@ -1,21 +1,17 @@
# Regular backup role to a separate device # Regular backup role to a separate device
{ { systemdMount, # Systemd mount name
systemdMount, # Systemd mount name
borgArchiveFolder, # Absolute borg root folder borgArchiveFolder, # Absolute borg root folder
keepWithin? "14d", keepWithin ? "14d", keepWeekly ? "4", keepMonthly ? "6", keepYearly ? "-1"
keepWeekly? "4", , schedule ? "13:37", # Systemd Schedule of backup timer
keepMonthly? "6",
keepYearly? "-1",
schedule? "13:37", # Systemd Schedule of backup timer
}: }:
let pkgs = import <nixpkgs> { }; let pkgs = import <nixpkgs> { };
in in {
{
systemd = { systemd = {
services.backup = { services.backup = {
description = "Backup of all user data and system configuration with BorgBackup"; description =
"Backup of all user data and system configuration with BorgBackup";
serviceConfig.Type = "oneshot"; serviceConfig.Type = "oneshot";
path = with pkgs; [ bash borgbackup ]; path = with pkgs; [ bash borgbackup ];
script = '' script = ''

View file

@ -15,14 +15,24 @@
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
wget curl vim tmux git ncat bind ack wget
fwupd pciutils dmidecode smartmontools parted curl
vim
tmux
git
ncat
bind
ack
fwupd
pciutils
dmidecode
smartmontools
parted
borgbackup borgbackup
]; ];
services.fwupd.enable = true; services.fwupd.enable = true;
# Networking # Networking
networking.firewall = { networking.firewall = {
allowPing = true; allowPing = true;

View file

@ -1,15 +1,13 @@
{ {
# To get the MAC address of each card, use this command: cat /sys/class/net/*device_name*/address # To get the MAC address of each card, use this command: cat /sys/class/net/*device_name*/address
# Make sure to use the lower-case hex values in your udev rules. It does not like upper-case. # Make sure to use the lower-case hex values in your udev rules. It does not like upper-case.
wanInterface, wanInterface, wireless ? {
wireless ? {
wleInterface = "wlp5s0"; wleInterface = "wlp5s0";
wleSSID = "hauser"; wleSSID = "hauser";
# Generate Encrypted Passphrase with: wpa_passphrase <wleSSID> <passphrase> # Generate Encrypted Passphrase with: wpa_passphrase <wleSSID> <passphrase>
wlePassphrase = "a5e42b914b5ad2b7e0474c3b9b35d0843a52668d30cd6aa8650ec43263a60b6e"; wlePassphrase =
}, "a5e42b914b5ad2b7e0474c3b9b35d0843a52668d30cd6aa8650ec43263a60b6e";
lanInterfaces ? [ "enp2s0" "enp3s0" ], }, lanInterfaces ? [ "enp2s0" "enp3s0" ], lanNetwork ? {
lanNetwork ? {
routerAddress = "10.1.1.1"; routerAddress = "10.1.1.1";
netid = "10.1.1.0"; netid = "10.1.1.0";
revIpDomain = "1.1.10"; revIpDomain = "1.1.10";
@ -17,12 +15,10 @@
domain = "ilanz.fh2.ch"; domain = "ilanz.fh2.ch";
dhcpRange = "10.1.1.2,10.1.1.249"; dhcpRange = "10.1.1.2,10.1.1.249";
routerHostName = "router"; routerHostName = "router";
}, }, }:
}:
let pkgs = import <nixpkgs> { }; let pkgs = import <nixpkgs> { };
in in {
{
imports = [ imports = [
(import ./wireless-access-point.nix wireless) (import ./wireless-access-point.nix wireless)
(import ./dns-recursive.nix lanNetwork) (import ./dns-recursive.nix lanNetwork)
@ -38,7 +34,10 @@ in
bridges.lan.interfaces = lanInterfaces ++ [ wireless.wleInterface ]; bridges.lan.interfaces = lanInterfaces ++ [ wireless.wleInterface ];
interfaces.lan = { interfaces.lan = {
ipv4 = { ipv4 = {
addresses = [ { address = lanNetwork.routerAddress; prefixLength = lanNetwork.prefixLength; } ]; addresses = [{
address = lanNetwork.routerAddress;
prefixLength = lanNetwork.prefixLength;
}];
}; };
}; };
firewall.trustedInterfaces = [ "lan" ]; firewall.trustedInterfaces = [ "lan" ];

View file

@ -1,17 +1,8 @@
{ routerAddress, netid, revIpDomain, prefixLength, domain, dhcpRange
{ , routerHostName, }:
routerAddress,
netid,
revIpDomain,
prefixLength,
domain,
dhcpRange,
routerHostName,
}:
let pkgs = import <nixpkgs> { }; let pkgs = import <nixpkgs> { };
in in {
{
services.unbound = { services.unbound = {
enable = true; enable = true;
@ -656,7 +647,5 @@ in
#log-dhcp #log-dhcp
''; '';
systemd.services.dnsmasq = { systemd.services.dnsmasq = { bindsTo = [ "network-addresses-lan.service" ]; };
bindsTo = [ "network-addresses-lan.service" ];
};
} }

View file

@ -1,6 +1,4 @@
{ { wleInterface, wleSSID,
wleInterface,
wleSSID,
# Generate Encrypted Passphrase with: wpa_passphrase <wleSSID> <passphrase> # Generate Encrypted Passphrase with: wpa_passphrase <wleSSID> <passphrase>
wlePassphrase, wlePassphrase,
# TODO: Type # TODO: Type
@ -8,8 +6,7 @@
}: }:
let pkgs = import <nixpkgs> { }; let pkgs = import <nixpkgs> { };
in in {
{
boot.extraModprobeConfig = '' boot.extraModprobeConfig = ''
options cfg80211 ieee80211_regdom=US options cfg80211 ieee80211_regdom=US
''; '';

View file

@ -24,8 +24,7 @@ let
systemctl restart wwan.service systemctl restart wwan.service
fi fi
''; '';
in in {
{
options.services.wwan = { options.services.wwan = {
enable = mkEnableOption "wwan client service"; enable = mkEnableOption "wwan client service";
@ -56,7 +55,9 @@ in
type = types.enum [ "PAP" "CHAP" "MSCHAPV2" "" ]; type = types.enum [ "PAP" "CHAP" "MSCHAPV2" "" ];
default = ""; default = "";
description = '' description = ''
APN authentication type, one of ${concatMapStringsSep ", " show values} (optional). APN authentication type, one of ${
concatMapStringsSep ", " show values
} (optional).
''; '';
}; };
@ -91,8 +92,10 @@ in
path = with pkgs; [ libmbim iproute ]; path = with pkgs; [ libmbim iproute ];
serviceConfig = { serviceConfig = {
ExecStart = "${mbim-ip-configured}/bin/mbim-ip-configured start ${cfg.networkInterface}"; ExecStart =
ExecStop = "${mbim-ip-configured}/bin/mbim-ip-configured stop ${cfg.networkInterface}"; "${mbim-ip-configured}/bin/mbim-ip-configured start ${cfg.networkInterface}";
ExecStop =
"${mbim-ip-configured}/bin/mbim-ip-configured stop ${cfg.networkInterface}";
RemainAfterExit = true; RemainAfterExit = true;
}; };