feat: fix dotfiles configuration and add home-manager
This commit is contained in:
@@ -0,0 +1,49 @@
|
|||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Determinate already manages the Nix daemon, so nix-darwin shouldn't.
|
||||||
|
nix.enable = false;
|
||||||
|
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
nixpkgs.hostPlatform = "aarch64-darwin"; # use x86_64-darwin for Intel CPU
|
||||||
|
|
||||||
|
system.primaryUser = "laptran";
|
||||||
|
users.users.laptran = {
|
||||||
|
home = "/Users/laptran";
|
||||||
|
};
|
||||||
|
|
||||||
|
system.stateVersion = 6;
|
||||||
|
system.defaults = {
|
||||||
|
NSGlobalDomain = {
|
||||||
|
AppleInterfaceStyle = "Dark";
|
||||||
|
KeyRepeat = 2; # fast key repeat
|
||||||
|
InitialKeyRepeat = 15; # short delay before repeat
|
||||||
|
_HIHideMenuBar = true; # auto-hide the menu bar
|
||||||
|
AppleShowAllExtensions = true;
|
||||||
|
};
|
||||||
|
dock.autohide = true;
|
||||||
|
finder.FXPreferredViewStyle = "Nlsv"; # list view by default
|
||||||
|
finder.CreateDesktop = false; # clean desktop
|
||||||
|
trackpad.Clicking = true; # tap to click
|
||||||
|
};
|
||||||
|
|
||||||
|
nix-homebrew = {
|
||||||
|
enable = true;
|
||||||
|
user = "laptran";
|
||||||
|
autoMigrate = true; # adopt existing homebrew if already installed
|
||||||
|
};
|
||||||
|
|
||||||
|
homebrew = {
|
||||||
|
enable = true;
|
||||||
|
onActivation.cleanup = "zap"; # remove anything not listed here
|
||||||
|
onActivation.autoUpdate = true;
|
||||||
|
onActivation.extraFlags = [ "--force" ];
|
||||||
|
brews = [
|
||||||
|
"herdr"
|
||||||
|
];
|
||||||
|
casks = [
|
||||||
|
"wezterm"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Generated
+107
@@ -0,0 +1,107 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"brew-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1784068757,
|
||||||
|
"narHash": "sha256-7KnV7rTlMpys+2J+TFVxUDDyKPLXFs4wIMtckMC72VM=",
|
||||||
|
"owner": "Homebrew",
|
||||||
|
"repo": "brew",
|
||||||
|
"rev": "6bd951d96e7ebc54787799dba77bfb26ec956c4c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Homebrew",
|
||||||
|
"ref": "6.0.11",
|
||||||
|
"repo": "brew",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1784350909,
|
||||||
|
"narHash": "sha256-ZWyzLbS1yKUTeFJLmdVuWNnHttL333/ldJbEE+KzCrM=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "4ce190229c73d44536caa7072f6308fb2d8feeb3",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"ref": "release-26.05",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1783744694,
|
||||||
|
"narHash": "sha256-2cp6N3rrwnGYLTx9l6N+NI+kwrCWxvJUbj5WJhvB29A=",
|
||||||
|
"owner": "nix-darwin",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"rev": "c3e90c89649b07d1a96e4b9dd6cd0d6e44b91a74",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-darwin",
|
||||||
|
"ref": "nix-darwin-26.05",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-homebrew": {
|
||||||
|
"inputs": {
|
||||||
|
"brew-src": "brew-src"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1784159664,
|
||||||
|
"narHash": "sha256-I/B6YoRLImHEqNWh8bs+tPjEDeteACeFhcLyoSMo1GE=",
|
||||||
|
"owner": "zhaofengli",
|
||||||
|
"repo": "nix-homebrew",
|
||||||
|
"rev": "842eeb863ecca0eeb463f7a814cdc51e1d925776",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "zhaofengli",
|
||||||
|
"repo": "nix-homebrew",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1784255083,
|
||||||
|
"narHash": "sha256-0Jz8G3+3g6i/l4aISUri0EidLnREelCff0m6+pE6aZg=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "fc51889f81924f15fba77a3c0b79cfb3f78fe0d4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-26.05-darwin",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"home-manager": "home-manager",
|
||||||
|
"nix-darwin": "nix-darwin",
|
||||||
|
"nix-homebrew": "nix-homebrew",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
description = "lt-dotfiles";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
# Use `github:NixOS/nixpkgs/nixpkgs-26.05-darwin` to use Nixpkgs 26.05.
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-26.05-darwin";
|
||||||
|
|
||||||
|
# Use `github:nix-darwin/nix-darwin/nix-darwin-26.05` to use Nixpkgs 26.05.
|
||||||
|
nix-darwin.url = "github:nix-darwin/nix-darwin/nix-darwin-26.05";
|
||||||
|
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
home-manager.url = "github:nix-community/home-manager/release-26.05";
|
||||||
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
nix-homebrew.url = "github:zhaofengli/nix-homebrew";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = inputs@{ self, nix-darwin, nixpkgs, nix-homebrew, home-manager }: {
|
||||||
|
darwinConfigurations."lt-mbp" = nix-darwin.lib.darwinSystem {
|
||||||
|
modules = [
|
||||||
|
./configuration.nix
|
||||||
|
nix-homebrew.darwinModules.nix-homebrew
|
||||||
|
home-manager.darwinModules.home-manager
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
home-manager.users.laptran = import ./home.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
dotfiles = "${config.home.homeDirectory}/.dotfiles";
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
home.username = "laptran";
|
||||||
|
home.homeDirectory = "/Users/laptran";
|
||||||
|
home.stateVersion = "24.11";
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
ripgrep
|
||||||
|
fd
|
||||||
|
fzf
|
||||||
|
jq
|
||||||
|
lazygit
|
||||||
|
neovim
|
||||||
|
nerd-fonts.hack
|
||||||
|
];
|
||||||
|
fonts.fontconfig.enable = true;
|
||||||
|
home.sessionVariables.EDITOR = "nvim";
|
||||||
|
|
||||||
|
home.file.".config/wezterm".source =
|
||||||
|
config.lib.file.mkOutOfStoreSymlink "${dotfiles}/home/.config/wezterm";
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
The reason you are still seeing command not found is that darwin-rebuild does not exist on your computer yet.When doing a brand-new installation of nix-darwin, the darwin-rebuild tool is not part of the standard Nix installer. You have to bootstrap it using the nix run command first, which will dynamically pull the tool from GitHub and execute the initial build.Run the following command from your terminal inside your ~/.dotfiles directory:zshsudo nix run nix-darwin#darwin-rebuild -- switch --flake ~/.dotfiles#lt-mbp
|
||||||
Executable
+5
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
|
||||||
|
ln -sfn "$DIR" ~/.dotfiles
|
||||||
|
exec sudo darwin-rebuild switch --flake ~/.dotfiles#lt-mbp
|
||||||
Reference in New Issue
Block a user