Compare commits

...

7 Commits

Author SHA1 Message Date
2a395c3d3a move home manager configuration to machine 2025-11-04 13:43:16 +08:00
f4cfe371f7 Add home manager modules 2025-11-04 13:40:41 +08:00
c27291b1b9 Migrate to common module structure 2025-11-04 11:21:42 +08:00
d6fd2eca4c homebrew with nix-darwin 2025-11-03 18:56:57 +08:00
56cce6456e add keys 2025-11-03 18:56:42 +08:00
819720e8f2 add yadunut-mbp configuration 2025-11-03 18:26:27 +08:00
3a56960502 change clan source to mine 2025-11-03 17:15:49 +08:00
14 changed files with 1135 additions and 35 deletions

2
.envrc Normal file
View File

@@ -0,0 +1,2 @@
# shellcheck shell=bash
use flake

View File

@@ -13,17 +13,5 @@
# machines/jon/configuration.nix will be automatically imported. # machines/jon/configuration.nix will be automatically imported.
# See: https://docs.clan.lol/guides/more-machines/#automatic-registration # See: https://docs.clan.lol/guides/more-machines/#automatic-registration
machines = { machines = {
"yadunut-mbp" = {
nixpkgs.hostPlatform = "aarch64-darwin";
clan.core.networking.targetHost = "root@localhost";
system.stateVersion = 6;
nix.enable = false;
users.users."yadunut".openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJXOpmWsAnl2RtOuJJMRUx+iJTwf2RWJ1iS3FqXJFzFG"
];
users.users."root".openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJXOpmWsAnl2RtOuJJMRUx+iJTwf2RWJ1iS3FqXJFzFG"
];
};
}; };
} }

181
flake.lock generated
View File

