Compare commits
4 commits
c23de0c990
...
45766ad724
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45766ad724 | ||
|
|
0645376730 | ||
|
|
df8b80a2c0 | ||
|
|
6edf5ecdfc |
12
flake.lock
12
flake.lock
|
|
@ -717,11 +717,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1757230583,
|
"lastModified": 1762951919,
|
||||||
"narHash": "sha256-4uqu7sFPOaVTCogsxaGMgbzZ2vK40GVGMfUmrvK3/LY=",
|
"narHash": "sha256-ma/xMEGf4J6n/RdZFdxXBJUQhP53HVEPQOC6Dp2TrkQ=",
|
||||||
"owner": "Jovian-Experiments",
|
"owner": "Jovian-Experiments",
|
||||||
"repo": "Jovian-NixOS",
|
"repo": "Jovian-NixOS",
|
||||||
"rev": "fc3960e6c32c9d4f95fff2ef84444284d24d3bea",
|
"rev": "3d248f6e8f877218dd2573fef8925ac997889922",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -1446,11 +1446,11 @@
|
||||||
},
|
},
|
||||||
"unstable": {
|
"unstable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1758690382,
|
"lastModified": 1762844143,
|
||||||
"narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=",
|
"narHash": "sha256-SlybxLZ1/e4T2lb1czEtWVzDCVSTvk9WLwGhmxFmBxI=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "e643668fd71b949c53f8626614b21ff71a07379d",
|
"rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
39
flake.nix
39
flake.nix
|
|
@ -213,6 +213,8 @@
|
||||||
"steam"
|
"steam"
|
||||||
"steam-original"
|
"steam-original"
|
||||||
"steam-runtime"
|
"steam-runtime"
|
||||||
|
"steamdeck-hw-theme"
|
||||||
|
"steam-jupiter-unwrapped"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
overlays = [
|
overlays = [
|
||||||
|
|
@ -335,25 +337,26 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
deck = unstable.lib.nixosSystem rec {
|
# new version of unstable has many changes I couldn't be bothered to deal with rn
|
||||||
specialArgs = { inherit inputs self; };
|
#deck = unstable.lib.nixosSystem rec {
|
||||||
system = "x86_64-linux";
|
# specialArgs = { inherit inputs self; };
|
||||||
pkgs = deckPkgsFor.${system};
|
# system = "x86_64-linux";
|
||||||
modules = [
|
# pkgs = deckPkgsFor.${system};
|
||||||
./hosts/deck
|
# modules = [
|
||||||
|
# ./hosts/deck
|
||||||
# jovian.nixosModules.default
|
# jovian.nixosModules.default
|
||||||
self.nixosModules.wireguard
|
# self.nixosModules.wireguard
|
||||||
agenix.nixosModules.age
|
# agenix.nixosModules.age
|
||||||
self.nixosModules.backup
|
# self.nixosModules.backup
|
||||||
home-manager.nixosModules.home-manager
|
# home-manager.nixosModules.home-manager
|
||||||
{
|
# {
|
||||||
nix.registry.nixpkgs.flake = unstable;
|
# nix.registry.nixpkgs.flake = unstable;
|
||||||
home-manager.useGlobalPkgs = true;
|
# home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
# home-manager.useUserPackages = true;
|
||||||
home-manager.users.anish = import ./home/gui;
|
# home-manager.users.anish = import ./home/gui;
|
||||||
}
|
# }
|
||||||
];
|
# ];
|
||||||
};
|
#};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Darwin configuration entrypoint
|
# Darwin configuration entrypoint
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,10 @@
|
||||||
# GPG configuration for user session
|
# GPG configuration for user session
|
||||||
services.gpg-agent = {
|
services.gpg-agent = {
|
||||||
enable = true;
|
enable = true;
|
||||||
pinentry.package = pkgs.pinentry-rofi; # Use rofi for consistency with desktop theme
|
pinentryPackage = pkgs.pinentry-curses;
|
||||||
enableSshSupport = true;
|
enableSshSupport = true;
|
||||||
defaultCacheTtl = 28800; # 8 hours
|
defaultCacheTtl = 28800; # 8 hours
|
||||||
maxCacheTtl = 86400; # 24 hours
|
maxCacheTtl = 86400; # 24 hours
|
||||||
extraConfig = ''
|
|
||||||
pinentry-program ${pkgs.writeShellScript "pinentry-rofi-themed" ''
|
|
||||||
exec ${pkgs.pinentry-rofi}/bin/pinentry-rofi -theme ~/.config/rofi/theme/passmenu.rasi "$@"
|
|
||||||
''}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.gpg = {
|
programs.gpg = {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@
|
||||||
bat
|
bat
|
||||||
fd
|
fd
|
||||||
ncdu
|
ncdu
|
||||||
du-dust
|
dust
|
||||||
# dia-cli
|
# dia-cli
|
||||||
duf
|
duf
|
||||||
trash-cli
|
trash-cli
|
||||||
|
|
@ -64,6 +64,7 @@
|
||||||
taskwarrior-tui
|
taskwarrior-tui
|
||||||
# vimwiki-cli
|
# vimwiki-cli
|
||||||
zk
|
zk
|
||||||
|
unstable.opencode
|
||||||
|
|
||||||
(pkgs.writeScriptBin "jq-repl" ''
|
(pkgs.writeScriptBin "jq-repl" ''
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
@ -310,7 +311,7 @@
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
cd ~/usr/helm && sudo darwin-rebuild switch --impure --flake ".#Anishs-MacBook-Pro" && cd $OLDPWD
|
cd ~/usr/helm && sudo darwin-rebuild switch --impure --flake ".#Anishs-MacBook-Pro" && cd $OLDPWD
|
||||||
else
|
else
|
||||||
cd /tmp && sudo nixos-rebuild switch --flake --impure '/home/anish/usr/helm#curve' && cd $OLDPWD
|
cd /tmp && sudo nixos-rebuild switch --impure --flake '/home/anish/usr/helm#curve' && cd $OLDPWD
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
nrt = "cd /tmp; sudo nixos-rebuild test --flake '/home/anish/usr/helm#curve'; cd $OLDPWD";
|
nrt = "cd /tmp; sudo nixos-rebuild test --flake '/home/anish/usr/helm#curve'; cd $OLDPWD";
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,8 @@
|
||||||
userEmail = "anish+git@lakhwara.com";
|
userEmail = "anish+git@lakhwara.com";
|
||||||
delta.enable = true;
|
delta.enable = true;
|
||||||
signing = {
|
signing = {
|
||||||
signByDefault = true;
|
signByDefault = if pkgs.stdenv.isLinux then false else true;
|
||||||
key = "7FC5DF072EF7B716";
|
key = if pkgs.stdenv.isLinux then "B8492C8FB53397B7" else "7FC5DF072EF7B716";
|
||||||
};
|
};
|
||||||
|
|
||||||
ignores = [
|
ignores = [
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib, pkgs, ... }:
|
{ pkgs, lib, config, ... }:
|
||||||
let
|
let
|
||||||
customPlugins = {
|
customPlugins = {
|
||||||
vim-zettel = pkgs.vimUtils.buildVimPlugin {
|
vim-zettel = pkgs.vimUtils.buildVimPlugin {
|
||||||
|
|
@ -11,16 +11,6 @@ let
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
amp-nvim = pkgs.vimUtils.buildVimPlugin {
|
|
||||||
name = "amp-nvim";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "sourcegraph";
|
|
||||||
repo = "amp.nvim";
|
|
||||||
rev = "main";
|
|
||||||
sha256 = "Sm/SQEIZlnqu/sD+MhZzgGm3bf+HnADOOimZ2Q++MXU=";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
my-lspsaga = pkgs.vimUtils.buildVimPlugin {
|
my-lspsaga = pkgs.vimUtils.buildVimPlugin {
|
||||||
name = "lspsaga.nvim";
|
name = "lspsaga.nvim";
|
||||||
src = pkgs.fetchFromGitHub {
|
src = pkgs.fetchFromGitHub {
|
||||||
|
|
@ -144,6 +134,9 @@ in
|
||||||
syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
|
syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Private mode plugin for concealing buffer content (out of store symlink for live editing)
|
||||||
|
home.file.".config/nvim/lua/private-mode.lua".source = config.lib.file.mkOutOfStoreSymlink "${toString ./.}/private-mode.lua";
|
||||||
|
|
||||||
#environment.systemPackages = with customPlugins; [ tidal ];
|
#environment.systemPackages = with customPlugins; [ tidal ];
|
||||||
programs.neovim = {
|
programs.neovim = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -495,6 +488,10 @@ in
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- private mode
|
||||||
|
-- Setup private mode
|
||||||
|
require('private-mode').setup({ keymap = '<leader>pm' })
|
||||||
|
|
||||||
local luasnip = require("luasnip")
|
local luasnip = require("luasnip")
|
||||||
local lspkind = require("lspkind")
|
local lspkind = require("lspkind")
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
|
|
@ -856,21 +853,6 @@ in
|
||||||
require("which-key").setup{}
|
require("which-key").setup{}
|
||||||
require('leap').set_default_keymaps()
|
require('leap').set_default_keymaps()
|
||||||
|
|
||||||
${lib.optionalString (customPlugins.amp-nvim != null) ''
|
|
||||||
-- Setup amp.nvim
|
|
||||||
require('amp').setup({
|
|
||||||
auto_start = true,
|
|
||||||
log_level = "info",
|
|
||||||
completion_enabled = true
|
|
||||||
})
|
|
||||||
-- require('amp.completion').setup({
|
|
||||||
-- keymaps = {
|
|
||||||
-- accept = "<C-y>",
|
|
||||||
-- dismiss = "<C-n>",
|
|
||||||
-- }
|
|
||||||
-- })
|
|
||||||
''}
|
|
||||||
|
|
||||||
-- supercollider
|
-- supercollider
|
||||||
local scnvim = require 'scnvim'
|
local scnvim = require 'scnvim'
|
||||||
local map = scnvim.map
|
local map = scnvim.map
|
||||||
|
|
@ -1074,67 +1056,6 @@ in
|
||||||
}):find()
|
}):find()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Setup amp.nvim
|
|
||||||
require('amp').setup({
|
|
||||||
auto_start = true,
|
|
||||||
log_level = "info"
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Amp commands
|
|
||||||
vim.api.nvim_create_user_command("AmpSend", function(opts)
|
|
||||||
local message = opts.args
|
|
||||||
if message == "" then
|
|
||||||
print("Please provide a message to send")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local amp_message = require("amp.message")
|
|
||||||
amp_message.send_message(message)
|
|
||||||
end, {
|
|
||||||
nargs = "*",
|
|
||||||
desc = "Send a message to Amp",
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("AmpSendBuffer", function(opts)
|
|
||||||
local buf = vim.api.nvim_get_current_buf()
|
|
||||||
local lines = vim.api.nvim_buf_get_lines(buf, 0, -1, false)
|
|
||||||
local content = table.concat(lines, "\n")
|
|
||||||
local amp_message = require("amp.message")
|
|
||||||
amp_message.send_message(content)
|
|
||||||
end, {
|
|
||||||
nargs = "?",
|
|
||||||
desc = "Send current buffer contents to Amp",
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("AmpPromptSelection", function(opts)
|
|
||||||
local lines = vim.api.nvim_buf_get_lines(0, opts.line1 - 1, opts.line2, false)
|
|
||||||
local text = table.concat(lines, "\n")
|
|
||||||
local amp_message = require("amp.message")
|
|
||||||
amp_message.send_to_prompt(text)
|
|
||||||
end, {
|
|
||||||
range = true,
|
|
||||||
desc = "Add selected text to Amp prompt",
|
|
||||||
})
|
|
||||||
|
|
||||||
vim.api.nvim_create_user_command("AmpPromptRef", function(opts)
|
|
||||||
local bufname = vim.api.nvim_buf_get_name(0)
|
|
||||||
if bufname == "" then
|
|
||||||
print("Current buffer has no filename")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local relative_path = vim.fn.fnamemodify(bufname, ":.")
|
|
||||||
local ref = "@" .. relative_path
|
|
||||||
if opts.line1 ~= opts.line2 then
|
|
||||||
ref = ref .. "#L" .. opts.line1 .. "-" .. opts.line2
|
|
||||||
elseif opts.line1 > 1 then
|
|
||||||
ref = ref .. "#L" .. opts.line1
|
|
||||||
end
|
|
||||||
local amp_message = require("amp.message")
|
|
||||||
amp_message.send_to_prompt(ref)
|
|
||||||
end, {
|
|
||||||
range = true,
|
|
||||||
desc = "Add file reference (with selection) to Amp prompt",
|
|
||||||
})
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
'';
|
'';
|
||||||
|
|
@ -1253,7 +1174,6 @@ in
|
||||||
# custom
|
# custom
|
||||||
yuck-vim
|
yuck-vim
|
||||||
nvim-parinfer
|
nvim-parinfer
|
||||||
amp-nvim
|
|
||||||
# vim-processing
|
# vim-processing
|
||||||
] ++ lib.optionals pkgs.stdenv.isLinux [
|
] ++ lib.optionals pkgs.stdenv.isLinux [
|
||||||
# Linux-only plugins
|
# Linux-only plugins
|
||||||
|
|
|
||||||
95
home/profiles/nvim/private-mode.lua
Normal file
95
home/profiles/nvim/private-mode.lua
Normal file
|
|
@ -0,0 +1,95 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
local ns_id = vim.api.nvim_create_namespace('private_mode')
|
||||||
|
local enabled = false
|
||||||
|
local concealed_char = '•' -- Character to show instead of text
|
||||||
|
|
||||||
|
local function conceal_buffer()
|
||||||
|
local buf = vim.api.nvim_get_current_buf()
|
||||||
|
local line_count = vim.api.nvim_buf_line_count(buf)
|
||||||
|
|
||||||
|
vim.api.nvim_buf_clear_namespace(buf, ns_id, 0, -1)
|
||||||
|
|
||||||
|
for i = 0, line_count - 1 do
|
||||||
|
local line = vim.api.nvim_buf_get_lines(buf, i, i + 1, false)[1]
|
||||||
|
if line and #line > 0 then
|
||||||
|
-- Conceal each character individually
|
||||||
|
for col = 0, #line - 1 do
|
||||||
|
vim.api.nvim_buf_set_extmark(buf, ns_id, i, col, {
|
||||||
|
end_col = col + 1,
|
||||||
|
conceal = concealed_char,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function reveal_current_line()
|
||||||
|
local buf = vim.api.nvim_get_current_buf()
|
||||||
|
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||||
|
local current_line = cursor[1] - 1
|
||||||
|
|
||||||
|
-- Clear concealment for current line only
|
||||||
|
vim.api.nvim_buf_clear_namespace(buf, ns_id, current_line, current_line + 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function update_display()
|
||||||
|
if not enabled then return end
|
||||||
|
|
||||||
|
conceal_buffer()
|
||||||
|
local mode = vim.fn.mode()
|
||||||
|
|
||||||
|
-- Reveal current line in insert mode
|
||||||
|
if mode == 'i' or mode == 'R' then
|
||||||
|
reveal_current_line()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.toggle()
|
||||||
|
enabled = not enabled
|
||||||
|
|
||||||
|
if enabled then
|
||||||
|
-- Set concealment options
|
||||||
|
vim.opt_local.conceallevel = 2
|
||||||
|
vim.opt_local.concealcursor = 'nvc'
|
||||||
|
|
||||||
|
-- Initial concealment
|
||||||
|
update_display()
|
||||||
|
|
||||||
|
-- Set up autocommands
|
||||||
|
local group = vim.api.nvim_create_augroup('PrivateMode', { clear = true })
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({'ModeChanged', 'CursorMoved', 'CursorMovedI', 'TextChanged', 'TextChangedI'}, {
|
||||||
|
group = group,
|
||||||
|
callback = update_display,
|
||||||
|
})
|
||||||
|
|
||||||
|
print("Private mode enabled")
|
||||||
|
else
|
||||||
|
-- Clear all concealment
|
||||||
|
local buf = vim.api.nvim_get_current_buf()
|
||||||
|
vim.api.nvim_buf_clear_namespace(buf, ns_id, 0, -1)
|
||||||
|
|
||||||
|
-- Clear autocommands
|
||||||
|
vim.api.nvim_create_augroup('PrivateMode', { clear = true })
|
||||||
|
|
||||||
|
print("Private mode disabled")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function M.setup(opts)
|
||||||
|
opts = opts or {}
|
||||||
|
concealed_char = opts.conceal_char or '•'
|
||||||
|
|
||||||
|
-- Create user command
|
||||||
|
vim.api.nvim_create_user_command('PrivateMode', function()
|
||||||
|
M.toggle()
|
||||||
|
end, {})
|
||||||
|
|
||||||
|
-- Optional: Set up a keybinding
|
||||||
|
if opts.keymap then
|
||||||
|
vim.keymap.set('n', opts.keymap, M.toggle, { desc = 'Toggle private mode' })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -57,6 +57,15 @@
|
||||||
# seafile
|
# seafile
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# for vibe code stuff, over wireguard
|
||||||
|
networking.firewall = {
|
||||||
|
allowedTCPPorts = [ 22 3000 4173 ]; # allow ssh, vibe, and vibekanban
|
||||||
|
allowedTCPPortRanges = [{
|
||||||
|
from = 6666;
|
||||||
|
to = 7666;
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [ lm_sensors ];
|
environment.systemPackages = with pkgs; [ lm_sensors ];
|
||||||
hardware.fancontrol = {
|
hardware.fancontrol = {
|
||||||
enable = false;
|
enable = false;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
# ../profiles/music
|
# ../profiles/music
|
||||||
../profiles/sync/cal
|
../profiles/sync/cal
|
||||||
../profiles/wifi
|
../profiles/wifi
|
||||||
../profiles/desktop
|
# ../profiles/desktop # Disabled: conflicts with jovian desktop manager
|
||||||
../profiles/mimetypes
|
../profiles/mimetypes
|
||||||
../profiles/syncthing
|
../profiles/syncthing
|
||||||
../profiles/mossnet-hosts
|
../profiles/mossnet-hosts
|
||||||
|
|
@ -31,12 +31,11 @@
|
||||||
# theme = "motion";
|
# theme = "motion";
|
||||||
# };
|
# };
|
||||||
|
|
||||||
# jovian.steam.enable = true;
|
jovian.steam.enable = true;
|
||||||
# jovian.devices.steamdeck.enable = true;
|
jovian.devices.steamdeck.enable = true;
|
||||||
# jovian.steam.user = "anish";
|
jovian.steam.user = "anish";
|
||||||
# jovian.steam.autoStart = true;
|
jovian.steam.autoStart = true;
|
||||||
# jovian.steam.desktopSession = "gnome";
|
jovian.steam.desktopSession = "gamescope-wayland";
|
||||||
# jovian.steam.desktopSession = "none+bspwm";
|
|
||||||
|
|
||||||
# Disable lightdm from desktop profile
|
# Disable lightdm from desktop profile
|
||||||
services.xserver.displayManager.lightdm.enable = lib.mkForce false;
|
services.xserver.displayManager.lightdm.enable = lib.mkForce false;
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,6 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
#unstable.sublime-music
|
|
||||||
# olm-3.2.16 is now insecure
|
# olm-3.2.16 is now insecure
|
||||||
# some reason I can't set insecure packages that will be respected
|
# some reason I can't set insecure packages that will be respected
|
||||||
nheko
|
nheko
|
||||||
|
|
@ -66,8 +65,7 @@ in {
|
||||||
unstable.newsflash
|
unstable.newsflash
|
||||||
unstable.liferea
|
unstable.liferea
|
||||||
unstable.gh
|
unstable.gh
|
||||||
unstable.flyctl
|
flyctl
|
||||||
unstable.sublime-music
|
|
||||||
|
|
||||||
kooha
|
kooha
|
||||||
light
|
light
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
{
|
{
|
||||||
services.immich = {
|
services.immich = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
package = pkgs.unstable.immich;
|
||||||
database = {
|
database = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
exports = ''
|
exports = ''
|
||||||
/home/ftp 192.168.1.0/24(rw)
|
/home/ftp 192.168.1.0/24(rw)
|
||||||
/mnt/one 192.168.1.0/24(rw)
|
/mnt/one 192.168.1.0/24(rw)
|
||||||
/mnt/two 192.168.1.0/24(rw,no_subtree_check) 10.0.69.0/24(rw,no_subtree_check)
|
/mnt/two 192.168.1.0/24(rw,async,no_subtree_check) 10.0.69.0/24(rw,async,no_subtree_check)
|
||||||
/mnt/three 192.168.1.0/24(rw)
|
/mnt/three 192.168.1.0/24(rw)
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -50,5 +50,40 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Ensure WireGuard restarts on failure
|
||||||
|
systemd.services.wireguard-wg0 = {
|
||||||
|
serviceConfig = {
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = "5s";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Periodic connection health check and reconnect
|
||||||
|
systemd.services.wireguard-wg0-healthcheck = {
|
||||||
|
description = "WireGuard wg0 connection health check";
|
||||||
|
after = [ "network-online.target" "wireguard-wg0.service" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
ExecStart = pkgs.writeShellScript "wg0-healthcheck" ''
|
||||||
|
# Check if we can ping the WireGuard gateway
|
||||||
|
if ! ${pkgs.iputils}/bin/ping -c 1 -W 5 10.0.69.1 &>/dev/null; then
|
||||||
|
echo "WireGuard connection down, restarting..."
|
||||||
|
${pkgs.systemd}/bin/systemctl restart wireguard-wg0.service
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.timers.wireguard-wg0-healthcheck = {
|
||||||
|
description = "Timer for WireGuard wg0 health check";
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnBootSec = "2min";
|
||||||
|
OnUnitActiveSec = "2min";
|
||||||
|
Unit = "wireguard-wg0-healthcheck.service";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue