Initial NixOS + Home Manager config for aspire-laptop

This commit is contained in:
sam
2026-01-05 22:01:55 +11:00
parent ea45405814
commit 735f19049d
39 changed files with 1009 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
sam/nixos
Host: aspire-laptop
- NixOS 25.11 (flakes)
- Home Manager 25.11
- Plasma 6 + Hyprland via SDDM
- Btrfs root, zram swap
- zsh + kitty
- Neovim config in home/sam/nvim (lazy.nvim downloads plugins, pinned by lazy-lock.json)
Install:
- Boot NixOS 25.11 Graphical ISO
- Run scripts/install-from-iso.sh (wipes disk)
- Clone this repo into /mnt/etc/nixos
- Replace hosts/aspire-laptop/hardware-configuration.nix with generated one
- nixos-install --flake /mnt/etc/nixos#aspire-laptop

31
flake.nix Normal file
View File

@@ -0,0 +1,31 @@
{
description = "sam: NixOS + Home Manager config (aspire-laptop)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
home-manager.url = "github:nix-community/home-manager/release-25.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{ self, nixpkgs, home-manager }:
let
system = "x86_64-linux";
in
{
nixosConfigurations.aspire-laptop = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/aspire-laptop/configuration.nix
home-manager.nixosModules.home-manager
({ ... }: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.sam = import ./home/sam/home.nix;
})
];
};
};
}

72
home/sam/home.nix Normal file
View File

@@ -0,0 +1,72 @@
{ pkgs, ... }:
{
home.username = "sam";
home.homeDirectory = "/home/sam";
home.stateVersion = "25.11";
programs.home-manager.enable = true;
home.sessionVariables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
};
programs.starship = {
enable = true;
enableZshIntegration = true;
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
programs.atuin = {
enable = true;
enableZshIntegration = true;
};
programs.kitty.enable = true;
programs.git.enable = true;
programs.gh.enable = true;
# Neovim Option 1: keep your config + lazy.nvim (downloads plugins),
# but Nix provides all the runtime deps (node/python/rg/fd/etc).
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
withNodeJs = true;
withPython3 = true;
};
home.packages = with pkgs; [
nodejs
python3
python3Packages.pynvim
ripgrep
fd
wl-clipboard
xclip
];
# Hyprland minimal config so it is usable immediately
xdg.configFile."hypr/hyprland.conf".source = ./../sam/hypr/hyprland.conf;
# Neovim config stored in this repo
xdg.configFile."nvim".source = ./nvim;
}

View File

@@ -0,0 +1,15 @@
$mod = SUPER
monitor = ,preferred,auto,1
exec-once = kitty
bind = $mod, RETURN, exec, kitty
bind = $mod, E, exec, dolphin
bind = $mod, Q, killactive
bind = $mod, M, exit
bind = $mod, H, movefocus, l
bind = $mod, J, movefocus, d
bind = $mod, K, movefocus, u
bind = $mod, L, movefocus, r

2
home/sam/nvim/init.lua Normal file
View File

@@ -0,0 +1,2 @@
require("sam.options")
require("sam.lazy")

View File

