Compare commits

...

5 Commits

Author SHA1 Message Date
Abhinav Sarkar 0d4776105a flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/3df2a80f3f85f91ea06e5e91071fa74ba92e5084' (2024-01-23)
  → 'github:nix-community/home-manager/d634c3abafa454551f2083b054cd95c3f287be61' (2024-01-28)
• Updated input 'nix-darwin':
    'github:LnL7/nix-darwin/4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d' (2023-11-24)
  → 'github:LnL7/nix-darwin/91b9daf672c957ef95a05491a75f62e6a01d5aaf' (2024-01-30)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/5f5210aa20e343b7e35f40c033000db0ef80d7b9' (2024-01-22)
  → 'github:nixos/nixpkgs/222c1940fafeda4dea161858ffe6ebfc853d3db5' (2024-01-30)
2024-01-31 16:02:50 +05:30
Abhinav Sarkar 006d6bdd91 Adds Homebrew support and packages 2024-01-31 16:00:03 +05:30
Abhinav Sarkar 3456978b5f Adds nix-darwin 2023-11-25 16:13:20 +05:30
Abhinav Sarkar 3f4264f030 flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/93e804e7f8a1eb88bde6117cd5046501e66aa4bd' (2024-01-11)
  → 'github:nix-community/home-manager/3df2a80f3f85f91ea06e5e91071fa74ba92e5084' (2024-01-23)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/eabe8d3eface69f5bb16c18f8662a702f50c20d5' (2024-01-09)
  → 'github:nixos/nixpkgs/5f5210aa20e343b7e35f40c033000db0ef80d7b9' (2024-01-22)
2024-01-24 10:46:56 +05:30
Abhinav Sarkar 79c333d7b2 flake.lock: Update
Flake lock file updates:

• Updated input 'fish-plugin-fzf':
    'github:PatrickF1/fzf.fish/be2b1653269f86a2203f2f9c08cfd868888265be' (2023-12-20)
  → 'github:PatrickF1/fzf.fish/e5d54b93cd3e096ad6c2a419df33c4f50451c900' (2024-01-03)
• Updated input 'home-manager':
    'github:nix-community/home-manager/2aff324cf65f5f98f89d878c056b779466b17db8' (2023-12-29)
  → 'github:nix-community/home-manager/93e804e7f8a1eb88bde6117cd5046501e66aa4bd' (2024-01-11)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/e1fa12d4f6c6fe19ccb59cac54b5b3f25e160870' (2023-12-25)
  → 'github:nixos/nixpkgs/eabe8d3eface69f5bb16c18f8662a702f50c20d5' (2024-01-09)
2024-01-11 20:48:39 +05:30
9 changed files with 229 additions and 75 deletions

46
configuration.nix Normal file
View File

@ -0,0 +1,46 @@
{ 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;
};
}

View File

@ -35,11 +35,11 @@
"fish-plugin-fzf": {
"flake": false,
"locked": {
"lastModified": 1703060768,
"narHash": "sha256-/31pjXPTBw3VnA0jM6WlRCLVaG57LQNjVQhSc3Bd2o4=",
"lastModified": 1704317914,
"narHash": "sha256-5cO5Ey7z7KMF3vqQhIbYip5JR6YiS2I9VPRd6BOmeC8=",
"owner": "PatrickF1",
"repo": "fzf.fish",
"rev": "be2b1653269f86a2203f2f9c08cfd868888265be",
"rev": "e5d54b93cd3e096ad6c2a419df33c4f50451c900",
"type": "github"
},
"original": {
@ -71,11 +71,11 @@
]
},
"locked": {
"lastModified": 1703838268,
"narHash": "sha256-SRg5nXcdPnrsQR2MTAp7en0NyJnQ2wB1ivmsgEbvN+o=",
"lastModified": 1706473109,
"narHash": "sha256-iyuAvpKTsq2u23Cr07RcV5XlfKExrG8gRpF75hf1uVc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2aff324cf65f5f98f89d878c056b779466b17db8",
"rev": "d634c3abafa454551f2083b054cd95c3f287be61",
"type": "github"
},
"original": {
@ -101,19 +101,39 @@
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1706581965,
"narHash": "sha256-1H7dRdK9LJ7+2X1XQtbwXr+QMqtVVo/ZF0/LIvkjdK8=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "91b9daf672c957ef95a05491a75f62e6a01d5aaf",
"type": "github"
},
"original": {
"owner": "LnL7",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1703499205,
"narHash": "sha256-lF9rK5mSUfIZJgZxC3ge40tp1gmyyOXZ+lRY3P8bfbg=",
"lastModified": 1706589919,
"narHash": "sha256-pNHnDITxSI3a17GOF1RUF3jBO1OiNYTRH2yV/cJG4m4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e1fa12d4f6c6fe19ccb59cac54b5b3f25e160870",
"rev": "222c1940fafeda4dea161858ffe6ebfc853d3db5",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"rev": "e1fa12d4f6c6fe19ccb59cac54b5b3f25e160870",
"type": "github"
}
},
@ -125,6 +145,7 @@
"flake-compat": "flake-compat",
"home-manager": "home-manager",
"monaspace-font": "monaspace-font",
"nix-darwin": "nix-darwin",
"nixpkgs": "nixpkgs"
}
}

