♻️ refactor home-manager / dotfiles to use chezmoi

This commit is contained in:
James Walker 2024-09-14 18:12:01 -04:00
parent 6321f08230
commit d9173abb79
Signed by: walkah
SSH Key Fingerprint: SHA256:f7Gn4jO4BFHZxWfKTTzEAfWz+cLW51IyGFl9MjDyZGI
15 changed files with 76 additions and 211 deletions

158
flake.lock generated
View File

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1726032244,
"narHash": "sha256-3VvRGPkpBJobQrFD3slQzMAwZlo4/UwxT8933U5tRVM=",
"lastModified": 1726188813,
"narHash": "sha256-Vop/VRi6uCiScg/Ic+YlwsdIrLabWUJc57dNczp0eBc=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "f4f18f3d7229845e1c9d517457b7a0b90a38b728",
"rev": "21fe31f26473c180390cfa81e3ea81aca0204c80",
"type": "github"
},
"original": {
@ -43,35 +43,6 @@
"type": "github"
}
},
"dotfiles": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"home-manager": [
"home-manager"
],
"nixpkgs": [
"nixpkgs"
],
"pre-commit-hooks": [
"pre-commit-hooks"
]
},
"locked": {
"lastModified": 1722618951,
"narHash": "sha256-ssE4hAbB+CZpbaRkVcDa9Ki9I3zaiODebGEzPXoYJPQ=",
"owner": "walkah",
"repo": "dotfiles",
"rev": "2de443f050f068a9aa31d178cfa4ead845a171ed",
"type": "github"
},
"original": {
"owner": "walkah",
"repo": "dotfiles",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
@ -120,22 +91,6 @@
"type": "github"
}
},
"flake-compat_4": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_2"
@ -154,24 +109,6 @@
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_3"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
@ -195,14 +132,16 @@
},
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1726036828,
"narHash": "sha256-ZQHbpyti0jcAKnwQY1lwmooecLmSG6wX1JakQ/eZNeM=",
"lastModified": 1726308872,
"narHash": "sha256-d4vwO5N4RsLnCY7k5tY9xbdYDWQsY3RDMeUoIa4ms2A=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "8a1671642826633586d12ac3158e463c7a50a112",
"rev": "6c1a461a444e6ccb3f3e42bb627b510c3a722a57",
"type": "github"
},
"original": {
@ -234,11 +173,11 @@
]
},
"locked": {
"lastModified": 1725843519,
"narHash": "sha256-Z6DglUwgFDz6fIvQ89wx/uBVWrGvEGECq0Ypyk/eigE=",
"lastModified": 1726102718,
"narHash": "sha256-u89QyfjtXryLHrO3Wre4kuWK5KDKiXe8lgRi6+cUOEw=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "214efbd73241d72a8f48b8b9a73bb54895cd51a7",
"rev": "5ae384b83b91080f0fead6bc1add1cff8277cb3f",
"type": "github"
},
"original": {
@ -265,16 +204,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1725634671,
"narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=",
"lastModified": 1726206720,
"narHash": "sha256-tI7141IHDABMNgz4iXDo8agCp0SeTLbaIZ2DRndwcmk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c",
"rev": "673d99f1406cb09b8eb6feab4743ebdf70046557",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -311,22 +250,6 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1726042813,
"narHash": "sha256-LnNKCCxnwgF+575y0pxUdlGZBO/ru1CtGHIqQVfvjlA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "159be5db480d1df880a0135ca0bfed84c2f88353",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat_3",
@ -354,16 +277,14 @@
"inputs": {
"darwin": "darwin",
"deploy-rs": "deploy-rs",
"dotfiles": "dotfiles",
"flake-compat": "flake-compat_2",
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nixos-generators": "nixos-generators",
"nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks",
"sops-nix": "sops-nix",
"workon": "workon"
"sops-nix": "sops-nix"
}
},
"sops-nix": {
@ -374,11 +295,11 @@
"nixpkgs-stable": "nixpkgs-stable_2"
},
"locked": {
"lastModified": 1725922448,
"narHash": "sha256-ruvh8tlEflRPifs5tlpa0gkttzq4UtgXkJQS7FusgFE=",
"lastModified": 1726218807,
"narHash": "sha256-z7CoWbSOtsOz8TmRKDnobURkKfv6nPZCo3ayolNuQGc=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "cede1a08039178ac12957733e97ab1006c6b6892",
"rev": "f30b1bac192e2dc252107ac8a59a03ad25e1b96e",
"type": "github"
},
"original": {
@ -417,21 +338,6 @@
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
@ -449,28 +355,6 @@
"repo": "flake-utils",
"type": "github"
}
},
"workon": {
"inputs": {
"flake-compat": "flake-compat_4",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1719248198,
"narHash": "sha256-xF4Odea8BJhBT5qi5ShKn4BeQ5cm+a6vTf45fLq/ADA=",
"owner": "walkah",
"repo": "workon",
"rev": "468788594f1696e70b288d6ffa9ef54ed583e476",
"type": "github"
},
"original": {
"owner": "walkah",
"repo": "workon",
"type": "github"
}
}
},
"root": "root",

View File

@ -4,7 +4,6 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
home-manager.url = "github:nix-community/home-manager";
flake-utils.url = "github:numtide/flake-utils";
deploy-rs = {
@ -17,6 +16,11 @@
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
@ -36,25 +40,9 @@
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
# My stuff
dotfiles = {
url = "github:walkah/dotfiles";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
flake-utils.follows = "flake-utils";
pre-commit-hooks.follows = "pre-commit-hooks";
};
};
workon = {
url = "github:walkah/workon";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, deploy-rs, pre-commit-hooks, workon, ... }@inputs:
outputs = { self, nixpkgs, flake-utils, deploy-rs, pre-commit-hooks, ... }@inputs:
flake-utils.lib.eachDefaultSystem
(system:
let
@ -70,12 +58,9 @@
})
// {
hosts = import ./nix/hosts.nix;
overlays.default = nixpkgs.lib.composeManyExtensions [
workon.overlays.default
];
overlays.default = nixpkgs.lib.composeManyExtensions [ ];
darwinConfigurations = import ./nix/darwin.nix inputs;
homeConfigurations = import ./nix/home.nix inputs;
nixosConfigurations = import ./nix/nixos.nix inputs;
deploy = import ./nix/deploy.nix inputs;
};

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";
};
}