diff --git a/flake.nix b/flake.nix index 947da74..1f935ea 100644 --- a/flake.nix +++ b/flake.nix @@ -61,26 +61,28 @@ }); homeModules = { - main = import ./modules/home.nix; + mac-portable = import ./modules/home/mac-portable.nix; + linux-headless = import ./modules/home/linux-headless.nix; }; darwinModules = { - mac-portable = import ./modules/mac-portable.nix; + mac-portable = import ./modules/darwin/mac-portable.nix; }; homeConfigurations."artem@deimos" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs.primaryUser = "artem"; modules = [ - self.homeModules.main vscode-server.homeModules.default + self.homeModules.linux-headless ./hosts/deimos/home.nix ]; }; homeConfigurations."artem@mars" = home-manager.lib.homeManagerConfiguration { pkgs = nixpkgs.legacyPackages.x86_64-darwin; - specialArgs.primaryUser = "artem"; + extraSpecialArgs.primaryUser = "artem"; modules = [ - self.homeModules.main + self.homeModules.mac-portable ./hosts/mars/home.nix ]; }; diff --git a/hosts/deimos/home.nix b/hosts/deimos/home.nix index e98cb44..0f4e3b8 100644 --- a/hosts/deimos/home.nix +++ b/hosts/deimos/home.nix @@ -1,6 +1,4 @@ -{ pkgs, ... }: -{ - home.username = "artem"; +_: { home.homeDirectory = "/home/artem"; services.vscode-server.enable = true; diff --git a/hosts/mars/home.nix b/hosts/mars/home.nix index 6b7d211..400af53 100644 --- a/hosts/mars/home.nix +++ b/hosts/mars/home.nix @@ -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; [ - secretive - vlc-bin dosbox-staging # dosbox appears broken on darwin # 1. Move config file to /usr/local/etc/wireguard/wg0.conf @@ -23,8 +11,10 @@ antigravity ]; - nixpkgs.config.allowUnfree = true; - programs.vscode.enable = true; + # TODO: consider + # 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 = { # Remap top-left key (paragraph) to backquote and backslash like diff --git a/modules/mac-portable.nix b/modules/darwin/mac-portable.nix similarity index 100% rename from modules/mac-portable.nix rename to modules/darwin/mac-portable.nix diff --git a/modules/home.nix b/modules/home/common.nix similarity index 93% rename from modules/home.nix rename to modules/home/common.nix index d96d178..71be493 100644 --- a/modules/home.nix +++ b/modules/home/common.nix @@ -1,5 +1,6 @@ -{ pkgs, ... }: +{ pkgs, primaryUser, ... }: { + home.username = primaryUser; home.packages = with pkgs; [ stow wget @@ -20,7 +21,7 @@ . ~/dotfiles/migrated/.zshrc else # If no custom override is available, use the one bundled with flake. - . ${../migrated/.zshrc} + . ${../../migrated/.zshrc} fi ''; diff --git a/modules/home/linux-headless.nix b/modules/home/linux-headless.nix new file mode 100644 index 0000000..634dcfa --- /dev/null +++ b/modules/home/linux-headless.nix @@ -0,0 +1,8 @@ +{ primaryUser, ... }: +{ + imports = [ + ./common.nix + ]; + + home.homeDirectory = "/home/${primaryUser}"; +} diff --git a/modules/home/mac-portable.nix b/modules/home/mac-portable.nix new file mode 100644 index 0000000..6ea3cdf --- /dev/null +++ b/modules/home/mac-portable.nix @@ -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; +}