again
This commit is contained in:
27
modules/nixos/hardware/asahi/default.nix
Normal file
27
modules/nixos/hardware/asahi/default.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ config, lib, inputs, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf types;
|
||||
inherit (lib.${namespace}) mkOpt mkBoolOpt;
|
||||
|
||||
cfg = config.${namespace}.hardware.asahi;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
inputs.apple-silicon.nixosModules.default
|
||||
];
|
||||
|
||||
options.${namespace}.hardware.asahi = {
|
||||
enable = lib.mkEnableOption "support for asahi linux";
|
||||
enableGPU = mkBoolOpt false "enable gpu driver";
|
||||
firmwareDirectory = mkOpt types.path null "firmware directory";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
hardware = {
|
||||
asahi = {
|
||||
peripheralFirmwareDirectory = cfg.firmwareDirectory;
|
||||
useExperimentalGPUDriver = cfg.enableGPU;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
40
modules/nixos/hardware/opengl/default.nix
Normal file
40
modules/nixos/hardware/opengl/default.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{ config, lib, pkgs, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
inherit (lib.${namespace}) mkBoolOpt;
|
||||
|
||||
cfg = config.${namespace}.hardware.opengl;
|
||||
in
|
||||
{
|
||||
options.${namespace}.hardware.opengl = {
|
||||
enable = lib.mkEnableOption "support for opengl";
|
||||
enable32Bit = mkBoolOpt false "enabel 32-bit";
|
||||
enableIntel = mkBoolOpt false "support for intel";
|
||||
enableNvidia = mkBoolOpt false "support for nvidia";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
libva-utils
|
||||
vdpauinfo
|
||||
] ++ lib.optionals cfg.enableNvidia [
|
||||
nvtopPackages.full
|
||||
];
|
||||
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = cfg.enable32Bit;
|
||||
|
||||
extraPackages = with pkgs;
|
||||
lib.optionals cfg.enableIntel [
|
||||
libvdpau-va-gl
|
||||
intel-vaapi-driver
|
||||
intel-media-driver
|
||||
intel-compute-runtime
|
||||
intel-ocl
|
||||
] ++ lib.optionals cfg.enableNvidia [
|
||||
cudatoolkit
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
76
modules/nixos/nix/default.nix
Normal file
76
modules/nixos/nix/default.nix
Normal file
@@ -0,0 +1,76 @@
|
||||
{ config, lib, pkgs, namespace, host, ... }:
|
||||
let
|
||||
inherit (lib.${namespace}) mkBoolOpt mkOpt;
|
||||
|
||||
cfg = config.${namespace}.nix;
|
||||
in
|
||||
{
|
||||
options.${namespace}.nix = {
|
||||
enable = mkBoolOpt true "Whether or not to manage nix configuration.";
|
||||
package = mkOpt lib.types.package pkgs.nixVersions.latest "Which nix package to use.";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
nix =
|
||||
let
|
||||
users = [
|
||||
"root"
|
||||
"@wheel"
|
||||
"nix-builder"
|
||||
"evanreichard"
|
||||
];
|
||||
in
|
||||
{
|
||||
inherit (cfg) package;
|
||||
|
||||
buildMachines = lib.optional (host != "nixos-builder") {
|
||||
hostName = "10.0.50.130";
|
||||
systems = [ "x86_64-linux" ];
|
||||
sshUser = "root";
|
||||
speedFactor = 1;
|
||||
protocol = "ssh";
|
||||
sshKey = config.sops.secrets.reichard_ssh_key.path;
|
||||
supportedFeatures = [
|
||||
"benchmark"
|
||||
"big-parallel"
|
||||
"nixos-test"
|
||||
"kvm"
|
||||
];
|
||||
};
|
||||
|
||||
checkConfig = true;
|
||||
distributedBuilds = true;
|
||||
|
||||
gc = {
|
||||
automatic = true;
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
|
||||
# This will additionally add your inputs to the system's legacy channels
|
||||
# # Making legacy nix commands consistent as well
|
||||
nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry;
|
||||
|
||||
optimise.automatic = true;
|
||||
|
||||
settings = {
|
||||
allowed-users = users;
|
||||
auto-optimise-store = pkgs.stdenv.hostPlatform.isLinux;
|
||||
builders-use-substitutes = true;
|
||||
experimental-features = [
|
||||
"nix-command"
|
||||
"flakes "
|
||||
];
|
||||
flake-registry = "/etc/nix/registry.json";
|
||||
http-connections = 50;
|
||||
keep-derivations = true;
|
||||
keep-going = true;
|
||||
keep-outputs = true;
|
||||
log-lines = 50;
|
||||
sandbox = true;
|
||||
trusted-users = users;
|
||||
warn-dirty = false;
|
||||
use-xdg-base-directories = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
28
modules/nixos/programs/graphical/wms/hyprland/default.nix
Normal file
28
modules/nixos/programs/graphical/wms/hyprland/default.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{ config, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.${namespace}.programs.graphical.wms.hyprland;
|
||||
in
|
||||
{
|
||||
options.${namespace}.programs.graphical.wms.hyprland = {
|
||||
enable = lib.mkEnableOption "Hyprland";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
programs = {
|
||||
hyprland = {
|
||||
enable = true;
|
||||
withUWSM = true;
|
||||
};
|
||||
};
|
||||
|
||||
reichard = {
|
||||
display-managers = {
|
||||
sddm = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
33
modules/nixos/security/sops/default.nix
Normal file
33
modules/nixos/security/sops/default.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{ config, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
|
||||
cfg = config.${namespace}.security.sops;
|
||||
in
|
||||
{
|
||||
options.${namespace}.security.sops = {
|
||||
enable = lib.mkEnableOption "sops";
|
||||
defaultSopsFile = mkOpt lib.types.path null "Default sops file.";
|
||||
sshKeyPaths = mkOpt (with lib.types; listOf path) [
|
||||
"/etc/ssh/ssh_host_ed25519_key"
|
||||
] "SSH Key paths to use.";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops = {
|
||||
inherit (cfg) defaultSopsFile;
|
||||
|
||||
age = {
|
||||
inherit (cfg) sshKeyPaths;
|
||||
|
||||
keyFile = "${config.users.users.${config.${namespace}.user.name}.home}/.config/sops/age/keys.txt";
|
||||
};
|
||||
};
|
||||
|
||||
sops.secrets = {
|
||||
"reichard_ssh_key" = {
|
||||
sopsFile = lib.snowfall.fs.get-file "secrets/default.yaml";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
78
modules/nixos/services/openssh/default.nix
Normal file
78
modules/nixos/services/openssh/default.nix
Normal file
@@ -0,0 +1,78 @@
|
||||
{ config, format, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
types
|
||||
mkDefault
|
||||
mkIf
|
||||
;
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
|
||||
cfg = config.${namespace}.services.openssh;
|
||||
|
||||
authorizedKeys = [
|
||||
# MBP-Personal NixOS
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIe1n9l9pVF5+kjWJCOt3AvBVf1HOSZkEDZxCWVPSIkr"
|
||||
];
|
||||
in
|
||||
{
|
||||
options.${namespace}.services.openssh = with types; {
|
||||
enable = lib.mkEnableOption "OpenSSH support";
|
||||
authorizedKeys = mkOpt (listOf str) authorizedKeys "The public keys to apply.";
|
||||
extraConfig = mkOpt str "" "Extra configuration to apply.";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
|
||||
hostKeys = mkDefault [
|
||||
{
|
||||
bits = 4096;
|
||||
path = "/etc/ssh/ssh_host_ed25519_key";
|
||||
type = "ed25519";
|
||||
}
|
||||
];
|
||||
|
||||
openFirewall = true;
|
||||
ports = [ 22 ];
|
||||
|
||||
settings = {
|
||||
AuthenticationMethods = "publickey";
|
||||
ChallengeResponseAuthentication = "no";
|
||||
PasswordAuthentication = false;
|
||||
PermitRootLogin = if format == "install-iso" then "yes" else "no";
|
||||
PubkeyAuthentication = "yes";
|
||||
StreamLocalBindUnlink = "yes";
|
||||
UseDns = false;
|
||||
UsePAM = true;
|
||||
X11Forwarding = false;
|
||||
|
||||
KexAlgorithms = [
|
||||
"curve25519-sha256"
|
||||
"curve25519-sha256@libssh.org"
|
||||
"diffie-hellman-group16-sha512"
|
||||
"diffie-hellman-group18-sha512"
|
||||
"diffie-hellman-group-exchange-sha256"
|
||||
"sntrup761x25519-sha512@openssh.com"
|
||||
];
|
||||
|
||||
Macs = [
|
||||
"hmac-sha2-512-etm@openssh.com"
|
||||
"hmac-sha2-256-etm@openssh.com"
|
||||
"umac-128-etm@openssh.com"
|
||||
];
|
||||
};
|
||||
|
||||
startWhenNeeded = true;
|
||||
};
|
||||
|
||||
programs.ssh = {
|
||||
startAgent = lib.mkDefault true;
|
||||
inherit (cfg) extraConfig;
|
||||
};
|
||||
|
||||
reichard = {
|
||||
user.extraOptions.openssh.authorizedKeys.keys = cfg.authorizedKeys;
|
||||
};
|
||||
};
|
||||
}
|
||||
43
modules/nixos/system/boot/default.nix
Normal file
43
modules/nixos/system/boot/default.nix
Normal file
@@ -0,0 +1,43 @@
|
||||
{ config, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.${namespace}.system.boot;
|
||||
in
|
||||
{
|
||||
options.${namespace}.system.boot = {
|
||||
enable = lib.mkEnableOption "booting";
|
||||
silentBoot = lib.mkEnableOption "silent boot";
|
||||
showNotch = lib.mkEnableOption "show macOS notch";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
boot = {
|
||||
kernelParams = lib.optionals cfg.silentBoot [
|
||||
"quiet"
|
||||
"loglevel=3"
|
||||
"udev.log_level=3"
|
||||
"rd.udev.log_level=3"
|
||||
"systemd.show_status=auto"
|
||||
"rd.systemd.show_status=auto"
|
||||
"vt.global_cursor_default=0"
|
||||
] ++ lib.optionals cfg.showNotch [
|
||||
"apple_dcp.show_notch=1"
|
||||
];
|
||||
|
||||
loader = {
|
||||
efi = {
|
||||
canTouchEfiVariables = false;
|
||||
};
|
||||
|
||||
systemd-boot = {
|
||||
enable = true;
|
||||
configurationLimit = 20;
|
||||
editor = false;
|
||||
};
|
||||
|
||||
timeout = 1;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
33
modules/nixos/system/networking/default.nix
Normal file
33
modules/nixos/system/networking/default.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{ config, lib, pkgs, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf mkForce;
|
||||
inherit (lib.${namespace}) mkBoolOpt;
|
||||
|
||||
cfg = config.${namespace}.system.networking;
|
||||
in
|
||||
{
|
||||
options.${namespace}.system.networking = {
|
||||
enable = lib.mkEnableOption "networking support";
|
||||
enableIWD = mkBoolOpt false "enable iwd";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
mtr
|
||||
tcpdump
|
||||
traceroute
|
||||
];
|
||||
|
||||
reichard.user.extraGroups = [ "network" ];
|
||||
|
||||
networking = {
|
||||
firewall.enable = true;
|
||||
usePredictableInterfaceNames = mkForce true;
|
||||
} // (lib.optionalAttrs cfg.enableIWD) {
|
||||
wireless.iwd = {
|
||||
enable = true;
|
||||
settings.General.EnableNetworkConfiguration = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
26
modules/nixos/system/networking/networkmanager/default.nix
Normal file
26
modules/nixos/system/networking/networkmanager/default.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{ config, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.${namespace}.system.networking;
|
||||
in
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
reichard.user.extraGroups = [ "networkmanager" ];
|
||||
|
||||
networking.networkmanager = {
|
||||
enable = true;
|
||||
|
||||
connectionConfig = {
|
||||
"connection.mdns" = "2";
|
||||
};
|
||||
|
||||
# unmanaged = [
|
||||
# "interface-name:br-*"
|
||||
# "interface-name:rndis*"
|
||||
# ]
|
||||
# ++ lib.optionals config.${namespace}.virtualisation.podman.enable [ "interface-name:docker*" ]
|
||||
# ++ lib.optionals config.${namespace}.virtualisation.kvm.enable [ "interface-name:virbr*" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
32
modules/nixos/system/time/default.nix
Normal file
32
modules/nixos/system/time/default.nix
Normal file
@@ -0,0 +1,32 @@
|
||||
{ config, lib, pkgs, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.${namespace}.system.time;
|
||||
in
|
||||
{
|
||||
options.${namespace}.system.time = {
|
||||
enable = lib.mkEnableOption "time related settings";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.openntpd ];
|
||||
|
||||
networking.timeServers = [
|
||||
"0.nixos.pool.ntp.org"
|
||||
"1.nixos.pool.ntp.org"
|
||||
"2.nixos.pool.ntp.org"
|
||||
"3.nixos.pool.ntp.org"
|
||||
];
|
||||
|
||||
services.openntpd = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
listen on 127.0.0.1
|
||||
listen on ::1
|
||||
'';
|
||||
};
|
||||
|
||||
time.timeZone = "America/New_York";
|
||||
};
|
||||
}
|
||||
35
modules/nixos/user/default.nix
Normal file
35
modules/nixos/user/default.nix
Normal file
@@ -0,0 +1,35 @@
|
||||
{ config, lib, pkgs, namespace, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
inherit (lib.${namespace}) mkOpt;
|
||||
|
||||
cfg = config.${namespace}.user;
|
||||
in
|
||||
{
|
||||
options.${namespace}.user = with types; {
|
||||
email = mkOpt str "evan@reichard.io" "The email of the user.";
|
||||
extraGroups = mkOpt (listOf str) [ ] "Groups for the user to be assigned.";
|
||||
extraOptions = mkOpt attrs { } "Extra options passed to <option>users.users.<name></option>.";
|
||||
fullName = mkOpt str "Evan Reichard" "The full name of the user.";
|
||||
initialPassword =
|
||||
mkOpt str "password"
|
||||
"The initial password to use when the user is first created.";
|
||||
name = mkOpt str "evanreichard" "The name to use for the user account.";
|
||||
};
|
||||
|
||||
config = {
|
||||
users.users.${cfg.name} = {
|
||||
inherit (cfg) name initialPassword;
|
||||
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
] ++ cfg.extraGroups;
|
||||
|
||||
group = "users";
|
||||
home = "/home/${cfg.name}";
|
||||
isNormalUser = true;
|
||||
shell = pkgs.bashInteractive;
|
||||
uid = 1000;
|
||||
} // cfg.extraOptions;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user