added NxACE (untested)

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2024-05-04 12:10:42 +02:00
parent c202666c0d
commit 66ef004344
433 changed files with 462 additions and 51424 deletions

View File

@@ -9,49 +9,35 @@
});
in
{
imports = [
imports = if host == "NxNORTH" then [
inputs.lanzaboote.nixosModules.lanzaboote
];
] else [];
config = if host == "NxXPS" then {
config = if (host == "NxXPS" || host == "NxACE") then {
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.grub = {
enable = true;
configurationLimit = 30;
# device = "/dev/nvme0n1p1";
device = "nodev";
# useOSProber = true;
efiSupport = true;
# theme = pkgs.sleek-grub-theme;
theme = grub-theme-ascii-diana;
font = "${grub-theme-ascii-diana}/unicode.pf2";
fontSize = 50;
splashImage = null;
extraEntries = ''
extraEntries = if host == "NxXPS" then ''
menuentry 'Windows 11' --class windows --class os $menuentry_id_option 'osprober-efi-0A97-7A2D' {
insmod part_gpt
insmod fat
search --no-floppy --fs-uuid --set=root 0A97-7A2D
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
'';
'' else '''';
};
} else {
# boot.loader = {
# systemd-boot = {
# enable = true;
# configurationLimit = 10;
# };
# timeout = 30;
# };
# I have to boot with secureboot becasue of the chineese spyware called Vanguard
# I have to boot with secureboot becasue of the chinese spyware called Vanguard
environment.systemPackages = with pkgs; [
sbctl
];
@@ -61,7 +47,7 @@
pkiBundle = "/etc/secureboot";
};
# we let lanzaboote install systemd-boot
# let lanzaboote install systemd-boot
loader.systemd-boot.enable = false;
};
};

View File

@@ -1,12 +1,10 @@
{ config, pkgs, ... }:
{ config, pkgs, user, ... }:
{
environment.systemPackages = with pkgs; [
lazydocker
];
virtualisation.docker.enable = true;
users.users.nx2.extraGroups = [ "docker" ];
users.extraGroups.docker.members = [ "username-with-access-to-socket" ];
}
users.users."${user}".extraGroups = [ "docker" ];
}

View File

@@ -7,28 +7,25 @@
environment.systemPackages = if host == "NxNORTH" then with pkgs; [
ntfs3g
btrfs-progs
] else with pkgs; [
] else if host == "NxXPS" then with pkgs; [
ntfs3g
];
] else [];
boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "vmd" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
# boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
# fileSystems = if lib.pathExists /dev/disk/by-label/shared == true then {
# "/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; };
# "/boot" = { device = "/dev/disk/by-label/EFI"; fsType = "vfat"; };
# "/home/${user}/shared" = { device = "/dev/disk/by-label/shared"; fsType = if host == "NxXPS" then "ntfs" else "btrfs"; };
# } else {
# "/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; };
# "/boot" = { device = "/dev/disk/by-label/EFI"; fsType = "vfat"; };
# };
fileSystems = {
fileSystems = if host != "NxACE" then {
"/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; };
"/boot" = { device = "/dev/disk/by-label/EFI"; fsType = "vfat"; };
"/home/${user}/shared" = { device = "/dev/disk/by-label/shared"; fsType = if host == "NxXPS" then "ntfs" else "btrfs"; };
};
} else {
"/" = { device = "/dev/disk/by-label/nixos"; fsType = "ext4"; };
"/boot" = { device = "/dev/disk/by-label/EFI"; fsType = "vfat"; };
"/vault" = { device = "/dev/disk/by-label/vault"; fsType = "ext4"; };
};
swapDevices = [

View File

@@ -1,61 +1,62 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, host, ... }:
lib.mkIf (host != "NxACE")
{
systemd.timers."health_reminder" = {
enable = true;
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "5m";
OnUnitActiveSec = "5m";
Unit = "health_reminder.service";
};
};
systemd.services."health_reminder" =
let hm = pkgs.writeScriptBin "health_reminder" ''
#!${pkgs.python3}/bin/python3
import random
class Action:
def __init__(self, actionA: str, actionB: str, likelihood: int, options: str):
self.actionA = actionA
self.actionB = actionB
self.likelihood = likelihood
self.options = options
def __str__(self):
if self.options:
return f"{self.actionA}{random.choice(self.options)}{self.actionB}"
else:
return self.actionA
actions = [
Action("look away for 20 Seconds!", "", 300, ""),
Action("Shrimp 3000!", "", 90, ""),
Action("Do ", " Biceps curls with each Arm! ", 5, ["50", "10", "20"]),
Action("Do ", " Shourlder thingees", 5, ["30", "50", "20"]),
Action("Plank for ", " senonds!", 5, ["60", "60", "70"]),
Action("Strech your upper body!", "", 10, ""),
Action("Strech your core!", "", 5, ""),
Action("Strech your legs!", "", 5, ""),
Action("Make Tea!", "", 5, ""),
]
total_likelihood = sum(a.likelihood for a in actions)
random_action = random.choices(actions, [a.likelihood for a in actions], k=1)[0]
print(random_action)
'';
in
{
script = ''
set -eu
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus"
${pkgs.libnotify}/bin/notify-send "$(${hm}/bin/health_reminder)"
'';
serviceConfig = {
Type = "oneshot";
User = "nx2";
timerConfig = {
OnBootSec = "5m";
OnUnitActiveSec = "5m";
Unit = "health_reminder.service";
};
};
}
systemd.services."health_reminder" =
let
hm = pkgs.writeScriptBin "health_reminder" ''
#!${pkgs.python3}/bin/python3
import random
class Action:
def __init__(self, actionA: str, actionB: str, likelihood: int, options: str):
self.actionA = actionA
self.actionB = actionB
self.likelihood = likelihood
self.options = options
def __str__(self):
if self.options:
return f"{self.actionA}{random.choice(self.options)}{self.actionB}"
else:
return self.actionA
actions = [
Action("look away for 20 Seconds!", "", 300, ""),
Action("Shrimp 3000!", "", 90, ""),
Action("Do ", " Biceps curls with each Arm! ", 5, ["50", "10", "20"]),
Action("Do ", " Shourlder thingees", 5, ["30", "50", "20"]),
Action("Plank for ", " senonds!", 5, ["60", "60", "70"]),
Action("Strech your upper body!", "", 10, ""),
Action("Strech your core!", "", 5, ""),
Action("Strech your legs!", "", 5, ""),
Action("Make Tea!", "", 5, ""),
]
total_likelihood = sum(a.likelihood for a in actions)
random_action = random.choices(actions, [a.likelihood for a in actions], k=1)[0]
print(random_action)
'';
in
{
script = ''
set -eu
export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$UID/bus"
${pkgs.libnotify}/bin/notify-send "$(${hm}/bin/health_reminder)"
'';
serviceConfig = {
Type = "oneshot";
User = "nx2";
};
};
}

View File

@@ -1,5 +1,5 @@
{ config, pkgs, lib, system, user, allowed, secrets, ... }:
{ config, pkgs, lib, system, host, user, allowed, secrets, ... }:
lib.mkIf (host != "NxACE")
{
environment.systemPackages = [
pkgs.strongswanNM

View File

@@ -1,14 +1,21 @@
{ config, pkgs, lib, system, user, allowed, secrets, ... }:
{ config, pkgs, lib, system, host, user, allowed, secrets, ... }:
{
users.defaultUserShell = pkgs.bash; # if interactive, itll switch to fish
users.users.nx2 = {
users.users."${user}" = {
isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" "audio" "video" "docker" "libvirtd" "uinput" ];
useDefaultShell = true;
packages = with pkgs; []; # all in home.nix
};
users.users.tv = lib.mkIf (host == "NxACE") {
isNormalUser = true;
extraGroups = [ "networkmanager" "audio" "video" "uinput" ];
useDefaultShell = true;
packages = with pkgs; []; # all in home.nix
};
programs = {
bash = {
@@ -21,4 +28,4 @@
'';
};
};
}
}