@@ -14,15 +14,15 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1762113984, "lastModified": 1762192438,
"narHash": "sha256-Gwah5F3ONMhvTYbsnJM4bAv0qcaI3wjz1Nq0rBGWVgo=", "narHash": "sha256-oTP++HLxeMxzd0KDP48yD4kwqCWWFcIWWP9gQdZZewQ=",
"rev": "0f847b4799deee4a2c878ba69bda9c446fe16177", "rev": "9a05d2a072ceb07b7cc205fb035b45e380451bca",
"type": "tarball", "type": "tarball",
"url": "https://git.clan.lol/api/v1/repos/clan/clan-core/archive/0f847b4799deee4a2c878ba69bda9c446fe16177.tar.gz" "url": "https://git.yadunut.dev/api/v1/repos/yadunut/clan-core/archive/9a05d2a072ceb07b7cc205fb035b45e380451bca.tar.gz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
"url": "https://git.clan.lol/clan/clan-core/archive/main.tar.gz" "url": "https://git.yadunut.dev/yadunut/clan-core/archive/main.tar.gz"
} }
}, },
"data-mesher": { "data-mesher": {
@@ -94,6 +94,94 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nixvim",
"nixpkgs"
]
},
"locked": {
"lastModified": 1760948891,
"narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"clan-core",
"nixpkgs"
]
},
"locked": {
"lastModified": 1762183399,
"narHash": "sha256-vr2aL1QLfERYTfYBgK8cW3T9eSdSEThH462wKaGlmEU=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "a5fee077929ae2f2800c3087dce5e1abb4edfbc6",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"ixx": {
"inputs": {
"flake-utils": [
"nixvim",
"nuschtosSearch",
"flake-utils"
],
"nixpkgs": [
"nixvim",
"nuschtosSearch",
"nixpkgs"
]
},
"locked": {
"lastModified": 1754860581,
"narHash": "sha256-EM0IE63OHxXCOpDHXaTyHIOk2cNvMCGPqLt/IdtVxgk=",
"owner": "NuschtOS",
"repo": "ixx",
"rev": "babfe85a876162c4acc9ab6fb4483df88fa1f281",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"ref": "v0.1.1",
"repo": "ixx",
"type": "github"
}
},
"nix-darwin": { "nix-darwin": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@@ -156,13 +244,62 @@
"url": "https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz" "url": "https://nixos.org/channels/nixpkgs-unstable/nixexprs.tar.xz"
} }
}, },
"root": { "nixvim": {
"inputs": { "inputs": {
"clan-core": "clan-core", "flake-parts": "flake-parts_2",
"nixpkgs": [ "nixpkgs": [
"clan-core", "clan-core",
"nixpkgs" "nixpkgs"
],
"nuschtosSearch": "nuschtosSearch",
"systems": "systems_3"
},
"locked": {
"lastModified": 1762207388,
"narHash": "sha256-+FvGHB57ZuJIYbI35qcyGsxhvKdeKlX7AomVD6M5sIg=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "de1760ddfd3e67aa5d2251d7df9e6bad30c36692",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixvim",
"type": "github"
}
},
"nuschtosSearch": {
"inputs": {
"flake-utils": "flake-utils",
"ixx": "ixx",
"nixpkgs": [
"nixvim",
"nixpkgs"
] ]
},
"locked": {
"lastModified": 1761730856,
"narHash": "sha256-t1i5p/vSWwueZSC0Z2BImxx3BjoUDNKyC2mk24krcMY=",
"owner": "NuschtOS",
"repo": "search",
"rev": "e29de6db0cb3182e9aee75a3b1fd1919d995d85b",
"type": "github"
},
"original": {
"owner": "NuschtOS",
"repo": "search",
"type": "github"
}
},
"root": {
"inputs": {
"clan-core": "clan-core",
"home-manager": "home-manager",
"nixpkgs": [
"clan-core",
"nixpkgs"
],
"nixvim": "nixvim"
} }
}, },
"sops-nix": { "sops-nix": {
@@ -201,6 +338,36 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"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"
}
},
"treefmt-nix": { "treefmt-nix": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [

View File

@@ -1,6 +1,14 @@
{ {
inputs.clan-core.url = "https://git.clan.lol/clan/clan-core/archive/main.tar.gz"; inputs.clan-core.url = "https://git.yadunut.dev/yadunut/clan-core/archive/main.tar.gz";
inputs.nixpkgs.follows = "clan-core/nixpkgs"; inputs.nixpkgs.follows = "clan-core/nixpkgs";
inputs.home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "clan-core/nixpkgs";
};
inputs.nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "clan-core/nixpkgs";
};
outputs = outputs =
{ {
@@ -35,20 +43,12 @@
"aarch64-darwin" "aarch64-darwin"
"x86_64-darwin" "x86_64-darwin"
] ]
( (system: {
system:
let
pkgs = import nixpkgs { inherit system; };
in
{
default = clan-core.inputs.nixpkgs.legacyPackages.${system}.mkShell { default = clan-core.inputs.nixpkgs.legacyPackages.${system}.mkShell {
packages = [ packages = [
clan-core.packages.${system}.clan-cli clan-core.packages.${system}.clan-cli
pkgs.nil
]; ];
}; };
} });
);
}; };
} }

6
keys.nix Normal file
View File

@@ -0,0 +1,6 @@
rec {
user = {
yadunut = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJXOpmWsAnl2RtOuJJMRUx+iJTwf2RWJ1iS3FqXJFzFG";
};
users = with users; [ yadunut ];
}

View File

@@ -0,0 +1,92 @@
{
pkgs,
lib,
inputs,
...
}:
{
imports = [
inputs.home-manager.darwinModules.home-manager
../../modules/common/sane-defaults
../../modules/common/users
];
system.primaryUser = "yadunut";
nut = {
users.enable = true;
sane-defaults.enable = true;
};
# # Home Manager configuration
home-manager.useUserPackages = true;
home-manager.users.yadunut = {
imports = [
./homes/yadunut.nix
inputs.nixvim.homeModules.nixvim
];
};
nixpkgs.config.allowUnfree = true;
homebrew = {
enable = true;
onActivation.cleanup = "zap";
greedyCasks = true;
casks = [
"1password"
"1password-cli"
"calibre"
"cardhop"
"coconutbattery"
"daisydisk"
"darktable"
"datagrip"
"discord"
"fantastical"
"fastmail"
"ghostty"
"google-chrome"
"iina"
"keybase"
"kicad"
"launchcontrol"
"ledger-live"
"lens"
"logitech-g-hub"
"logseq"
"loom"
"lulu"
"obs"
"obsidian"
"protonvpn"
"raycast"
"skim"
"slack"
"spotify"
"steam"
"syncthing-app"
"tailscale"
"tailscale-app"
"telegram"
"the-unarchiver"
"transmission"
"visual-studio-code"
"whatsapp"
"xcodes-app"
"yaak"
"zen"
"zerotier-one"
"zoom"
"zotero"
];
};
fonts.packages = [ pkgs.jetbrains-mono ];
security.pam.services.sudo_local.touchIdAuth = true;
nixpkgs.hostPlatform = "aarch64-darwin";
clan.core.networking.targetHost = "root@localhost";
nix.enable = false; # since we're using nix darwin
system.stateVersion = 6;
}

