Compare commits

...

26 Commits

Author SHA1 Message Date
ef484c8ff0 fixed dns, modified config for valefor 2025-01-07 18:15:49 -05:00
ea2820a1bb Merge pull request 'Appliance server setup' (#4) from valefor-setup into master
Reviewed-on: #4
2025-01-05 20:36:45 -06:00
1c054207b2 refactored custom core networking 2025-01-04 19:27:42 -05:00
b5b66f1c1b redefining custom networking namespace 2025-01-04 19:07:36 -05:00
a1eb9b74c2 fixed networkmanager 2025-01-04 18:56:53 -05:00
f10c3e7a8c fixed bind interfaces 2025-01-04 18:51:51 -05:00
1f5eda31b2 removed throw, renamed services.named to services.bind 2025-01-04 18:46:37 -05:00
1484f3a04e be more explicit in defining dns 2025-01-04 18:23:17 -05:00
539f0db8d1 fixed valefor config again
very obv
2025-01-04 18:20:00 -05:00
65bf72cd5b fixed syntax errors 2025-01-04 18:17:24 -05:00
50d1e00a02 changed graphics config to amd - cloud
this to pull down any relevant amd packages from nixpkgs, not any nvidia
packages
2025-01-04 18:12:42 -05:00
30b7d23b3a added hardware config for valefor 2025-01-04 18:10:18 -05:00
c8990196b7 wip: added valefor machine config 2025-01-04 16:02:31 -05:00
0c8c5c5f2a added git aliases 2024-12-29 15:34:06 -05:00
93c8464641 fixed podman config for sephiroth, added ghostty as brew package
todo: fix ghostty when it gets added as a nix package for darwin
2024-12-28 17:11:52 -05:00
b9dd11dd7b Merge pull request 'Modularizing system configuration' (#3) from modular into master
Reviewed-on: #3
2024-12-27 00:27:24 -06:00
51d8ee2887 added latest linux kernel, added comments 2024-12-27 01:35:22 -05:00
86970a7f6c updated modules to work for cloud 2024-12-23 15:35:36 -05:00
972cd76421 fix flatpak module 2024-12-20 08:25:18 -06:00
fe049f0594 change unstable nixpkgs to 24.11 nixpkgs 2024-12-18 20:10:01 -05:00
39afe2d114 wip: home stuff 2024-12-18 20:09:28 -05:00
b6653cee0b darwin compatible commit, touching up on modules, common system ietms 2024-12-18 20:09:08 -05:00
1e3ffdf0a3 created defaults, created common fonts, modified root flake nix 2024-12-18 13:07:02 -05:00
ea8607eb41 small changes 2024-12-15 22:37:43 -05:00
adabefd821 modularized all the things
part one (?)
2024-12-15 18:22:36 -05:00
d8a9e92dff code dump v1 2024-12-12 20:41:58 -05:00
36 changed files with 1143 additions and 199 deletions

33
flake.lock generated
View File

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1730448474,
"narHash": "sha256-qE/cYKBhzxHMtKtLK3hlSR3uzO1pWPGLrBuQK7r0CHc=",
"lastModified": 1733570843,
"narHash": "sha256-sQJAxY1TYWD1UyibN/FnN97paTFuwBw3Vp3DNCyKsMk=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "683d0c4cd1102dcccfa3f835565378c7f3cbe05e",
"rev": "a35b08d09efda83625bef267eb24347b446c80b8",
"type": "github"
},
"original": {
@ -28,15 +28,16 @@
]
},
"locked": {
"lastModified": 1730490306,
"narHash": "sha256-AvCVDswOUM9D368HxYD25RsSKp+5o0L0/JHADjLoD38=",
"lastModified": 1734366194,
"narHash": "sha256-vykpJ1xsdkv0j8WOVXrRFHUAdp9NXHpxdnn1F4pYgSw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1743615b61c7285976f85b303a36cdf88a556503",
"rev": "80b0fdf483c5d1cb75aaad909bd390d48673857f",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-24.11",
"repo": "home-manager",
"type": "github"
}
@ -62,11 +63,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1728031945,
"narHash": "sha256-NRkLjdMtVfC6dD1gEbYZWFEtbmC2xfD6ft1IP7l76Vw=",
"lastModified": 1734338723,
"narHash": "sha256-BpJs2QnVwdE4Btsx2BcBmdsq86H7QJYv2GmoOkr1ii4=",
"owner": "Mic92",
"repo": "nix-ld",
"rev": "4524c512e8729ccb5a1b9239d01e1474cbf074a2",
"rev": "911665df070e3d6c970e5a248fc4a38550bd5689",
"type": "github"
},
"original": {
@ -77,11 +78,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1727634051,
"narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=",
"lastModified": 1733015953,
"narHash": "sha256-t4BBVpwG9B4hLgc6GUBuj3cjU7lP/PJfpTHuSqE+crk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "06cf0e1da4208d3766d898b7fdab6513366d45b9",
"rev": "ac35b104800bff9028425fec3b6e8a41de2bbfff",
"type": "github"
},
"original": {
@ -93,16 +94,16 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1726243404,
"narHash": "sha256-sjiGsMh+1cWXb53Tecsm4skyFNag33GPbVgCdfj3n9I=",
"lastModified": 1734737257,
"narHash": "sha256-GIMyMt1pkkoXdCq9un859bX6YQZ/iYtukb9R5luazLM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "345c263f2f53a3710abe117f28a5cb86d0ba4059",
"rev": "1c6e20d41d6a9c1d737945962160e8571df55daa",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}

