diff --git a/flake.lock b/flake.lock index 7d1edbb5..2bfb72e4 100644 --- a/flake.lock +++ b/flake.lock @@ -695,11 +695,11 @@ ] }, "locked": { - "lastModified": 1757230583, - "narHash": "sha256-4uqu7sFPOaVTCogsxaGMgbzZ2vK40GVGMfUmrvK3/LY=", + "lastModified": 1762951919, + "narHash": "sha256-ma/xMEGf4J6n/RdZFdxXBJUQhP53HVEPQOC6Dp2TrkQ=", "owner": "Jovian-Experiments", "repo": "Jovian-NixOS", - "rev": "fc3960e6c32c9d4f95fff2ef84444284d24d3bea", + "rev": "3d248f6e8f877218dd2573fef8925ac997889922", "type": "github" }, "original": { @@ -1351,11 +1351,11 @@ }, "unstable": { "locked": { - "lastModified": 1758690382, - "narHash": "sha256-NY3kSorgqE5LMm1LqNwGne3ZLMF2/ILgLpFr1fS4X3o=", + "lastModified": 1762844143, + "narHash": "sha256-SlybxLZ1/e4T2lb1czEtWVzDCVSTvk9WLwGhmxFmBxI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "e643668fd71b949c53f8626614b21ff71a07379d", + "rev": "9da7f1cf7f8a6e2a7cb3001b048546c92a8258b4", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 2cb9d3d3..69c466ab 100644 --- a/flake.nix +++ b/flake.nix @@ -205,6 +205,8 @@ "steam" "steam-original" "steam-runtime" + "steamdeck-hw-theme" + "steam-jupiter-unwrapped" ]; }; overlays = [ @@ -325,25 +327,26 @@ ]; }; - deck = unstable.lib.nixosSystem rec { - specialArgs = { inherit inputs self; }; - system = "x86_64-linux"; - pkgs = deckPkgsFor.${system}; - modules = [ - ./hosts/deck - jovian.nixosModules.default - self.nixosModules.wireguard - agenix.nixosModules.age - self.nixosModules.backup - home-manager.nixosModules.home-manager - { - nix.registry.nixpkgs.flake = unstable; - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.anish = import ./home/gui; - } - ]; - }; + # new version of unstable has many changes I couldn't be bothered to deal with rn + #deck = unstable.lib.nixosSystem rec { + # specialArgs = { inherit inputs self; }; + # system = "x86_64-linux"; + # pkgs = deckPkgsFor.${system}; + # modules = [ + # ./hosts/deck + # jovian.nixosModules.default + # self.nixosModules.wireguard + # agenix.nixosModules.age + # self.nixosModules.backup + # home-manager.nixosModules.home-manager + # { + # nix.registry.nixpkgs.flake = unstable; + # home-manager.useGlobalPkgs = true; + # home-manager.useUserPackages = true; + # home-manager.users.anish = import ./home/gui; + # } + # ]; + #}; }; # Darwin configuration entrypoint diff --git a/home/profiles/cli/default.nix b/home/profiles/cli/default.nix index a3da81a3..2c6aaa10 100644 --- a/home/profiles/cli/default.nix +++ b/home/profiles/cli/default.nix @@ -31,7 +31,7 @@ bat fd ncdu - du-dust + dust # dia-cli duf trash-cli @@ -63,6 +63,7 @@ taskwarrior-tui # vimwiki-cli zk + unstable.opencode (pkgs.writeScriptBin "jq-repl" '' #!/usr/bin/env bash diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 8a2c51b5..af008148 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, config, ... }: let customPlugins = { vim-zettel = pkgs.vimUtils.buildVimPlugin { @@ -139,6 +139,9 @@ in 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 ]; programs.neovim = { enable = true; @@ -482,6 +485,10 @@ in return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end + -- private mode + -- Setup private mode + require('private-mode').setup({ keymap = 'pm' }) + local luasnip = require("luasnip") local lspkind = require("lspkind") local cmp = require('cmp') @@ -1206,7 +1213,7 @@ in owner = "sourcegraph"; repo = "amp.nvim"; rev = "main"; - sha256 = "1n6d8nbakyg6yiq8mhhrvmsp9z0zb8cb67820jsg3wl6vqd1vwv5"; + sha256 = "sha256-+jIbAZjRpt30gcrIiwW+yZhT9CFLnW9ARf92GEfioZ0="; }; }) ]; diff --git a/home/profiles/nvim/private-mode.lua b/home/profiles/nvim/private-mode.lua new file mode 100644 index 00000000..13c840c7 --- /dev/null +++ b/home/profiles/nvim/private-mode.lua @@ -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 diff --git a/hosts/box/default.nix b/hosts/box/default.nix index 6e73a783..2a83dc3d 100644 --- a/hosts/box/default.nix +++ b/hosts/box/default.nix @@ -57,6 +57,15 @@ # 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 ]; hardware.fancontrol = { enable = false; diff --git a/hosts/deck/default.nix b/hosts/deck/default.nix index cda17705..d54c3056 100644 --- a/hosts/deck/default.nix +++ b/hosts/deck/default.nix @@ -8,7 +8,7 @@ # ../profiles/music ../profiles/sync/cal ../profiles/wifi - ../profiles/desktop + # ../profiles/desktop # Disabled: conflicts with jovian desktop manager ../profiles/mimetypes ../profiles/syncthing ../profiles/mossnet-hosts @@ -35,8 +35,7 @@ jovian.devices.steamdeck.enable = true; jovian.steam.user = "anish"; jovian.steam.autoStart = true; - jovian.steam.desktopSession = "gnome"; - # jovian.steam.desktopSession = "none+bspwm"; + jovian.steam.desktopSession = "gamescope-wayland"; # Install XR drivers # environment.systemPackages = with pkgs; [ diff --git a/hosts/profiles/desktop/default.nix b/hosts/profiles/desktop/default.nix index f1b38f91..d92d12fa 100644 --- a/hosts/profiles/desktop/default.nix +++ b/hosts/profiles/desktop/default.nix @@ -57,7 +57,6 @@ in { }; environment.systemPackages = with pkgs; [ - #unstable.sublime-music # olm-3.2.16 is now insecure # some reason I can't set insecure packages that will be respected nheko @@ -67,7 +66,6 @@ in { unstable.liferea unstable.gh unstable.flyctl - unstable.sublime-music kooha light diff --git a/hosts/profiles/immich/default.nix b/hosts/profiles/immich/default.nix index c94c8b65..5c42310e 100644 --- a/hosts/profiles/immich/default.nix +++ b/hosts/profiles/immich/default.nix @@ -2,6 +2,7 @@ { services.immich = { enable = true; + package = pkgs.unstable.immich; database = { enable = true; }; diff --git a/hosts/profiles/nfs/default.nix b/hosts/profiles/nfs/default.nix index bf09097a..4fcdc5c9 100644 --- a/hosts/profiles/nfs/default.nix +++ b/hosts/profiles/nfs/default.nix @@ -14,7 +14,7 @@ exports = '' /home/ftp 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) ''; }; diff --git a/modules/nixos/wireguard.nix b/modules/nixos/wireguard.nix index d0333ade..b75312a2 100644 --- a/modules/nixos/wireguard.nix +++ b/modules/nixos/wireguard.nix @@ -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"; + }; + }; }; }