View File

@@ -0,0 +1,51 @@
{
_class,
config,
lib,
pkgs,
...
}:
let
keys = import ../../../keys.nix;
config = {
nut = {
git = {
enable = true;
gpgProgram = "/Applications/1Password.app/Contents/MacOS/op-ssh-sign";
signingKey = keys.user.yadunut;
};
zsh.enable = true;
neovim.enable = true;
};
home.username = "yadunut";
home.packages = [
pkgs.entr
pkgs.jq
pkgs.just
pkgs.rsync
pkgs.codex
pkgs.dive
pkgs.cachix
pkgs.ouch
pkgs.nil
pkgs.nixd
pkgs.claude-code
pkgs.codex
pkgs.amp-cli
];
nixpkgs.config.allowUnfree = true;
programs.home-manager.enable = true;
home.stateVersion = "25.05";
};
in
{
imports = [
config
../../../modules/home/git
../../../modules/home/zsh
../../../modules/home/neovim
];
}

View File

@@ -0,0 +1,32 @@
{
_class,
lib,
config,
...
}:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.nut.sane-defaults;
nixosModule = mkIf cfg.enable { };
darwinModule = mkIf cfg.enable {
system.defaults = {
NSGlobalDomain = {
InitialKeyRepeat = 10;
KeyRepeat = 1;
AppleShowAllExtensions = true;
ApplePressAndHoldEnabled = false;
};
dock.autohide = true;
dock.autohide-delay = 0.0;
};
};
in
{
imports = [
(lib.optionalAttrs (_class == "nixos") nixosModule)
(lib.optionalAttrs (_class == "darwin") darwinModule)
];
options.nut.sane-defaults = {
enable = mkEnableOption "enable sane defaults";
};
}

View File

@@ -0,0 +1,19 @@
{
_class,
lib,
config,
...
}:
let
inherit (lib) mkIf;
cfg = config.nut.template;
nixosModule = mkIf cfg.enable { };
darwinModule = mkIf cfg.enable { };
in
{
imports = [
(lib.optionalAttrs (_class == "nixos") nixosModule)
(lib.optionalAttrs (_class == "darwin") darwinModule)
];
options.nut.template = { };
}

View File

@@ -0,0 +1,33 @@
{
_class,
lib,
config,
...
}:
let
keys = import ../../../keys.nix;
cfg = config.nut.users;
nixosModule = { };
darwinModule = {
config = lib.mkIf cfg.enable {
# Darwin user configuration
users.users."yadunut" = {
home = "/Users/yadunut";
openssh.authorizedKeys.keys = [ keys.user.yadunut ];
};
users.users."root" = {
openssh.authorizedKeys.keys = [ keys.user.yadunut ];
};
};
};
in
{
imports = [
(lib.optionalAttrs (_class == "nixos") nixosModule)
(lib.optionalAttrs (_class == "darwin") darwinModule)
];
options.nut.users = {
enable = lib.mkEnableOption "user setup";
};
}

View File

