infra/nix/os/devices/steveej-x13s/configuration.nix

201 lines
4.6 KiB
Nix
Raw Normal View History

{
2024-02-08 20:53:22 +01:00
repoFlake,
nodeFlake,
pkgs,
lib,
config,
nodeName,
localDomainName,
system,
...
}: {
nixos-x13s = {
enable = true;
# TODO: use hardware address
bluetoothMac = "65:9e:7a:8b:86:28";
kernel = "jhovold";
};
services.illum.enable = true;
systemd.services.bluetooth-mac = {
enable = true;
path = [
pkgs.systemd
pkgs.util-linux
pkgs.bluez5-experimental
pkgs.expect
];
script = ''
# TODO: this may not be required
while ! (journalctl -b0 | grep 'Bluetooth: hci0: QCA setup on UART is completed'); do
echo Waiting for bluetooth firmware to complete
echo sleep 1
done
(
# best effort
set +e
rfkill block bluetooth
echo $?
btmgmt public-addr ${config.nixos-x13s.bluetoothMac}
echo $?
rfkill unblock bluetooth
echo $?
)
'';
2024-02-08 20:53:22 +01:00
requiredBy = ["bluetooth.service"];
before = ["bluetooth.service"];
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
# we need a tty, otherwise btmgmt will hang
StandardInput = "tty";
TTYPath = "/dev/tty2";
TTYReset = "yes";
TTYVHangup = "yes";
};
};
imports = [
nodeFlake.inputs.nixos-x13s.nixosModules.default
repoFlake.inputs.sops-nix.nixosModules.sops
nodeFlake.inputs.disko.nixosModules.disko
./disko.nix
../../snippets/nix-settings.nix
../../snippets/nix-settings-holo-chain.nix
../../profiles/common/user.nix
{
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
services.openssh.openFirewall = true;
sops.defaultSopsFile = ../../../../secrets/${nodeName}/secrets.yaml;
sops.defaultSopsFormat = "yaml";
users.commonUsers = {
enable = true;
enableNonRoot = true;
};
}
# TODO: create syncthing os snippet
(let
tcp = [22000];
udp = [
22000
21027
];
in {
# TODO: upstream feature for inverse rule to work: `! --in-interface zt+`
networking.firewall.interfaces."en+".allowedTCPPorts = tcp;
networking.firewall.interfaces."en+".allowedUDPPorts = udp;
networking.firewall.interfaces."wl+".allowedTCPPorts = tcp;
networking.firewall.interfaces."wl+".allowedUDPPorts = udp;
})
../../snippets/home-manager-with-zsh.nix
../../snippets/sway-desktop.nix
../../snippets/bluetooth.nix
2024-01-22 23:47:48 +00:00
../../snippets/timezone.nix
../../snippets/radicale.nix
../../snippets/holo-zerotier.nix
];
networking.hostName = nodeName;
networking.firewall.enable = true;
networking.networkmanager.enable = true;
nixpkgs.config.allowUnfree = true;
environment.systemPackages = [
pkgs.sshfs
pkgs.util-linux
pkgs.coreutils
pkgs.vim
pkgs.git
pkgs.git-crypt
];
system.stateVersion = "23.11";
2024-01-22 23:47:48 +00:00
home-manager.users.root = _: {
home.stateVersion = "23.11";
};
home-manager.users.steveej = _: {
home.stateVersion = "23.11";
imports = [
../../../home-manager/configuration/graphical-fullblown.nix
];
2024-02-08 20:53:22 +01:00
home.sessionVariables = {};
home.packages = with pkgs; [
];
# TODO: currently unsupported
services.gammastep.enable = lib.mkForce false;
# programs.chromium.enable = lib.mkForce false;
};
boot = {
loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = lib.mkForce false;
loader.efi.efiSysMountPoint = "/boot";
2024-02-08 20:53:22 +01:00
blacklistedKernelModules = ["wwan"];
# kernelParams = let
# dtbName = "sc8280xp-lenovo-thinkpad-x13s.dtb";
# in lib.mkForce [
# # needed to boot
# "dtb=${dtbName}"
# # jhovold recommended
# "efi=noruntime"
# "clk_ignore_unused"
# "pd_ignore_unused"
# # "regulator_ignore_unused"
# "arm64.nopauth"
# # blacklist graphics in initrd so the firmware can load from disk
# "rd.driver.blacklist=msm"
# ];
};
# see https://linrunner.de/tlp/
# TODO: find an equivalent to tlp that supports this machine
services.tlp = {
enable = false;
settings = {
START_CHARGE_THRESH_BAT0 = "80";
STOP_CHARGE_THRESH_BAT0 = "85";
};
};
# android on linux
virtualisation.waydroid.enable = false;
virtualisation.podman.enable = true;
virtualisation.podman.dockerCompat = true;
2024-02-07 11:08:46 +01:00
hardware.ledger.enable = true;
nix.settings.substituters = [
"https://nixos-x13s.cachix.org"
];
nix.settings.trusted-public-keys = [
"nixos-x13s.cachix.org-1:SzroHbidolBD3Sf6UusXp12YZ+a5ynWv0RtYF0btFos="
];
steveej.holo-zerotier = {
enable = true;
autostart = false;
};
}