@@ -0,0 +1,42 @@
{
"Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" },
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
"avante.nvim": { "branch": "main", "commit": "ca95e0386433da2077184719886fa658257261a3" },
"catppuccin": { "branch": "main", "commit": "234fc048de931a0e42ebcad675bf6559d75e23df" },
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
"conform.nvim": { "branch": "master", "commit": "cde4da5c1083d3527776fee69536107d98dae6c9" },
"dracula.nvim": { "branch": "main", "commit": "ae752c13e95fb7c5f58da4b5123cb804ea7568ee" },
"dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" },
"everforest-nvim": { "branch": "main", "commit": "557bce922401e247a596583679bc181d4d688554" },
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"live-preview.nvim": { "branch": "main", "commit": "a1bb1b3a851df5276e53908276f5ae1d724d4812" },
"lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" },
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
"nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" },
"nvim-dap": { "branch": "master", "commit": "b38f7d30366d9169d0a623c4c85fbcf99d8d58bb" },
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
"nvim-lint": { "branch": "master", "commit": "2536f1b18ea389e6b078b3a47a5e273c74a46a34" },
"nvim-lspconfig": { "branch": "master", "commit": "cc3d02065593d74b2fa7c0ff337c3e8b087fd788" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-tree.lua": { "branch": "master", "commit": "1eda2569394f866360e61f590f1796877388cb8a" },
"nvim-treesitter": { "branch": "main", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
"onedark.nvim": { "branch": "master", "commit": "6c10964f91321c6a0f09bcc41dd64e7a6602bc4f" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"tabular": { "branch": "master", "commit": "12437cd1b53488e24936ec4b091c9324cafee311" },
"telescope-themes": { "branch": "main", "commit": "65721365bd7a04a6c9679e76b6387b60320fd5f3" },
"telescope.nvim": { "branch": "master", "commit": "3a12a853ebf21ec1cce9a92290e3013f8ae75f02" },
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
"vim-markdown": { "branch": "master", "commit": "1bc9d0cd8e1cc3e901b0a49c2b50a843f1c89397" },
"vimtex": { "branch": "master", "commit": "32bcb3922c20588e00de68f73c86312eda2141ad" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
}

View File

@@ -0,0 +1 @@
vim.cmd("colorscheme kanagawa-wave")

View File

@@ -0,0 +1,17 @@
-- ~/.config/nvim/lua/sam/lazy.lua
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
-- Tell lazy to load our plugin specs from the "plugins" directory
require("lazy").setup("sam.plugins", {})

View File

@@ -0,0 +1,92 @@
-- ~/.config/nvim/lua/sam/options.lua
vim.g.mapleader = " " -- Set the leader key to the space bar.
vim.g.maplocalleader = " " -- Set the local leader key to the space bar.
-- sam.options.lua
vim.opt.number = true -- Absolute numbers on all lines
vim.opt.relativenumber = true -- Relative numbers (hybrid when both enabled)
-- ===================================================================
-- Clipboard Settings (Added)
-- ===================================================================
-- Sync with system clipboard
vim.opt.clipboard = "unnamedplus"
-- OSC 52 Support for SSH (Copy from Remote Nvim -> Local Computer)
if vim.env.SSH_TTY then
vim.g.clipboard = {
name = 'OSC 52',
copy = {
['+'] = require('vim.ui.clipboard.osc52').copy('+'),
['*'] = require('vim.ui.clipboard.osc52').copy('*'),
},
paste = {
['+'] = require('vim.ui.clipboard.osc52').paste('+'),
['*'] = require('vim.ui.clipboard.osc52').paste('*'),
},
}
end
-- ===================================================================
-- Search Settings
-- ===================================================================
vim.opt.hlsearch = true -- Highlight all matches on search
vim.opt.incsearch = true -- Show search results incrementally as you type
vim.opt.ignorecase = true -- Ignore case in search patterns
vim.opt.smartcase = true -- Override ignorecase if search pattern contains uppercase letters
-- ===================================================================
-- Essential Keybindings
-- ===================================================================
-- Set a timeout for which-key to respond (in milliseconds)
vim.opt.timeoutlen = 300
-- A helper function to make setting keymaps easier
local keymap = function(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
vim.api.nvim_create_autocmd("BufWritePost", {
group = vim.api.nvim_create_augroup("VimtexCompile", { clear = true }),
pattern = "*.tex",
callback = function()
vim.cmd("VimtexCompile")
end,
})
-- --- General ---
-- Save the current file
keymap("n", "<leader>w", ":w<CR>", { desc = "Write (Save) File" })
-- Quit the current buffer/window
keymap("n", "<leader>q", ":q<CR>", { desc = "Quit Window" })
-- --- Window Management (Splits) ---
-- Split window vertically
keymap("n", "<leader>sv", "<C-w>v", { desc = "Split Vertically" })
-- Split window horizontally
keymap("n", "<leader>sh", "<C-w>s", { desc = "Split Horizontally" })
-- --- Navigation Between Splits ---
-- Move to the window below/above/left/right
keymap("n", "<C-j>", "<C-w>j", { desc = "Move to Window Below" })
keymap("n", "<C-k>", "<C-w>k", { desc = "Move to Window Above" })
keymap("n", "<C-h>", "<C-w>h", { desc = "Move to Window Left" })
keymap("n", "<C-l>", "<C-w>l", { desc = "Move to Window Right" })
-- --- Buffer Navigation ---
-- Go to the next buffer
keymap("n", "<S-l>", ":bnext<CR>", { desc = "Next Buffer" })
-- Go to the previous buffer
keymap("n", "<S-h>", ":bprevious<CR>", { desc = "Previous Buffer" })
vim.keymap.set({'n', 'i', 'v'}, '<F14>', '<C-V>', { desc = 'Enter Visual Block' })
vim.keymap.set({'n', 'i'}, '<F15>', 'V', { desc = 'Enter Visual Line' })

View File

@@ -0,0 +1,7 @@
return {
"windwp/nvim-autopairs",
event = "InsertEnter",
config = function()
require("nvim-autopairs").setup({})
end,
}

View File

@@ -0,0 +1,70 @@
return {
"yetone/avante.nvim",
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-lua/plenary.nvim",
"stevearc/dressing.nvim",
"MunifTanjim/nui.nvim",
"folke/which-key.nvim", -- For keymaps
},
event = "VeryLazy",
config = function()
require("avante").setup({
provider = "openai",
providers = {
openai = {
api_key_name = "OPENAI_API_KEY",
endpoint = "https://api.openai.com/v1",
model = "gpt-4o-mini", -- Your paid model
timeout = 30000,
extra_request_body = {
temperature = 0.1,
max_completion_tokens = 8192,
},
},
},
behaviour = {
auto_suggestions = true, -- Inline completion
auto_set_highlight_group = true, -- Hints on hover
auto_apply_diff_after_generation = false, -- No auto-insert
},
mappings = {
normal = {
["gq"] = "AvanteAsk",
},
insert = {
["<C-g>"] = "AvanteToggleAutoSuggestions",
},
visual = {
["gq"] = "AvanteAsk",
},
},
hints = { enabled = true },
})
-- Your keymap style
local keymap = function(mode, lhs, rhs, opts)
local options = { noremap = true, silent = true }
if opts then options = vim.tbl_extend("force", options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
keymap("n", "<leader>ai", ":AvanteAsk<CR>", { desc = "Avante Chat" })
keymap("v", "<leader>ae", ":<C-U>AvanteAsk explain simply<CR>", { desc = "Explain Selected" })
keymap("v", "<leader>af", ":<C-U>AvanteAsk fix: optimize<CR>", { desc = "Fix Selected" })
keymap("i", "<C-Space>", "<cmd>AvanteToggleAutoSuggestions<CR>", { desc = "Toggle Inline" })
-- Which-key
vim.schedule(function()
local status_ok, wk = pcall(require, "which-key")
if status_ok then
wk.add({
{ "<leader>a", group = "AI (Avante)" },
{ "<leader>ai", "<cmd>AvanteAsk<CR>", desc = "Open Chat", mode = "n" },
{ "<leader>ae", desc = "Explain Selected", mode = "v" },
{ "<leader>af", desc = "Fix Selected", mode = "v" },
})
end
end)
end,
}

View File

@@ -0,0 +1,39 @@
-- ~/.config/nvim/lua/sam/plugins/cmp.lua
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-nvim-lsp", -- Source for LSP completions
"hrsh7th/cmp-buffer", -- Source for buffer completions
"hrsh7th/cmp-path", -- Source for path completions
"L3MON4D3/LuaSnip", -- Snippet engine
"saadparwaiz1/cmp_luasnip", -- Bridge for snippet engine
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
["<C-k>"] = cmp.mapping.select_prev_item(), -- Previous item
["<C-j>"] = cmp.mapping.select_next_item(), -- Next item
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-Space>"] = cmp.mapping.complete(), -- Trigger completion
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Confirm selection
}),
-- The sources for completion
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
}),
})
end,
}