@@ -0,0 +1,141 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.nut.git;
inherit (lib) mkEnableOption mkIf mkOption;
types = lib.types;
name = "Yadunand Prem";
email = "yadunand@yadunut.com";
in
{
options.nut.git = {
enable = mkEnableOption "Git";
gpgProgram = mkOption {
default = null;
type = types.nullOr types.str;
};
signingKey = mkOption {
type = types.nullOr types.str;
default = null;
};
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
git
lazygit
jujutsu
delta
];
programs.zsh.shellAliases = {
lg = "lazygit";
js = "jj status";
jd = "jj diff";
jn = "jj new";
jf = "jj git fetch";
jp = "jj git push";
};
programs.delta = {
enable = true;
enableGitIntegration = true;
};
programs.git = {
ignores = [
".DS_Store"
".direnv/"
".envrc"
"**/.claude/settings.local.json"
];
enable = true;
lfs.enable = true;
settings = lib.mkMerge [
{
init = {
defaultBranch = "main";
defaultRefFormat = "files";
};
user = {
email = email;
name = name;
};
pull = {
rebase = true;
autostash = true;
};
push = {
autoSetupRemote = true;
followTags = true;
};
commit = {
gpgsign = true;
verbose = true;
};
diff = {
# merge.conflictstyle = "zdiff2";
colorMoved = true;
algorithm = "histogram";
mnemonicPrefix = true;
};
feature.experimental = true;
branch.sort = "committerdate";
fetch.all = true;
column.ui = "auto";
tags.sort = "version:refname";
rerere = {
enabled = true;
autoupdate = true;
};
rebase = {
autostash = true;
autosquash = true;
updateRefs = true;
};
credential = {
helper = [
"${pkgs.git-credential-oauth}/bin/git-credential-oauth"
];
"https://git.yadunut.dev" = {
oauthClientId = "a4792ccc-144e-407e-86c9-5e7d8d9c3269";
oauthScopes = "read:repository write:repository";
oauthAuthURL = "/login/oauth/authorize";
oauthTokenURL = "/login/oauth/access_token";
};
};
gpg.format = "ssh";
}
(mkIf (cfg.gpgProgram != null) { gpg.ssh.program = cfg.gpgProgram; })
(mkIf (cfg.signingKey != null) { user.signingkey = "key::${cfg.signingKey}"; })
];
};
programs.jujutsu = {
enable = true;
settings = {
user = {
name = name;
email = email;
};
aliases = {
tug = [
"bookmark"
"move"
"--from"
"heads(::@- & bookmarks())"
"--to"
"@-"
];
};
ui.default-command = "log";
};
};
programs.gh.enable = true;
};
}

View File

