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

2
.envrc Normal file
View File

@@ -0,0 +1,2 @@
# shellcheck shell=bash
use flake

View File

@@ -43,20 +43,12 @@
"aarch64-darwin" "aarch64-darwin"
"x86_64-darwin" "x86_64-darwin"
] ]
( (system: {
system: default = clan-core.inputs.nixpkgs.legacyPackages.${system}.mkShell {
packages = [
let clan-core.packages.${system}.clan-cli
pkgs = import nixpkgs { inherit system; }; ];
in };
{ });
default = clan-core.inputs.nixpkgs.legacyPackages.${system}.mkShell {
packages = [
clan-core.packages.${system}.clan-cli
pkgs.nil
];
};
}
);
}; };
} }

View File

@@ -1,4 +1,6 @@
rec { rec {
yadunut = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJXOpmWsAnl2RtOuJJMRUx+iJTwf2RWJ1iS3FqXJFzFG"; user = {
users = [ yadunut ]; yadunut = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJXOpmWsAnl2RtOuJJMRUx+iJTwf2RWJ1iS3FqXJFzFG";
};
users = with users; [ yadunut ];
} }

View File

@@ -1,9 +1,12 @@
{ pkgs, ... }: {
let pkgs,
keys = import ../../keys.nix; lib,
in inputs,
...
}:
{ {
imports = [ imports = [
inputs.home-manager.darwinModules.home-manager
../../modules/common/sane-defaults ../../modules/common/sane-defaults
../../modules/common/users ../../modules/common/users
]; ];
@@ -14,6 +17,15 @@ in
sane-defaults.enable = true; sane-defaults.enable = true;
}; };
# # Home Manager configuration
home-manager.useUserPackages = true;
home-manager.users.yadunut = {
imports = [
./homes/yadunut.nix
inputs.nixvim.homeModules.nixvim
];
};
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
homebrew = { homebrew = {
@@ -31,6 +43,7 @@ in
"datagrip" "datagrip"
"discord" "discord"
"fantastical" "fantastical"
"fastmail"
"ghostty" "ghostty"
"google-chrome" "google-chrome"
"iina" "iina"
@@ -51,7 +64,6 @@ in
"slack" "slack"
"spotify" "spotify"
"steam" "steam"
"superwhisper"
"syncthing-app" "syncthing-app"
"tailscale" "tailscale"
"tailscale-app" "tailscale-app"

View File

@@ -6,12 +6,13 @@
... ...
}: }:
let let
keys = import ../../../keys.nix;
config = { config = {
nut = { nut = {
git = { git = {
enable = true; enable = true;
gpgProgram = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign"; gpgProgram = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
signingKey = "~/.ssh/yadunut_ed25519.pub"; signingKey = keys.user.yadunut;
}; };
zsh.enable = true; zsh.enable = true;
neovim.enable = true; neovim.enable = true;
@@ -27,6 +28,9 @@ let
pkgs.cachix pkgs.cachix
pkgs.ouch pkgs.ouch
pkgs.nil
pkgs.nixd
pkgs.claude-code pkgs.claude-code
pkgs.codex pkgs.codex
pkgs.amp-cli pkgs.amp-cli
@@ -40,8 +44,8 @@ in
{ {
imports = [ imports = [
config config
../../home/git ../../../modules/home/git
../../home/zsh ../../../modules/home/zsh
../../home/neovim ../../../modules/home/neovim
]; ];
} }

View File

@@ -2,54 +2,28 @@
_class, _class,
lib, lib,
config, config,
inputs,
... ...
}: }:
let let
keys = import ../../../keys.nix; keys = import ../../../keys.nix;
cfg = config.nut.users; cfg = config.nut.users;
nixosModule = { 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";
};
};
};
darwinModule = { darwinModule = {
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Darwin user configuration
users.users."yadunut" = { users.users."yadunut" = {
openssh.authorizedKeys.keys = [ keys.yadunut ]; home = "/Users/yadunut";
openssh.authorizedKeys.keys = [ keys.user.yadunut ];
}; };
users.users."root" = { users.users."root" = {
openssh.authorizedKeys.keys = [ keys.yadunut ]; openssh.authorizedKeys.keys = [ keys.user.yadunut ];
};
home-manager.useUserPackages = true;
home-manager.users.yadunut = {
imports = [
./home.nix
inputs.nixvim.homeManagerModules.nixvim
];
home.homeDirectory = lib.mkForce "/Users/yadunut";
}; };
}; };
}; };
in in
{ {
imports = [ 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 == "nixos") nixosModule)
(lib.optionalAttrs (_class == "darwin") darwinModule) (lib.optionalAttrs (_class == "darwin") darwinModule)
]; ];