Compare commits

...

7 Commits

Author SHA1 Message Date
Abhinav Sarkar 063505ee8c Adds nix-darwin 2024-01-31 09:54:29 +05:30
Abhinav Sarkar 96a3d38fcd 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 16:25:51 +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
Abhinav Sarkar 626324703b flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/07c322a7cff03267fd881adae1afe63367c5d608' (2023-12-22)
  → 'github:nix-community/home-manager/2aff324cf65f5f98f89d878c056b779466b17db8' (2023-12-29)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/2b9c57d33e3d5be6262e124fc66e3a8bc650b93d' (2023-12-20)
  → 'github:nixos/nixpkgs/e1fa12d4f6c6fe19ccb59cac54b5b3f25e160870' (2023-12-25)
2023-12-29 22:02:12 +05:30
Abhinav Sarkar a2fffeeacd Modifies VSCode settings 2023-12-14 09:07:10 +05:30
Abhinav Sarkar bf4beceaf1 Fixes report-hm-change script 2023-12-09 12:14:27 +05:30
Abhinav Sarkar cf0350ad6d flake.lock: Update
Flake lock file updates:

• Updated input 'home-manager':
    'github:nix-community/home-manager/e1f3b36ab01573fd35cae57d21f45d520433df61' (2023-11-24)
  → 'github:nix-community/home-manager/ac7216918cd65f3824ba7817dea8f22e61221eaf' (2023-12-04)
2023-12-09 12:14:11 +05:30
9 changed files with 140 additions and 79 deletions

6
configuration.nix Normal file
View File

@ -0,0 +1,6 @@
{ pkgs, inputs, ... }:
{
imports = [./nix.nix];
system.stateVersion = 4;
security.pam.enableSudoTouchIdAuth = true;
}

View File