@@ -0,0 +1,461 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.nut.neovim;
inherit (lib) mkEnableOption mkIf mkOption;
in
{
options.nut.neovim = {
enable = mkEnableOption "Neovim";
nix.enable = mkOption {
default = true;
description = "Enable nix related vim packages";
type = lib.types.bool;
};
performance.enable = mkOption {
default = false;
description = "Enable performance options";
type = lib.types.bool;
};
};
config = mkIf cfg.enable {
home.sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
programs.nixvim = {
enable = true;
performance = mkIf cfg.performance.enable {
combinePlugins.enable = true;
byteCompileLua = {
enable = true;
nvimRuntime = true;
plugins = true;
};
};
defaultEditor = true;
colorschemes.gruvbox.enable = true;
plugins = {
flash.enable = true;
oil.enable = true;
neogit.enable = true;
image = {
enable = true;
settings = {
backend = "kitty";
};
};
lsp = {
enable = true;
servers = {
# gleam.enable = true;
ts_ls.enable = true; # TS/JS
biome.enable = true; # TS/JS
pyright.enable = true; # Python
ruff.enable = true; # python
nixd = mkIf cfg.nix.enable {
enable = true;
extraOptions.settings.nixd = {
formatting.command = "nixfmt";
};
};
cssls.enable = true;
jsonls.enable = true;
html.enable = true;
tinymist.enable = true;
gopls.enable = true;
texlab = {
enable = true;
settings = {
texlab.build = {
executable = "tectonic";
args = [
"-X"
"compile"
"%f"
"--synctex"
"--keep-logs"
"--keep-intermediates"
];
};
};
};
};
keymaps.lspBuf = {
gd = {
action = "definition";
desc = "Goto Definition";
};
gr = {
action = "references";
desc = "Goto References";
};
gD = {
action = "declaration";
desc = "Goto Declaration";
};
gI = {
action = "implementation";
desc = "Goto Implementation";
};
gT = {
action = "type_definition";
desc = "Type Definition";
};
K = {
action = "hover";
desc = "Hover";
};
"<leader>rn" = {
action = "rename";
desc = "Rename";
};
};
keymaps.extra = [
{
action.__raw = "vim.lsp.buf.code_action";
key = "<leader>la";
}
{
action.__raw = "function() vim.lsp.buf.format { async = true } end";
key = "<leader>lf";
}
];
keymaps.diagnostic = {
"<leader>cd" = {
action = "open_float";
desc = "Line Diagnostics";
};
"[d" = {
action = "goto_next";
desc = "Next Diagnostic";
};
"]d" = {
action = "goto_prev";
desc = "Previous Diagnostic";
};
};
};
trouble.enable = true;
cmp = {
enable = true;
autoEnableSources = true;
settings = {
sources = [
{ name = "nvim_lsp"; }
{ name = "nvim_lua"; }
# {name = "emoji";}
{
name = "buffer";
option.get_bufnrs.__raw = "vim.api.nvim_list_bufs";
keywordLength = 3;
}
{
name = "path";
keywordLength = 3;
}
{
name = "luasnip";
keywordLength = 3;
}
];
window = {
# completion = { border = "solid"; };
# documentation = { border = "solid"; };
};
mapping = {
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-e>" = "cmp.mapping.abort()";
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<S-CR>" = "cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true })";
};
};
};
cmp-nvim-lsp.enable = true;
cmp-nvim-lua.enable = true;
cmp-buffer.enable = true;
cmp-path.enable = true;
cmp_luasnip.enable = true;
cmp-cmdline.enable = true;
nvim-tree = {
enable = true;
settings = {
view.side = "right";
update_focused_file.enable = true;
};
};
friendly-snippets.enable = true;
luasnip = {
enable = true;
settings = {
enable_autosnippets = true;
store_selection_keys = "<Tab>";
};
fromVscode = [
{
lazyLoad = true;
paths = "${pkgs.vimPlugins.friendly-snippets}";
}
];
};
bufferline.enable = true;
treesitter = {
enable = true;
folding = true;
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
bash
json
lua
make
markdown
nix
regex
toml
vim
vimdoc
xml
yaml
javascript
go
typescript
];
settings = {
highlight.enable = true;
indent.enable = true;
};
};
treesitter-context.enable = true;
treesitter-textobjects = {
enable = true;
settings.move = {
enable = true;
gotoNextStart = {
"]m" = {
query = "@function.outer";
};
"]]" = {
query = "@class.outer";
desc = "Next class start";
};
"]o" = {
query = "@loop.*";
};
"]s" = {
query = "@scope";
queryGroup = "locals";
desc = "Next scope";
};
"]z" = {
query = "@fold";
queryGroup = "folds";
desc = "Next fold";
};
};
gotoNextEnd = {
"]M" = {
query = "@function.outer";
};
"][" = {
query = "@class.outer";
};
};
gotoPreviousStart = {
"[m" = {
query = "@function.outer";
};
"[[" = {
query = "@class.outer";
};
};
gotoPreviousEnd = {
"[M" = {
query = "@function.outer";
};
"[]" = {
query = "@class.outer";
};
};
gotoNext = {
"]d" = {
query = "@conditional.outer";
};
};
gotoPrevious = {
"[d" = {
query = "@conditional.outer";
};
};
};
};
ts-autotag.enable = true;
which-key.enable = true;
telescope = {
enable = true;
extensions.fzf-native.enable = true;
settings = {
defaults = {
mappings = {
i = {
"<C-t>".__raw = "require('trouble.sources.telescope').open";
};
n = {
"<C-t>".__raw = "require('trouble.sources.telescope').open";
};
};
};
};
};
web-devicons.enable = true;
overseer = {
enable = true;
};
};
opts = {
number = true;
relativenumber = true;
signcolumn = "yes";
updatetime = 250;
undofile = true;
ignorecase = true;
smartcase = true;
swapfile = false;
foldlevel = 9;
smartindent = true;
tabstop = 2;
shiftwidth = 2;
softtabstop = 0;
expandtab = true;
smarttab = true;
scrolloff = 5;
termguicolors = true;
foldmethod = lib.mkForce "expr";
foldexpr = lib.mkForce "v:lua.vim.treesitter.foldexpr()";
};
globals = {
mapleader = " ";
maplocalleader = " ";
};
keymaps = [
{
action = ":";
key = ";";
mode = [ "n" ];
}
# { action = "gj"; key = "j"; mode = [ "n" ]; }
# { action = "gk"; key = "k"; mode = [ "n" ]; }
{
action = "<Esc>";
key = "jk";
mode = [ "i" ];
}
{
action = "<cmd>Telescope find_files<CR>";
key = "<leader><leader>";
options.desc = "Find Files";
}
{
action.__raw = "function() require('telescope.builtin').lsp_document_symbols({symbols='method'}) end";
key = "<leader>fm";
options.desc = "Find Methods";
}
{
action = "<cmd>Telescope live_grep<CR>";
key = "<leader>fg";
options.desc = "Grep";
}
{
action = "<cmd>Telescope buffers<CR>";
key = "<leader>fb";
options.desc = "Find Buffers";
}
{
action = "<cmd>Telescope buffers<CR>";
key = "<leader>fb";
options.desc = "Find Buffers";
}
{
action = "<cmd>Telescope projects<CR>";
key = "<leader>pp";
options.desc = "Switch Projects";
}
{
action = "<cmd>Trouble diagnostics toggle<CR>";
key = "<leader>tr";
}
{
action = "<cmd>Neogit<CR>";
key = "<leader>gg";
options.desc = "Open Git";
}
{
action = "<cmd>NvimTreeToggle<CR>";
key = "<leader>tt";
options.desc = "Tree View";
}
{
action.__raw = "function() require('flash').jump() end";
key = "s";
mode = [
"n"
"x"
"o"
];
options.desc = "Flash";
}
{
action.__raw = "function() require('flash').treesitter() end";
key = "S";
mode = [
"n"
"x"
"o"
];
options.desc = "Flash Treesitter";
}
{
action.__raw = "function() require('flash').remote() end";
key = "r";
mode = [ "o" ];
options.desc = "Remote Flash";
}
{
action.__raw = "function() require('flash').treesitter_search() end";
key = "R";
mode = [ "o" ];
options.desc = "Treesitter Search";
}
{
action.__raw = "function() require('flash').toggle() end";
key = "<c-s>";
mode = [ "c" ];
options.desc = "Toggle Flash";
}
];
};
};
}