View File

@@ -0,0 +1,11 @@
-- ~/.config/nvim/lua/sam/plugins/colorscheme.lua
return {
"catppuccin/nvim",
name = "catppuccin",
priority = 1000, -- Make sure to load this before all the other start plugins
config = function()
-- load the colorscheme here
vim.cmd.colorscheme("catppuccin")
end,
}

View File

@@ -0,0 +1,6 @@
return {
"numToStr/Comment.nvim",
config = function()
require("Comment").setup()
end,
}

View File

@@ -0,0 +1,20 @@
return {
"mfussenegger/nvim-dap",
dependencies = {
-- Installs the beautiful UI for DAP
"rcarriga/nvim-dap-ui",
-- Required by dap-ui
"nvim-neotest/nvim-nio",
},
config = function()
local dap, dapui = require("dap"), require("dapui")
dapui.setup()
-- Add your keymaps for debugging here
vim.keymap.set("n", "<Leader>db", dap.toggle_breakpoint, { desc = "Toggle Breakpoint" })
vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Continue" })
vim.keymap.set("n", "<Leader>do", dap.step_over, { desc = "Step Over" })
vim.keymap.set("n", "<Leader>di", dap.step_into, { desc = "Step Into" })
vim.keymap.set("n", "<Leader>du", dapui.toggle, { desc = "Toggle DAP UI" })
end,
}

