-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 729c12c
Showing
63 changed files
with
4,042 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Set update schedule for GitHub Actions | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
# Check for updates to GitHub Actions every week | ||
interval: "weekly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: "Publish tags to FlakeHub" | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * 6" | ||
jobs: | ||
flakehub-publish: | ||
runs-on: "ubuntu-latest" | ||
permissions: | ||
id-token: "write" | ||
contents: "read" | ||
steps: | ||
- uses: "actions/checkout@v4" | ||
with: | ||
ref: "${{ (inputs.tag != null) && format('refs/tags/{0}', inputs.tag) || '' }}" | ||
- uses: "DeterminateSystems/nix-installer-action@main" | ||
- uses: "DeterminateSystems/flakehub-push@main" | ||
with: | ||
visibility: "public" | ||
name: "Ruixi-rebirth/nvim-flake" | ||
rolling: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: "push_to_cachix" | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * 6" | ||
env: | ||
CACHIX_CACHE_NAME: ruixi-rebirth | ||
jobs: | ||
push_to_cachix: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install nix | ||
uses: cachix/install-nix-action@v30 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
extra_nix_config: | | ||
experimental-features = nix-command flakes | ||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | ||
- name: Flake check | ||
run: nix flake check --all-systems | ||
- name: Setup cachix | ||
uses: cachix/cachix-action@v15 | ||
with: | ||
name: ${{ env.CACHIX_CACHE_NAME }} | ||
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}" | ||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | ||
- name: Push build results to Cachix | ||
run: nix build --json | jq -r '.[].outputs | to_entries[].value' | cachix push $CACHIX_CACHE_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: update-flake-lock | ||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "0 0 * * 5" | ||
|
||
jobs: | ||
lockfile: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install Nix | ||
uses: cachix/install-nix-action@v30 | ||
with: | ||
extra_nix_config: | | ||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | ||
- name: Update flake.lock | ||
uses: DeterminateSystems/update-flake-lock@main | ||
with: | ||
pr-title: "flake: update the lock" # Title of PR to be created | ||
pr-labels: | # Labels to be set on the PR | ||
dependencies | ||
automated | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: peter-evans/enable-pull-request-automerge@v3 | ||
with: | ||
pull-request-number: ${{ github.event.pull_request.number }} | ||
merge-method: squash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_Store | ||
/result | ||
/.pre-commit-config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
local nvim_lsp = require("lspconfig") | ||
nvim_lsp.nixd.setup({ | ||
cmd = { "nixd" }, | ||
settings = { | ||
nixd = { | ||
nixpkgs = { | ||
expr = 'import (builtins.getFlake ("git+file://" + toString ./.)).inputs.nixpkgs { }', | ||
}, | ||
formatting = { | ||
command = { "nix fmt" }, | ||
}, | ||
options = { | ||
flake_parts = { | ||
expr = 'let flake = builtins.getFlake ("git+file://" + toString ./.); in flake.debug.options // flake.currentSystem.options', | ||
}, | ||
nixvim = { | ||
expr = '(builtins.getFlake ("git+file://" + toString ./.)).packages.${builtins.currentSystem}.default.options', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
## Ruixi-rebirth'nvim | ||
|
||
My Neovim configuration uses [nixvim](https://github.com/nix-community/nixvim), with lazy loading handled by the plugin [lazy.nvim](https://github.com/folke/lazy.nvim). | ||
|
||
[](https://ruixi-rebirth.cachix.org)  | ||
|
||
### Flake Usage | ||
|
||
- Temporarily use it in the terminal: | ||
|
||
```console | ||
nix run "github:Ruixi-rebirth/nvim-flake#lazynvim" | ||
``` | ||
|
||
- Use as a package: | ||
|
||
```nix | ||
{ | ||
inputs = { | ||
nvim-flake.url = "github:Ruixi-rebirth/nvim-flake"; | ||
}; | ||
outputs = inputs: { | ||
nixosConfigurations."my-laptop-hostname" = | ||
let system = "x86_64-linux"; | ||
in nixpkgs.lib.nixosSystem { | ||
inherit system; | ||
modules = [({pkgs, config, ... }: { | ||
config = { | ||
nix.settings = { | ||
# add binary caches | ||
trusted-public-keys = [ | ||
"ruixi-rebirth.cachix.org-1:ypGqoIU9MfXwv/fE02ZGg8mutJqmcYHgLTR1DMoPGac=" | ||
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" | ||
]; | ||
substituters = [ | ||
"https://ruixi-rebirth.cachix.org" | ||
"https://cache.nixos.org" | ||
]; | ||
}; | ||
# pull specific packages (built against inputs.nixpkgs, usually `nixos-unstable`) | ||
environment.systemPackages = [ | ||
inputs.nvim-flake.packages.${system}.lazynvim | ||
]; | ||
}; | ||
})]; | ||
}; | ||
}; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ helpers, ... }: | ||
{ | ||
autoCmd = [ | ||
{ | ||
# Jump to the last edit position | ||
event = [ "BufReadPost" ]; | ||
pattern = [ "*" ]; | ||
command = '' | ||
if line("'\"") > 1 && line("'\"") <= line("$") | | ||
exe "normal! g`\"" | ||
endif | ||
''; | ||
} | ||
{ | ||
# Automatically remove trailing whitespace before saving the file | ||
event = [ "BufWritePre" ]; | ||
pattern = [ "*" ]; | ||
command = "%s/\\s\\+$//e"; | ||
} | ||
{ | ||
event = [ "FileType" ]; | ||
pattern = [ "*" ]; | ||
callback = helpers.mkRaw '' | ||
function() | ||
local util = require("lspconfig.util") | ||
local root_dir = util.find_git_ancestor(vim.fn.expand("%:p")) | ||
if root_dir then | ||
pcall(function() vim.cmd('cd ' .. root_dir) end) | ||
else | ||
local file_dir = vim.fn.expand('%:p:h') | ||
pcall(function() vim.cmd('cd ' .. file_dir) end) | ||
end | ||
end | ||
''; | ||
} | ||
{ | ||
# Save folding state | ||
event = [ "BufWinLeave" ]; | ||
pattern = [ "*" ]; | ||
callback = helpers.mkRaw '' | ||
function() | ||
pcall(function() vim.cmd("mkview") end) | ||
end | ||
''; | ||
} | ||
{ | ||
# Restore folding state | ||
event = [ "BufRead" ]; | ||
pattern = [ "*" ]; | ||
callback = helpers.mkRaw '' | ||
function() | ||
pcall(function() vim.cmd("loadview") end) | ||
end | ||
''; | ||
} | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
clipboard = { | ||
register = "unnamedplus"; | ||
providers = { | ||
wl-copy.enable = true; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
imports = [ | ||
./options.nix | ||
./clipboard.nix | ||
./keymaps.nix | ||
./autocmd.nix | ||
./extraConfigLua.nix | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
extraConfigLua = '' | ||
-- Add '-' to the list of characters considered part of a keyword | ||
vim.cmd([[set iskeyword+=-]]) | ||
-- Allow moving between lines using arrow keys and h/l when at the start/end of a line | ||
vim.cmd("set whichwrap+=<,>,[,],h,l") | ||
local util = require("lspconfig.util") | ||
local function load_project_nvim_config() | ||
local root_dir = function(fname) | ||
return util.find_git_ancestor(fname) | ||
end | ||
local current_file = vim.fn.expand("%:p") | ||
local project_root = root_dir(current_file) | ||
if project_root then | ||
local nvim_config_path = project_root .. "/.nvim.lua" | ||
if vim.loop.fs_stat(nvim_config_path) then | ||
vim.cmd("source " .. nvim_config_path) | ||
end | ||
end | ||
end | ||
load_project_nvim_config() | ||
local load_clipboard_config = function() | ||
if vim.fn.has("wsl") == 1 then | ||
vim.g.clipboard = { | ||
name = "WslClipboard", | ||
copy = { | ||
["+"] = "cb cp", | ||
["*"] = "cb cp", | ||
}, | ||
paste = { | ||
["+"] = "cb p", | ||
["*"] = "cb p", | ||
}, | ||
cache_enabled = 0, | ||
} | ||
end | ||
end | ||
load_clipboard_config() | ||
''; | ||
} |
Oops, something went wrong.