{ config, lib, pkgs, inputs, ... }: { imports = [ ./services ./packages ./programs ]; options.sysconfig = with lib; { host = mkOption { type = with types; nullOr str; default = null; }; graphical = mkOption { type = with types; bool; default = config.hardware.graphics.enable; }; remoteBuildHost = mkOption { type = with types; bool; default = false; }; remoteBuildClient = mkOption { type = with types; bool; default = false; }; }; config = { sops.secrets."remoteBuildSSHKey" = lib.mkIf config.sysconfig.remoteBuildClient {}; networking.hostName = lib.mkDefault config.sysconfig.host; programs.bash.completion.enable = true; nix = { nixPath = [ "nixpkgs=${inputs.nixpkgs}" ]; channel.enable = false; settings = { experimental-features = [ "nix-command" "flakes" ]; }; distributedBuilds = config.sysconfig.remoteBuildClient; buildMachines = lib.mkIf config.sysconfig.remoteBuildClient [ { hostName = "blunkall.us"; sshUser = "remote-builder"; sshKey = config.sops.secrets."remoteBuildSSHKey".path; supportedFeatures = [ "nixos-test" "benchmark" "big-parallel" "kvm" ]; systems = [ "x86_64-linux" "aarch64-linux" ]; } ]; trusted-users = lib.mkIf config.sysconfig.remoteBuildHost [ "remote-builder" ]; }; boot.binfmt.emulatedSystems = lib.mkIf config.sysconfig.remoteBuildHost [ "aarch64-linux" ]; users.users."remote-builder" = lib.mkIf config.sysconfig.remoteBuildHost { isNormalUser = true; createHome = false; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN7wpZD7mpHHpfHBSBV28x3ify+dtoLRDXO91mJ/WhUj root@laptop" ]; }; time.timeZone = lib.mkDefault "America/Chicago"; i18n = lib.mkDefault { defaultLocale = "en_US.UTF-8"; extraLocaleSettings = { LC_ADDRESS = "en_US.UTF-8"; LC_IDENTIFICATION = "en_US.UTF-8"; LC_MEASUREMENT = "en_US.UTF-8"; LC_MONETARY = "en_US.UTF-8"; LC_NAME = "en_US.UTF-8"; LC_NUMERIC = "en_US.UTF-8"; LC_PAPER = "en_US.UTF-8"; LC_TELEPHONE = "en_US.UTF-8"; LC_TIME = "en_US.UTF-8"; }; }; }; }