@ -35,11 +35,11 @@
"fish-plugin-fzf": {
"flake": false,
"locked": {
"lastModified": 1699637473,
"narHash": "sha256-lxQZo6APemNjt2c21IL7+uY3YVs81nuaRUL7NDMcB6s=",
"lastModified": 1704317914,
"narHash": "sha256-5cO5Ey7z7KMF3vqQhIbYip5JR6YiS2I9VPRd6BOmeC8=",
"owner": "PatrickF1",
"repo": "fzf.fish",
"rev": "46c7bc6354494be5d869d56a24a46823a9fdded0",
"rev": "e5d54b93cd3e096ad6c2a419df33c4f50451c900",
"type": "github"
},
"original": {
@ -71,11 +71,11 @@
]
},
"locked": {
"lastModified": 1700814342,
"narHash": "sha256-orNc5wfsE7arQ9TWSTJwvk+utDvJrJ36V84N8o+VI/Y=",
"lastModified": 1706001011,
"narHash": "sha256-J7Bs9LHdZubgNHZ6+eE/7C18lZ1P6S5/zdJSdXFItI4=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "e1f3b36ab01573fd35cae57d21f45d520433df61",
"rev": "3df2a80f3f85f91ea06e5e91071fa74ba92e5084",
"type": "github"
},
"original": {
@ -101,19 +101,39 @@
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1700795494,
"narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d",
"type": "github"
},
"original": {
"owner": "LnL7",
"repo": "nix-darwin",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1700755841,
"narHash": "sha256-W3zJkGdMtQoGUJcqYnLIii/Zvv2Y3w6UGNbDtkP4vqc=",
"lastModified": 1705883077,
"narHash": "sha256-ByzHHX3KxpU1+V0erFy8jpujTufimh6KaS/Iv3AciHk=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e8b0430bc4c4235607ae102010dec2ba32e8c0ca",
"rev": "5f5210aa20e343b7e35f40c033000db0ef80d7b9",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"rev": "e8b0430bc4c4235607ae102010dec2ba32e8c0ca",
"rev": "5f5210aa20e343b7e35f40c033000db0ef80d7b9",
"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

@ -2,7 +2,11 @@
description = "Home Manager configuration of Abhinav Sarkar";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?rev=e8b0430bc4c4235607ae102010dec2ba32e8c0ca";
nixpkgs.url = "github:nixos/nixpkgs?rev=5f5210aa20e343b7e35f40c033000db0ef80d7b9";
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,33 @@
};
};
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
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,11 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, ... }:
{
imports = [ ./programs ./scripts ./launchd.nix ./nix.nix ];
imports = [ ./programs ./scripts ./launchd.nix ];
home = {
username = "abhinav";
homeDirectory = "/Users/abhinav";
homeDirectory = lib.mkForce "/Users/abhinav";
stateVersion = "22.05";
enableNixpkgsReleaseCheck = true;
@ -23,7 +23,6 @@
sessionVariables = {
EDITOR = "micro";
NIX_PATH = "$HOME/.hm-nixchannels";
};
file."Applications/Home Manager Apps".source = let

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,21 @@ _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 > \
{{ root_dir }}/programs/vscode/extensions.nix
_update: _update-vscode-extensions && _switch
_update: && _switch
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 packages and switch
update: (_run "_update")

48
nix.nix
View File

@ -1,19 +1,35 @@
{ 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;
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

@ -139,7 +139,10 @@ in {
window.autoDetectColorScheme = true;
workbench = {
activityBar.visible = false;
activityBar = {
visible = false;
location = "hidden";
};
colorTheme = "Gruvbox Dark Hard";
editor.highlightModifiedTabs = true;
preferredDarkColorTheme = "Gruvbox Dark Hard";

View File

@ -14,14 +14,14 @@
{
name = "markdown-mermaid";
publisher = "bierner";
version = "1.20.0";
sha256 = "0g9xrssiw06rik0pz1kpv1smllxvnjfw50207gj70xnlvlxvpqjy";
version = "1.21.0";
sha256 = "1ix0l8h1g32yn65nsc1sja7ddh42y5wdxbr7w753zdqyx04rs8v3";
}
{
name = "vscode-markdownlint";
publisher = "DavidAnson";
version = "0.52.0";
sha256 = "0pi1vr86hmf26v6zcaaa2dhb38fcs557ihy39yrzq9rgs5qa9jk3";
version = "0.53.0";
sha256 = "1jd2bgzmk11jgv897605ibfl38lr0yssmic6yv6mrrwcgvmrg402";
}
{
name = "mustache";
@ -44,32 +44,32 @@
{
name = "copilot";
publisher = "GitHub";
version = "1.138.566";
sha256 = "0anhwjj4pbc1pw3hjzhb2wb5s4g3vd6k206h47cgd3gnl1pjq9m7";
version = "1.153.669";
sha256 = "11qy0ksv8baym7ds7j6qmggr0l41bfacd3sy6niypxn33iad01mv";
}
{
name = "copilot-chat";
publisher = "GitHub";
version = "0.11.2023112401";
sha256 = "1xbv5imhxxf1cnqpp2m4b2wm753yjhx0vw3mydhs08cghz26zckw";
version = "0.12.2024012301";
sha256 = "18px2wnlb8vrh2fy0c413m0s57bkqcjmciv35bzfmi5grp5h6gwx";
}
{
name = "go";
publisher = "golang";
version = "0.40.0";
sha256 = "1k2zv49pam436cgvb970dc9n4xpdkd07lp8jllrsx5vnx7m2ml52";
version = "0.40.3";
sha256 = "15kicpv9xpn7l3w9mbmsjdzjmavh88p3skkim0a9prg9p40bsq0m";
}
{
name = "haskell";
publisher = "haskell";
version = "2.5.0";
sha256 = "1dnqw3mkzdfqaqy11ygl3cwnfjm30k5dazldl4pqgb7mw11n32as";
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.13171007";
sha256 = "0kqwbv0v550icz6dvfxp19bk0yj017wyh4n6l7x27src9lkff833";
version = "2023.9.10231018";
sha256 = "104ng2sl8pdi011pqbwdlp6b3xpkj6mfs9d5jcw099y9m18h5s3w";
}
{
name = "debugpy";
publisher = "ms-python";
version = "2023.3.13341008";
sha256 = "091vcjx35mq76fpd6wqhcyvp8gq3mg49n0bzbv0q6g0yaf0xhc9n";
}
{
name = "python";
publisher = "ms-python";
version = "2023.21.13261010";
sha256 = "0bhn5jqr54nvkf7hb25x2g4wigbx7rf9a2fcg6frspgd6jl8lkj8";
version = "2023.25.10221012";
sha256 = "14bkvlflib4wky6lw1hq0i01ymzf5349cl4d9minaam2lq0451i0";
}
{
name = "vscode-pylance";
publisher = "ms-python";
version = "2023.11.13";
sha256 = "1ayy4pp983j8fwgjffv0cy39anhl2ai1n4a4c84ngj0si18y7k0a";
version = "2023.12.104";
sha256 = "07hh0x4z255xswcwd0dkyridpaxsbfnrna9hhbqiiz50vf4grzjx";
}
{
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.1744";
sha256 = "0a23w8jszsiw135znl9dh1pn5vjb3mbnc5h8n77w1vmmim2cy0sb";
version = "0.4.1817";
sha256 = "1nj3cw4nhan7gh04f91z09rh14l37zq6yjjvxqjw2ylvfjrz0klr";
}
{
name = "just";
@ -158,8 +164,8 @@
{
name = "shellcheck";
publisher = "timonwong";
version = "0.34.0";
sha256 = "0b833lyvklkad1zvcvg141lr7qkrnjq0yca7fjsgwajfx4n8vwim";
version = "0.35.0";
sha256 = "0bnrad3s66nv0kqlrzq8wfw9jycn7vj80nwq8f4l171l14j5c7jj";
}
{
name = "sort-lines";

View File

@ -1,13 +1,13 @@
{ config, pkgs, ... }:
let
profiles = "/nix/var/nix/profiles/per-user/${config.home.username}/home-manager-*-link";
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 [ $(ls -d1v ${profiles} 2>/dev/null | wc -l) -lt 2 ]; then
if [ $(/bin/ls -d1v ${profiles} 2>/dev/null | wc -l) -lt 2 ]; then
echo "Skipping changes report..."
else
${pkgs.nvd}/bin/nvd diff $(ls -d1v ${profiles} | tail -2)
${pkgs.nvd}/bin/nvd diff $(/bin/ls -d1v ${profiles} | tail -2)
fi
''