View File

@@ -0,0 +1,93 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.nut.zsh;
inherit (lib) mkEnableOption mkIf;
in
{
options.nut.zsh = {
enable = mkEnableOption "Zsh";
};
config = mkIf cfg.enable {
home.packages = with pkgs; [
zsh-completions
fd
ripgrep
wget
delta
];
programs = {
bat = {
enable = true;
};
dircolors = {
enable = true;
enableZshIntegration = true;
};
direnv = {
enable = true;
enableZshIntegration = true;
nix-direnv.enable = true;
config = {
hide_env_diff = true;
};
};
zsh = {
enable = true;
enableCompletion = true;
syntaxHighlighting.enable = true;
autosuggestion.enable = true;
autocd = true;
history = {
size = 1000000;
extended = true;
append = true;
expireDuplicatesFirst = true;
ignoreDups = true;
ignoreAllDups = true;
ignoreSpace = true;
};
historySubstringSearch.enable = true;
shellAliases = {
cat = "bat --theme=\"$(defaults read -globalDomain AppleInterfaceStyle &> /dev/null && echo 'gruvbox-dark' || echo 'gruvbox-light')\"";
diff = "delta";
};
profileExtra = builtins.readFile ./functions.zsh;
};
fzf = {
enable = true;
enableZshIntegration = true;
};
zoxide = {
enable = true;
enableZshIntegration = true;
};
eza = {
enable = true;
enableZshIntegration = true;
extraOptions = [ "--group-directories-first" ];
};
starship = {
enable = true;
enableZshIntegration = true;
settings = {
nodejs.disabled = true;
package.disabled = true;
aws.disabled = true;
python.disabled = true;
};
};
nix-your-shell = {
enable = true;
enableZshIntegration = true;
};
};
};
}

View File

@@ -0,0 +1,15 @@
# helper function to crop cs3223 slides
crop_slides() {
input="$1"
if [ -z "$input" ]; then
echo "Usage: crop_slides <inputfile>"
return 1
fi
# Get base name (without extension)
base="${input%.*}"
output="${base}-slides.mp4"
# Crop left 2/3 of a 1280x640 video (≈853 px wide)
nix run "nixpkgs#ffmpeg" -- -i "$input" -filter:v "crop=853:640:0:0" -c:a copy "$output"
}