View File

@ -1,11 +1,11 @@
{
description = "Wyatt's nix configuration suite";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=v0.4.1";
nix-ld.url = "github:Mic92/nix-ld";
home-manager = {
url = "github:nix-community/home-manager";
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
@ -37,10 +37,8 @@
hostname = "sephiroth";
};
modules = [
./modules/common/core.nix
./modules/common/users.nix
./modules/machine/sephiroth/configuration.nix
./modules/machine/sephiroth/apps.nix
./modules/common
./modules/machine/sephiroth
home-manager.darwinModules.home-manager
{
@ -62,10 +60,8 @@
modules = [
nix-flatpak.nixosModules.nix-flatpak
nix-ld.nixosModules.nix-ld
./modules/common/core.nix
./modules/common/users.nix
./modules/machine/cloud/hardware-configuration.nix
./modules/machine/cloud/configuration.nix
./modules/common
./modules/machine/cloud
home-manager.nixosModules.home-manager
{
@ -86,21 +82,21 @@
inherit userName userEmail;
hostname = "valefor";
};
# modules = [
# nix-ld.nixosModules.nix-ld
# ./modules/nix-core.nix
# ./modules/host-users.nix
#
# home-manager.nixosModules.home-manager
# {
# home-manager.useGlobalPkgs = true;
# home-manager.useUserPackages = true;
# home-manager.extraSpecialArgs = extraSpecialArgs;
# home-manager.users.${userName}.imports = [
# ./home
# ];
# }
# ];
modules = [
nix-ld.nixosModules.nix-ld
./modules/common
./modules/machine/valefor
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = extraSpecialArgs;
home-manager.users.${userName}.imports = [
./home
];
}
];
};
# Storage, status, game, and media server

View File

@ -50,7 +50,7 @@ in {
size = 22;
};
stateVersion = "24.05";
stateVersion = "24.11";
};
# Let Home Manager install and manage itself.

View File

@ -3,10 +3,6 @@
userEmail,
...
}: {
# `programs.git` will generate the config file: ~/.config/git/config
# to make git use this config file, `~/.gitconfig` should not exist!
#
# https://git-scm.com/docs/git-config#Documentation/git-config.txt---global
home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
rm -f ~/.gitconfig
'';
@ -30,6 +26,8 @@
aliases = {
# common aliases
a = "add";
ap = "add -p";
br = "branch";
co = "checkout";
st = "status -sb";

View File

@ -1,4 +1,8 @@
{pkgs, ...}: {
{
lib,
pkgs,
...
}: {
home.packages = with pkgs; [
nnn # terminal file manager

0
home/packages/server.nix Normal file
View File

View File

View File

@ -22,7 +22,6 @@
# top alias
top = "btm";
htop = "btm";
};
functions = {
@ -70,7 +69,6 @@
'';
};
programs.bash = {
enable = true;
initExtra = ''

27
modules/apps/flatpak.nix Normal file
View File

@ -0,0 +1,27 @@
{
lib,
pkgs,
flatpakPackages ? [],
flatpakRemotes ? [],
...
}: {
services.flatpak = {
enable = true;
remotes =
if flatpakRemotes == []
then [
{
name = "flathub";
location = "https://dl.flathub.org/repo/flathub.flatpakrepo";
}
]
else flatpakRemotes;
packages = flatpakPackages;
update = {
auto = {
enable = true;
onCalendar = "weekly";
};
};
};
}

159
modules/apps/gaming.nix Normal file
View File

@ -0,0 +1,159 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.gaming;
in {
options.gaming = {
steam = {
enable = lib.mkEnableOption "Steam gaming platform";
firewall = {
remotePlay = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Open firewall ports for Steam Remote Play";
};
localNetworkGameTransfers = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Open firewall ports for local network game transfers";
};
};
};
gamemode = {
enable = lib.mkEnableOption "Gamemode performance optimization";
config = lib.mkOption {
type = lib.types.attrs;
default = {};
description = "Custom Gamemode configuration options";
};
};
gamescope = {
enable = lib.mkEnableOption "Gamescope gaming compositor";
settings = {
resolution = lib.mkOption {
type = lib.types.nullOr (lib.types.submodule {
options = {
width = lib.mkOption {
type = lib.types.int;
description = "Gamescope rendering width";
};
height = lib.mkOption {
type = lib.types.int;
description = "Gamescope rendering height";
};
};
});
default = null;
description = "Gamescope rendering resolution";
};
refreshRate = lib.mkOption {
type = lib.types.nullOr lib.types.int;
default = null;
description = "Gamescope rendering refresh rate";
};
};
};
lutris = {
enable = lib.mkEnableOption "Lutris game manager and launcher";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.lutris;
description = "Lutris package to use (allows for custom or alternative packages)";
};
wine = {
enable = lib.mkEnableOption "Enable Wine support for Lutris";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.wine-staging;
description = "Wine package to use with Lutris";
};
};
# Compatibility layers for Lutris
compatibility = {
protonSupport = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Enable Proton-like compatibility layers for Lutris";
};
extraTools = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [];
description = "Additional compatibility tools for Lutris";
};
};
# Additional system packages for Lutris
extraPackages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [];
description = "Additional packages to install alongside Lutris";
};
};
minecraft = {
enable = lib.mkEnableOption "Minecraft in the form of PrismLauncher, a tool for launching Minecraft";
};
ffxiv = {
enable = lib.mkEnableOption "Final Fantasy XIV and it's accompanied (unofficial) launcher";
};
};
config = {
programs.steam = lib.mkIf cfg.steam.enable {
enable = true;
remotePlay.openFirewall = cfg.steam.firewall.remotePlay;
localNetworkGameTransfers.openFirewall = cfg.steam.firewall.localNetworkGameTransfers;
};
programs.gamemode = lib.mkIf cfg.gamemode.enable {
enable = true;
settings = cfg.gamemode.config;
};
programs.gamescope = lib.mkIf cfg.gamescope.enable {
enable = true;
# Apply custom resolution if specified
args =
lib.optional (cfg.gamescope.settings.resolution != null) [
"-w"
(toString cfg.gamescope.settings.resolution.width)
"-h"
(toString cfg.gamescope.settings.resolution.height)
]
++ lib.optional (cfg.gamescope.settings.refreshRate != null) [
"-r"
(toString cfg.gamescope.settings.refreshRate)
];
};
environment.systemPackages =
(lib.optionals cfg.lutris.enable (
[cfg.lutris.package] ++
(lib.optionals cfg.lutris.wine.enable [
cfg.lutris.wine.package
pkgs.winetricks
]) ++
(lib.optionals cfg.lutris.compatibility.protonSupport [
pkgs.protonup-ng
pkgs.protonup-qt
]) ++
cfg.lutris.compatibility.extraTools ++
cfg.lutris.extraPackages
)) ++
(lib.optionals cfg.minecraft.enable [pkgs.prismlauncher]) ++
(lib.optionals cfg.ffxiv.enable [pkgs.xivlauncher]);
};
}

