modularizes config

This commit is contained in:
Dennis Schoepf 2025-12-06 15:16:21 +01:00
parent 8d24fc479e
commit d1f446410a
7 changed files with 229 additions and 189 deletions

View file

@ -35,6 +35,12 @@
inherit (self) outputs;
in
{
# Custom nixosModules
nixosModules.base = import ./modules/base;
nixosModules.macos = import ./modules/macos;
nixosModules.homebrew = import ./modules/homebrew;
nixosModules.aerospace = import ./modules/aerospace;
nixosConfigurations.dnsc-machine = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs outputs; };

View file

@ -1,4 +1,4 @@
{ ... }:
{ pkgs, ... }:
{
home.username = "dennis";
@ -10,6 +10,14 @@
GOPATH = "$HOME/go";
};
home.packages = with pkgs; [
yt-dlp
fnm
devenv
zellij
zellij-switch
];
xdg.enable = true;
imports = [

View file

@ -1,206 +1,64 @@
{
inputs,
outputs,
_lib,
_config,
lib,
pkgs,
...
}:
{
imports = [
inputs.home-manager.darwinModules.home-manager
../../modules/aerospace
outputs.nixosModules.base
outputs.nixosModules.macos
outputs.nixosModules.homebrew
outputs.nixosModules.aerospace
];
# Setting the user
# Device & user-specific settings
networking.hostName = "dnsc-air";
networking.computerName = "dnsc-air";
system.defaults.smb.NetBIOSName = "dnsc-air";
users.users."dennis" = {
home = "/Users/dennis";
description = "Dennis Schoepf";
};
nix.settings.trusted-users = [ "dennis" ];
nixpkgs = {
config = {
allowUnfree = true;
allowUnsupportedSystem = true;
};
overlays = [
inputs.zellij-switch.overlays.default
];
};
# System Packages
environment.systemPackages = with pkgs; [
git
btop
fish
ripgrep
fzf
fd
sd
bat
neovim
just
tldr
fortune
stylua
typescript-language-server
vscode-langservers-extracted
astro-language-server
tailwindcss-language-server
lua-language-server
prettierd
eslint_d
atuin
nil
shellcheck
lazygit
ffmpeg
yt-dlp
zoxide
sqlite
tree-sitter
rsync
fnm
imagemagick
restic
devenv
zellij
zellij-switch
# Device specific overlays
# Overlays for all devices are defined
# in modules/default.nix
nixpkgs.overlays = [
inputs.zellij-switch.overlays.default
];
# Homebrew
nix-homebrew = {
enable = true;
# enableRosetta = true;
user = "dennis";
autoMigrate = true;
# System Packages
environment.systemPackages = lib.mkAfter (with pkgs; [ ]);
# Install additional homebrew apps
homebrew.masApps = {
Bitwarden = 1352778147;
"Wipr 2" = 1662217862;
"Yesterday For Old Reddit" = 1603279883;
"Final Cut Pro" = 424389933;
};
homebrew = {
user = "dennis";
enable = true;
homebrew.brews = lib.mkAfter ([
"harfbuzz"
"openexr"
"openjph"
"p11-kit"
"ca-certificates"
"gettext"
]);
onActivation = {
autoUpdate = true;
upgrade = true;
cleanup = "zap";
};
taps = [
"homebrew/services"
"d12frosted/emacs-plus"
];
masApps = {
Bitwarden = 1352778147;
"Wipr 2" = 1662217862;
"Yesterday For Old Reddit" = 1603279883;
"Final Cut Pro" = 424389933;
};
brews = [
"harfbuzz"
"openexr"
"openjph"
"p11-kit"
"mas"
"go"
"ca-certificates"
"gettext"
];
casks = [
"chromium"
"font-victor-mono"
"font-victor-mono-nerd-font"
"vlc"
"wezterm"
"ghostty"
"hiddenbar"
"eurkey"
"karabiner-elements"
"wezterm"
"cyberduck"
"caffeine"
"tailscale-app"
"raycast"
"spotify"
"zen"
];
};
homebrew.casks = lib.mkAfter ([
"cyberduck"
]);
# Shells
environment.shells = [ pkgs.fish ];
programs.direnv.enable = true;
# System settings
system = {
primaryUser = "dennis";
stateVersion = 5;
activationScripts.postActivation.text = ''
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
'';
defaults = {
smb.NetBIOSName = "dnsc-air";
NSGlobalDomain."com.apple.swipescrolldirection" = false;
dock = {
autohide = true;
autohide-delay = 0.01;
autohide-time-modifier = 0.01;
expose-group-apps = true;
launchanim = false;
minimize-to-application = true;
orientation = "right";
show-recents = false;
persistent-apps = [
"/Applications/Zen.app"
"/Applications/WezTerm.app"
"/System/Applications/System Settings.app/"
];
persistent-others = [
"/Users/dennis/Downloads"
];
};
finder = {
AppleShowAllExtensions = true;
CreateDesktop = false;
FXEnableExtensionChangeWarning = false;
FXPreferredViewStyle = "clmv";
ShowPathbar = true;
ShowStatusBar = true;
};
loginwindow = {
LoginwindowText = "λ dnsc-air (powered by nix-darwin)";
};
menuExtraClock = {
Show24Hour = true;
ShowDate = 0;
};
screencapture = {
location = "/Users/dennis/Downloads";
target = "file";
};
spaces.spans-displays = false;
};
};
# Add ability to used TouchID for sudo authentication
security.pam.services.sudo_local.touchIdAuth = true;
# Home Manager Setup
home-manager = {
extraSpecialArgs = { inherit inputs outputs; };
@ -210,17 +68,4 @@
dennis = import ../../home/darwin.nix;
};
};
# Nix settings
# Enable new Nix CLI and flakes
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nix.package = pkgs.nix;
nix.gc = {
automatic = true;
options = "--delete-older-than 1w";
};
}

59
modules/base/default.nix Normal file
View file

@ -0,0 +1,59 @@
{
pkgs,
inputs,
...
}:
{
nix = {
channel.enable = false;
package = pkgs.nix;
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
settings = {
experimental-features = [
"nix-command"
"flakes"
];
};
gc = {
automatic = true;
dates = "weekly";
options = "delete-older-than 7d";
persistent = false;
};
optimise = {
automatic = true;
dates = [ "weekly" ];
};
};
nixpkgs = {
config = {
allowUnfree = true;
allowUnsupportedSystem = true;
};
};
environment.systemPackages = with pkgs; [
git
btop
fish
ripgrep
fzf
fd
sd
bat
neovim
just
tldr
fortune
ffmpeg
zoxide
sqlite
rsync
restic
imagemagick
sqlite
fortune
];
}

View file

@ -0,0 +1,42 @@
{
nix-homebrew = {
enable = true;
user = "dennis";
autoMigrate = true;
};
homebrew = {
user = "dennis";
enable = true;
onActivation = {
autoUpdate = true;
upgrade = true;
cleanup = "zap";
};
taps = [
"homebrew/services"
];
brews = [
"go"
"mas"
];
casks = [
"font-victor-mono"
"font-victor-mono-nerd-font"
"vlc"
"ghostty"
"hiddenbar"
"eurkey"
"karabiner-elements"
"caffeine"
"raycast"
"spotify"
"zen"
"tailscale-app"
];
};
}

59
modules/macos/default.nix Normal file
View file

@ -0,0 +1,59 @@
{
system = {
primaryUser = "dennis";
stateVersion = 5;
activationScripts.postActivation.text = ''
/System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u
'';
defaults = {
NSGlobalDomain."com.apple.swipescrolldirection" = false;
dock = {
autohide = true;
autohide-delay = 0.01;
autohide-time-modifier = 0.01;
expose-group-apps = true;
launchanim = false;
minimize-to-application = true;
orientation = "right";
show-recents = false;
persistent-apps = [
"/Applications/Zen.app"
"/Applications/Ghostty.app"
"/System/Applications/System Settings.app/"
];
persistent-others = [
"/Users/dennis/Downloads"
];
};
finder = {
AppleShowAllExtensions = true;
CreateDesktop = false;
FXEnableExtensionChangeWarning = false;
FXPreferredViewStyle = "clmv";
ShowPathbar = true;
ShowStatusBar = true;
};
loginwindow = {
LoginwindowText = "(λ) powered by nix-darwin";
};
menuExtraClock = {
Show24Hour = true;
ShowDate = 0;
};
screencapture = {
location = "/Users/dennis/Downloads";
target = "file";
};
spaces.spans-displays = false;
};
};
security.pam.services.sudo_local.touchIdAuth = true;
}

View file

@ -1,8 +1,29 @@
{ config, ... }:
{
pkgs,
config,
lib,
...
}:
{
xdg.configFile."nvim" = {
# mkOutOfStoreSymlink needs an absolute path, otherwise it does not work: https://github.com/nix-community/home-manager/issues/676#issuecomment-1595795685
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dev/nix-config/modules/nvim/config";
};
home.packages = lib.mkAfter (
with pkgs;
[
stylua
typescript-language-server
vscode-langservers-extracted
astro-language-server
tailwindcss-language-server
lua-language-server
prettierd
eslint_d
nil
tree-sitter
]
);
}