infra/nix/os/devices/sj-bm-hostkey0/configuration.nix

224 lines
5.4 KiB
Nix
Raw Normal View History

2024-02-08 20:53:22 +01:00
{
modulesPath,
repoFlake,
packages',
pkgs,
lib,
config,
nodeFlake,
nodeName,
system,
...
}: let
pkgsUnstable = import nodeFlake.inputs.nixpkgs-unstable {inherit (pkgs) system config;};
pkgsVscodium = import repoFlake.inputs.nixpkgs-vscodium {inherit (pkgs) system config;};
in {
2023-11-23 16:03:07 +01:00
disabledModules = [
];
imports = [
nodeFlake.inputs.disko.nixosModules.disko
repoFlake.inputs.sops-nix.nixosModules.sops
nodeFlake.inputs.srvos.nixosModules.roles-nix-remote-builder
{
roles.nix-remote-builder.schedulerPublicKeys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINQ22z5rDdCLYH+MEoEt+tXJXTJqoeZNqvJl2n4aB+Kn steveej@steveej-x13s"
# TODO: make this a reference to the private key's secret
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC8FHuK0k86iBWq41+NAhVwJqH1ZpGJe+q01m7iLviz6 root@steveej-t14"
];
}
2023-11-23 16:03:07 +01:00
../../profiles/common/user.nix
../../snippets/nix-settings.nix
2023-12-01 21:00:17 +01:00
../../snippets/nix-settings-holo-chain.nix
2023-11-23 16:03:07 +01:00
2024-04-04 21:04:39 +02:00
../../snippets/holo-zerotier.nix
2023-11-23 16:03:07 +01:00
# TODO
# ./network.nix
# ./monitoring.nix
# user config
../../snippets/home-manager-with-zsh.nix
{
2023-11-23 16:03:07 +01:00
users.commonUsers = {
enable = true;
enableNonRoot = true;
};
2024-02-08 20:53:22 +01:00
home-manager.users.steveej = {pkgs, ...}: {
home.packages = [
pkgs.nil
pkgs.rnix-lsp
pkgs.nixd
pkgs.nixpkgs-fmt
pkgs.alejandra
pkgs.nixfmt
repoFlake.packages.${system}.rperf
# TODO: automate linking this
# 1. get the commit with: `codium --version`
# 2. create the binary directory: `mkdir -p /home/steveej/.vscodium-server/bin/c8ce3ba4bc6b30b3b10edc61481cb85b1d2396bc/bin/`
# 3. link the binary. this relies on the client-side setting `"remote.SSH.experimental.serverBinaryName": "openvscode-server"` : ln -s $(which openvscode-server) /home/steveej/.vscodium-server/bin/c8ce3ba4bc6b30b3b10edc61481cb85b1d2396bc/bin/
/*
e.g.:
```
(
set -e
export COMMIT=$(codium --version | rg '^[0-9a-f]{40}$')
ssh bm-hostkey0 "rm -rf /home/steveej/.vscodium-server/bin/$COMMIT; mkdir -p /home/steveej/.vscodium-server/bin/$COMMIT/bin/; ln -s \$(which openvscode-server) /home/steveej/.vscodium-server/bin/$COMMIT/bin/"
)
```
*/
(pkgsVscodium.openvscode-server.overrideAttrs (attrs: {
src = repoFlake.inputs.openvscode-server;
version = "1.87.1";
yarnCache = attrs.yarnCache.overrideAttrs (_: {outputHash = "sha256-oRuy7PjVv3Y24GQlvX4tPPndvKTgxbv7TR8ytTBY2DQ=";});
}))
];
};
programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh;
2024-02-08 20:53:22 +01:00
environment.pathsToLink = ["/share/zsh"];
2023-11-23 16:03:07 +01:00
}
];
2023-11-23 17:52:21 +01:00
services.openssh.enable = true;
services.openssh.settings.PermitRootLogin = "yes";
2023-11-23 16:03:07 +01:00
boot = {
kernel = {
sysctl = {
"net.ipv4.conf.all.forwarding" = true;
"net.ipv6.conf.all.forwarding" = true;
};
};
};
networking = {
hostName = nodeName;
useNetworkd = true;
useDHCP = true;
# No local firewall.
nat.enable = true;
firewall.enable = false;
};
2024-02-08 20:53:22 +01:00
disko.devices = let
disk = id: {
type = "disk";
device = "/dev/${id}";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02"; # for grub MBR
};
mdadm = {
size = "100%";
content = {
type = "mdraid";
name = "raid0";
};
};
};
};
};
in {
disk = {
sda = disk "sda";
sdb = disk "sdb";
};
mdadm = {
raid0 = {
type = "mdadm";
level = 0;
2023-11-23 16:03:07 +01:00
content = {
type = "gpt";
partitions = {
2024-02-08 20:53:22 +01:00
primary = {
2023-11-23 16:03:07 +01:00
size = "100%";
content = {
2024-02-08 20:53:22 +01:00
type = "filesystem";
format = "btrfs";
mountpoint = "/";
2023-11-23 16:03:07 +01:00
};
};
};
};
};
};
2024-02-08 20:53:22 +01:00
};
2023-11-23 16:03:07 +01:00
system.stateVersion = "23.11";
2023-11-23 16:03:07 +01:00
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.initrd.includeDefaultModules = true;
boot.initrd.kernelModules = [
"dm-raid"
"dm-integrity"
"xhci_pci_renesas"
];
hardware.enableRedistributableFirmware = true;
environment.systemPackages = [
pkgs.hdparm
pkgs.fuse
2023-11-23 16:03:07 +01:00
];
2023-11-23 17:52:21 +01:00
programs.fuse.userAllowOther = true;
services.caddy.enable = true;
services.caddy.email = "mail@stefanjunker.de";
services.caddy.globalConfig = ''
auto_https disable_redirects
'';
services.caddy.virtualHosts = let
holochainDomain = "dev.infra.holochain.org";
in {
"${nodeName}.${holochainDomain}" = {
extraConfig = ''
handle_path /s3/* {
reverse_proxy http://127.0.0.1:9000
}
'';
};
};
# home-manager.users.steveej = _: {
# imports = [
# ../../../home-manager/configuration/text-minimal.nix
# ];
# home.sessionVariables = {
# };
# home.packages = with pkgs; [
# ];
# };
virtualisation.libvirtd.enable = true;
virtualisation.docker.enable = true;
virtualisation.podman.enable = true;
virtualisation.podman.autoPrune.enable = true;
# virtualisation.podman.dockerSocket.enable = true;
boot.binfmt.emulatedSystems = [
"aarch64-linux"
];
2024-04-18 17:28:17 +02:00
steveej.holo-zerotier = {
enable = true;
autostart = false;
};
2023-11-23 16:03:07 +01:00
}