mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-24 02:11:29 +01:00
refactor(home): consolidate host home modules under home/hosts
This commit is contained in:
@@ -26,6 +26,9 @@ home/
|
||||
│ │ └── ...
|
||||
│ ├── editors/ # Linux-specific editors
|
||||
│ └── ...
|
||||
├── hosts/ # Host-specific home manager entry modules
|
||||
│ ├── linux/ # Linux host home modules (ai, shoukei, k3s-*, etc.)
|
||||
│ └── darwin/ # macOS host home modules (fern, frieren)
|
||||
└── darwin/ # macOS-specific home manager configurations
|
||||
├── aerospace/ # macOS window manager
|
||||
├── proxy/ # Proxy configurations
|
||||
@@ -46,3 +49,8 @@ home/
|
||||
3. **darwin**: macOS-specific configuration
|
||||
- macOS applications and services
|
||||
- Platform-specific integrations (Aerospace, Squirrel, etc.)
|
||||
|
||||
4. **hosts**: Host entry modules for Home Manager
|
||||
- Each output should reference only one host home module file
|
||||
- Host modules are responsible for importing shared stacks (`home/linux/*` or `home/darwin`) and
|
||||
applying host overrides
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{ mylib, ... }:
|
||||
{
|
||||
imports = mylib.scanPaths ./.;
|
||||
}
|
||||
17
home/hosts/README.md
Normal file
17
home/hosts/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Host Home Modules
|
||||
|
||||
This directory contains host-specific Home Manager entry modules.
|
||||
|
||||
## Layout
|
||||
|
||||
- `home/hosts/linux/*.nix`: Linux host home modules
|
||||
- `home/hosts/darwin/*.nix`: macOS host home modules
|
||||
|
||||
## Conventions
|
||||
|
||||
1. Each host output should reference only one file under `home/hosts/...`.
|
||||
2. Shared home module imports should be handled in the host file itself.
|
||||
- Linux hosts usually import `../../linux/core.nix` or `../../linux/gui.nix`.
|
||||
- Darwin hosts import `../../darwin`.
|
||||
3. Host-specific overrides (SSH keys, desktop toggles, host-local config links) live in the same
|
||||
host file.
|
||||
@@ -3,6 +3,8 @@ let
|
||||
hostName = "fern";
|
||||
in
|
||||
{
|
||||
imports = [ ../../darwin ];
|
||||
|
||||
programs.ssh.matchBlocks."github.com".identityFile =
|
||||
"${config.home.homeDirectory}/.ssh/${hostName}";
|
||||
}
|
||||
@@ -3,6 +3,8 @@ let
|
||||
hostName = "frieren";
|
||||
in
|
||||
{
|
||||
imports = [ ../../darwin ];
|
||||
|
||||
programs.ssh.matchBlocks."github.com".identityFile =
|
||||
"${config.home.homeDirectory}/.ssh/${hostName}";
|
||||
}
|
||||
@@ -4,9 +4,13 @@ let
|
||||
mkSymlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
in
|
||||
{
|
||||
imports = [ ../../linux/gui.nix ];
|
||||
|
||||
programs.ssh.matchBlocks."github.com".identityFile =
|
||||
"${config.home.homeDirectory}/.ssh/${hostName}";
|
||||
|
||||
modules.desktop.gaming.enable = false;
|
||||
modules.desktop.niri.enable = true;
|
||||
modules.desktop.nvidia.enable = false;
|
||||
|
||||
xdg.configFile."niri/niri-hardware.kdl".source =
|
||||
@@ -3,8 +3,12 @@ let
|
||||
mkSymlink = config.lib.file.mkOutOfStoreSymlink;
|
||||
in
|
||||
{
|
||||
imports = [ ../../linux/gui.nix ];
|
||||
|
||||
programs.ssh.matchBlocks."github.com".identityFile = "${config.home.homeDirectory}/.ssh/idols-ai";
|
||||
|
||||
modules.desktop.gaming.enable = true;
|
||||
modules.desktop.niri.enable = true;
|
||||
modules.desktop.nvidia.enable = true;
|
||||
|
||||
xdg.configFile."niri/niri-hardware.kdl".source =
|
||||
3
home/hosts/linux/k3s-prod-1-master-1.nix
Normal file
3
home/hosts/linux/k3s-prod-1-master-1.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
imports = [ ../../linux/core.nix ];
|
||||
}
|
||||
3
home/hosts/linux/k3s-test-1-master-1.nix
Normal file
3
home/hosts/linux/k3s-test-1-master-1.nix
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
imports = [ ../../linux/core.nix ];
|
||||
}
|
||||
@@ -80,7 +80,7 @@ configurations follow similar patterns but are customized for specific hardware
|
||||
2. Create & add the new host's `hardware-configuration.nix` to the new folder, and add the new
|
||||
host's `configuration.nix` to `hosts/<name>/default.nix`.
|
||||
3. If the new host need to use home-manager, add its custom config into
|
||||
`home/linux/hosts/<name>.nix` or `home/darwin/hosts/<name>.nix`.
|
||||
`home/hosts/linux/<name>.nix` or `home/hosts/darwin/<name>.nix`.
|
||||
1. Under `outputs/`
|
||||
1. Add a new nix file named `outputs/<system-architecture>/src/<name>.nix`.
|
||||
2. Copy the content from one of the existing similar host, and modify it to fit the new host.
|
||||
|
||||
@@ -29,8 +29,7 @@ let
|
||||
];
|
||||
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
"home/darwin/hosts/darwin-${name}.nix"
|
||||
"home/darwin"
|
||||
"home/hosts/darwin/darwin-${name}.nix"
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -28,8 +28,7 @@ let
|
||||
}
|
||||
];
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
"home/darwin/hosts/darwin-${name}.nix"
|
||||
"home/darwin"
|
||||
"home/hosts/darwin/darwin-${name}.nix"
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -36,19 +36,9 @@ let
|
||||
modules.desktop.gaming.enable = false;
|
||||
}
|
||||
];
|
||||
home-modules =
|
||||
(map mylib.relativeToRoot [
|
||||
# common
|
||||
"home/linux/gui.nix"
|
||||
# host specific
|
||||
"home/linux/hosts/12kingdoms-${name}.nix"
|
||||
])
|
||||
++ [
|
||||
{
|
||||
# not supported yet
|
||||
modules.desktop.gaming.enable = false;
|
||||
}
|
||||
];
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
"home/hosts/linux/12kingdoms-${name}.nix"
|
||||
];
|
||||
};
|
||||
|
||||
modules-niri = {
|
||||
@@ -56,10 +46,7 @@ let
|
||||
{ programs.niri.enable = true; }
|
||||
]
|
||||
++ base-modules.nixos-modules;
|
||||
home-modules = [
|
||||
{ modules.desktop.niri.enable = true; }
|
||||
]
|
||||
++ base-modules.home-modules;
|
||||
home-modules = base-modules.home-modules;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
@@ -36,18 +36,9 @@ let
|
||||
modules.desktop.gaming.enable = true;
|
||||
}
|
||||
];
|
||||
home-modules =
|
||||
(map mylib.relativeToRoot [
|
||||
# common
|
||||
"home/linux/gui.nix"
|
||||
# host specific
|
||||
"home/linux/hosts/idols-${name}.nix"
|
||||
])
|
||||
++ [
|
||||
{
|
||||
modules.desktop.gaming.enable = true;
|
||||
}
|
||||
];
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
"home/hosts/linux/idols-${name}.nix"
|
||||
];
|
||||
};
|
||||
|
||||
modules-niri = {
|
||||
@@ -55,10 +46,7 @@ let
|
||||
{ programs.niri.enable = true; }
|
||||
]
|
||||
++ base-modules.nixos-modules;
|
||||
home-modules = [
|
||||
{ modules.desktop.niri.enable = true; }
|
||||
]
|
||||
++ base-modules.home-modules;
|
||||
home-modules = base-modules.home-modules;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ let
|
||||
{ modules.secrets.server.storage.enable = true; }
|
||||
];
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
"home/linux/hosts/idols-${name}.nix"
|
||||
"home/hosts/linux/idols-${name}.nix"
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ let
|
||||
];
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
# host specific
|
||||
"home/linux/hosts/idols-${name}.nix"
|
||||
"home/hosts/linux/idols-${name}.nix"
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ let
|
||||
];
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
# host specific
|
||||
"home/linux/hosts/idols-${name}.nix"
|
||||
"home/hosts/linux/idols-${name}.nix"
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ let
|
||||
{ modules.secrets.server.kubernetes.enable = true; }
|
||||
];
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
"home/linux/core.nix"
|
||||
"home/hosts/linux/${name}.nix"
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ let
|
||||
{ modules.secrets.server.kubernetes.enable = true; }
|
||||
];
|
||||
home-modules = map mylib.relativeToRoot [
|
||||
"home/linux/core.nix"
|
||||
"home/hosts/linux/${name}.nix"
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user