feat(homes/rafiq): port over configs

This commit is contained in:
Mohammad Rafiq 2025-07-07 21:19:08 +08:00
parent aa06b5f6fd
commit 4c82720251
No known key found for this signature in database
15 changed files with 440 additions and 2 deletions

91
flake.lock generated
View file

@ -15,6 +15,26 @@
"type": "github"
}
},
"dedupe_flake-utils": {
"inputs": {
"systems": [
"systems"
]
},
"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"
}
},
"dedupe_gitignore": {
"inputs": {
"nixpkgs": [
@ -35,6 +55,21 @@
"type": "github"
}
},
"dedupe_mnw": {
"locked": {
"lastModified": 1748710831,
"narHash": "sha256-eZu2yH3Y2eA9DD3naKWy/sTxYS5rPK2hO7vj8tvUCSU=",
"owner": "gerg-l",
"repo": "mnw",
"rev": "cff958a4e050f8d917a6ff3a5624bc4681c6187d",
"type": "github"
},
"original": {
"owner": "gerg-l",
"repo": "mnw",
"type": "github"
}
},
"disko": {
"inputs": {
"nixpkgs": [
@ -186,6 +221,26 @@
"type": "github"
}
},
"nix-index-database": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1751774635,
"narHash": "sha256-DuOznGdgMxeSlPpUu6Wkq0ZD5e2Cfv9XRZeZlHWMd1s=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "85686025ba6d18df31cc651a91d5adef63378978",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nix-index-database",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1751637120,
@ -202,10 +257,44 @@
"type": "github"
}
},
"nvf": {
"inputs": {
"flake-parts": [
"flake-parts"
],
"flake-utils": [
"dedupe_flake-utils"
],
"mnw": [
"dedupe_mnw"
],
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1751887073,
"narHash": "sha256-M92RDGGx330MPqK2v7IRn98938Y2b1tkfe0ujD5GK70=",
"owner": "notashelf",
"repo": "nvf",
"rev": "d70c3a834061b9f24cfcc350ce2325c3bbede774",
"type": "github"
},
"original": {
"owner": "notashelf",
"repo": "nvf",
"type": "github"
}
},
"root": {
"inputs": {
"dedupe_flake-compat": "dedupe_flake-compat",
"dedupe_flake-utils": "dedupe_flake-utils",
"dedupe_gitignore": "dedupe_gitignore",
"dedupe_mnw": "dedupe_mnw",
"disko": "disko",
"files": "files",
"flake-parts": "flake-parts",
@ -214,7 +303,9 @@
"impermanence": "impermanence",
"import-tree": "import-tree",
"make-shell": "make-shell",
"nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs",
"nvf": "nvf",
"sops-nix": "sops-nix",
"systems": "systems",
"text": "text"

View file

@ -21,6 +21,9 @@
};
# impermanence provides a nice abstraction over linking files from /persist
impermanence.url = "github:nix-community/impermanence";
### FLAKE PARTS MODULES ###
# sops-nix lets us version control secrets like passwords and api keys
sops-nix = {
url = "github:Mic92/sops-nix";
@ -47,8 +50,32 @@
};
};
# The following are not used but are here for deduplication.
### PROGRAMS ###
# nix-index-database indexes the nixpkgs binaries for use with comma
nix-index-database = {
url = "github:nix-community/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
};
# nvf provides modules to wrap neovim
nvf = {
url = "github:notashelf/nvf";
inputs = {
nixpkgs.follows = "nixpkgs";
flake-parts.follows = "flake-parts";
systems.follows = "systems";
flake-utils.follows = "dedupe_flake-utils";
mnw.follows = "dedupe_mnw";
};
};
### DEDUPE ###
# The following are not used in the flake
dedupe_flake-compat.url = "github:edolstra/flake-compat";
dedupe_flake-utils = {
url = "github:numtide/flake-utils";
inputs.systems.follows = "systems";
};
dedupe_mnw.url = "github:gerg-l/mnw";
dedupe_gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";

View file

