From d395f45f911c7cc7114fc78750f44a7be6add263 Mon Sep 17 00:00:00 2001 From: Fabian Hauser Date: Fri, 29 Jul 2022 00:10:13 +0200 Subject: [PATCH] Add bachtel config --- defaults/hardware/apu.nix | 28 ++++++++++++++++++++++++ defaults/threema | 2 +- flake.lock | 16 +++++++------- flake.nix | 2 +- host/bachtel/default.nix | 27 +++++++++++++++++++++++ host/bachtel/filesystems.nix | 20 +++++++++++++++++ host/bachtel/networking.nix | 42 ++++++++++++++++++++++++++++++++++++ 7 files changed, 127 insertions(+), 10 deletions(-) create mode 100644 defaults/hardware/apu.nix create mode 100644 host/bachtel/default.nix create mode 100644 host/bachtel/filesystems.nix create mode 100644 host/bachtel/networking.nix diff --git a/defaults/hardware/apu.nix b/defaults/hardware/apu.nix new file mode 100644 index 0000000..fd9e555 --- /dev/null +++ b/defaults/hardware/apu.nix @@ -0,0 +1,28 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.loader.grub.extraConfig = + "\n serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1\n terminal_input serial\n terminal_output serial\n "; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "ahci" + "ehci_pci" + "usbhid" + "usb_storage" + "sd_mod" + "sdhci_pci" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" "virtio" "tun" ]; + boot.extraModulePackages = [ ]; + boot.kernelParams = [ "console=ttyS0,115200n8" ]; + + # CPU Configuration + hardware.cpu.amd.updateMicrocode = true; + nix.maxJobs = lib.mkDefault 4; +} diff --git a/defaults/threema b/defaults/threema index 5f75497..dd6ec3a 160000 --- a/defaults/threema +++ b/defaults/threema @@ -1 +1 @@ -Subproject commit 5f75497e0f9a19ab4a2f509e177163a012c888d6 +Subproject commit dd6ec3ad8996533f49320f13e340d3f9966195ef diff --git a/flake.lock b/flake.lock index bee0f65..c529cae 100644 --- a/flake.lock +++ b/flake.lock @@ -54,11 +54,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1658826464, - "narHash": "sha256-94ZTF0uIX/iZdiD4RJ5f933ak/OM4XLl7hF+gCa4Iuk=", + "lastModified": 1658916876, + "narHash": "sha256-BG7MCClmy9esk8pZLCtKoggNv91tAMm7P6dGHXMl3zc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ce49cb7792a7ffd65ef352dda1110a4e4a204eac", + "rev": "2b0dd45aca6a260762395ca2e94beab247f455a7", "type": "github" }, "original": { @@ -108,11 +108,11 @@ ] }, "locked": { - "lastModified": 1658502202, - "narHash": "sha256-Qo0A+x/rbxtlTaB4+DtCYvM2+8UWC1lrvXg09hM2Mm4=", - "ref": "HEAD", - "rev": "5f75497e0f9a19ab4a2f509e177163a012c888d6", - "revCount": 16, + "lastModified": 1659046155, + "narHash": "sha256-/e2GlMu4YjuXv0J/ylEE89eKl477Q7aG3vjsvh7HPDs=", + "ref": "master", + "rev": "dd6ec3ad8996533f49320f13e340d3f9966195ef", + "revCount": 17, "type": "git", "url": "file:///etc/nixos/defaults/threema" }, diff --git a/flake.nix b/flake.nix index 9c857b4..bf3e48d 100644 --- a/flake.nix +++ b/flake.nix @@ -28,7 +28,7 @@ inherit system; config.allowUnfree = true; # For vscode }; - hosts = [ "speer" "hummelberg" "ochsenchopf" ]; + hosts = [ "speer" "hummelberg" "ochsenchopf" "bachtel" ]; in { checks.${system}.formatCheck = let pkgs = pkgsUnstable; in pkgs.runCommand "nixfmt-check" { } '' diff --git a/host/bachtel/default.nix b/host/bachtel/default.nix new file mode 100644 index 0000000..2368230 --- /dev/null +++ b/host/bachtel/default.nix @@ -0,0 +1,27 @@ +{ config, pkgs, threemaModules, ... }: { + + imports = [ + ./networking.nix + ./filesystems.nix + ../../defaults/base + ../../defaults/hardware/apu.nix + ]; + + # Set your time zone. + # time.timeZone = "Europe/Amsterdam"; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.jane = { + # isNormalUser = true; + # extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user. + # }; + + # This value determines the NixOS release from which the default + # settings for stateful data, like fi:le 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 = "22.05"; # Did you read the comment? + +} diff --git a/host/bachtel/filesystems.nix b/host/bachtel/filesystems.nix new file mode 100644 index 0000000..4a16a09 --- /dev/null +++ b/host/bachtel/filesystems.nix @@ -0,0 +1,20 @@ +{ config, pkgs, threemaModules, ... }: { + + fileSystems."/" = { + device = "/dev/disk/by-uuid/360a6bc9-fc4e-4803-bd53-69320ac32ac5"; + fsType = "btrfs"; + options = [ "defaults" "subvol=nixos" "noatime" ]; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/73f91e99-d856-4504-b6b2-d60f855d6d95"; }]; + + # Use the GRUB 2 boot loader. + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + # boot.loader.grub.efiSupport = true; + # boot.loader.grub.efiInstallAsRemovable = true; + # boot.loader.efi.efiSysMountPoint = "/boot/efi"; + # Define on which hard drive you want to install Grub. + boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only +} diff --git a/host/bachtel/networking.nix b/host/bachtel/networking.nix new file mode 100644 index 0000000..d9bc18e --- /dev/null +++ b/host/bachtel/networking.nix @@ -0,0 +1,42 @@ +{ config, pkgs, threemaModules, ... }: { + + services.qois.wwan = { + enable = true; + apn = "gprs.swisscom.ch"; + networkInterface = "wwp0s19u1u3i12"; + }; + + services.qois.router = { + enable = true; + wanInterface = "enp1s0"; + wirelessInterfaces = [ "wlp5s0" ]; + lanInterfaces = [ "enp2s0" "enp3s0" "enp4s0" ]; + internalRouterIP = "10.2.1.1"; + dhcp = { + enable = true; + localDomain = "iot-bachtel-lan.net.fh2.ch"; + dhcpRange = "10.2.1.2,10.2.1.249"; + }; + #recursiveDns = { + # enable = true; + # networkIdIp = "10.2.1.0"; + #}; + wireless = { + enable = true; + wleInterface24Ghz = "wlp5s0"; + #wleInterface5Ghz = "wlp5s0"; + ssid = "jona-iot"; + passphrase = "vrzjYq36xA"; + }; + }; + + networking.hostName = "bachtel"; # Define your hostname. + #networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + #networking.wireless.networks = { + # yummi = { + # psk = "cookies!"; + # }; + #}; + networking.interfaces.enp1s0.useDHCP = true; + +}