View File

@ -1,8 +1,12 @@
{
description = "Home Manager configuration of Abhinav Sarkar";
description = "Nix Darwin + Home Manager configuration of Abhinav Sarkar";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?rev=e1fa12d4f6c6fe19ccb59cac54b5b3f25e160870";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
@ -29,25 +33,34 @@
};
};
outputs = inputs@{ nixpkgs, home-manager, ... }:
outputs = inputs@{ self, nixpkgs, nix-darwin, home-manager, ... }:
let
system = "x86_64-darwin";
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
in {
homeConfigurations.abhinav = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./home.nix ];
extraSpecialArgs = { inherit inputs; };
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;
home-manager.useUserPackages = true;
home-manager.users.abhinav = import ./home.nix;
home-manager.extraSpecialArgs = { inherit inputs; };
}
];
};
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [ (import home-manager { inherit pkgs; }).home-manager just ];
shellHook = ''
export NIX_PATH=$HOME/.hm-nixchannels;
mkdir -p $NIX_PATH;
ln -f -s ${pkgs.path} -T $NIX_PATH/nixpkgs;
export NIXPKGS_PATH=${pkgs.path};
'';
};
};

View File

@ -1,11 +1,12 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
imports = [ ./programs ./scripts ./launchd.nix ./nix.nix ];
let username = config.home.username;
in {
imports = [ ./programs ./scripts ./launchd.nix ];
home = {
username = "abhinav";
homeDirectory = "/Users/abhinav";
homeDirectory = lib.mkForce "/Users/${username}";
stateVersion = "22.05";
enableNixpkgsReleaseCheck = true;
@ -23,7 +24,7 @@
sessionVariables = {
EDITOR = "micro";
NIX_PATH = "$HOME/.hm-nixchannels";
NIX_PATH = "/nix/var/nix/profiles/per-user/${username}/channels";
};
file."Applications/Home Manager Apps".source = let

43
homebrew.nix Normal file
View File

@ -0,0 +1,43 @@
{ ... }: {
homebrew = {
enable = true;
onActivation = {
autoUpdate = false;
cleanup = "uninstall";
upgrade = false;
};
global = {
autoUpdate = false;
brewfile = true;
};
casks = [
"amethyst"
"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;
};
};
}

View File

@ -1,5 +1,6 @@
in_nix_shell := env_var_or_default("IN_NIX_SHELL", "false")
root_dir := justfile_directory()
hostname := `scutil --get LocalHostName`
# choose a just command to run
default:
@ -18,24 +19,26 @@ _run cmd:
fi
_build:
home-manager -v build --flake "{{ root_dir }}#abhinav"
nix build {{ root_dir }}#darwinConfigurations.{{ hostname }}.system
# build latest home-manager generation
build: (_run "_build")
_switch:
home-manager -v switch --flake "{{ root_dir }}#abhinav"
report-hm-changes
_switch: _build
./result/sw/bin/darwin-rebuild -v switch --flake "{{ root_dir }}"
# switch to latest home-manager generation
switch: (_run "_switch")
_update-vscode-extensions:
$NIX_PATH/nixpkgs/pkgs/applications/editors/vscode/extensions/update_installed_exts.sh > \
_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
_update: _update-vscode-extensions && _switch
nix flake update --commit-lock-file "{{ root_dir }}"
_brew-update:
brew update
brew upgrade
mas upgrade
# update packages and switch
update: (_run "_update")
@ -43,4 +46,5 @@ 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

49
nix.nix
View File

@ -1,19 +1,36 @@
{ config, pkgs, ... }:
{ config, pkgs, inputs, ... }:
{
nixpkgs.config.allowUnfree = true;
nix.package = pkgs.nixStable;
nix.settings = {
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
max-jobs = 6;
cores = 2;
auto-optimise-store = true;
connect-timeout = 5;
log-lines = 25;
min-free = 128000000;
max-free = 1000000000;
fallback = true;
warn-dirty = false;
keep-outputs = true;
services.nix-daemon.enable = true;
nix = {
package = pkgs.nixFlakes;
registry.nixpkgs.flake = inputs.nixpkgs;
nixPath = [{ nixpkgs = inputs.nixpkgs.outPath; }];
extraOptions = ''
keep-outputs = true
keep-derivations = true
'';
gc = {
automatic = true;
interval.Day = 1;
options = "--delete-older-than 7d";
};
settings = {
auto-optimise-store = true;
connect-timeout = 5;
cores = 2;
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
fallback = true;
keep-outputs = true;
log-lines = 25;
max-free = 1000000000;
max-jobs = 6;
min-free = 128000000;
warn-dirty = false;
trusted-users = ["@admin"];
};
};
nixpkgs = {
hostPlatform = "x86_64-darwin";
config.allowUnfree = true;
};
}

View File

@ -1,6 +1,7 @@
{ inputs, config, pkgs, ... }:
{
let username = config.home.username;
in {
programs.fish = {
enable = true;
@ -29,7 +30,9 @@
shellInit = ''
# nix
fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
fish_add_path -m ~/.local/bin ~/.cabal/bin
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 "$(/usr/local/bin/brew shellenv)"
'';
};
}

View File

@ -20,8 +20,8 @@
{
name = "vscode-markdownlint";
publisher = "DavidAnson";
version = "0.53.0";
sha256 = "1jd2bgzmk11jgv897605ibfl38lr0yssmic6yv6mrrwcgvmrg402";
version = "0.54.0";
sha256 = "171qw6mymc9hmm8xin3gwr8r2ac8yfr3s8agagsqq9193cawbcq6";
}
{
name = "mustache";
@ -44,32 +44,32 @@
{
name = "copilot";
publisher = "GitHub";
version = "1.143.601";
sha256 = "0c5zpns1agbvsb32w4d0fj2dmqyak6d1sjwip128x10zy3aymvqr";
version = "1.156.683";
sha256 = "0hks2vav7xxcrrwqrpg6lckanxh8qd0a5zzhywn72i8r18a14jl2";
}
{
name = "copilot-chat";
publisher = "GitHub";
version = "0.12.2023122001";
sha256 = "1n298nsm8zfm8hxpafbx74b881ccda7vssbwg01djk9ybivdrh1f";
version = "0.12.2024013003";
sha256 = "0k5mqhx1acf41sf2qn5fnw5icah2awvivgpqgfrkxn98b5adc2p0";
}
{
name = "go";
publisher = "golang";
version = "0.40.1";
sha256 = "0844kxbi7qi79wal0cqcd4wiygc42fyhamn33lsx2ms4yj5jxri9";
version = "0.40.3";
sha256 = "15kicpv9xpn7l3w9mbmsjdzjmavh88p3skkim0a9prg9p40bsq0m";
}
{
name = "haskell";
publisher = "haskell";
version = "2.5.1";
sha256 = "1gy2s9pzwsiwjk2b3sqn9hp3zbcg1jxbf4zl9hcqan3q6v96m7dz";
version = "2.5.2";
sha256 = "09pr3ya77ryj5n80k5srwaxmr0j77f6xp67w0kz324i6fhjd12bq";
}
{
name = "gruvbox";
publisher = "jdinhlife";
version = "1.17.0";
sha256 = "1w9h4ygvgbj71npwlkg39rsw63pdz28g2msifa1hmf4y543ii069";
version = "1.18.0";
sha256 = "07iy4649vjqif40agvp2ck9695vl1kv4zv69rn4j6hi0jra8dhg2";
}
{
name = "plantuml";
@ -110,32 +110,38 @@
{
name = "black-formatter";
publisher = "ms-python";
version = "2023.7.13471009";
sha256 = "18gdvmpnq5v6dp6v63vk43x27r1q5y8mzm516mr4rzvvgciyakqp";
version = "2023.9.10291927";
sha256 = "1alh8j35qidgmbb293ar02x5xbigqcv7khq1bp7blsffisdxdqm4";
}
{
name = "debugpy";
publisher = "ms-python";
version = "2023.3.13341008";
sha256 = "091vcjx35mq76fpd6wqhcyvp8gq3mg49n0bzbv0q6g0yaf0xhc9n";
}
{
name = "python";
publisher = "ms-python";
version = "2023.23.13541005";
sha256 = "1rir25hf09ig70py57j6aaqd12a3g16kxx8271m2q92s26ldgvpv";
version = "2023.25.10292213";
sha256 = "09r82h3px2nlkyd3h5y8p6xcz9pccayvfnrnymlkiy9n2j2889sy";
}
{
name = "vscode-pylance";
publisher = "ms-python";
version = "2023.12.101";
sha256 = "0i8gjrr5l5q9x9pd55gj4vd20fgajljiaib3qs05p9hxnqfj11xj";
version = "2024.1.102";
sha256 = "05wikxrc7bw2m71gp2n4myfqdk7gk8y474v2fhg0qrxz5hafkyx6";
}
{
name = "vscode-cljfmt";
publisher = "pedrorgirardi";
version = "1.4.0";
sha256 = "1y5mlrfk6zsb32f7nj6nlh03xa4dyrf80iyjbq167i3gvy6n0d95";
version = "1.5.0";
sha256 = "1l4v3xs10y4z9fa2nshvqwzmf3a10va37k7yq5pgp8inlg01kff5";
}
{
name = "rust-analyzer";
publisher = "rust-lang";
version = "0.4.1786";
sha256 = "12rs0yjidm1nim0abn3cwsxr1q4f74f7r0k4wjqk09chia5w5jj6";
version = "0.4.1825";
sha256 = "19yqnrxf5c8wm330g13i3vyjbabakw2ary4c6z0j74fh4f1xniz8";
}
{
name = "just";