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"
"x86_64-darwin"
]
(
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
(system: {
default = clan-core.inputs.nixpkgs.legacyPackages.${system}.mkShell {
packages = [
clan-core.packages.${system}.clan-cli
pkgs.nil
];
};
}
);
});
};
}

View File

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

View File

@@ -1,9 +1,12 @@
{ pkgs, ... }:
let
keys = import ../../keys.nix;
in
{
pkgs,
lib,
inputs,
...
}:
{
imports = [
inputs.home-manager.darwinModules.home-manager
../../modules/common/sane-defaults
../../modules/common/users
];
@@ -14,6 +17,15 @@ in
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;
homebrew = {
@@ -31,6 +43,7 @@ in
"datagrip"
"discord"
"fantastical"
"fastmail"
"ghostty"
"google-chrome"
"iina"
@@ -51,7 +64,6 @@ in
"slack"
"spotify"
"steam"
"superwhisper"
"syncthing-app"
"tailscale"
"tailscale-app"

View File

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

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)
];