@ -0,0 +1,25 @@
{ lib }:
{
blink-cmp = {
enable = true;
friendly-snippets.enable = true;
sourcePlugins.ripgrep.enable = true;
setupOpts = {
# Disable completion in markdown files
# TODO: Disable completion when in comments
enabled =
lib.generators.mkLuaInline
# lua
''
function()
return not vim.tbl_contains({"markdown"}, vim.bo.filetype)
and vim.bo.buftype ~= "prompt"
and vim.b.completion ~= false
end
'';
completion.documentation.auto_show_delay_ms = 0;
# Show e.g. function parameters
signature.enabled = true;
};
};
}

View file

@ -0,0 +1,3 @@
{
whichKey.enable = true;
}

View file

@ -0,0 +1,34 @@
{
enableExtraDiagnostics = true;
enableFormat = true;
enableTreesitter = true;
bash.enable = true;
clang.enable = true;
csharp.enable = true;
css.enable = true;
go.enable = true;
html.enable = true;
lua.enable = true;
markdown = {
enable = true;
extensions.markview-nvim.enable = true;
format.type = "prettierd";
};
nix = {
enable = true;
format.type = "nixfmt";
lsp.server = "nil";
};
python = {
enable = true;
format.type = "ruff";
lsp.server = "pyright";
};
rust.enable = true;
rust.crates.enable = true;
ts.enable = true;
ts.extensions.ts-error-translator.enable = true;
typst.enable = true;
typst.extensions.typst-preview-nvim.enable = true;
yaml.enable = true;
}

View file

@ -0,0 +1,17 @@
{
enable = true;
# Show virtual text hints
inlayHints.enable = true;
lightbulb.enable = true;
# Show icons for lsp actions
lspkind.enable = true;
null-ls.enable = true;
otter-nvim = {
enable = true;
setupOpts = {
buffers.set_filetype = true;
buffers.write_to_disk = true;
handle_leading_whitespace = true;
};
};
}

View file

@ -0,0 +1,9 @@
{
harpoon = {
enable = true;
mappings.listMarks = "<leader>ml";
mappings.markFile = "<leader>mm";
setupOpts.defaults.save_on_toggle = true;
setupOpts.defaults.sync_on_ui_close = true;
};
}

View file

@ -0,0 +1,28 @@
{ pkgs }:
{
luasnip = {
enable = true;
setupOpts.enable_autosnippets = true;
providers = with pkgs.vimPlugins; [ vim-snippets ];
loaders = "require('luasnip.loaders.from_vscode').lazy_load()";
customSnippets.snipmate = {
nix = [
{
trigger = "mod";
description = "empty module";
body = # nix
''
{config, lib, ...}:
let
cfg = config.$1;
in
{
options.$1 = { $2 };
config = $3;
}
'';
}
];
};
};
}

View file

@ -0,0 +1,10 @@
{
lualine = {
enable = true;
refresh = {
statusline = 10;
winbar = 10;
};
#TODO: rice lualine
};
}

View file

@ -0,0 +1,16 @@
{
borders = {
enable = true;
globalStyle = "rounded";
};
breadcrumbs.enable = true;
# Show color values e.g. #ffffff
colorizer.enable = true;
# Highlight matching symbols
illuminate.enable = true;
noice.enable = true;
noice.setupOpts.notify.enabled = false;
# Make folds look nicer
nvim-ufo.enable = true;
smartcolumn.enable = true;
}

View file

@ -0,0 +1,11 @@
{
motion.hop.enable = true;
yazi-nvim = {
enable = true;
mappings = {
openYazi = "<leader>tt";
openYaziDir = "<leader>TT";
};
setupOpts.open_for_directories = true;
};
}

View file

@ -0,0 +1,7 @@
{
indent-blankline.enable = true;
fidget-nvim.enable = true;
fidget-nvim.setupOpts.notification.override_vim_notify = true;
nvim-web-devicons.enable = true;
rainbow-delimiters.enable = true;
}

150
nix/homes/rafiq/default.nix Normal file
View file