0
modules/apps/xdg.nix Normal file
View File

View File

@ -0,0 +1,11 @@
{
pkgs,
lib,
...
}: {
imports = [
./core.nix
./fonts.nix
./users.nix
];
}

14
modules/common/fonts.nix Normal file
View File

@ -0,0 +1,14 @@
{
pkgs,
lib,
...
}: {
fonts.packages = with pkgs; [
nerdfonts
noto-fonts
noto-fonts-emoji
liberation_ttf
noto-fonts-cjk-sans
monaspace
];
}

View File

@ -5,16 +5,8 @@
hostname,
...
} @ args: {
# Set up networking configuration
networking.hostName = hostname;
# networking.computerName = hostname;
# networking.firewall.enable = true; # VERY important, do not touch
# networking.firewall.allowedTCPPorts = [];
# networking.firewall.allowedUDPPorts = [];
# networking.networkmanager.enable = pkgs.stdenv.isLinux; # Linux tool for managing network connections
# system.defaults.smb.NetBIOSName = hostname;
# Set up user accounts
# Don't forget to set a password with passwd!
users.users."${userName}" = lib.mkMerge [
{

View File

@ -0,0 +1,107 @@
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.graphics;
in {
options.graphics = {
gpuVendor = mkOption {
type = types.enum ["nvidia" "amd" "intel" "none"];
default = "none";
description = "GPU vendor to configure graphics drivers for";
};
enable = mkEnableOption "graphics configuration";
wayland = {
enable = mkEnableOption "Wayland support";
variableRefreshRate = mkOption {
type = types.bool;
default = false;
description = "Enable variable refresh rate (FreeSync/G-Sync) support";
};
};
vulkan = {
enable = mkEnableOption "Vulkan support";
debug = mkOption {
type = types.bool;
default = false;
description = "Enable Vulkan validation layers";
};
};
};
config = mkIf cfg.enable (mkMerge [
{
environment.systemPackages = with pkgs; [
glxinfo
vulkan-tools
mesa-demos
];
}
(mkIf (cfg.gpuVendor == "nvidia") {
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.stable;
open = true;
modesetting.enable = true;
powerManagement.enable = true;
};
environment.systemPackages = with pkgs; [
nvidia-vaapi-driver
nvtopPackages.full
];
})
(mkIf (cfg.gpuVendor == "amd") {
services.xserver.videoDrivers = ["amdgpu"];
hardware.opengl.extraPackages = with pkgs; [
rocm-opencl-icd
rocm-opencl-runtime
amdvlk
];
environment.systemPackages = with pkgs; [
radeontop
];
})
(mkIf (cfg.gpuVendor == "intel") {
services.xserver.videoDrivers = ["modesetting"];
hardware.opengl.extraPackages = with pkgs; [
intel-media-driver
intel-compute-runtime
];
})
(mkIf cfg.wayland.enable {
programs.xwayland.enable = true;
environment.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
QT_QPA_PLATFORM = "wayland";
SDL_VIDEODRIVER = "wayland";
};
})
(mkIf cfg.vulkan.enable {
environment.systemPackages = with pkgs;
[
vulkan-loader
vulkan-validation-layers
]
++ (
if cfg.vulkan.debug
then [
vulkan-tools
]
else []
);
})
]);
}

View File

@ -7,3 +7,7 @@ Licensed by the Mozilla Public License v2
## Synopsis
This directory is where the machine-specific configuration files for hostname `cloud` live, my primary desktop. These files get called by the root `flake.nix` file.
### `TODO` list
- Migrate to (disko)[https://github.com/nix-community/disko]

View File

@ -1,70 +1,55 @@
{
config,
lib,
pkgs,
userName,
...
}: {
}: let
flatpakPackages = [
"com.github.tchx84.Flatseal"
"com.slack.Slack"
"info.beyondallreason.bar"
"io.dbeaver.DBeaverCommunity"
"io.openrct2.OpenRCT2"
"md.obsidian.Obsidian"
"org.prismlauncher.PrismLauncher"
"sh.cider.Cider"
];
in {
imports = [
(import ../../apps/flatpak.nix {
inherit lib pkgs flatpakPackages;
})
../../apps/gaming.nix
../../graphics
../../pwrMgmt
../../networking/core.nix
../../sound/pipewire.nix
../../sound/shairport.nix
../../virtualization/podman.nix
../../virtualization/hardware.nix
];
# Enable flakes for NixOS
nix.settings.experimental-features = ["nix-command" "flakes"];
# Utilize systemd-boot
# Custom kernel/boot stuff
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Install and enable common graphics drivers
hardware.opengl = {
# driSupport = true;
extraPackages = with pkgs; [
mesa
libvdpau-va-gl
libva
libva-utils
intel-vaapi-driver # for Intel
intel-media-driver # for Intel
rocm-opencl-icd # for AMD
];
};
# For systems with AMD graphics, this enables Vulkan on 32-bit applications
# For 64-bit application, however, Vulkan is enabled by default
# hardware.graphics.driSupport32Bit = true;
# For systems with AMD graphics, enable AMDVLK
#hardware.graphics = {
# extraPackages = with pkgs; [
# amdvlk
# ];
# extraPackages32 = with pkgs; [
# driversi686Linux
# ];
#};
# Enable Bluetooth if present
hardware.bluetooth.enable = true;
# Set your timezone
time.timeZone = "America/Detroit";
# Enable Pipewire (sound)
services.pipewire = {
enable = true;
pulse.enable = true;
};
# Enable touchpad
services.libinput.enable = true;
# Install packages to be installed system-wide
environment.systemPackages = with pkgs; [
vim
neovim
git
wireguard-tools
podman
buildah
podman-tui
podman-compose
podman-desktop
toolbox
grim
slurp
playerctl
@ -73,20 +58,9 @@
firefox
wttrbar
cliphist
xivlauncher
patchelf
];
# Install system-wide fonts
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
liberation_ttf
monaspace
nerdfonts
];
# Set the EDITOR global environment variable to neovim
environment.variables.EDITOR = "nvim";
@ -108,25 +82,69 @@
# Enable Polkit
security.polkit.enable = true;
# Enable power management
powerManagement = {
# Graphics module (../../graphics/default.nix)
graphics = {
enable = true;
powertop.enable = false; # TODO: to be enabled on laptops
cpuFreqGovernor = "performace";
gpuVendor = "amd"; # or "amd" or "intel"
wayland.enable = true;
vulkan.enable = true;
};
# Enable Steam and open various firewall ports when applicable
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
localNetworkGameTransfers.openFirewall = true;
# Gaming module (see ../../apps/gaming.nix)
gaming = {
steam = {
enable = true;
firewall = {
remotePlay = true;
localNetworkGameTransfers = true;
};
};
gamemode.enable = true;
gamescope.enable = true;
lutris = {
enable = true;
wine = {
enable = true;
package = pkgs.wine-staging;
};
compatibility = {
protonSupport = true;
};
extraPackages = with pkgs; [
gamemode
mangohud
];
};
ffxiv.enable = true;
minecraft.enable = true;
};
# Enable gamemode (gamemode, gamemoded, gamemoderun) when needed
programs.gamemode.enable = true;
# Power management (see ../../pwrMgmt/default.nix)
pwrMgmt = {
enable = true;
cpuFreqGovernor = "performance";
powertop.enable = false;
};
# Enable gamescope (compositor) when needed
programs.gamescope.enable = true;
# Podman module (see ../../virtualization/podman.nix)
podman = {
enable = true;
extraPackages = with pkgs; [
docker-credential-helpers
toolbox
cosign
crane
podman-tui
podman-desktop
];
};
# Core networking module (see ../../networking/core.nix)
network = {
firewall.enable = true;
networkmanager.enable = true;
};
# Enable dconf
programs.dconf.enable = true;
@ -134,6 +152,9 @@
# Add username to groups "wheel" and "video" - more may be added here later
users.users.${userName}.extraGroups = ["wheel" "video" "gamemode" "podman" "network"];
# Flatpak packages (see ../../apps/flatpak.nix)
services.flatpak.packages = flatpakPackages;
# XDG stuff
xdg = {
portal = {
@ -154,57 +175,5 @@
};
};
# Firewall stuff not allowed in common user and network creation
networking.firewall.enable = true; # VERY important, do not touch
networking.firewall.allowedTCPPorts = [];
networking.firewall.allowedUDPPorts = [];
networking.networkmanager.enable = true; # Linux tool for managing network connections
# Enable Flatpak (app containerization)
# services.flatpak.enable = true;
services.flatpak = {
enable = true;
remotes = [
{
name = "flathub";
location = "https://dl.flathub.org/repo/flathub.flatpakrepo";
}
];
packages = [
"com.github.tchx84.Flatseal"
"com.slack.Slack"
"info.beyondallreason.bar"
"io.dbeaver.DBeaverCommunity"
"io.openrct2.OpenRCT2"
"md.obsidian.Obsidian"
"org.prismlauncher.PrismLauncher"
"sh.cider.Cider"
];
update = {
auto = {
enable = true;
onCalendar = "weekly";
};
};
};
# Enable Podman (OCI containers)
virtualisation.podman = {
enable = true;
dockerSocket.enable = true;
defaultNetwork.settings.dns_enabled = true;
};
services.shairport-sync = {
enable = pkgs.stdenv.isLinux;
openFirewall = pkgs.stdenv.isLinux;
arguments = "-v -o pw";
};
# users.users."${userName}" = {
# group = "${userName}";
# isNormalUser = true;
# };
system.stateVersion = "24.05";
system.stateVersion = "24.11";
}

View File

@ -0,0 +1,6 @@
{...}: {
imports = [
./configuration.nix
./hardware-configuration.nix
];
}

View File

@ -8,17 +8,11 @@
homebrew = {
enable = true;
onActivation = {
autoUpdate = false;
# 'zap': uninstalls all formulae(and related files) not listed here.
cleanup = "zap";
};
# Applications to install from Mac App Store using mas.
# You need to install all these Apps manually first so that your apple account have records for them.
# otherwise Apple Store will refuse to install them.
# For details, see https://github.com/mas-cli/mas
masApps = {
Xcode = 497799835;
"Reeder 5." = 1529448980;
@ -34,6 +28,7 @@
];
casks = [
"ghostty"
"raycast"
"jordanbaird-ice"
];

View File

@ -3,30 +3,22 @@
hostname,
...
}: {
imports = [
../../virtualization/podman.nix
];
system = {
# activationScripts are executed every time you boot the system or run `nixos-rebuild` / `darwin-rebuild`.
activationScripts.postUserActivation.text = ''
# activateSettings -u will reload the settings from the database and apply them to the current session,
# so we do not need to logout and login again to make the changes take effect.
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
'';
defaults = {
menuExtraClock.Show24Hour = true; # show 24 hour clock
menuExtraClock.Show24Hour = true;
# customize dock
dock = {
autohide = true;
# show-recents = false; # disable recent apps
# # customize Hot Corners
# wvous-tl-corner = 2; # top-left - Mission Control
# wvous-tr-corner = 13; # top-right - Lock Screen
# wvous-bl-corner = 3; # bottom-left - Application Windows
# wvous-br-corner = 4; # bottom-right - Desktop
};
# # customize finder
finder = {
_FXShowPosixPathInTitle = true; # show full path in finder title
AppleShowAllExtensions = true; # show all file extensions
@ -36,7 +28,6 @@
ShowStatusBar = true; # show status bar
};
# # customize trackpad
# trackpad = {
# Clicking = true; # enable tap to click
# TrackpadRightClick = true; # enable two finger right click
@ -176,6 +167,15 @@
system.stateVersion = 5;
podman = {
enable = true;
extraPackages = with pkgs; [
docker-credential-helpers
cosign
crane
];
};
# Set your time zone.
time.timeZone = "America/Detroit";
}

View File

@ -0,0 +1,6 @@
{...}: {
imports = [
./apps.nix
./configuration.nix
];
}

View File

@ -0,0 +1,102 @@
{
config,
lib,
pkgs,
userName,
...
}: {
imports = [
../../graphics
../../pwrMgmt
../../networking/core.nix
../../networking/dns.nix
../../virtualization/podman.nix
];
# Enable flakes for NixOS
nix.settings.experimental-features = ["nix-command" "flakes"];
# Custom kernel/boot stuff
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Enable Bluetooth if present
hardware.bluetooth.enable = true;
# Set your timezone
time.timeZone = "America/Detroit";
# Install packages to be installed system-wide
environment.systemPackages = with pkgs; [
vim
neovim
git
patchelf
];
# Set the EDITOR global environment variable to neovim
environment.variables.EDITOR = "nvim";
# Enable OpenSSH
services.openssh.enable = true;
# Enable keyring
services.gnome.gnome-keyring.enable = true;
# Enable GnuPG
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
# Enable SUID wrappers (some programs need them)
programs.mtr.enable = true;
# Enable Polkit
security.polkit.enable = true;
# Graphics module (../../graphics/default.nix)
graphics = {
enable = true;
gpuVendor = "intel";
wayland.enable = true;
vulkan.enable = true;
};
# Power management (see ../../pwrMgmt/default.nix)
pwrMgmt = {
enable = true;
cpuFreqGovernor = "performance";
powertop.enable = false;
};
# Podman module (see ../../virtualization/podman.nix)
podman = {
enable = true;
extraPackages = with pkgs; [
docker-credential-helpers
toolbox
cosign
crane
podman-tui
podman-desktop
];
};
# Core networking module (see ../../networking/core.nix)
network = {
firewall.enable = true;
networkManager.enable = true;
};
# DNS module (see ../../networking/dns.nix)
dns = {
technitium.enable = true;
};
# Add username to groups "wheel" and "video" - more may be added here later
users.users.${userName}.extraGroups = ["wheel" "podman" "network"];
system.stateVersion = "24.11";
}

View File

@ -0,0 +1,6 @@
{...}: {
imports = [
./configuration.nix
./hardware-configuration.nix
];
}

View File

@ -0,0 +1,39 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/ff89bde1-4b33-4277-b649-b92700b2406c";
fsType = "xfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/3A4B-6866";
fsType = "vfat";
options = [ "fmask=0022" "dmask=0022" ];
};
swapDevices = [ ];
# 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;
# networking.interfaces.eno1.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp1s0.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@ -0,0 +1,90 @@
# Network and networking modules
This directory houses all network, firewall, DHCP, DNS, and all other related networking enablement.
## `core.nix`
This is where the firewall and NetworkManager live. For the firewall, you have pre-defined options that will open ports for you by enabling some network service.
For example:
```nix
tcpPorts.web.enable = true;
udpPorts.dns.enable = true;
```
Here's a more featureful example of how you would enable a firewall and set up NetworkManager:
```nix
customNetworking = {
firewall = {
enable = true;
# Open web service ports
tcpPorts.web.enable = true;
# Custom TCP ports
tcpPorts.allowedPorts = [ 8080 22 ];
# Custom UDP ports
udpPorts.allowedPorts = [ 5000 ];
};
networkManager = {
enable = true;
extraPlugins = with pkgs; [
# Additional NetworkManager plugins
networkmanager-openvpn
networkmanager-openconnect
];
};
};
```
As shown above, you'll have to open ports for services you would want to access remotely.
## DNS
There are two options here: BIND9 (or simply Bind) or Technitium DNS server. Enabling both DNS servers will throw an error and your configuration will not build.
You'll have to import `./dns.nix` for the services to be enabled.
Here's an example of what configuration might look like:
```nix
dns.bind = {
enable = true;
settings = {
interfaces = [ "127.0.0.1" "192.168.100.100" ];
zones = [
{
name = "example.com";
type = "master";
file = "/etc/named/zones/example.com.zone";
}
];
extraConfig = ''
// Additional BIND configuration
options {
directory "/var/named";
recursion yes;
}
'';
}
};
```
_or_
```nix
dns.technitium = {
enable = true;
settings = {
address = "192.168.100.0";
port = 5380;
extraOptions = {
LOG_LEVEL = "info";
};
}
};
```

View File

@ -0,0 +1,68 @@
{
config,
lib,
...
}: let
cfg = config.network;
in {
options.network = {
firewall = {
enable = lib.mkEnableOption "system firewall";
tcpPorts = {
ssh.enable = lib.mkEnableOption "SSH service port (22)";
web.enable = lib.mkEnableOption "common web service ports (80, 443)";
smtp.enable = lib.mkEnableOption "SMTP service ports (25, 465, 587)";
imap.enable = lib.mkEnableOption "IMAP service ports (143, 993)";
mysql.enable = lib.mkEnableOption "MySQL service port (3306)";
mssql.enable = lib.mkEnableOption "Microsoft SQL Server service port (1433)";
postgres.enable = lib.mkEnableOption "Postgres service port (5432)";
allowedPorts = lib.mkOption {
type = lib.types.listOf lib.types.port;
default = [];
description = "List of custom TCP ports to open";
};
};
udpPorts = {
dns.enable = lib.mkEnableOption "DNS service port (53)";
ntp.enable = lib.mkEnableOption "NTP service port (123)";
allowedPorts = lib.mkOption {
type = lib.types.listOf lib.types.port;
default = [];
description = "List of custom UDP ports to open";
};
};
};
networkManager = {
enable = lib.mkEnableOption "NetworkManager for network connection management";
extraPlugins = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [];
description = "Additional NetworkManager plugins to install";
};
};
};
config = {
networking.firewall = {
enable = cfg.firewall.enable;
allowedTCPPorts = lib.flatten [
(lib.optionals cfg.firewall.tcpPorts.ssh.enable [22])
(lib.optionals cfg.firewall.tcpPorts.web.enable [80 443])
(lib.optionals cfg.firewall.tcpPorts.smtp.enable [25 465 587])
(lib.optionals cfg.firewall.tcpPorts.imap.enable [143 993])
(lib.optionals cfg.firewall.tcpPorts.mysql.enable [3306])
(lib.optionals cfg.firewall.tcpPorts.mssql.enable [1433])
(lib.optionals cfg.firewall.tcpPorts.postgres.enable [5432])
cfg.firewall.tcpPorts.allowedPorts
];
allowedUDPPorts = lib.flatten [
(lib.optionals cfg.firewall.udpPorts.dns.enable [53])
(lib.optionals cfg.firewall.udpPorts.ntp.enable [123])
cfg.firewall.udpPorts.allowedPorts
];
};
networking.networkmanager = {
enable = lib.mkForce cfg.networkManager.enable;
packages = cfg.networkManager.extraPlugins;
};
};
}

109
modules/networking/dns.nix Normal file
View File

@ -0,0 +1,109 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.dns;
in {
options.dns = {
bind = {
enable = lib.mkEnableOption "BIND DNS server";
settings = {
interfaces = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = ["127.0.0.1"];
description = "Network interfaces BIND should listen on (IPv4)";
};
interfaces6 = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = ["::1"];
description = "Network interfaces BIND should listen on (IPv6)";
};
zones = lib.mkOption {
type = lib.types.listOf (lib.types.submodule {
options = {
name = lib.mkOption {
type = lib.types.str;
description = "Name of the DNS zone";
};
type = lib.mkOption {
type = lib.types.enum ["master" "slave"];
default = "master";
description = "Type of DNS zone";
};
file = lib.mkOption {
type = lib.types.str;
default = "";
description = "Path to zone file";
};
};
});
default = [];
description = "DNS zones to configure";
};
extraConfig = lib.mkOption {
type = lib.types.lines;
default = "";
description = "Additional BIND configuration options";
};
};
};
technitium = {
enable = lib.mkEnableOption "Technitium DNS server";
settings = {
address = lib.mkOption {
type = lib.types.str;
default = "0.0.0.0";
description = "IP address Technitium should listen on";
};
port = lib.mkOption {
type = lib.types.port;
default = 5380;
description = "Port for Technitium DNS server";
};
extraOptions = lib.mkOption {
type = lib.types.attrs;
default = {};
description = "Additional Technitium configuration options";
};
};
};
};
config = lib.mkMerge [
(lib.mkIf cfg.bind.enable {
services.bind = {
enable = true;
listenOn = cfg.bind.settings.interfaces;
listenOnIpv6 = cfg.bind.settings.interfaces6;
zones =
map (zone: {
name = zone.name;
type = zone.type;
file = zone.file;
})
cfg.bind.settings.zones;
extraConfig = cfg.bind.settings.extraConfig;
};
networking.firewall = {
allowedTCPPorts = [53];
allowedUDPPorts = [53];
};
environment.systemPackages = [pkgs.bind];
})
(lib.mkIf cfg.technitium.enable {
services.technitium-dns-server = {
enable = true;
openFirewall = true;
firewallTCPPorts = [53 5380 53443];
firewallUDPPorts = [53];
};
})
];
}

