feat!: adding neovim via homemanager
💥D
This commit is contained in:
parent
0fa0933cf1
commit
42536537fa
4 changed files with 188 additions and 9 deletions
43
nixos/flake.lock
generated
43
nixos/flake.lock
generated
|
|
@ -34,6 +34,47 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1757385184,
|
||||
"narHash": "sha256-LCxtQn9ajvOgGRbQIRUJgfP7clMGGvV1SDW1HcSb0zk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "26993d87fd0d3b14f7667b74ad82235f120d986e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1757430124,
|
||||
"narHash": "sha256-MhDltfXesGH8VkGv3hmJ1QEKl1ChTIj9wmGAFfWj/Wk=",
|
||||
"owner": "nix-darwin",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "830b3f0b50045cf0bcfd4dab65fad05bf882e196",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-darwin",
|
||||
"ref": "master",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixos-wsl": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
|
|
@ -102,6 +143,8 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"home-manager": "home-manager",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nixos-wsl": "nixos-wsl",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"vscode-server": "vscode-server"
|
||||
|
|
|
|||
|
|
@ -9,9 +9,8 @@
|
|||
nix-darwin.url = "github:nix-darwin/nix-darwin/master";
|
||||
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
# for later
|
||||
# home-manager.url = "github:nix-community/home-manager";
|
||||
# home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
home-manager.url = "github:nix-community/home-manager";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = {
|
||||
|
|
@ -20,7 +19,7 @@
|
|||
vscode-server,
|
||||
nix-darwin,
|
||||
self,
|
||||
# home-manager,
|
||||
home-manager,
|
||||
...
|
||||
}: {
|
||||
nixosConfigurations = {
|
||||
|
|
@ -57,11 +56,16 @@
|
|||
darwinConfigurations."Daniel-Macbook-Air" = nix-darwin.lib.darwinSystem {
|
||||
modules = [
|
||||
./hosts/macos.nix
|
||||
# TODO: nix-darwin lacks tmux options; move to Home Manager.x
|
||||
# ./tmux.nix
|
||||
# TODO: add neovim via homemanager, that should work the same for NixOS as Nix-Darwin
|
||||
# ./neovim.nix # NOTE: Option only exists on NixOS.
|
||||
./fish.nix
|
||||
|
||||
# Home Manager on macOS
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
# Point HM to your user config (mac-only for now)
|
||||
home-manager.users.danny = import ./home/danny/home.nix;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
|||
133
nixos/home/danny/home.nix
Normal file
133
nixos/home/danny/home.nix
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
home.username = "danny";
|
||||
home.homeDirectory = "/Users/danny";
|
||||
|
||||
programs.home-manager.enable = true;
|
||||
|
||||
# Neovim (user-level, works great on macOS)
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
# extraLuaConfig is also available; we’ll keep your Vimscript as-is:
|
||||
extraConfig = ''
|
||||
set title
|
||||
set go=a
|
||||
set mouse=a
|
||||
set nohlsearch
|
||||
set number
|
||||
let mapleader=","
|
||||
|
||||
lua << EOF
|
||||
local config_file = os.getenv("HOME")..'/.local/share/nvim_color_scheme'
|
||||
local f = io.open(config_file, "r")
|
||||
if f ~= nil then
|
||||
local system_theme = f:read()
|
||||
io.close(f)
|
||||
if system_theme == 'dark' then
|
||||
vim.cmd("set bg=dark")
|
||||
elseif system_theme == 'light' then
|
||||
vim.cmd("set bg=light")
|
||||
else
|
||||
print('warning: expected value "light" or "dark"')
|
||||
print(' got:', system_theme)
|
||||
print(' expected path:', config_file)
|
||||
end
|
||||
else
|
||||
print('warning: nvim color scheme not found')
|
||||
print(' expected path:', config_file)
|
||||
end
|
||||
EOF
|
||||
|
||||
colorscheme catppuccin " catppuccin-latte, catppuccin-frappe, catppuccin-macchiato, catppuccin-mocha
|
||||
|
||||
" netrw (dir listing) settings
|
||||
let g:netrw_liststyle = 3
|
||||
let g:netrw_banner = 0
|
||||
let g:netrw_browse_split = 3
|
||||
let g:netrw_winsize = 25 " % of page
|
||||
|
||||
set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:»
|
||||
set clipboard+=unnamedplus
|
||||
|
||||
" Replace-all is aliased to S.
|
||||
nnoremap S :%s//g<Left><Left>
|
||||
|
||||
" save file with ,w
|
||||
map <leader>w :w<cr><Space>
|
||||
|
||||
" spellcheck
|
||||
set spell spelllang=en_us
|
||||
setlocal spell! spelllang=en_us
|
||||
'';
|
||||
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
vim-surround
|
||||
vim-gitgutter
|
||||
vim-nix
|
||||
vimtex
|
||||
fzf-vim
|
||||
nerdtree
|
||||
rainbow
|
||||
catppuccin-nvim
|
||||
goyo-vim
|
||||
limelight-vim
|
||||
];
|
||||
};
|
||||
|
||||
# tmux (user-level; same config on macOS and NixOS if you reuse this file)
|
||||
programs.tmux = {
|
||||
enable = true;
|
||||
# Keep portable things in extraConfig:
|
||||
extraConfig = ''
|
||||
# remap prefix from ^B to Alt-f
|
||||
unbind C-b
|
||||
set -g prefix M-f
|
||||
bind M-f send-prefix
|
||||
|
||||
# nvim 'checkhealth' advice
|
||||
set -g focus-events on
|
||||
set -sa terminal-overrides ',xterm-256color:RGB'
|
||||
set -g default-terminal "screen-256color"
|
||||
|
||||
# indices
|
||||
set -g base-index 1
|
||||
set -g pane-base-index 1
|
||||
|
||||
# sensible defaults
|
||||
set -g mouse on
|
||||
setw -g mode-keys vi
|
||||
set -g history-limit 100000
|
||||
set -g escape-time 20
|
||||
|
||||
# pane movement shortcuts
|
||||
bind h select-pane -L
|
||||
bind j select-pane -D
|
||||
bind k select-pane -U
|
||||
bind l select-pane -R
|
||||
|
||||
# window selection
|
||||
bind -r C-h select-window -t :-
|
||||
bind -r C-l select-window -t :+
|
||||
|
||||
# split with dash and vbar
|
||||
bind | split-window -h -c "#{pane_current_path}"
|
||||
bind - split-window -v -c "#{pane_current_path}"
|
||||
'';
|
||||
plugins = with pkgs.tmuxPlugins; [
|
||||
catppuccin
|
||||
tmux-fzf
|
||||
extrakto
|
||||
];
|
||||
};
|
||||
|
||||
# Put user-installed binaries here if you want HM to own them (optional)
|
||||
home.packages = with pkgs; [
|
||||
neovim
|
||||
tmux
|
||||
];
|
||||
|
||||
# First HM version for this user config; bump only if you understand the migration notes.
|
||||
home.stateVersion = "24.11";
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +64,6 @@
|
|||
fzf
|
||||
cowsay
|
||||
lolcat
|
||||
neovim
|
||||
];
|
||||
|
||||
# Keep for darwin as well (tracks defaults across upgrades)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue