commit be59d5c16f8dffc180c29d9979fac2c1a2735e9d
parent bfbd882db59f24df2ad9cd3b7a963b3924d05209
Author: Milutin Popovic <milutin@popovic.xyz>
Date: Sat, 7 Mar 2026 17:24:48 +0100
fix root home dir sepcs
Diffstat:
5 files changed, 64 insertions(+), 60 deletions(-)
diff --git a/flake.lock b/flake.lock
@@ -69,16 +69,15 @@
]
},
"locked": {
- "lastModified": 1747688870,
- "narHash": "sha256-ypL9WAZfmJr5V70jEVzqGjjQzF0uCkz+AFQF7n9NmNc=",
+ "lastModified": 1772845525,
+ "narHash": "sha256-Dp5Ir2u4jJDGCgeMRviHvEQDe+U37hMxp6RSNOoMMPc=",
"owner": "nix-community",
"repo": "home-manager",
- "rev": "d5f1f641b289553927b3801580598d200a501863",
+ "rev": "27b93804fbef1544cb07718d3f0a451f4c4cd6c0",
"type": "github"
},
"original": {
"owner": "nix-community",
- "ref": "release-24.11",
"repo": "home-manager",
"type": "github"
}
diff --git a/flake.nix b/flake.nix
@@ -17,7 +17,7 @@
};
home-manager = {
- url = "github:nix-community/home-manager?ref=release-24.11";
+ url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
@@ -140,11 +140,11 @@
hostName = "mac";
systemName = darwinSystem;
system = darwinSystem;
+ isDarwin = true;
in
nix-darwin.lib.darwinSystem {
specialArgs = {
- inherit hostName systemName inputs;
- isDarwin = true;
+ inherit hostName systemName inputs isDarwin;
};
modules = [
home-manager.darwinModules.home-manager
@@ -155,9 +155,8 @@
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = {
- inherit system inputs;
+ inherit system inputs isDarwin;
standalone = false;
- isDarwin = true;
};
users.mika = import ./users/mika.nix;
};
@@ -171,14 +170,14 @@
let
system = builtins.currentSystem;
pkgs = nixpkgs.legacyPackages.${system};
+ isDarwin = builtins.currentSystem == "aarch64-darwin";
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./users/mika.nix ];
extraSpecialArgs = {
- inherit system inputs;
+ inherit system inputs isDarwin;
standalone = true;
- isDarwin = true;
};
};
};
diff --git a/system/host/mac.nix b/system/host/mac.nix
@@ -35,13 +35,17 @@
users = {
mika = {
shell = pkgs.zsh;
+ home = "/Users/mika";
};
root = {
shell = pkgs.zsh;
+ home = "/var/root";
};
};
};
+ system.primaryUser = "mika";
+
environment.systemPackages = with pkgs; [
neovim
wget
@@ -62,7 +66,7 @@
homebrew = {
enable = true;
- brewPrefix = "/opt/homebrew";
+ prefix = "/opt/homebrew";
taps = [
"homebrew/cask"
"homebrew/cask-fonts"
diff --git a/users/mika.nix b/users/mika.nix
@@ -17,8 +17,32 @@ in
{
home = {
username = "mika";
- homeDirectory = if isDarwin then "/Users/mika" else "/home/mika";
stateVersion = if isDarwin then "25.05" else "25.11";
+ packages = with packageSets; lib.flatten [
+ system
+ shell
+ cli
+ xorg
+ media
+ fileManagement
+ network
+ office
+ email
+ development
+ ];
+ file = {
+ ".zshenv".source = link "${dotfiles}/.zshenv";
+ ".local" = {
+ source = link "${dotfiles}/.local";
+ recursive = true;
+ };
+ ".config/nix-zsh-plugins.zsh".text = ''
+ source ${pkgs.zsh-fast-syntax-highlighting}/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
+ source ${pkgs.zsh-system-clipboard}/share/zsh/zsh-system-clipboard/zsh-system-clipboard.zsh
+ '';
+ };
+ } // lib.optionalAttrs (!isDarwin ){
+ homeDirectory = "/home/mika/";
};
programs.kitty = lib.mkIf isDarwin {
@@ -49,30 +73,7 @@ in
} else
{};
- home.packages = with packageSets; lib.flatten [
- system
- shell
- cli
- xorg
- media
- fileManagement
- network
- office
- email
- development
- ];
- home.file = {
- ".zshenv".source = link "${dotfiles}/.zshenv";
- ".local" = {
- source = link "${dotfiles}/.local";
- recursive = true;
- };
- ".config/nix-zsh-plugins.zsh".text = ''
- source ${pkgs.zsh-fast-syntax-highlighting}/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
- source ${pkgs.zsh-system-clipboard}/share/zsh/zsh-system-clipboard/zsh-system-clipboard.zsh
- '';
- };
xdg.configFile = let
filteredDirs = builtins.filter (dir: dir != "systemd") configDirs;
diff --git a/users/root.nix b/users/root.nix
@@ -9,7 +9,7 @@ in {
environment.pathsToLink = if (!isDarwin)
then [
"/share/applications"
- /share/xdg-desktop-portal
+ "/share/xdg-desktop-portal"
] else [];
home-manager = {
@@ -17,32 +17,33 @@ in {
useUserPackages = true;
users.root = { pkgs, config, ... }: {
- home.username = "root";
- home.homeDirectory = if isDarwin then "/var/root" else "/root";
- home.stateVersion = if isDarwin then "25.05" else "25.11";
- imports = [ ] ++ lib.optionals (!isDarwin) [ ../modules/xdg.nix ];
+ home = {
+ username = "root";
+ stateVersion = if isDarwin then "25.05" else "25.11";
+ file = let
+ mkDotfileLink = path: {
+ source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/${path}";
+ recursive = true;
+ };
+ in {
+ # zsh no plugins
+ ".zshenv" = mkDotfileLink ".zshenv";
+ ".config/zsh/.zshrc" = mkDotfileLink ".config/zsh/.zshrc";
+ ".config/shell/bindings" = mkDotfileLink ".config/shell/bindings";
+ ".config/shell/profile" = mkDotfileLink ".config/shell/profile";
+ ".config/shell/aliases" = mkDotfileLink ".config/shell/aliases";
+ ".config/git" = mkDotfileLink ".config/git";
- home.file = let
- mkDotfileLink = path: {
- source = config.lib.file.mkOutOfStoreSymlink "${dotfiles}/${path}";
- recursive = true;
- };
- in {
- # zsh no plugins
- ".zshenv" = mkDotfileLink ".zshenv";
- ".config/zsh/.zshrc" = mkDotfileLink ".config/zsh/.zshrc";
- ".config/shell/bindings" = mkDotfileLink ".config/shell/bindings";
- ".config/shell/profile" = mkDotfileLink ".config/shell/profile";
- ".config/shell/aliases" = mkDotfileLink ".config/shell/aliases";
- ".config/git" = mkDotfileLink ".config/git";
-
- ".local/bin/.keep".text = "";
+ ".local/bin/.keep".text = "";
- # nvim no plugins
- ".config/nvim/init.lua" = mkDotfileLink ".config/nvim/init.lua";
- ".config/nvim/after" = mkDotfileLink ".config/nvim/after";
- ".config/nvim/lua/config" = mkDotfileLink ".config/nvim/lua/config";
+ # nvim no plugins
+ ".config/nvim/init.lua" = mkDotfileLink ".config/nvim/init.lua";
+ ".config/nvim/after" = mkDotfileLink ".config/nvim/after";
+ ".config/nvim/lua/config" = mkDotfileLink ".config/nvim/lua/config";
+ };
+ } // lib.optionalAttrs (!isDarwin) {
+ homeDirectory = "/root";
};
};
};