♻️ refactor home-manager / dotfiles to use chezmoi

This commit is contained in:
2024-09-14 18:12:01 -04:00
parent 6321f08230
commit d9173abb79
15 changed files with 76 additions and 211 deletions

View File

@ -1,4 +1,4 @@
{ self, darwin, home-manager, dotfiles, ... }:
{ self, darwin, home-manager, ... }:
let
mkDarwin = hostName: modules:
let
@ -13,7 +13,7 @@ let
nixpkgs.overlays = [ self.overlays.default ];
})
] ++ modules;
specialArgs = { inherit dotfiles home-manager; };
specialArgs = { inherit home-manager; };
};
in
{

View File

@ -1,5 +0,0 @@
{ dotfiles, ... }:
{
"walkah@epicurus" = dotfiles.homeConfigurations.aarch64-darwin.walkah;
"walkah@heraclitus" = dotfiles.homeConfigurations.aarch64-darwin.walkah;
}

View File

@ -18,8 +18,4 @@
# Auto upgrade nix package and the daemon service.
services.nix-daemon.enable = true;
users.users.walkah.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ0mE4MyMnfd1b2nlBJT7kpZ6Vov+ILuGNfzdp5ZBNQe walkah@walkah.net"
];
}

View File

@ -7,7 +7,6 @@ in
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
../../users
../../modules/base/nixos.nix
../../modules/coredns

View File

@ -2,7 +2,6 @@
imports = [
./hardware-configuration.nix
./networking.nix # generated at runtime by nixos-infect
../../users
../../modules/base/nixos.nix
../../modules/akkoma

View File

@ -1,13 +1,6 @@
{ pkgs, ... }:
_:
{
environment.systemPackages = with pkgs; [
dogdns
htop
inetutils
vim
];
nix = {
extraOptions = ''
experimental-features = nix-command flakes
@ -30,10 +23,5 @@
};
};
programs = {
zsh = {
enable = true;
promptInit = "";
};
};
programs.zsh.enable = true;
}

View File

@ -1,6 +1,6 @@
{ pkgs, dotfiles, ... }: {
{ ... }: {
imports = [ ./common.nix ];
imports = [ ./common.nix ../../users ];
nix = {
configureBuildUsers = true;
@ -42,16 +42,5 @@
};
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.walkah = import "${dotfiles}/home.nix";
};
users.users.walkah = {
home = "/Users/walkah";
shell = pkgs.zsh;
};
system.stateVersion = 4;
}

View File

@ -1,6 +1,12 @@
{ config, ... }: {
{ config, pkgs, ... }: {
imports = [ ./common.nix ../monitoring ];
imports = [ ./common.nix ../monitoring ../../users ];
environment.systemPackages = with pkgs; [
htop
inetutils
vim
];
nix = {
gc = {

View File

@ -32,8 +32,5 @@
nixd
nixf
nixpkgs-fmt
# My stuff
workon
];
}

View File

@ -1,4 +1,4 @@
{ self, dotfiles, nixpkgs, home-manager, nixos-hardware, sops-nix, ... }:
{ self, nixpkgs, home-manager, nixos-hardware, sops-nix, ... }:
let
mkSystem = hostName: modules:
let
@ -14,7 +14,7 @@ let
nixpkgs.config.allowUnfree = true;
})
] ++ modules;
specialArgs = { inherit dotfiles nixos-hardware sops-nix; };
specialArgs = { inherit nixos-hardware sops-nix; };
};
in
{

View File

@ -1,5 +1,5 @@
{ ... }:
{
imports = [ ./walkah.nix ];
imports = [ ./walkah ];
}

View File

@ -1,18 +1,23 @@
{ pkgs, dotfiles, ... }:
{ lib, pkgs, ... }:
{
users.users.walkah = {
isNormalUser = true;
home = if pkgs.stdenv.isDarwin then "/Users/walkah" else "/home/walkah";
shell = pkgs.zsh;
extraGroups = [ "wheel" "docker" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ0mE4MyMnfd1b2nlBJT7kpZ6Vov+ILuGNfzdp5ZBNQe walkah@walkah.net"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM8YMax7PGIrcPNIHkpuNRFgn3HJK6Wepm+ycZWO6jfR walkah@walkah-ipadpro11"
];
} // lib.optionalAttrs pkgs.stdenv.isLinux {
extraGroups = [ "wheel" "docker" ];
group = "walkah";
isNormalUser = true;
};
users.groups.walkah = { };
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.walkah = import "${dotfiles}/home.nix";
users.walkah = import ./home.nix;
};
}

22
nix/users/walkah/home.nix Normal file
View File

@ -0,0 +1,22 @@
{ lib, pkgs, ... }: {
home = {
username = "walkah";
# homeDirectory = if pkgs.stdenv.isDarwin then "/Users/walkah" else "/home/walkah";
packages = with pkgs; [
chezmoi
direnv
eza
fzf
git
starship
tmux
];
activation.chezmoi = lib.hm.dag.entryAfter [ "installPackages" ] ''
$DRY_RUN_CMD ${pkgs.chezmoi}/bin/chezmoi init --apply walkah/dotfiles
'';
stateVersion = "24.05";
};
}