@ -0,0 +1,150 @@
{ lib, inputs, ... }:
let
inherit (lib.strings) concatStrings;
in
{
flake.homes.rafiq =
{ pkgs, ... }:
{
imports = [
inputs.nvf.homeManagerModules.default
inputs.nix-index-database.hmModules.nix-index
];
persistDirs = [
".local/share/zoxide"
"notebook"
];
xdg.configFile."aichat/config.yaml".text = ''
model: gemini:gemini-2.0-flash
clients:
- type: gemini
'';
home = {
sessionVariables = {
EDITOR = "nvim";
FETCH = "hyfetch";
FILE_BROWSER = "yazi";
SHELL = "fish";
};
shellAliases = {
fetch = "hyfetch";
windows = "sudo systemctl reboot --boot-loader-entry=auto-windows";
v = "$EDITOR";
e = "edit";
cd = "z"; # zoxide
ai = "aichat -r %shell% -e";
};
packages = with pkgs; [
fastfetch
ripgrep
aichat
(pkgs.writeShellScriptBin "note" # bash
''
zk edit -i
pushd ~/notebook > /dev/null
git add .
commit -u
popd > /dev/null
''
)
];
};
programs = {
nvf.enable = true;
nvf.settings.vim = {
syntaxHighlighting = true;
hideSearchHighlight = true;
searchCase = "ignore";
undoFile.enable = true;
telescope.enable = true;
fzf-lua.enable = true;
git.enable = true;
autopairs.nvim-autopairs.enable = true;
autocomplete = import ./_nvf/autocomplete.nix { inherit lib; };
binds = import ./_nvf/binds.nix;
languages = import ./_nvf/languages.nix;
lsp = import ./_nvf/lsp.nix;
navigation = import ./_nvf/navigation.nix;
notes.todo-comments.enable = true;
options = {
autoindent = true;
backspace = "indent,eol,start";
cursorline = true;
expandtab = true;
shiftwidth = 2;
smartindent = true;
tabstop = 2;
};
snippets = import ./_nvf/snippets.nix { inherit pkgs; };
statusline = import ./_nvf/statusline.nix;
treesitter = {
autotagHtml = true;
fold = true;
indent.disable = [ "markdown" ];
textobjects.enable = true;
};
ui = import ./_nvf/ui.nix;
utility = import ./_nvf/utility.nix;
visuals = import ./_nvf/visuals.nix;
};
zk = {
enable = true;
settings.notebook.dir = "~/notebook";
};
hyfetch = {
enable = true;
settings = {
preset = "bisexual";
mode = "rgb";
light_dark = "dark";
lightness = 0.5;
color_align = {
# Flag color alignment
mode = "horizontal";
fore_back = null;
};
backend = "fastfetch";
};
};
tealdeer.enable = true;
tealdeer.enableAutoUpdates = true;
direnv = {
enable = true;
nix-direnv.enable = true;
};
zoxide.enable = true;
nix-index.enable = true;
nix-index-database.comma.enable = true;
fzf.enable = true;
fzf.enableZshIntegration = true;
yazi = {
enable = true;
shellWrapperName = "t";
settings.mgr.sort_by = "natural";
};
fish.enable = true;
starship = {
enable = true;
settings = {
add_newline = false;
format = concatStrings [
# First Line
## Left Prompt
"$hostname$directory"
"$fill"
## Right Prompt
"$all"
# Second Line
## Left Prompt
"$character"
];
git_branch.format = "[$symbol$branch(:$remote_branch)]($style) ";
shlvl.disabled = false;
username.disabled = true;
fill.symbol = " ";
};
};
};
};
}

View file

@ -6,7 +6,12 @@
}:
let
inherit (lib.options) mkOption;
inherit (lib.types) path lazyAttrsOf raw;
inherit (lib.types)
path
lazyAttrsOf
raw
deferredModule
;
inherit (inputs.flake-parts.lib) mkSubmoduleOptions;
inherit (cfg.lib.attrsets) firstAttrNameMatching;
cfg = config.flake;
@ -29,6 +34,10 @@ in
type = lazyAttrsOf raw;
default = { };
};
homes = mkOption {
type = lazyAttrsOf deferredModule;
default = { };
};
};
config.flake = {
paths.secrets = cfg.paths.root + "/secrets";

View file

@ -18,5 +18,6 @@ in
{ config, ... }:
{
programs.${cfg.manifest.users.${config.home.username}.shell}.enable = true;
home.shell.enableShellIntegration = true;
};
}