diff --git a/alex/colours/catppuchin-mocha.nix b/alex/colours/catppuchin-mocha.nix new file mode 100644 index 0000000..1ab7898 --- /dev/null +++ b/alex/colours/catppuchin-mocha.nix @@ -0,0 +1,17 @@ +{ + # Catppuccin Mocha Palette + base = "#1e1e2e"; + mantle = "#181825"; + surface0 = "#313244"; + surface1 = "#45475a"; + text = "#cdd6f4"; + lavender = "#b4befe"; + blue = "#89b4fa"; + sapphire = "#74c7ec"; + red = "#f38ba8"; + peach = "#fab387"; + yellow = "#f9e2af"; + green = "#a6e3a1"; + mauve = "#cba6f7"; + overlay0 = "#6c7086"; +} diff --git a/alex/nvim/init.lua b/alex/nvim/init.lua index f01875c..12ae617 100644 --- a/alex/nvim/init.lua +++ b/alex/nvim/init.lua @@ -987,7 +987,30 @@ require("lazy").setup({ } end, dependencies = { {"nvim-tree/nvim-web-devicons"}} - } + }, + { + "zk-org/zk-nvim", + config = function() + require("zk").setup({ + picker = "telescope", + }) + + local opts = { noremap = true, silent = true } + + -- new note in the current group/dir + vim.keymap.set("n", "zn", "ZkNew { title = vim.fn.input('Title: ') }", opts) + -- new note in inbox (no title needed) + vim.keymap.set("n", "zi", "ZkNew { dir = 'inbox' }", opts) + -- search notes by title/filename + vim.keymap.set("n", "zf", "ZkNotes { sort = { 'modified' } }", opts) + -- search notes by content (full text) + vim.keymap.set("n", "zs", "ZkNotes { sort = { 'modified' }, match = { vim.fn.input('Search: ') } }", opts) + -- search tags + vim.keymap.set("n", "zt", "ZkTags", opts) + -- insert a link to another note + vim.keymap.set("n", "zl", "ZkInsertLink", opts) + end, + }, }, { ui = { -- If you are using a Nerd Font: set icons to an empty table which will use the diff --git a/alex/personal.nix b/alex/personal.nix index 2ff953a..0ca8348 100644 --- a/alex/personal.nix +++ b/alex/personal.nix @@ -9,7 +9,8 @@ in { home.packages = with pkgs; [ foliate - inputs.locutus.packages.${pkgs.stdenv.hostPlatform.system}.default + zk + # inputs.locutus.packages.${pkgs.stdenv.hostPlatform.system}.default # jrnl # disable tests for now until the bug is fixed # https://github.com/NixOS/nixpkgs/issues/476190 @@ -39,6 +40,7 @@ in spotify unstable.gemini-cli unstable.claude-code + unstable.claude-monitor foliate diff --git a/alex/sway.nix b/alex/sway.nix index 81b3759..c0ab550 100644 --- a/alex/sway.nix +++ b/alex/sway.nix @@ -18,6 +18,10 @@ let overlay0 = "#6c7086"; in { + imports = [ + ./waybar.nix + ]; + home.packages = with pkgs; [ swaybg swayidle @@ -64,7 +68,7 @@ in line-clear-color = base; line-wrong-color = base; bs-hl-color = red; - grace = 2; + grace = 6; grace-no-mouse = true; grace-no-touch = true; datestr = "%a, %B %e"; @@ -154,6 +158,7 @@ in keybindings = let modifier = "Mod4"; in lib.mkOptionDefault { + "${modifier}+Caps_Lock" = "input * xkb_switch_layout next"; "${modifier}+Return" = "exec wezterm"; "${modifier}+d" = "exec fuzzel"; "${modifier}+space" = "floating toggle"; @@ -214,7 +219,8 @@ in services.swayidle = let - lock = "${pkgs.swaylock-effects}/bin/swaylock --daemonize"; + lock = "${pkgs.swaylock-effects}/bin/swaylock -f"; + lockNow = "${pkgs.swaylock-effects}/bin/swaylock -f --grace 0"; # modify "display" function based on your window manager # Sway display = status: "${pkgs.sway}/bin/swaymsg 'output * power ${status}'"; @@ -246,7 +252,7 @@ in { event = "before-sleep"; # adding duplicated entries for the same event may not work - command = (display "off") + "; " + lock; + command = lockNow + "; " + (display "off"); } { event = "after-resume"; @@ -288,213 +294,4 @@ in }; }; }; - - programs.waybar = { - enable = true; - settings = { - mainBar = { - layer = "top"; - position = "top"; - height = 30; - margin-top = 5; - margin-left = 10; - margin-right = 10; - spacing = 4; - - modules-left = [ "sway/workspaces" "sway/mode" ]; - modules-center = [ "clock" ]; - modules-right = [ "pulseaudio" "network" "cpu" "memory" "battery" "tray" ]; - - "sway/workspaces" = { - disable-scroll = true; - all-outputs = true; - }; - - "clock" = { - format = "{:%a %d %b %H:%M:%S}"; - tooltip-format = "{:%Y %B}\n{calendar}"; - interval = 1; - }; - - "cpu" = { - format = "{usage}% "; - }; - - "memory" = { - format = "{}% "; - tooltip-format = "RAM: {used}GiB / {total}GiB ({percentage}%)\nSwap: {swapUsed}GiB / {swapTotal}GiB ({swapPercentage}%)"; - }; - - "battery" = { - states = { - warning = 30; - critical = 15; - }; - format = "{capacity}% {icon}"; - format-charging = "{capacity}% "; - format-plugged = "{capacity}% "; - format-icons = ["" "" "" "" ""]; - }; - - "network" = { - format-wifi = "{essid} ({signalStrength}%) "; - format-ethernet = "{ipaddr}/{cidr} 󰈀"; - tooltip-format = "{ifname} via {gwaddr} 󱂇"; - format-linked = "{ifname} (No IP) 󰈀"; - format-disconnected = "Disconnected ⚠"; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - }; - - "pulseaudio" = { - format = "{volume}% {icon} {format_source}"; - format-bluetooth = "{volume}% {icon} {format_source}"; - format-bluetooth-muted = " {icon} {format_source}"; - format-muted = " {format_source}"; - format-source = "{volume}% "; - format-source-muted = ""; - format-icons = { - headphone = ""; - hands-free = ""; - headset = ""; - phone = ""; - portable = ""; - car = ""; - default = ["" "" ""]; - }; - on-click = "pavucontrol"; - }; - }; - }; - - style = '' - * { - font-family: "JetBrainsMono Nerd Font"; - font-size: 13px; - } - - window#waybar { - background-color: transparent; - color: ${text}; - transition-property: background-color; - transition-duration: .5s; - } - - window#waybar > box { - background-color: ${base}; - border-radius: 15px; - opacity: 1.0; - padding: 0 3px 0 13px; - } - - button { - box-shadow: inset 0 -3px transparent; - border: none; - border-radius: 0; - } - - button:hover { - background: inherit; - box-shadow: inset 0 -3px ${text}; - } - - #workspaces button { - padding: 0 5px; - background-color: transparent; - color: ${text}; - } - - #workspaces button:hover { - background: rgba(0, 0, 0, 0.2); - } - - #workspaces button.focused { - background-color: ${surface1}; - box-shadow: inset 0 -3px ${lavender}; - } - - #workspaces button.urgent { - background-color: ${red}; - } - - #mode { - background-color: ${surface0}; - border-bottom: 3px solid ${text}; - } - - #clock, - #battery, - #cpu, - #memory, - #disk, - #temperature, - #backlight, - #network, - #pulseaudio, - #custom-media, - #tray, - #mode, - #idle_inhibitor, - #mpd { - padding: 0 10px; - color: ${text}; - background-color: ${surface0}; - border-radius: 10px; - margin: 5px 2px; - } - - #clock { - background-color: ${mauve}; - color: ${base}; - } - - #battery { - background-color: ${green}; - color: ${base}; - } - - #battery.charging, #battery.plugged { - color: ${base}; - background-color: ${green}; - } - - #battery.critical:not(.charging) { - background-color: ${red}; - color: ${text}; - animation-name: blink; - animation-duration: 0.5s; - animation-timing-function: linear; - animation-iteration-count: infinite; - animation-direction: alternate; - } - - #cpu { - background-color: ${peach}; - color: ${base}; - } - - #memory { - background-color: ${yellow}; - color: ${base}; - } - - #network { - background-color: ${sapphire}; - color: ${base}; - } - - #pulseaudio { - background-color: ${blue}; - color: ${base}; - } - - #pulseaudio.muted { - background-color: ${overlay0}; - color: ${text}; - } - - #tray { - background-color: ${surface0}; - } - ''; - }; } diff --git a/alex/waybar.nix b/alex/waybar.nix new file mode 100644 index 0000000..ca0f882 --- /dev/null +++ b/alex/waybar.nix @@ -0,0 +1,224 @@ +{ config, pkgs, lib, ... }: +let + palette = import ./colours/catppuchin-mocha.nix; +in +{ + programs.waybar = { + enable = true; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 30; + margin-top = 10; + margin-bottom = 0; + margin-left = 10; + margin-right = 10; + spacing = 4; + + modules-left = if (config.programs.niri or {}).enable or false then + [ "niri/workspaces" ] + else + [ "sway/workspaces" "sway/mode" ]; + modules-center = [ "clock" ]; + modules-right = [ "pulseaudio" "network" "cpu" "memory" "battery" "tray" ]; + + "sway/workspaces" = { + disable-scroll = true; + all-outputs = true; + }; + + "niri/workspaces" = { + disable-scroll = true; + all-outputs = true; + }; + + "clock" = { + format = "{:%a %d %b %H:%M:%S}"; + tooltip-format = "{:%Y %B}\n{calendar}"; + interval = 1; + }; + + "cpu" = { + format = "{usage}% "; + }; + + "memory" = { + format = "{}% "; + tooltip-format = "RAM: {used}GiB / {total}GiB ({percentage}%)\nSwap: {swapUsed}GiB / {swapTotal}GiB ({swapPercentage}%)"; + }; + + "battery" = { + states = { + warning = 30; + critical = 15; + }; + format = "{capacity}% {icon}"; + format-full = "{capacity}% {icon} full"; + format-charging = "{capacity}%  charged"; + format-plugged = "{capacity}% "; + format-icons = ["" "" "" "" ""]; + }; + + "network" = { + format-wifi = "{essid} ({signalStrength}%) "; + format-ethernet = "{ipaddr}/{cidr} 󰈀"; + tooltip-format = "{ifname} via {gwaddr} 󱂇"; + format-linked = "{ifname} (No IP) 󰈀"; + format-disconnected = "Disconnected ⚠"; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + + "pulseaudio" = { + format = "{volume}% {icon} {format_source}"; + format-bluetooth = "{volume}% {icon} {format_source}"; + format-bluetooth-muted = " {icon} {format_source}"; + format-muted = " {format_source}"; + format-source = "{volume}% "; + format-source-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = ["" "" ""]; + }; + on-click = "pavucontrol"; + }; + }; + }; + + style = '' + * { + font-family: "Symbols Nerd Font Mono", "Lilex Nerd Font", "JetBrainsMono Nerd Font"; + font-size: 13px; + } + + window#waybar { + background-color: transparent; + color: ${palette.text}; + transition-property: background-color; + transition-duration: .5s; + } + + window#waybar > box { + background-color: ${palette.base}; + border-radius: 15px; + opacity: 1.0; + padding: 0 3px 0 13px; + } + + button { + box-shadow: inset 0 -3px transparent; + border: none; + border-radius: 0; + } + + button:hover { + background: inherit; + box-shadow: inset 0 -3px ${palette.text}; + } + + #workspaces button { + padding: 0 5px; + background-color: transparent; + color: ${palette.text}; + } + + #workspaces button:hover { + background: rgba(0, 0, 0, 0.2); + } + + #workspaces button.focused { + background-color: ${palette.surface1}; + box-shadow: inset 0 -3px ${palette.lavender}; + } + + #workspaces button.urgent { + background-color: ${palette.red}; + } + + #mode { + background-color: ${palette.surface0}; + border-bottom: 3px solid ${palette.text}; + } + + #clock, + #battery, + #cpu, + #memory, + #disk, + #temperature, + #backlight, + #network, + #pulseaudio, + #custom-media, + #tray, + #mode, + #idle_inhibitor, + #mpd { + padding: 0 10px; + color: ${palette.text}; + background-color: ${palette.surface0}; + border-radius: 10px; + margin: 5px 2px; + } + + #clock { + background-color: ${palette.mauve}; + color: ${palette.base}; + } + + #battery { + background-color: ${palette.green}; + color: ${palette.base}; + } + + #battery.charging, #battery.plugged { + color: ${palette.base}; + background-color: ${palette.green}; + } + + #battery.critical:not(.charging) { + background-color: ${palette.red}; + color: ${palette.text}; + animation-name: blink; + animation-duration: 0.5s; + animation-timing-function: linear; + animation-iteration-count: infinite; + animation-direction: alternate; + } + + #cpu { + background-color: ${palette.peach}; + color: ${palette.base}; + } + + #memory { + background-color: ${palette.yellow}; + color: ${palette.base}; + } + + #network { + background-color: ${palette.sapphire}; + color: ${palette.base}; + } + + #pulseaudio { + background-color: ${palette.blue}; + color: ${palette.base}; + } + + #pulseaudio.muted { + background-color: ${palette.overlay0}; + color: ${palette.text}; + } + + #tray { + background-color: ${palette.surface0}; + } + ''; + }; +} diff --git a/flake.lock b/flake.lock index 360504f..aaa00b0 100644 --- a/flake.lock +++ b/flake.lock @@ -1,23 +1,5 @@ { "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -25,11 +7,11 @@ ] }, "locked": { - "lastModified": 1773264488, - "narHash": "sha256-rK0507bDuWBrZo+0zts9bCs/+RRUEHuvFE5DHWPxX/Q=", + "lastModified": 1775425411, + "narHash": "sha256-KY6HsebJHEe5nHOWP7ur09mb0drGxYSzE3rQxy62rJo=", "owner": "nix-community", "repo": "home-manager", - "rev": "5c0f63f8d55040a7eed69df7e3fcdd15dfb5a04c", + "rev": "0d02ec1d0a05f88ef9e74b516842900c41f0f2fe", "type": "github" }, "original": { @@ -39,64 +21,13 @@ "type": "github" } }, - "locutus": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" - }, - "locked": { - "lastModified": 1751595811, - "narHash": "sha256-/lwWL8a9lIgB4YgM/f2TgOsTGe/OxYCrGYj/JGAy1+E=", - "ref": "refs/heads/main", - "rev": "35e72ae715021dfa261fc2b065dd2e13757de4e0", - "revCount": 4, - "type": "git", - "url": "https://git.figtree.dev/alex/locutus" - }, - "original": { - "type": "git", - "url": "https://git.figtree.dev/alex/locutus" - } - }, "nixpkgs": { "locked": { - "lastModified": 1750506804, - "narHash": "sha256-VLFNc4egNjovYVxDGyBYTrvVCgDYgENp5bVi9fPTDYc=", + "lastModified": 1775595990, + "narHash": "sha256-OEf7YqhF9IjJFYZJyuhAypgU+VsRB5lD4DuiMws5Ltc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4206c4cb56751df534751b058295ea61357bbbaa", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-unstable": { - "locked": { - "lastModified": 1773282481, - "narHash": "sha256-b/GV2ysM8mKHhinse2wz+uP37epUrSE+sAKXy/xvBY4=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "fe416aaedd397cacb33a610b33d60ff2b431b127", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1773375660, - "narHash": "sha256-SEzUWw2Rf5Ki3bcM26nSKgbeoqi2uYy8IHVBqOKjX3w=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "3e20095fe3c6cbb1ddcef89b26969a69a1570776", + "rev": "4e92bbcdb030f3b4782be4751dc08e6b6cb6ccf2", "type": "github" }, "original": { @@ -106,28 +37,28 @@ "type": "github" } }, - "root": { - "inputs": { - "home-manager": "home-manager", - "locutus": "locutus", - "nixpkgs": "nixpkgs_2", - "nixpkgs-unstable": "nixpkgs-unstable" - } - }, - "systems": { + "nixpkgs-unstable": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "lastModified": 1775423009, + "narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", "type": "github" } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 9021253..6cc5b16 100644 --- a/flake.nix +++ b/flake.nix @@ -13,7 +13,7 @@ # to avoid problems caused by different versions of nixpkgs. inputs.nixpkgs.follows = "nixpkgs"; }; - locutus.url = "git+https://git.figtree.dev/alex/locutus"; + # locutus.url = "git+https://git.figtree.dev/alex/locutus"; }; outputs = { self, nixpkgs, home-manager, ... }@inputs: @@ -79,6 +79,16 @@ (mkHomeManagerConfig {}) ]; }; + + panam = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./hosts/panam/configuration.nix + home-manager.nixosModules.home-manager + (mkHomeManagerConfig {}) + ]; + }; # other hosts... }; }; diff --git a/hosts/alt/caddy.nix b/hosts/alt/caddy.nix index e7fb5be..d8fb7de 100644 --- a/hosts/alt/caddy.nix +++ b/hosts/alt/caddy.nix @@ -5,7 +5,7 @@ let "analytics.figtree.dev" = "http://192.168.80.1:3300"; "figtree.dev" = "http://192.168.1.63:8080"; "files.figtree.dev" = "http://192.168.80.4:8080"; - "git.figtree.dev" = "http://192.168.80.2:3000"; + "git.figtree.dev" = "http://192.168.80.8:3000"; "nc.figtree.dev" = "http://192.168.1.62:11000"; "paperless.figtree.dev" = "http://192.168.1.63:8010"; "photos.figtree.dev" = "http://192.168.80.1:2283"; diff --git a/hosts/modules/base.nix b/hosts/modules/base.nix index 46a9f37..ed49e4b 100644 --- a/hosts/modules/base.nix +++ b/hosts/modules/base.nix @@ -110,6 +110,7 @@ services.avahi = { enable = true; nssmdns4 = true; # Enables Avahi for name service lookups (e.g., in /etc/nsswitch.conf) + nssmdns6 = true; # Also resolve IPv6 mDNS addresses via NSS publish = { enable = true; addresses = true; # Publish your laptop's IP addresses diff --git a/hosts/modules/desktop.nix b/hosts/modules/desktop.nix index 7b16f4c..4bcfba8 100644 --- a/hosts/modules/desktop.nix +++ b/hosts/modules/desktop.nix @@ -45,6 +45,7 @@ noto-fonts-cjk-sans noto-fonts-cjk-serif nerd-fonts.lilex + nerd-fonts.symbols-only fira-code ]; }; @@ -57,6 +58,7 @@ # Enable networking networking.networkmanager.enable = true; + networking.networkmanager.wifi.backend = "iwd"; # Enable CUPS to print documents. services.printing.enable = true; diff --git a/hosts/modules/laptop.nix b/hosts/modules/laptop.nix index a7dfb4b..d7dd01b 100644 --- a/hosts/modules/laptop.nix +++ b/hosts/modules/laptop.nix @@ -22,6 +22,9 @@ # START_CHARGE_THRESH_BAT0 = 40; # 40 and below it starts to charge STOP_CHARGE_THRESH_BAT0 = 81; # 80 and above it stops charging + WIFI_PWR_ON_AC = "off"; + WIFI_PWR_ON_BAT = "off"; + }; }; } diff --git a/hosts/panam/configuration.nix b/hosts/panam/configuration.nix new file mode 100644 index 0000000..d3663ab --- /dev/null +++ b/hosts/panam/configuration.nix @@ -0,0 +1,24 @@ +{ config, modulesPath, pkgs, inputs, ... }: + +{ + imports = + [ + (modulesPath + "/virtualisation/proxmox-lxc.nix") + ../modules/base.nix + ../modules/server.nix + ./forgejo.nix + ]; + + nix.settings = { sandbox = false; }; + proxmoxLXC = { + manageNetwork = false; + privileged = true; + }; + + networking.hostName = "panam"; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. + system.stateVersion = "25.05"; +} diff --git a/hosts/panam/forgejo.nix b/hosts/panam/forgejo.nix new file mode 100644 index 0000000..ab1df43 --- /dev/null +++ b/hosts/panam/forgejo.nix @@ -0,0 +1,33 @@ +{ config, pkgs, lib, ... }: + +let + cfg = config.services.forgejo; + srv = cfg.settings.server; +in +{ + services.forgejo = { + enable = true; + database.type = "sqlite3"; + lfs.enable = true; + settings = { + server = { + DOMAIN = "git.figtree.dev"; + ROOT_URL = "https://git.figtree.dev/"; + SSH_DOMAIN = "panam.local"; + HTTP_ADDR = "0.0.0.0"; + HTTP_PORT = 3000; + }; + service.DISABLE_REGISTRATION = true; + }; + }; + + # Open the firewall for Forgejo's HTTP and SSH ports + networking.firewall.allowedTCPPorts = [ 3000 22 ]; + + # Ensure the user 'alex' is an admin in Forgejo if needed + # (Note: Forgejo doesn't allow 'admin' as a username) + systemd.services.forgejo.preStart = '' + # This will fail if the user already exists, hence || true + ${lib.getExe cfg.package} admin user create --admin --email "code@figtree.dev" --username alex --password "changeme123" || true + ''; +} diff --git a/readme.md b/readme.md index 12d38f0..e90ed4c 100644 --- a/readme.md +++ b/readme.md @@ -8,6 +8,16 @@ From within this directory: sudo nixos-rebuild switch --flake . ``` +# WiFi + +NetworkManager is enabled. Use the terminal UI to connect: + +``` +nmtui +``` + +Select "Activate a connection", pick your network, and enter the password. + # Update and deploy From within this directory: diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..1932765 --- /dev/null +++ b/update.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -e + +nix flake update +sudo -v && sudo nixos-rebuild switch --flake . |& nom