Compare commits

..

1 Commits

Author SHA1 Message Date
f868227874 wip: valefor configuration
not complete
2024-11-26 11:55:43 -05:00
36 changed files with 250 additions and 1093 deletions

33
flake.lock generated
View File

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

View File

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

View File

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

View File

@ -3,6 +3,10 @@
userEmail, 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"] '' home.activation.removeExistingGitconfig = lib.hm.dag.entryBefore ["checkLinkTargets"] ''
rm -f ~/.gitconfig rm -f ~/.gitconfig
''; '';
@ -26,8 +30,6 @@
aliases = { aliases = {
# common aliases # common aliases
a = "add";
ap = "add -p";
br = "branch"; br = "branch";
co = "checkout"; co = "checkout";
st = "status -sb"; st = "status -sb";

View File

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

View File

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

View File

@ -1,27 +0,0 @@
{
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";
};
};
};
}

View File

@ -1,159 +0,0 @@
{
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]);
};
}

View File

View File

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

View File

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

View File

@ -5,8 +5,16 @@
hostname, hostname,
... ...
} @ args: { } @ args: {
# Set up networking configuration
networking.hostName = hostname; 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! # Don't forget to set a password with passwd!
users.users."${userName}" = lib.mkMerge [ users.users."${userName}" = lib.mkMerge [
{ {

View File

@ -1,107 +0,0 @@
{
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,7 +7,3 @@ Licensed by the Mozilla Public License v2
## Synopsis ## 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. 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,55 +1,70 @@
{ {
config,
lib,
pkgs, pkgs,
userName, 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 # Enable flakes for NixOS
nix.settings.experimental-features = ["nix-command" "flakes"]; nix.settings.experimental-features = ["nix-command" "flakes"];
# Custom kernel/boot stuff # Utilize systemd-boot
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = 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 # Enable Bluetooth if present
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;
# Set your timezone # Set your timezone
time.timeZone = "America/Detroit"; 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 # Install packages to be installed system-wide
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
vim vim
neovim neovim
git git
wireguard-tools wireguard-tools
podman
buildah
podman-tui
podman-compose
podman-desktop
toolbox
grim grim
slurp slurp
playerctl playerctl
@ -58,9 +73,20 @@ in {
firefox firefox
wttrbar wttrbar
cliphist cliphist
xivlauncher
patchelf 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 # Set the EDITOR global environment variable to neovim
environment.variables.EDITOR = "nvim"; environment.variables.EDITOR = "nvim";
@ -82,69 +108,25 @@ in {
# Enable Polkit # Enable Polkit
security.polkit.enable = true; security.polkit.enable = true;
# Graphics module (../../graphics/default.nix) # Enable power management
graphics = { powerManagement = {
enable = true; enable = true;
gpuVendor = "amd"; # or "amd" or "intel" powertop.enable = false; # TODO: to be enabled on laptops
wayland.enable = true; cpuFreqGovernor = "performace";
vulkan.enable = true;
}; };
# Gaming module (see ../../apps/gaming.nix) # Enable Steam and open various firewall ports when applicable
gaming = { programs.steam = {
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;
};
# Power management (see ../../pwrMgmt/default.nix)
pwrMgmt = {
enable = true; enable = true;
cpuFreqGovernor = "performance"; remotePlay.openFirewall = true;
powertop.enable = false; localNetworkGameTransfers.openFirewall = true;
}; };
# Podman module (see ../../virtualization/podman.nix) # Enable gamemode (gamemode, gamemoded, gamemoderun) when needed
podman = { programs.gamemode.enable = true;
enable = true;
extraPackages = with pkgs; [
docker-credential-helpers
toolbox
cosign
crane
podman-tui
podman-desktop
];
};
# Core networking module (see ../../networking/core.nix) # Enable gamescope (compositor) when needed
network = { programs.gamescope.enable = true;
firewall.enable = true;
networkmanager.enable = true;
};
# Enable dconf # Enable dconf
programs.dconf.enable = true; programs.dconf.enable = true;
@ -152,9 +134,6 @@ in {
# Add username to groups "wheel" and "video" - more may be added here later # Add username to groups "wheel" and "video" - more may be added here later
users.users.${userName}.extraGroups = ["wheel" "video" "gamemode" "podman" "network"]; users.users.${userName}.extraGroups = ["wheel" "video" "gamemode" "podman" "network"];
# Flatpak packages (see ../../apps/flatpak.nix)
services.flatpak.packages = flatpakPackages;
# XDG stuff # XDG stuff
xdg = { xdg = {
portal = { portal = {
@ -175,5 +154,57 @@ in {
}; };
}; };
system.stateVersion = "24.11"; # 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";
} }

View File

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

View File

@ -8,11 +8,17 @@
homebrew = { homebrew = {
enable = true; enable = true;
onActivation = { onActivation = {
autoUpdate = false; autoUpdate = false;
# 'zap': uninstalls all formulae(and related files) not listed here.
cleanup = "zap"; 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 = { masApps = {
Xcode = 497799835; Xcode = 497799835;
"Reeder 5." = 1529448980; "Reeder 5." = 1529448980;
@ -28,7 +34,6 @@
]; ];
casks = [ casks = [
"ghostty"
"raycast" "raycast"
"jordanbaird-ice" "jordanbaird-ice"
]; ];

View File

@ -3,22 +3,30 @@
hostname, hostname,
... ...
}: { }: {
imports = [
../../virtualization/podman.nix
];
system = { system = {
# activationScripts are executed every time you boot the system or run `nixos-rebuild` / `darwin-rebuild`.
activationScripts.postUserActivation.text = '' 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 /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
''; '';
defaults = { defaults = {
menuExtraClock.Show24Hour = true; menuExtraClock.Show24Hour = true; # show 24 hour clock
# customize dock
dock = { dock = {
autohide = true; 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 = { finder = {
_FXShowPosixPathInTitle = true; # show full path in finder title _FXShowPosixPathInTitle = true; # show full path in finder title
AppleShowAllExtensions = true; # show all file extensions AppleShowAllExtensions = true; # show all file extensions
@ -28,6 +36,7 @@
ShowStatusBar = true; # show status bar ShowStatusBar = true; # show status bar
}; };
# # customize trackpad
# trackpad = { # trackpad = {
# Clicking = true; # enable tap to click # Clicking = true; # enable tap to click
# TrackpadRightClick = true; # enable two finger right click # TrackpadRightClick = true; # enable two finger right click
@ -167,15 +176,6 @@
system.stateVersion = 5; system.stateVersion = 5;
podman = {
enable = true;
extraPackages = with pkgs; [
docker-credential-helpers
cosign
crane
];
};
# Set your time zone. # Set your time zone.
time.timeZone = "America/Detroit"; time.timeZone = "America/Detroit";
} }

View File

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

View File

@ -1,28 +1,31 @@
{ {
config,
lib,
pkgs, pkgs,
userName, userName,
... ...
}: { }: {
imports = [
../../graphics
../../pwrMgmt
../../networking/core.nix
../../networking/dns.nix
../../virtualization/podman.nix
];
# Enable flakes for NixOS # Enable flakes for NixOS
nix.settings.experimental-features = ["nix-command" "flakes"]; nix.settings.experimental-features = ["nix-command" "flakes"];
# Custom kernel/boot stuff # Utilize systemd-boot
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
# Enable Bluetooth if present # For systems with AMD graphics, this enables Vulkan on 32-bit applications
hardware.bluetooth.enable = true; # 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
# ];
#};
# Disable Bluetooth
hardware.bluetooth.enable = false;
# Set your timezone # Set your timezone
time.timeZone = "America/Detroit"; time.timeZone = "America/Detroit";
@ -32,7 +35,22 @@
vim vim
neovim neovim
git git
patchelf wireguard-tools
podman
buildah
podman-tui
podman-compose
podman-desktop
toolbox
bind
];
# Install system-wide fonts
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
liberation_ttf
]; ];
# Set the EDITOR global environment variable to neovim # Set the EDITOR global environment variable to neovim
@ -56,47 +74,28 @@
# Enable Polkit # Enable Polkit
security.polkit.enable = true; security.polkit.enable = true;
# Graphics module (../../graphics/default.nix) # Enable power management
graphics = { powerManagement = {
enable = true; enable = true;
gpuVendor = "intel"; powertop.enable = false; # TODO: to be enabled on laptops
wayland.enable = true; cpuFreqGovernor = "performace";
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 # Add username to groups "wheel" and "video" - more may be added here later
users.users.${userName}.extraGroups = ["wheel" "podman" "network"]; users.users.${userName}.extraGroups = ["wheel" "video" "podman" "network"];
system.stateVersion = "24.11"; # 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 = [53];
networking.networkmanager.enable = true; # Linux tool for managing network connections
# Enable Podman (OCI containers)
virtualisation.podman = {
enable = true;
dockerSocket.enable = true;
defaultNetwork.settings.dns_enabled = true;
};
system.stateVersion = "24.05";
} }

View File

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

View File

@ -1,39 +0,0 @@
# 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

@ -1,90 +0,0 @@
# 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

@ -1,68 +0,0 @@
{
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;
};
};
}

View File

@ -1,109 +0,0 @@
{
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];
};
})
];
}

View File

@ -1,48 +0,0 @@
# 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

@ -1,69 +0,0 @@
{
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
'';
};
};
}

View File

@ -1,19 +0,0 @@
# 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

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

View File

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

View File

@ -1,51 +0,0 @@
# 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

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

View File

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

View File

@ -1,32 +0,0 @@
{
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;
};
}