improve notes workflow and macOS shell setup

This commit is contained in:
Rasyidan Akbar F. 2026-09-03 15:38:56 +07:00
commit 55390ebcde
5 changed files with 83 additions and 21 deletions

29
flake.lock generated
View file

@ -42,15 +42,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1784665499, "lastModified": 1788011267,
"narHash": "sha256-9BMxlTxCCDAeoNLtb1a/st7udtTIJep+wpUzquA29VU=", "narHash": "sha256-mEq2kU+ljompTToZ44Afvm7d/rHJ5iMBl0tjZuyShJs=",
"owner": "nix-community", "owner": "Mic92",
"repo": "bun2nix", "repo": "bun2nix",
"rev": "0f2a1f0b6f42cebe3b149bf62d38754c5e0e9729", "rev": "5765b0614591f75ee8ba5596e81ae85c167d1071",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "Mic92",
"ref": "fix-structured-attrs-hook",
"repo": "bun2nix", "repo": "bun2nix",
"type": "github" "type": "github"
} }
@ -106,11 +107,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1787559586, "lastModified": 1788450739,
"narHash": "sha256-onL0VLf9vPllmT0H/OlURIU5r5t5WIEl7t4tVNKT0Nw=", "narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "9d0d87172c374f89da73c1cfe6d81ae62feac1f1", "rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -223,11 +224,11 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1788063845, "lastModified": 1788684345,
"narHash": "sha256-SdJE2vyoZJr+8iOoau7UDZAKD2hRhi51LYSBCDthiHM=", "narHash": "sha256-+3tYyzbgr5LdaqPDQ9tHM1JuXx7DVQqZH8MeQ7ooStI=",
"owner": "numtide", "owner": "numtide",
"repo": "llm-agents.nix", "repo": "llm-agents.nix",
"rev": "b7e6d6d4cb01ee1bc704db8e11629adec7e2509c", "rev": "76e610601903fd31e82b996b28a49c6d1adb559c",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -329,11 +330,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1787424095, "lastModified": 1788549839,
"narHash": "sha256-dWLO5AHhKaw6rdWCtTes8hnntT1r0/J5yhQGm0f0ZgU=", "narHash": "sha256-kOrCcSIA6w9J1hX5DqHy2k9pDTJymExTsbV74U9UtCA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "174eb786fb68e3a13e4e535a3deea479a0c07a6a", "rev": "17de0b976395537756f30a3e78f2f06e5cec89ed",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -52,16 +52,27 @@
XDG_CACHE_HOME = "$HOME/.cache"; XDG_CACHE_HOME = "$HOME/.cache";
}; };
users.users.${user} = { users.users.${user}.home = lib.mkDefault "/Users/${user}";
home = lib.mkDefault "/Users/${user}";
# Use the macOS system Zsh as the login shell. Nushell remains available as `nu`.
shell = "/bin/zsh";
};
system = { system = {
primaryUser = user; primaryUser = user;
stateVersion = 6; stateVersion = 6;
# nix-darwin does not manage an existing primary user unless the user is in
# users.knownUsers. Manage only the login shell to avoid owning the account.
activationScripts.postActivation.text = lib.mkAfter ''
current_shell=$(
/usr/bin/dscl . -read ${lib.escapeShellArg "/Users/${user}"} UserShell 2>/dev/null \
| /usr/bin/awk '{ print $2 }' \
|| true
)
if [ "$current_shell" != "/bin/zsh" ]; then
echo "setting ${user}'s login shell to /bin/zsh..." >&2
/usr/bin/dscl . -create ${lib.escapeShellArg "/Users/${user}"} UserShell /bin/zsh
fi
'';
defaults = { defaults = {
NSGlobalDomain = { NSGlobalDomain = {
ApplePressAndHoldEnabled = false; ApplePressAndHoldEnabled = false;

View file

@ -22,6 +22,7 @@
pyright pyright
nodePackages.typescript-language-server nodePackages.typescript-language-server
mdx-language-server mdx-language-server
harper # Grammar checking for Markdown and text
rust-analyzer rust-analyzer
gopls gopls
clang-tools # provides clangd clang-tools # provides clangd

View file

@ -13,6 +13,31 @@ local function last_line(value)
return output:match("([^\r\n]+)$") return output:match("([^\r\n]+)$")
end end
local function first_matching_line(value, pattern)
for line in (value or ""):gmatch("[^\r\n]+") do
local candidate = vim.trim(line)
if candidate:match(pattern) then
return candidate
end
end
end
local function first_actionable_line(value)
for line in (value or ""):gmatch("[^\r\n]+") do
local candidate = vim.trim(line)
if candidate ~= "" and not candidate:match("^%$ ") and not candidate:match('^error: script ".-" exited') then
return candidate
end
end
end
local function command_error(result)
return first_matching_line(result.stdout, "^ERROR%s")
or first_actionable_line(result.stderr)
or first_actionable_line(result.stdout)
or "Notes command failed."
end
local function run(arguments, options) local function run(arguments, options)
options = options or {} options = options or {}
@ -39,8 +64,7 @@ local function run(arguments, options)
}, },
vim.schedule_wrap(function(result) vim.schedule_wrap(function(result)
if result.code ~= 0 then if result.code ~= 0 then
local message = last_line(result.stderr) or last_line(result.stdout) or "Notes command failed." notify(command_error(result), vim.log.levels.ERROR)
notify(message, vim.log.levels.ERROR)
return return
end end

View file

@ -106,6 +106,31 @@ return {
lspconfig.mdx_analyzer.setup({ lspconfig.mdx_analyzer.setup({
capabilities = capabilities, capabilities = capabilities,
}) })
-- Harper grammar checking for prose. Keep the profile quiet so it does
-- not enforce capitalization, spelling, sentence length, or house style.
lspconfig.harper_ls.setup({
capabilities = capabilities,
filetypes = { "markdown", "text" },
settings = {
["harper-ls"] = {
diagnosticSeverity = "hint",
linters = {
AvoidContractions = false,
AvoidCurses = false,
Cant = false,
CapitalizePersonalPronouns = false,
GoogleNames = false,
LongSentences = false,
OrthographicConsistency = false,
OxfordComma = false,
SentenceCapitalization = false,
SpellCheck = false,
UseTitleCase = false,
},
},
},
})
end, end,
}, },
} }