48
modules/pwrMgmt/README.md Normal file
View File

@ -0,0 +1,48 @@
# Power management modules
This directory houses my own custom defined power management settings. These are set in the machine-specific configurations (typically).
## Examples
Given that this configuration is in the `machine/<hostname>` directory (where hostname is the name of the computer your configuring):
### Desktop configuration
```nix
imports = [
../../pwrMgmt
# other configuration files here...
];
customPowerManagement = {
enable = true;
cpuFreqGovernor = "performance";
powertop.enable = false;
};
```
### Laptop configuration
```nix
imports = [
../../pwrMgmt
# other configuration files here...
];
customPowerManagement = {
enable = true;
cpuFreqGovernor = "powersave";
powertop = {
enable = true;
autotuneOnBoot = true;
};
battery = {
enable = true;
startChargeThreshold = 40;
stopChargeThreshold = 75;
};
};
```
Remember, these are just examples. Please suit these examples to fit your specific hardware.

View File

@ -0,0 +1,69 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.pwrMgmt;
in {
options.pwrMgmt = {
enable = lib.mkEnableOption "Custom power management configuration";
cpuFreqGovernor = lib.mkOption {
type = lib.types.enum [
"performance"
"powersave"
"ondemand"
"conservative"
];
default = "performance";
description = "CPU frequency scaling governor to use";
};
powertop = {
enable = lib.mkEnableOption "PowerTop power management tool";
autotuneOnBoot = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Automatically tune power settings on boot";
};
};
battery = {
enable = lib.mkEnableOption "Battery-specific power management";
startChargeThreshold = lib.mkOption {
type = lib.types.int;
default = 20;
description = "Percentage at which to start charging";
};
stopChargeThreshold = lib.mkOption {
type = lib.types.int;
default = 80;
description = "Percentage at which to stop charging";
};
};
};
config = lib.mkIf cfg.enable {
powerManagement = {
enable = true;
cpuFreqGovernor = cfg.cpuFreqGovernor;
};
environment.systemPackages = lib.mkIf cfg.powertop.enable [pkgs.powertop];
systemd.services.battery-charge-threshold = lib.mkIf cfg.battery.enable {
description = "Set battery charge thresholds";
wantedBy = ["multi-user.target"];
script = ''
if [ -f /sys/class/power_supply/BAT0/charge_start_threshold ]; then
echo ${toString cfg.battery.startChargeThreshold} > /sys/class/power_supply/BAT0/charge_start_threshold
fi
if [ -f /sys/class/power_supply/BAT0/charge_stop_threshold ]; then
echo ${toString cfg.battery.stopChargeThreshold} > /sys/class/power_supply/BAT0/charge_stop_threshold
fi
'';
};
};
}

