Generalize and split up more files
This commit is contained in:
parent
93541beed7
commit
a0447a18da
|
@ -1,28 +0,0 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
networking = {
|
||||
firewall.allowedUDPPorts = [ 51820 ];
|
||||
|
||||
nat = {
|
||||
enable = config.system.wireguard.server.enable;
|
||||
externalInterface = "eno1";
|
||||
internalInterfaces = [ "wgs" ];
|
||||
};
|
||||
|
||||
wireguard.interfaces.wgs = {
|
||||
ips = [ "10.100.0.1/24" ];
|
||||
listenPort = 51820;
|
||||
privateKey = config.secrets.wgServerPriv;
|
||||
peers = [
|
||||
{ # NixOS Config Key
|
||||
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
|
||||
allowedIPs = [ "10.100.0.16/28" ];
|
||||
}
|
||||
{ # Pixel 9
|
||||
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
|
||||
allowedIPs = [ "10.100.0.2/32" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -3,38 +3,5 @@
|
|||
boot = {
|
||||
kernelPackages = pkgs.linuxPackages_latest;
|
||||
kernel.sysctl."vm.max_map_count" = 2147483642;
|
||||
|
||||
initrd = {
|
||||
systemd = {
|
||||
enable = true;
|
||||
services.root-reset = {
|
||||
description = "Reset BTRFS root and snapshot last boot";
|
||||
wantedBy = [ "initrd.target" ];
|
||||
after = [ "dev-nixos-root.device" ];
|
||||
before = [ "sysroot.mount" ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
mkdir -p /mnt
|
||||
mount /dev/nixos/root /mnt
|
||||
|
||||
if [[ -e /mnt/@prev ]]; then
|
||||
btrfs subvolume delete /mnt/@prev
|
||||
fi
|
||||
|
||||
btrfs subvolume snapshot /mnt/@ /mnt/@prev
|
||||
|
||||
btrfs subvolume list -o /mnt/@ | cut -f9 -d' ' | while read subvolume; do
|
||||
btrfs subvolume delete "/mnt/$subvolume"
|
||||
done
|
||||
|
||||
btrfs subvolume delete /mnt/@
|
||||
btrfs subvolume create /mnt/@
|
||||
|
||||
umount /mnt
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,27 +3,15 @@
|
|||
imports = [
|
||||
./boot
|
||||
./disko
|
||||
./filesystems
|
||||
./hardware
|
||||
|
||||
# Apps and programs
|
||||
../../modules/system
|
||||
../../modules/system/accounts
|
||||
../../modules/system/desktop
|
||||
../../modules/system/programs
|
||||
../../modules/system/services
|
||||
|
||||
# Devices and hardware
|
||||
../../modules/system/devices
|
||||
../../modules/system/devices/boot/systemd
|
||||
../../modules/system/devices/networking/wireless
|
||||
../../modules/system/devices/networking/firewall/pc
|
||||
../../modules/system/devices/networking/wireguard/pc
|
||||
|
||||
# Extras
|
||||
../../overlays
|
||||
../../variables
|
||||
];
|
||||
|
||||
system.lanzaboote.enable = true;
|
||||
|
||||
system.wireguard.client.enable = true;
|
||||
networking.wireguard.interfaces.wgc.ips = [ "10.100.0.23/24" ];
|
||||
|
||||
networking.hostName = "redmond";
|
||||
networking.wireguard.interfaces."${config.ips.wgInt}".ips = [ "${config.ips.wgSpan}.20/24" ];
|
||||
}
|
||||
|
|
10
hosts/redmond/filesystems/default.nix
Normal file
10
hosts/redmond/filesystems/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ ... }:
|
||||
{
|
||||
fileSystems = {
|
||||
"/home/jimbo/JimboNFS" = {
|
||||
device = "10.100.0.1:/export/JimboNFS";
|
||||
fsType = "nfs4";
|
||||
options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,27 +1,7 @@
|
|||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
boot = {
|
||||
kernelModules = [ "kvm-amd" ];
|
||||
initrd = {
|
||||
availableKernelModules = [
|
||||
"xhci_pci"
|
||||
"ahci"
|
||||
"ehci_pci"
|
||||
"sd_mod"
|
||||
"sr_mod"
|
||||
"sdhci_pci"
|
||||
"rtsx_usb_sdmmc"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems = {
|
||||
"/home/jimbo/JimboNFS" = {
|
||||
device = "${config.ips.wgSpan}.1:/export/JimboNFS";
|
||||
fsType = "nfs4";
|
||||
options = ["x-systemd.automount" "_netdev" "nofail" "noauto"];
|
||||
};
|
||||
};
|
||||
boot.kernelModules = [ "kvm-amd" ];
|
||||
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "ehci_pci" "sd_mod" "sr_mod" "sdhci_pci" "rtsx_usb_sdmmc" ];
|
||||
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
|
|
|
@ -1 +1 @@
|
|||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG9uITpyw5WgxT7UnswueFtyWxAqQCZv4h9DfcDkr+kn
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKsPwxV2qr4IFC63SxPM5bI9iFCbH5wVxorNHYKSvE7i
|
||||
|
|
|
@ -27,37 +27,6 @@ in {
|
|||
"vfio_pci"
|
||||
"vfio_iommu_type1"
|
||||
];
|
||||
|
||||
initrd.systemd = {
|
||||
enable = true;
|
||||
services.root-reset = {
|
||||
description = "Reset root and snapshot last boot";
|
||||
wantedBy = [ "initrd.target" ];
|
||||
before = [ "sysroot.mount" ];
|
||||
after = [ "dev-${config.networking.hostName}-root.device" ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
mkdir -p /mnt
|
||||
mount /dev/${config.networking.hostName}/root /mnt
|
||||
|
||||
if [[ -e /mnt/prev ]]; then
|
||||
btrfs subvolume delete /mnt/prev
|
||||
fi
|
||||
|
||||
btrfs subvolume snapshot /mnt/root /mnt/prev
|
||||
|
||||
btrfs subvolume list -o /mnt/root | cut -f9 -d' ' | while read subvolume; do
|
||||
btrfs subvolume delete "/mnt/$subvolume"
|
||||
done
|
||||
|
||||
btrfs subvolume delete /mnt/root
|
||||
btrfs subvolume create /mnt/root
|
||||
|
||||
umount /mnt
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Use second GPU on boot
|
||||
|
|
|
@ -134,6 +134,7 @@ in {
|
|||
|
||||
"extensions.pocket.enabled" = false;
|
||||
"extensions.autoDisableScopes" = 0;
|
||||
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
|
||||
|
||||
"toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||
"toolkit.tabbox.switchByScrolling" = true;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [ ./small ];
|
||||
home.file.".config/fastfetch/config.jsonc".source = ./config.jsonc;
|
||||
programs.fastfetch.enable = true;
|
||||
home.file.".config/fastfetch/config.jsonc".source = ./config.jsonc;
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
home = {
|
||||
packages = with pkgs; [ (pkgs.writeScriptBin "pfetch" "fastfetch --config ~/.config/fastfetch/small.jsonc") ];
|
||||
file.".config/fastfetch/small.jsonc".source = ./small.jsonc;
|
||||
packages = with pkgs; [
|
||||
(pkgs.writeScriptBin "pfetch" "fastfetch --config ~/.config/fastfetch/small.jsonc")
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,7 +16,5 @@
|
|||
|
||||
services.mpd-discord-rpc.enable = true;
|
||||
|
||||
home.packages = with pkgs; [
|
||||
mpc-cli
|
||||
];
|
||||
home.packages = with pkgs; [ mpc-cli ];
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
{
|
||||
programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = false;
|
||||
autosuggestion.enable = true;
|
||||
syntaxHighlighting.enable = true;
|
||||
oh-my-zsh = {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
{ pkgs, config, ... }:
|
||||
{
|
||||
imports = [
|
||||
./swappy
|
||||
];
|
||||
imports = [ ./swappy ];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
(pkgs.writeScriptBin "swayshot" ''
|
||||
|
|
7
modules/system/boot/default.nix
Normal file
7
modules/system/boot/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./firmware
|
||||
./systemd
|
||||
];
|
||||
}
|
4
modules/system/boot/firmware/default.nix
Normal file
4
modules/system/boot/firmware/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ ... }:
|
||||
{
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
}
|
6
modules/system/boot/systemd/default.nix
Normal file
6
modules/system/boot/systemd/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [ ./root-reset ];
|
||||
|
||||
boot.initrd.systemd.enable = true;
|
||||
}
|
30
modules/system/boot/systemd/root-reset/default.nix
Normal file
30
modules/system/boot/systemd/root-reset/default.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{ config, ... }:
|
||||
{
|
||||
boot.initrd.systemd.services.root-reset = {
|
||||
description = "Reset root and snapshot last boot";
|
||||
wantedBy = [ "initrd.target" ];
|
||||
before = [ "sysroot.mount" ];
|
||||
after = [ "dev-${config.networking.hostName}-root.device" ];
|
||||
unitConfig.DefaultDependencies = "no";
|
||||
serviceConfig.Type = "oneshot";
|
||||
script = ''
|
||||
mkdir -p /mnt
|
||||
mount /dev/${config.networking.hostName}/root /mnt
|
||||
|
||||
if [[ -e /mnt/prev ]]; then
|
||||
btrfs subvolume delete /mnt/prev
|
||||
fi
|
||||
|
||||
btrfs subvolume snapshot /mnt/root /mnt/prev
|
||||
|
||||
btrfs subvolume list -o /mnt/root | cut -f9 -d' ' | while read subvolume; do
|
||||
btrfs subvolume delete "/mnt/$subvolume"
|
||||
done
|
||||
|
||||
btrfs subvolume delete /mnt/root
|
||||
btrfs subvolume create /mnt/root
|
||||
|
||||
umount /mnt
|
||||
'';
|
||||
};
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
{
|
||||
imports = [
|
||||
./accounts
|
||||
./boot
|
||||
./devices
|
||||
./options
|
||||
./programs
|
||||
|
@ -10,8 +11,5 @@
|
|||
../extras
|
||||
];
|
||||
|
||||
time.timeZone = "America/Toronto";
|
||||
programs.nano.enable = false;
|
||||
hardware.enableRedistributableFirmware = true;
|
||||
system.stateVersion = "24.05";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [ ./wireless ];
|
||||
imports = [
|
||||
./wireless
|
||||
./wireguard
|
||||
];
|
||||
|
||||
networking = {
|
||||
wireless.enable = false;
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
options.system.wireguard.client.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable the wireguard client";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.system.wireguard.client.enable {
|
||||
networking = {
|
||||
firewall = {
|
||||
allowedUDPPorts = [ 51820 ];
|
||||
trustedInterfaces = [ "wgc" ];
|
||||
};
|
||||
|
||||
wireguard.interfaces.wgc = {
|
||||
listenPort = 51820;
|
||||
privateKey = config.secrets.wgClientPriv;
|
||||
peers = [
|
||||
{ # Cyberspark Server
|
||||
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
|
||||
allowedIPs = [ "10.100.0.0/24" ];
|
||||
endpoint = "sv.${config.domains.jim1}:51820";
|
||||
persistentKeepalive = 25;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
7
modules/system/devices/networking/wireguard/default.nix
Normal file
7
modules/system/devices/networking/wireguard/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
./client
|
||||
./server
|
||||
];
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
{ lib, config, ... }:
|
||||
{
|
||||
options.system.wireguard.server.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Enable the wireguard server";
|
||||
};
|
||||
|
||||
config = lib.mkIf config.system.wireguard.server.enable {
|
||||
networking = {
|
||||
firewall.allowedUDPPorts = [ 51820 ];
|
||||
|
||||
nat = {
|
||||
enable = config.system.wireguard.server.enable;
|
||||
externalInterface = "eno1";
|
||||
internalInterfaces = [ "wgs" ];
|
||||
};
|
||||
|
||||
wireguard.interfaces.wgs = {
|
||||
ips = [ "10.100.0.1/24" ];
|
||||
listenPort = 51820;
|
||||
privateKey = config.secrets.wgServerPriv;
|
||||
peers = [
|
||||
{ # NixOS Config Key
|
||||
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
|
||||
allowedIPs = [ "10.100.0.16/28" ];
|
||||
}
|
||||
{ # Pixel 9
|
||||
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
|
||||
allowedIPs = [ "10.100.0.2/32" ];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,12 +1,10 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
options.system.wireless = {
|
||||
enable = lib.mkOption {
|
||||
options.system.wireless.enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Enable Wifi with iwd";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf config.system.wireless.enable {
|
||||
networking = {
|
||||
|
|
|
@ -5,5 +5,6 @@
|
|||
./fonts
|
||||
./minimal
|
||||
./nix
|
||||
./timezone
|
||||
];
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
stub-ld.enable = false;
|
||||
};
|
||||
|
||||
programs.nano.enable = false;
|
||||
programs.less.lessopen = null;
|
||||
|
||||
services.logrotate.enable = false;
|
||||
|
|
4
modules/system/settings/timezone/default.nix
Normal file
4
modules/system/settings/timezone/default.nix
Normal file
|
@ -0,0 +1,4 @@
|
|||
{ ... }:
|
||||
{
|
||||
time.timeZone = "America/Toronto";
|
||||
}
|
Loading…
Reference in a new issue