View File

@@ -0,0 +1,14 @@
-- ~/.config/nvim/lua/sam/plugins/filetree.lua
return {
"nvim-tree/nvim-tree.lua",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("nvim-tree").setup({})
-- A keymap to toggle the file tree
vim.keymap.set("n", "<leader>e", ":NvimTreeToggle<CR>", {
desc = "Toggle file explorer",
})
end,
}

View File

@@ -0,0 +1,34 @@
-- ~/.config/nvim/lua/sam/plugins/formatter.lua
return {
"stevearc/conform.nvim",
config = function()
require("conform").setup({
formatters_by_ft = {
-- Web
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
html = { "prettier" },
css = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
sh = { "shfmt" }, -- << ADD THIS LINE
bash = { "shfmt" }, -- << AND THIS ONE
-- PHP
php = { "pint" },
-- Python
python = { "black" },
-- Lua (for our config)
lua = { "stylua" },
},
})
-- A keymap to trigger formatting
vim.keymap.set({ "n", "v" }, "<leader>f", function()
require("conform").format({ async = true, lsp_fallback = true })
end, { desc = "Format code" })
end,
}

View File

@@ -0,0 +1,17 @@
-- ~/.config/nvim/lua/sam/plugins/gitsigns.lua
return {
"lewis6991/gitsigns.nvim",
config = function()
require("gitsigns").setup({
-- You can configure the signs here if you want
-- signs = {
-- add = { text = '+' },
-- change = { text = '~' },
-- delete = { text = '_' },
-- topdelete = { text = '‾' },
-- changedelete = { text = '~' },
-- },
})
end,
}

View File

@@ -0,0 +1,5 @@
-- ~/.config/nvim/lua/sam/plugins/icons.lua
return {
"nvim-tree/nvim-web-devicons",
}

View File

@@ -0,0 +1,16 @@
return {
"mfussenegger/nvim-lint",
event = "VeryLazy",
config = function()
require("lint").linters_by_ft = {
-- You can add your languages here. Examples:
-- javascript = { "eslint_d" },
-- python = { "ruff" },
}
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
callback = function()
require("lint").try_lint()
end,
})
end,
}

View File