19
modules/sound/README.md Normal file
View File

@ -0,0 +1,19 @@
# Sound and audio modules
This directory houses all sound and audio modules for a given system.
## Pipewire
Pipewire is the new kid on the block, and frankly, this new kid cleans the streets. With Pulseaudio and ALSA compatibility, this is basically the _defacto_ audio solution for every Linux workstation.
Although, for some use cases, expect me to write a Pulseaudio or an ALSA module here soon :P
All that's needed to get this working to import the `./pipewire.nix` into your machine's configuration.
## Shairport
This is a program where your computer is enabled with AirPlay! How cool is that??
All that's needed to get this working to import the `./shairport.nix` into your machine's configuration.
Note that this _only_ works with Pipewire.

View File

@ -0,0 +1,6 @@
{...}: {
services.pipewire = {
enable = true;
pulse.enable = true;
};
}

View File

@ -0,0 +1,7 @@
{pkgs, ...}: {
services.shairport-sync = {
enable = pkgs.stdenv.isLinux;
openFirewall = pkgs.stdenv.isLinux;
arguments = "-v -o pw";
};
}

View File

@ -0,0 +1,51 @@
# Virtualization modules
This directory houses all virtualization and container related enablement. Cloud native anyone??
## Hardware virtualization
This is for running virtual machines on the bare metal.
All that's needed to get this working to import the `./hardware.nix` into your machine's configuration.
## Docker (OCI containers)
This is for running the Docker runtime (rootful or rootless, rootful by default) to run OCI containers.
All that's needed to get this working to import the `./docker.nix` into your machine's configuration.
Note: I don't use Docker too much as I use Podman for development. I'd check the Podman documentation.
## Podman/Buildah (OCI containers)
This is for running the Podman runtime (rootless) to run OCI containers.
You will need to import `./podman.nix` into your machine configuration. Additionally, there's some added configuration to suit your needs.
Example:
```nix
podman = {
podman = {
enable = true;
extraPackages = with pkgs; [
docker-credential-helpers
toolbox
cosign
crane
podman-tui
podman-desktop
];
};
};
```
To get a full, comprehensive list of what you can do with the podman module, please check out (podman.nix)[./podman.nix]!
## Kubernetes
Coming soon!
## LXC/LXD
I don't have anything in the way of a nix configuration for LXC/LXD as I don't have a use-case for them. Come back later!

View File

@ -0,0 +1,7 @@
{...}: {
virtualisation.docker = {
enable = true;
enableOnBoot = true;
rootless = false;
};
}

View File

@ -0,0 +1,4 @@
{...}: {
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
}

View File

@ -0,0 +1,32 @@
{
config,
lib,
pkgs,
...
}: let
cfg = config.podman;
in {
options = {
podman = {
enable = lib.mkEnableOption "Podman container runtime";
extraPackages = lib.mkOption {
type = lib.types.listOf lib.types.package;
default = [];
description = "Additional container-related packages to install";
};
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages =
[
pkgs.podman
pkgs.podman-compose
pkgs.buildah
pkgs.skopeo
pkgs.dive
]
++ cfg.extraPackages;
};
}