chore: add a new host and make a few adjustments

This commit is contained in:
TheGeneralist 2025-06-23 09:09:26 +02:00
parent d084d841ce
commit 688acfe889
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4
16 changed files with 195 additions and 65 deletions

View file

@ -38,7 +38,7 @@
|> mapAttrs (name: const <| import ./hosts/${name} lib inputs self) |> mapAttrs (name: const <| import ./hosts/${name} lib inputs self)
|> attrsToList |> attrsToList
|> groupBy (host: |> groupBy (host:
if host.name == "thegeneralist" then if host.name == "thegeneralist" || host.name == "thegeneralist-central" then
"nixosConfigurations" "nixosConfigurations"
else else
"darwinConfigurations") "darwinConfigurations")

View file

@ -0,0 +1,33 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ self, config, pkgs, lib, inputs, ... }:
{
imports = [ ./hardware-configuration.nix ./jellyfin.nix ];
users.knownUsers = [
"central"
];
users.users.central = {
name = "central";
home = "/Users/central";
shell = pkgs.zsh;
uid = 502;
openssh.authorizedKeys.keys = let
inherit (import ../../keys.nix) thegeneralist;
in [ thegeneralist ];
};
home-manager = {
backupFileExtension = "home.bak";
users.central.home = {
stateVersion = "25.11";
homeDirectory = "/Users/central";
};
};
system.stateVersion = 6;
}

View file

@ -0,0 +1,30 @@
lib: inputs: self: lib.darwinSystem {
specialArgs = inputs // { inherit inputs; inherit self; };
modules = [
# Extensions: nixosModules, darwinModules, overlays
({ pkgs, lib, inputs, ... }: let
inherit (lib) attrValues hasAttrByPath getAttrFromPath filter;
collect = packagePath: (attrValues inputs)
|> filter (hasAttrByPath packagePath)
|> map (getAttrFromPath packagePath);
modules = collect [ "darwinModules" "default" ];
extensions = {
nixpkgs.overlays = collect [ "overlays" "default" ];
imports = modules;
};
in extensions)
./configuration.nix
# Modules
({ pkgs, ... }: let
inherit (lib) filter hasSuffix;
commonModules = lib.filesystem.listFilesRecursive ../../modules/common |> filter (hasSuffix ".nix");
darwinModules = lib.filesystem.listFilesRecursive ../../modules/darwin |> filter (hasSuffix ".nix");
in {
imports = commonModules ++ darwinModules;
})
];
}

View file

@ -0,0 +1,11 @@
{ lib, ... }:
{
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
# networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-darwin";
}

View file

@ -5,17 +5,14 @@
{ self, config, pkgs, lib, inputs, ... }: { self, config, pkgs, lib, inputs, ... }:
{ {
imports = [ ./hardware-configuration.nix ./jellyfin.nix ]; imports = [ ./hardware-configuration.nix ];
users.knownUsers = [ users.users.thegeneralist = {
"central" isNormalUser = true;
]; description = "thegeneralist";
extraGroups = [ "wheel" "audio" "video" "input" "scanner" ];
users.users.central = {
name = "central";
home = "/Users/central";
shell = pkgs.zsh; shell = pkgs.zsh;
uid = 502; home = "/home/thegeneralist";
openssh.authorizedKeys.keys = let openssh.authorizedKeys.keys = let
inherit (import ../../keys.nix) thegeneralist; inherit (import ../../keys.nix) thegeneralist;
in [ thegeneralist ]; in [ thegeneralist ];
@ -23,11 +20,34 @@
home-manager = { home-manager = {
backupFileExtension = "home.bak"; backupFileExtension = "home.bak";
users.central.home = { extraSpecialArgs = { inherit inputs; };
stateVersion = "25.11"; users = {
homeDirectory = "/Users/central"; thegeneralist = import (self + /modules/home);
}; };
}; };
system.stateVersion = 6; age.secrets.hostkey.file = ./hostkey.age;
services.openssh.hostKeys = [{
type = "ed25519";
path = config.age.secrets.hostkey.path;
}];
# Some programs
services.libinput.enable = true;
programs.firefox.enable = true;
programs.zsh.enable = true;
# Set your time zone.
time.timeZone = "Europe/Berlin";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
# console = {
# font = "Lat2-Terminus16";
# keyMap = "us";
# useXkbConfig = true; # use xkb.options in tty.
# };
system.stateVersion = "24.11";
} }

View file

@ -1,4 +1,4 @@
lib: inputs: self: lib.darwinSystem { lib: inputs: self: lib.nixosSystem {
specialArgs = inputs // { inherit inputs; inherit self; }; specialArgs = inputs // { inherit inputs; inherit self; };
modules = [ modules = [
# Extensions: nixosModules, darwinModules, overlays # Extensions: nixosModules, darwinModules, overlays
@ -9,7 +9,7 @@ lib: inputs: self: lib.darwinSystem {
|> filter (hasAttrByPath packagePath) |> filter (hasAttrByPath packagePath)
|> map (getAttrFromPath packagePath); |> map (getAttrFromPath packagePath);
modules = collect [ "darwinModules" "default" ]; modules = collect [ "nixosModules" "default" ];
extensions = { extensions = {
nixpkgs.overlays = collect [ "overlays" "default" ]; nixpkgs.overlays = collect [ "overlays" "default" ];
imports = modules; imports = modules;
@ -22,9 +22,9 @@ lib: inputs: self: lib.darwinSystem {
({ pkgs, ... }: let ({ pkgs, ... }: let
inherit (lib) filter hasSuffix; inherit (lib) filter hasSuffix;
commonModules = lib.filesystem.listFilesRecursive ../../modules/common |> filter (hasSuffix ".nix"); commonModules = lib.filesystem.listFilesRecursive ../../modules/common |> filter (hasSuffix ".nix");
darwinModules = lib.filesystem.listFilesRecursive ../../modules/darwin |> filter (hasSuffix ".nix"); linuxModules = lib.filesystem.listFilesRecursive ../../modules/linux |> filter (hasSuffix ".nix");
in { in {
imports = commonModules ++ darwinModules; imports = commonModules ++ linuxModules;
}) })
]; ];
} }

View file

@ -1,11 +1,37 @@
{ lib, ... }: { config, lib, pkgs, modulesPath, ... }:
{ {
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
# Wi-Fi stuff
nixpkgs.config.allowUnfree = true;
hardware.enableAllFirmware = true;
fileSystems."/" =
{
device = "/dev/disk/by-label/NIXROOT";
fsType = "ext4";
};
fileSystems."/boot" =
{
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [{
device = "/dev/disk/by-label/swap";
}];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction # still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
# networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f0u5.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "aarch64-darwin"; nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
} }

Binary file not shown.

View file

@ -1,11 +1,17 @@
{ lib, pkgs, ... }: { config, lib, pkgs, ... }: let
inherit (lib) mkOption types;
{ in {
options = { options = {
onLinux = lib.mkOption { onLinux = mkOption {
type = lib.types.bool; type = types.bool;
default = pkgs.stdenv.isLinux; default = pkgs.stdenv.isLinux;
description = "Whether the system is running on Linux"; description = "Whether the system is running on Linux";
}; };
isServer = mkOption {
type = types.bool;
default = config.nixpkgs.hostPlatform.isAarch64;
description = "Whether the system is a server. Determined by the processor architecture.";
};
}; };
} }

View file

@ -1,30 +1,29 @@
{ pkgs, ... }: { { pkgs, ... }: {
# TODO: this environment.variables = {
# environment.variables = { TERMINAL = "ghostty";
# TERMINAL = "ghostty"; };
# };
# home-manager.sharedModules = [{
# home-manager.sharedModules = [{ programs.ghostty = {
# programs.ghostty = { enable = true;
# enable = true; package = pkgs.ghostty;
# package = pkgs.ghostty;
# clearDefaultKeybinds = false;
# clearDefaultKeybinds = false; settings = {
# settings = { theme = "tokyonight";
# theme = "tokyonight"; font-family = "JetBrainsMono NL NFM Medium";
# font-family = "JetBrainsMono NL NFM Medium"; font-size = 16;
# font-size = 16;
# shell-integration-features = "no-cursor";
# shell-integration-features = "no-cursor";
# cursor-style = "block";
# cursor-style = "block"; background-opacity = 1;
# background-opacity = 1;
# background-blur-radius = 0;
# background-blur-radius = 0;
# gtk-titlebar = false;
# gtk-titlebar = false; mouse-hide-while-typing = true;
# mouse-hide-while-typing = true; };
# }; };
# }; }];
# }];
} }

View file

@ -8,6 +8,10 @@ in {
neovim neovim
vim vim
home-manager home-manager
gcc
gnumake
automake
; ;
}; };
} }

View file

@ -1,5 +1,5 @@
{ { config, ... }: {
networking.hostName = "thegeneralist"; networking.hostName = if config.isServer then "thegeneralist-central" else "thegeneralist";
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
networking.networkmanager.wifi.powersave = false; networking.networkmanager.wifi.powersave = false;
} }

View file

@ -1,4 +1,4 @@
{ { lib, config, ... }: lib.mkIf (!config.isServer) {
hardware.nvidia = { hardware.nvidia = {
open = true; open = true;
modesetting.enable = true; modesetting.enable = true;

View file

@ -1,16 +1,15 @@
{ pkgs, lib, ...}: let { pkgs, lib, config, ...}: let
inherit (lib) attrValues; inherit (lib) attrValues;
in { in {
environment.systemPackages = attrValues { environment.systemPackages = attrValues {
inherit (pkgs) inherit (pkgs)
protonup-qt
pipewire pipewire
pwvucontrol pwvucontrol
wireplumber wireplumber
playerctl playerctl;
} ++ (if (!config.isServer) then (attrValues {
inherit (pkgs) protonup-qt
xsane xsane
simple-scan simple-scan;
; }) else []);
};
} }

View file

@ -1,4 +1,4 @@
{ lib, ... }: { { lib, config, ... }: lib.mkIf (!config.isServer) {
programs.steam = { programs.steam = {
enable = true; enable = true;
remotePlay.openFirewall = true; remotePlay.openFirewall = true;

View file

@ -2,5 +2,7 @@ let
inherit (import ./keys.nix) thegeneralist; inherit (import ./keys.nix) thegeneralist;
in { in {
"hosts/thegeneralist/hostkey.age".publicKeys = [ thegeneralist ]; "hosts/thegeneralist/hostkey.age".publicKeys = [ thegeneralist ];
"hosts/thegeneralist-central/hostkey.age".publicKeys = [ thegeneralist ];
"modules/linux/tailscale-marshall.age".publicKeys = [ thegeneralist ]; "modules/linux/tailscale-marshall.age".publicKeys = [ thegeneralist ];
} }