@@ -0,0 +1,97 @@
-- ~/.config/nvim/lua/sam/plugins/lsp.lua (emmet-ls for HTML Tag Completion + No Warning)
return {
"neovim/nvim-lspconfig",
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/nvim-cmp",
},
config = function()
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local on_attach = function(client, bufnr)
-- LSP keymaps
local nmap = function(keys, func, desc)
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = "LSP: " .. desc })
end
nmap("gD", vim.lsp.buf.declaration, "Go to Declaration")
nmap("gd", vim.lsp.buf.definition, "Go to Definition")
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
nmap("<leader>rn", vim.lsp.buf.rename, "Rename Symbol")
nmap("<leader>ca", vim.lsp.buf.code_action, "Code Action")
end
require("mason").setup()
-- ADDING THE NEW LSP SERVERS HERE (emmet_ls replaces html for better tags)
local servers = {
"intelephense", -- PHP
"pyright", -- Python
"ts_ls", -- TS/JS
"clangd", -- C++
"lua_ls", -- Lua
"emmet_ls", -- HTML/CSS (for tag completion/snippets)
"jsonls", -- JSON
"yamlls", -- YAML
"marksman", -- Markdown
"bashls",
}
local mason_lspconfig = require("mason-lspconfig")
mason_lspconfig.setup({
ensure_installed = servers,
handlers = {
-- Global handler using new vim.lsp.config API (no global lspconfig require)
function(server_name)
vim.lsp.config(server_name, {
on_attach = on_attach,
capabilities = capabilities,
root_dir = function(fname)
if type(fname) ~= "string" then
return vim.fn.getcwd()
end
local util = require("lspconfig.util")
return util.root_pattern(".git", "composer.json", "package.json")(fname)
or util.path.dirname(fname)
end,
})
end,
},
})
-- emmet-ls Specific Setup (for HTML/CSS tag completion + snippets)
vim.lsp.config("emmet_ls", {
on_attach = on_attach,
capabilities = vim.tbl_deep_extend("force", capabilities, {
textDocument = {
completion = {
completionItem = {
snippetSupport = true, -- Enables <div> → <div></div> + Emmet expansions
},
},
},
}),
filetypes = { "html", "css", "javascriptreact", "typescriptreact" }, -- Broad for web files
root_dir = function(fname)
if type(fname) ~= "string" then
return vim.fn.getcwd()
end
local util = require("lspconfig.util")
return util.root_pattern(".git", "package.json")(fname)
or util.path.dirname(fname)
end,
init_options = {
html = {
options = {
["bem.enabled"] = true, -- Optional: BEM naming support
},
completions = true,
format = true,
extractColors = true,
includeLanguages = {
javascript = "javascriptreact",
},
},
},
})
end,
}

View File

@@ -0,0 +1,9 @@
-- ~/.config/nvim/lua/sam/plugins/lualine.lua
return {
"nvim-lualine/lualine.nvim",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("lualine").setup({})
end,
}

View File

@@ -0,0 +1,75 @@
return {
-- Enhanced Markdown editing (only for .md)
{
"godlygeek/tabular",
ft = "markdown",
},
{
"plasticboy/vim-markdown",
ft = "markdown",
dependencies = { "godlygeek/tabular" },
config = function()
-- Core settings
vim.g.vim_markdown_folding_disabled = 0
vim.g.vim_markdown_conceal = 1
vim.g.vim_markdown_toc_autofit = 1
vim.g.vim_markdown_strikethrough = 1
-- Prose-friendly wrapping + Pandoc exports (MD only)
vim.api.nvim_create_autocmd("FileType", {
pattern = "markdown",
callback = function()
-- Wrapping
vim.opt_local.wrap = true
vim.opt_local.linebreak = true
vim.opt_local.list = false
-- HTML preview/export
vim.keymap.set("n", "<leader>mh", function()
local input = vim.fn.expand("%")
local output = "/tmp/" .. vim.fn.fnamemodify(input, ":t:r") .. ".html"
vim.fn.system("pandoc " .. vim.fn.shellescape(input) .. " -o " .. vim.fn.shellescape(output) .. " --standalone --self-contained")
vim.fn.system("open " .. vim.fn.shellescape(output))
end, { desc = "Markdown to HTML Preview", buffer = true })
-- PDF export
vim.keymap.set("n", "<leader>mp", function()
local input = vim.fn.expand("%")
local output = vim.fn.fnamemodify(input, ":r") .. ".pdf"
vim.fn.system("pandoc " .. vim.fn.shellescape(input) .. " -o " .. vim.fn.shellescape(output) .. " --pdf-engine=pdflatex")
end, { desc = "Markdown to PDF", buffer = true })
-- TOC preview
vim.keymap.set("n", "<leader>mt", ":!pandoc % --toc -o /tmp/toc.html && open /tmp/toc.html<CR>", { desc = "Generate TOC Preview", buffer = true })
end,
})
end,
},
-- Live browser preview (MD + HTML)
{
"brianhuster/live-preview.nvim",
dependencies = { "nvim-telescope/telescope.nvim" },
ft = { "markdown", "html" }, -- Load for both
lazy = false,
opts = {
usage_title = "Usage: <leader>lp to start preview",
picker_title = "Select file to preview",
templates = { -- Basic MD render (for .md); HTML serves raw
md = {
command = "pandoc % -o /tmp/preview.html --standalone --self-contained", -- Use Pandoc for MD
extension = "html"
},
html = {
command = "echo 'Serving raw HTML'", -- No-op; serves file directly
extension = "html"
}
},
debounce = 300, -- Refresh delay post-save
},
keys = {
{ "<leader>lp", "<cmd>LivePreview start<cr>", desc = "Start Live Preview", ft = { "markdown", "html" } },
{ "<leader>ls", "<cmd>LivePreview stop<cr>", desc = "Stop Live Preview", ft = { "markdown", "html" } },
},
},
}

