Compare commits
4 Commits
5059cf6555
...
d6d7e7981d
Author | SHA1 | Date |
---|---|---|
Abhinav Sarkar | d6d7e7981d | |
Abhinav Sarkar | 1cf36aa9b7 | |
Abhinav Sarkar | b73e442f22 | |
Abhinav Sarkar | aa90003b99 |
|
@ -4,7 +4,7 @@ This is the [Nix] and [Home Manager] configuration for managing my MacBook.
|
|||
|
||||
## Usage
|
||||
|
||||
First install [Nix]. Then, in the repo directory, run `nix develop` to get into the Nix shell.
|
||||
First install [Nix] and [Homebrew]. Then, in the repo directory, run `nix develop` to get into the Nix shell.
|
||||
|
||||
To set up the MacBook as per the config, run:
|
||||
|
||||
|
@ -31,5 +31,6 @@ just <repo_dir>/switch # or update or clean
|
|||
```
|
||||
|
||||
[Nix]: https://nixos.org
|
||||
[Homebrew]: https://brew.sh
|
||||
[Home Manager]: https://github.com/nix-community/home-manager
|
||||
[`just`]: https://just.systems
|
||||
|
|
|
@ -1,46 +1 @@
|
|||
{ pkgs, inputs, ... }:
|
||||
{
|
||||
imports = [./nix.nix];
|
||||
security.pam.enableSudoTouchIdAuth = true;
|
||||
system = {
|
||||
defaults = {
|
||||
dock = {
|
||||
appswitcher-all-displays = false;
|
||||
autohide = true;
|
||||
magnification = true;
|
||||
mru-spaces = false;
|
||||
orientation = "bottom";
|
||||
wvous-bl-corner = 13;
|
||||
wvous-br-corner = 14;
|
||||
wvous-tl-corner = 2;
|
||||
wvous-tr-corner = 3;
|
||||
};
|
||||
finder = {
|
||||
AppleShowAllExtensions = true;
|
||||
FXPreferredViewStyle = "Nlsv";
|
||||
};
|
||||
NSGlobalDomain = {
|
||||
AppleEnableMouseSwipeNavigateWithScrolls = true;
|
||||
AppleEnableSwipeNavigateWithScrolls = true;
|
||||
AppleICUForce24HourTime = true;
|
||||
AppleInterfaceStyle = "Dark";
|
||||
AppleInterfaceStyleSwitchesAutomatically = false;
|
||||
NSAutomaticCapitalizationEnabled = false;
|
||||
NSAutomaticDashSubstitutionEnabled = true;
|
||||
NSAutomaticSpellingCorrectionEnabled = false;
|
||||
NSAutomaticPeriodSubstitutionEnabled = false;
|
||||
NSAutomaticQuoteSubstitutionEnabled = true;
|
||||
_HIHideMenuBar = true;
|
||||
};
|
||||
trackpad = {
|
||||
Clicking = true;
|
||||
TrackpadRightClick = true;
|
||||
};
|
||||
};
|
||||
keyboard = {
|
||||
enableKeyMapping = true;
|
||||
remapCapsLockToControl = true;
|
||||
};
|
||||
stateVersion = 4;
|
||||
};
|
||||
}
|
||||
{ pkgs, inputs, ... }: { imports = [ ./nix.nix ./system.nix ]; }
|
||||
|
|
20
flake.lock
20
flake.lock
|
@ -71,11 +71,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1706001011,
|
||||
"narHash": "sha256-J7Bs9LHdZubgNHZ6+eE/7C18lZ1P6S5/zdJSdXFItI4=",
|
||||
"lastModified": 1706473109,
|
||||
"narHash": "sha256-iyuAvpKTsq2u23Cr07RcV5XlfKExrG8gRpF75hf1uVc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "3df2a80f3f85f91ea06e5e91071fa74ba92e5084",
|
||||
"rev": "d634c3abafa454551f2083b054cd95c3f287be61",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -108,11 +108,11 @@
|
|||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1700795494,
|
||||
"narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=",
|
||||
"lastModified": 1706581965,
|
||||
"narHash": "sha256-1H7dRdK9LJ7+2X1XQtbwXr+QMqtVVo/ZF0/LIvkjdK8=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d",
|
||||
"rev": "91b9daf672c957ef95a05491a75f62e6a01d5aaf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -123,17 +123,17 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1705883077,
|
||||
"narHash": "sha256-ByzHHX3KxpU1+V0erFy8jpujTufimh6KaS/Iv3AciHk=",
|
||||
"lastModified": 1706589919,
|
||||
"narHash": "sha256-pNHnDITxSI3a17GOF1RUF3jBO1OiNYTRH2yV/cJG4m4=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5f5210aa20e343b7e35f40c033000db0ef80d7b9",
|
||||
"rev": "222c1940fafeda4dea161858ffe6ebfc853d3db5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "5f5210aa20e343b7e35f40c033000db0ef80d7b9",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
description = "Home Manager configuration of Abhinav Sarkar";
|
||||
description = "Nix Darwin + Home Manager configuration of Abhinav Sarkar";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?rev=5f5210aa20e343b7e35f40c033000db0ef80d7b9";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
nix-darwin = {
|
||||
url = "github:LnL7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
@ -40,13 +40,13 @@
|
|||
inherit system;
|
||||
config = { allowUnfree = true; };
|
||||
};
|
||||
in
|
||||
{
|
||||
in {
|
||||
darwinConfigurations."Abhinavs-MacBook-Pro" = nix-darwin.lib.darwinSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
./configuration.nix
|
||||
./homebrew.nix
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
{ ... }: {
|
||||
homebrew = {
|
||||
enable = true;
|
||||
onActivation = {
|
||||
autoUpdate = false;
|
||||
cleanup = "uninstall";
|
||||
upgrade = false;
|
||||
};
|
||||
global = {
|
||||
autoUpdate = false;
|
||||
brewfile = true;
|
||||
};
|
||||
casks = [
|
||||
"amethyst"
|
||||
"appcleaner"
|
||||
"calibre"
|
||||
"dropbox"
|
||||
"fanny"
|
||||
"firefox"
|
||||
"garmin-express"
|
||||
"google-chrome"
|
||||
"homebrew/cask/handbrake"
|
||||
"spotify"
|
||||
"telegram"
|
||||
"utm"
|
||||
"vlc"
|
||||
];
|
||||
masApps = {
|
||||
Amphetamine = 937984704;
|
||||
Bear = 1091189122;
|
||||
GarageBand = 682658836;
|
||||
iMovie = 408981434;
|
||||
Ivory = 6444602274;
|
||||
Keynote = 409183694;
|
||||
Kindle = 302584613;
|
||||
NextDNS = 1464122853;
|
||||
Numbers = 409203825;
|
||||
Pages = 409201541;
|
||||
Reeder = 1449412482;
|
||||
TestFlight = 899247664;
|
||||
Xcode = 497799835;
|
||||
};
|
||||
};
|
||||
}
|
10
justfile
10
justfile
|
@ -30,15 +30,21 @@ _switch: _build
|
|||
# switch to latest home-manager generation
|
||||
switch: (_run "_switch")
|
||||
|
||||
_update: && _switch
|
||||
_update: && _switch _brew-update
|
||||
nix flake update --commit-lock-file "{{ root_dir }}"
|
||||
$NIXPKGS_PATH/pkgs/applications/editors/vscode/extensions/update_installed_exts.sh > \
|
||||
{{ root_dir }}/programs/vscode/extensions.nix
|
||||
|
||||
_brew-update:
|
||||
brew update
|
||||
brew upgrade
|
||||
mas upgrade
|
||||
|
||||
# update packages and switch
|
||||
update: (_run "_update")
|
||||
|
||||
# clean up nix garbage
|
||||
clean:
|
||||
home-manager expire-generations "-7 days"
|
||||
nix-collect-garbage -d --delete-old
|
||||
sudo nix-collect-garbage -d --delete-older-than 7d
|
||||
brew cleanup --prune 7
|
||||
|
|
5
nix.nix
5
nix.nix
|
@ -1,5 +1,4 @@
|
|||
{ config, pkgs, inputs, ... }:
|
||||
{
|
||||
{ config, pkgs, inputs, ... }: {
|
||||
services.nix-daemon.enable = true;
|
||||
nix = {
|
||||
package = pkgs.nixFlakes;
|
||||
|
@ -26,7 +25,7 @@
|
|||
max-jobs = 6;
|
||||
min-free = 128000000;
|
||||
warn-dirty = false;
|
||||
trusted-users = ["@admin"];
|
||||
trusted-users = [ "@admin" ];
|
||||
};
|
||||
};
|
||||
nixpkgs = {
|
||||
|
|
|
@ -12,23 +12,8 @@ let
|
|||
statix
|
||||
cachix
|
||||
];
|
||||
networkingPackages = with pkgs; [
|
||||
curl
|
||||
dig
|
||||
httpie
|
||||
openssh
|
||||
mosh
|
||||
];
|
||||
cmdLineUtilPackages = with pkgs; [
|
||||
bash
|
||||
broot
|
||||
coreutils-full
|
||||
fd
|
||||
gnugrep
|
||||
less
|
||||
ranger
|
||||
tree
|
||||
];
|
||||
networkingPackages = with pkgs; [ curl dig httpie openssh mosh ];
|
||||
cmdLineUtilPackages = with pkgs; [ bash broot coreutils-full fd gnugrep less ranger tree ];
|
||||
miscPackages = with pkgs; [
|
||||
binutils
|
||||
cabal2nix
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ inputs, config, pkgs, ... }:
|
||||
{ inputs, config, osConfig, pkgs, ... }:
|
||||
|
||||
let username = config.home.username;
|
||||
in {
|
||||
|
@ -25,6 +25,14 @@ in {
|
|||
interactiveShellInit = ''
|
||||
fzf_configure_bindings --git_status=\cs --history=\cr --variables=\cv --directory=\cf --git_log=\cg
|
||||
neofetch
|
||||
|
||||
if test -d (brew --prefix)"/share/fish/completions"
|
||||
set -p fish_complete_path (brew --prefix)/share/fish/completions
|
||||
end
|
||||
|
||||
if test -d (brew --prefix)"/share/fish/vendor_completions.d"
|
||||
set -p fish_complete_path (brew --prefix)/share/fish/vendor_completions.d
|
||||
end
|
||||
'';
|
||||
|
||||
shellInit = ''
|
||||
|
@ -32,6 +40,7 @@ in {
|
|||
fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
fenv source /etc/profiles/per-user/${username}/etc/profile.d/hm-session-vars.sh
|
||||
fish_add_path -m ~/.local/bin ~/.cabal/bin /etc/profiles/per-user/${username}/bin
|
||||
eval "$(${osConfig.homebrew.brewPrefix}/brew shellenv)"
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ in {
|
|||
"[json]" = { editor.defaultFormatter = "esbenp.prettier-vscode"; };
|
||||
"[python]" = { editor.defaultFormatter = "ms-python.black-formatter"; };
|
||||
|
||||
black-formatter.args = ["--line-length" "100"];
|
||||
black-formatter.args = [ "--line-length" "100" ];
|
||||
};
|
||||
|
||||
keybindings = [
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
{
|
||||
name = "vscode-markdownlint";
|
||||
publisher = "DavidAnson";
|
||||
version = "0.53.0";
|
||||
sha256 = "1jd2bgzmk11jgv897605ibfl38lr0yssmic6yv6mrrwcgvmrg402";
|
||||
version = "0.54.0";
|
||||
sha256 = "171qw6mymc9hmm8xin3gwr8r2ac8yfr3s8agagsqq9193cawbcq6";
|
||||
}
|
||||
{
|
||||
name = "mustache";
|
||||
|
@ -44,14 +44,14 @@
|
|||
{
|
||||
name = "copilot";
|
||||
publisher = "GitHub";
|
||||
version = "1.153.669";
|
||||
sha256 = "11qy0ksv8baym7ds7j6qmggr0l41bfacd3sy6niypxn33iad01mv";
|
||||
version = "1.156.683";
|
||||
sha256 = "0hks2vav7xxcrrwqrpg6lckanxh8qd0a5zzhywn72i8r18a14jl2";
|
||||
}
|
||||
{
|
||||
name = "copilot-chat";
|
||||
publisher = "GitHub";
|
||||
version = "0.12.2024012301";
|
||||
sha256 = "18px2wnlb8vrh2fy0c413m0s57bkqcjmciv35bzfmi5grp5h6gwx";
|
||||
version = "0.12.2024013003";
|
||||
sha256 = "0k5mqhx1acf41sf2qn5fnw5icah2awvivgpqgfrkxn98b5adc2p0";
|
||||
}
|
||||
{
|
||||
name = "go";
|
||||
|
@ -110,8 +110,8 @@
|
|||
{
|
||||
name = "black-formatter";
|
||||
publisher = "ms-python";
|
||||
version = "2023.9.10231018";
|
||||
sha256 = "104ng2sl8pdi011pqbwdlp6b3xpkj6mfs9d5jcw099y9m18h5s3w";
|
||||
version = "2023.9.10291927";
|
||||
sha256 = "1alh8j35qidgmbb293ar02x5xbigqcv7khq1bp7blsffisdxdqm4";
|
||||
}
|
||||
{
|
||||
name = "debugpy";
|
||||
|
@ -122,14 +122,14 @@
|
|||
{
|
||||
name = "python";
|
||||
publisher = "ms-python";
|
||||
version = "2023.25.10221012";
|
||||
sha256 = "14bkvlflib4wky6lw1hq0i01ymzf5349cl4d9minaam2lq0451i0";
|
||||
version = "2023.25.10292213";
|
||||
sha256 = "09r82h3px2nlkyd3h5y8p6xcz9pccayvfnrnymlkiy9n2j2889sy";
|
||||
}
|
||||
{
|
||||
name = "vscode-pylance";
|
||||
publisher = "ms-python";
|
||||
version = "2023.12.104";
|
||||
sha256 = "07hh0x4z255xswcwd0dkyridpaxsbfnrna9hhbqiiz50vf4grzjx";
|
||||
version = "2024.1.102";
|
||||
sha256 = "05wikxrc7bw2m71gp2n4myfqdk7gk8y474v2fhg0qrxz5hafkyx6";
|
||||
}
|
||||
{
|
||||
name = "vscode-cljfmt";
|
||||
|
@ -140,8 +140,8 @@
|
|||
{
|
||||
name = "rust-analyzer";
|
||||
publisher = "rust-lang";
|
||||
version = "0.4.1817";
|
||||
sha256 = "1nj3cw4nhan7gh04f91z09rh14l37zq6yjjvxqjw2ylvfjrz0klr";
|
||||
version = "0.4.1825";
|
||||
sha256 = "19yqnrxf5c8wm330g13i3vyjbabakw2ary4c6z0j74fh4f1xniz8";
|
||||
}
|
||||
{
|
||||
name = "just";
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
rc = pkgs.callPackage ./report-hm-changes.nix { inherit config pkgs; };
|
||||
in {
|
||||
home.packages = [ rc ];
|
||||
}
|
||||
let rc = pkgs.callPackage ./report-hm-changes.nix { inherit config pkgs; };
|
||||
in { home.packages = [ rc ]; }
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
profiles = "/nix/var/nix/profiles/per-user/${config.home.username}/profile-*-link";
|
||||
in
|
||||
pkgs.writeShellScriptBin "report-hm-changes" ''
|
||||
let profiles = "/nix/var/nix/profiles/per-user/${config.home.username}/profile-*-link";
|
||||
in pkgs.writeShellScriptBin "report-hm-changes" ''
|
||||
# Disable nvd if there are less than 2 hm profiles.
|
||||
if [ $(/bin/ls -d1v ${profiles} 2>/dev/null | wc -l) -lt 2 ]; then
|
||||
echo "Skipping changes report..."
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
{ pkgs, inputs, ... }: {
|
||||
security.pam.enableSudoTouchIdAuth = true;
|
||||
system = {
|
||||
defaults = {
|
||||
dock = {
|
||||
appswitcher-all-displays = false;
|
||||
autohide = true;
|
||||
magnification = true;
|
||||
mru-spaces = false;
|
||||
orientation = "bottom";
|
||||
wvous-bl-corner = 13;
|
||||
wvous-br-corner = 14;
|
||||
wvous-tl-corner = 2;
|
||||
wvous-tr-corner = 3;
|
||||
};
|
||||
finder = {
|
||||
AppleShowAllExtensions = true;
|
||||
FXPreferredViewStyle = "Nlsv";
|
||||
};
|
||||
NSGlobalDomain = {
|
||||
AppleEnableMouseSwipeNavigateWithScrolls = true;
|
||||
AppleEnableSwipeNavigateWithScrolls = true;
|
||||
AppleICUForce24HourTime = true;
|
||||
AppleInterfaceStyle = "Dark";
|
||||
AppleInterfaceStyleSwitchesAutomatically = false;
|
||||
NSAutomaticCapitalizationEnabled = false;
|
||||
NSAutomaticDashSubstitutionEnabled = true;
|
||||
NSAutomaticSpellingCorrectionEnabled = false;
|
||||
NSAutomaticPeriodSubstitutionEnabled = false;
|
||||
NSAutomaticQuoteSubstitutionEnabled = true;
|
||||
_HIHideMenuBar = true;
|
||||
};
|
||||
trackpad = {
|
||||
Clicking = true;
|
||||
TrackpadRightClick = true;
|
||||
};
|
||||
};
|
||||
keyboard = {
|
||||
enableKeyMapping = true;
|
||||
remapCapsLockToControl = true;
|
||||
};
|
||||
stateVersion = 4;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue