Split configuration into reusable modules

This commit is contained in:
2026-03-29 11:50:03 +02:00
parent 5a8f0aa4df
commit 58fb358955
7 changed files with 40 additions and 25 deletions

View File

@@ -61,26 +61,28 @@
}); });
homeModules = { homeModules = {
main = import ./modules/home.nix; mac-portable = import ./modules/home/mac-portable.nix;
linux-headless = import ./modules/home/linux-headless.nix;
}; };
darwinModules = { darwinModules = {
mac-portable = import ./modules/mac-portable.nix; mac-portable = import ./modules/darwin/mac-portable.nix;
}; };
homeConfigurations."artem@deimos" = home-manager.lib.homeManagerConfiguration { homeConfigurations."artem@deimos" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs.primaryUser = "artem";
modules = [ modules = [
self.homeModules.main
vscode-server.homeModules.default vscode-server.homeModules.default
self.homeModules.linux-headless
./hosts/deimos/home.nix ./hosts/deimos/home.nix
]; ];
}; };
homeConfigurations."artem@mars" = home-manager.lib.homeManagerConfiguration { homeConfigurations."artem@mars" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-darwin; pkgs = nixpkgs.legacyPackages.x86_64-darwin;
specialArgs.primaryUser = "artem"; extraSpecialArgs.primaryUser = "artem";
modules = [ modules = [
self.homeModules.main self.homeModules.mac-portable
./hosts/mars/home.nix ./hosts/mars/home.nix
]; ];
}; };

View File

@@ -1,6 +1,4 @@
{ pkgs, ... }: _: {
{
home.username = "artem";
home.homeDirectory = "/home/artem"; home.homeDirectory = "/home/artem";
services.vscode-server.enable = true; services.vscode-server.enable = true;

View File

@@ -1,18 +1,6 @@
{ pkgs, primaryUser, ... }: { pkgs, ... }:
{ {
nixpkgs.hostPlatform = "x86_64-darwin";
# TODO: consider
# https://nest.pijul.com/yonkeltron/macOS-nix-config:main/ZLDSMIXK5XFW6.EIAAA
# and
# https://github.com/bgub/nix-macos-starter/tree/main
home.username = primaryUser;
home.homeDirectory = "/Users/${primaryUser}";
home.packages = with pkgs; [ home.packages = with pkgs; [
secretive
vlc-bin
dosbox-staging # dosbox appears broken on darwin dosbox-staging # dosbox appears broken on darwin
# 1. Move config file to /usr/local/etc/wireguard/wg0.conf # 1. Move config file to /usr/local/etc/wireguard/wg0.conf
@@ -23,8 +11,10 @@
antigravity antigravity
]; ];
nixpkgs.config.allowUnfree = true; # TODO: consider
programs.vscode.enable = true; # https://nest.pijul.com/yonkeltron/macOS-nix-config:main/ZLDSMIXK5XFW6.EIAAA
# and
# https://github.com/bgub/nix-macos-starter/tree/main
launchd.agents.keyboard-remap = { launchd.agents.keyboard-remap = {
# Remap top-left key (paragraph) to backquote and backslash like # Remap top-left key (paragraph) to backquote and backslash like

View File

@@ -1,5 +1,6 @@
{ pkgs, ... }: { pkgs, primaryUser, ... }:
{ {
home.username = primaryUser;
home.packages = with pkgs; [ home.packages = with pkgs; [
stow stow
wget wget
@@ -20,7 +21,7 @@
. ~/dotfiles/migrated/.zshrc . ~/dotfiles/migrated/.zshrc
else else
# If no custom override is available, use the one bundled with flake. # If no custom override is available, use the one bundled with flake.
. ${../migrated/.zshrc} . ${../../migrated/.zshrc}
fi fi
''; '';

View File

@@ -0,0 +1,8 @@
{ primaryUser, ... }:
{
imports = [
./common.nix
];
home.homeDirectory = "/home/${primaryUser}";
}

View File

@@ -0,0 +1,16 @@
{ pkgs, primaryUser, ... }:
{
imports = [
./common.nix
];
home.homeDirectory = "/Users/${primaryUser}";
home.packages = with pkgs; [
secretive
vlc-bin
];
nixpkgs.config.allowUnfree = true;
programs.vscode.enable = true;
}