View File

@@ -0,0 +1,17 @@
-- ~/.config/nvim/lua/sam/plugins/mason-tools.lua
return {
"williamboman/mason.nvim",
opts = {
ensure_installed = {
-- Formatters
"html-ls",
"prettier", -- For web files
"pint", -- For PHP/Laravel
"black", -- For Python
"shfmt",
-- Linters (optional but recommended)
"eslint_d", -- For JS/TS
},
},
}

View File

@@ -0,0 +1,3 @@
return {
"andrewberty/telescope-themes",
}

View File

@@ -0,0 +1,21 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
-- This section is unchanged
local builtin = require("telescope.builtin")
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Find files" })
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Live grep" })
-- ADD THIS LINE to load the new extension
require("telescope").load_extension("themes")
vim.keymap.set("n", "<leader>f", builtin.find_files, { desc = "Find files" })
vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Find files" })
vim.keymap.set("n", "<leader>fg", builtin.live_grep, { desc = "Live grep" })
-- ADD THIS LINE to create the new keymap
vim.keymap.set("n", "<leader>th", "<cmd>Telescope themes<cr>", { desc = "Switch Theme" })
end,
}

View File

@@ -0,0 +1,8 @@
return {
"catppuccin/nvim",
name = "catppuccin",
priority = 1000, -- Make sure this theme is loaded first
config = function()
-- You can add custom settings here if you like
end,
}

View File

@@ -0,0 +1 @@
return { "Mofiqul/dracula.nvim" }

View File

@@ -0,0 +1 @@
return { "neanias/everforest-nvim" }

View File

@@ -0,0 +1 @@
return { "ellisonleao/gruvbox.nvim" }

View File

@@ -0,0 +1 @@
return { "rebelot/kanagawa.nvim" }

View File

@@ -0,0 +1 @@
return { "navarasu/onedark.nvim" }

View File

@@ -0,0 +1 @@
return { "folke/tokyonight.nvim" }

View File

@@ -0,0 +1,36 @@
-- ~/.config/nvim/lua/sam/plugins/treesitter.lua
return {
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate", -- Installs and updates parsers
config = function()
require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all"
ensure_installed = {
"c",
"cpp",
"lua",
"vim",
"vimdoc",
"python",
"javascript",
"typescript",
"tsx",
"html",
"css",
"json",
"php",
},
-- Install parsers synchronously (only applied on startup)
sync_install = false,
-- Automatically install missing parsers when entering buffer
auto_install = true,
highlight = {
enable = true,
},
})
end,
}

View File

@@ -0,0 +1,15 @@
-- In your plugins configuration file
return {
-- ... other plugins
{
"lervag/vimtex",
lazy = false, -- Or ft = "tex" to load it only for tex files
config = function()
-- Use Zathura as the PDF viewer
vim.g.vimtex_view_method = "zathura"
end,
},
-- ... other plugins
}

View File

@@ -0,0 +1,9 @@
return {
"folke/which-key.nvim",
config = function()
require("which-key").setup({
-- your configuration comes here
-- or leave it empty to use the default settings
})
end,
}

View File

