move home manager configuration to machine

This commit is contained in:
2025-11-04 02:38:41 +08:00
parent f4cfe371f7
commit 2a395c3d3a
6 changed files with 43 additions and 57 deletions

View File

@@ -2,54 +2,28 @@
_class,
lib,
config,
inputs,
...
}:
let
keys = import ../../../keys.nix;
cfg = config.nut.users;
nixosModule = {
config = lib.mkIf cfg.enable {
# Enable Home Manager for NixOS and define the user
home-manager.useUserPackages = true;
home-manager.users.yadunut = {
imports = [
./home.nix
inputs.nixvim.homeManagerModules.nixvim
];
home.homeDirectory = lib.mkForce "/home/yadunut";
};
};
};
nixosModule = { };
darwinModule = {
config = lib.mkIf cfg.enable {
# Darwin user configuration
users.users."yadunut" = {
openssh.authorizedKeys.keys = [ keys.yadunut ];
home = "/Users/yadunut";
openssh.authorizedKeys.keys = [ keys.user.yadunut ];
};
users.users."root" = {
openssh.authorizedKeys.keys = [ keys.yadunut ];
};
home-manager.useUserPackages = true;
home-manager.users.yadunut = {
imports = [
./home.nix
inputs.nixvim.homeManagerModules.nixvim
];
home.homeDirectory = lib.mkForce "/Users/yadunut";
openssh.authorizedKeys.keys = [ keys.user.yadunut ];
};
};
};
in
{
imports = [
# Import the correct Home Manager module for the current platform
(
if _class == "darwin" then
inputs.home-manager.darwinModules.home-manager
else
inputs.home-manager.nixosModules.home-manager
)
(lib.optionalAttrs (_class == "nixos") nixosModule)
(lib.optionalAttrs (_class == "darwin") darwinModule)
];

View File

@@ -1,47 +0,0 @@
{
_class,
config,
lib,
pkgs,
...
}:
let
config = {
nut = {
git = {
enable = true;
gpgProgram = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
signingKey = "~/.ssh/yadunut_ed25519.pub";
};
zsh.enable = true;
neovim.enable = true;
};
home.username = "yadunut";
home.packages = [
pkgs.entr
pkgs.jq
pkgs.just
pkgs.rsync
pkgs.codex
pkgs.dive
pkgs.cachix
pkgs.ouch
pkgs.claude-code
pkgs.codex
pkgs.amp-cli
];
nixpkgs.config.allowUnfree = true;
programs.home-manager.enable = true;
home.stateVersion = "25.05";
};
in
{
imports = [
config
../../home/git
../../home/zsh
../../home/neovim
];
}