@@ -0,0 +1,132 @@
{ pkgs, ... }:
{
imports = [
./hardware-configuration.nix
];
nixpkgs.config.allowUnfree = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
networking.hostName = "aspire-laptop";
networking.networkmanager.enable = true;
time.timeZone = "Australia/Melbourne";
i18n.defaultLocale = "en_AU.UTF-8";
console.useXkbConfig = true;
services.xserver.enable = true;
services.xserver.xkb.layout = "au";
services.displayManager.sddm.enable = true;
services.displayManager.sddm.wayland.enable = true;
services.desktopManager.plasma6.enable = true;
programs.hyprland.enable = true;
programs.hyprland.xwayland.enable = true;
xdg.portal.enable = true;
xdg.portal.extraPortals = with pkgs; [
xdg-desktop-portal-hyprland
xdg-desktop-portal-gtk
xdg-desktop-portal-kde
];
security.polkit.enable = true;
programs.dconf.enable = true;
services.libinput.enable = true;
services.pipewire.enable = true;
services.pipewire.pulse.enable = true;
services.pipewire.alsa.enable = true;
services.pipewire.alsa.support32Bit = true;
security.rtkit.enable = true;
zramSwap.enable = true;
services.tailscale.enable = true;
programs.zsh.enable = true;
users.defaultUserShell = pkgs.zsh;
users.users.sam = {
isNormalUser = true;
description = "sam";
extraGroups = [
"wheel"
"networkmanager"
"audio"
"video"
];
shell = pkgs.zsh;
};
environment.systemPackages = with pkgs; [
# Browsers / editors
google-chrome
vscode
thunderbird
# KDE apps (Plasma includes Dolphin usually, but we pin it)
kdePackages.dolphin
# Base tools
git
curl
wget
jq
# CLI tools you listed
atuin
zellij
starship
fzf
ripgrep
fd
bat
btop
zoxide
eza
yazi
tealdeer
navi
dua
lazygit
gh
borgbackup
# Terminal
kitty
# Clipboard
wl-clipboard
xclip
# Neovim + build deps for treesitter/etc.
neovim
gcc
gnumake
unzip
# Markdown / LaTeX (small)
pandoc
texlive.combined.scheme-small
latexmk
zathura
zathura-pdf-mupdf
];
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.configurationLimit = 20;
networking.firewall.enable = true;
system.stateVersion = "25.11";
}

View File

@@ -0,0 +1,7 @@
{ modulesPath, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
}

47
scripts/install-from-iso.sh Executable file
View File

@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -euo pipefail
DISK="${DISK:-/dev/sda}"
echo "About to WIPE: ${DISK}"
lsblk "${DISK}" || true
read -r -p 'Type WIPE to continue: ' CONFIRM
if [ "${CONFIRM}" != "WIPE" ]; then
echo "Aborted."
exit 1
fi
wipefs -a "${DISK}"
parted -s "${DISK}" mklabel gpt
parted -s "${DISK}" mkpart ESP fat32 1MiB 513MiB
parted -s "${DISK}" set 1 esp on
parted -s "${DISK}" mkpart primary btrfs 513MiB 100%
EFI_PART="${DISK}1"
ROOT_PART="${DISK}2"
mkfs.fat -F 32 "${EFI_PART}"
mkfs.btrfs -f "${ROOT_PART}"
mount "${ROOT_PART}" /mnt
btrfs subvolume create /mnt/@
btrfs subvolume create /mnt/@home
umount /mnt
mount -o subvol=@,compress=zstd,noatime "${ROOT_PART}" /mnt
mkdir -p /mnt/home
mount -o subvol=@home,compress=zstd,noatime "${ROOT_PART}" /mnt/home
mkdir -p /mnt/boot/efi
mount "${EFI_PART}" /mnt/boot/efi
nixos-generate-config --root /mnt
echo
echo "Partitioning done."
echo "Generated /mnt/etc/nixos/hardware-configuration.nix"
echo "Next steps:"
echo "1) Put your flake repo at /mnt/etc/nixos (clone it there)."
echo "2) Copy /mnt/etc/nixos/hardware-configuration.nix into:"
echo " /mnt/etc/nixos/hosts/aspire-laptop/hardware-configuration.nix"
echo "3) Run: nixos-install --flake /mnt/etc/nixos#aspire-laptop"