diff --git a/home/dot_config/nvim/lua/config/colorscheme.lua b/home/dot_config/nvim/lua/config/colorscheme.lua index ff17745..816067c 100644 --- a/home/dot_config/nvim/lua/config/colorscheme.lua +++ b/home/dot_config/nvim/lua/config/colorscheme.lua @@ -3,29 +3,37 @@ -- https://www.reddit.com/r/neovim/comments/1d3hk1t/automatic_dark_mode_following_system_theme_on/ local function get_system_theme() -- Default value - local background = 'light' + local background = "light" -- First check whether we are on MacOS if vim.loop.os_uname().sysname == "Darwin" then -- Check if 'defaults' is executable - if vim.fn.executable('defaults') ~= 0 then + if vim.fn.executable("defaults") ~= 0 then -- Execute command to check if the macOS appearance is set to Dark local appleInterfaceStyle = vim.fn.system({ "defaults", "read", "-g", "AppleInterfaceStyle" }) if appleInterfaceStyle:find("Dark") then - background = 'dark' + background = "dark" end end -- Check if 'busctl' is executable (part of systemd) - elseif vim.fn.executable('busctl') ~= 0 then + elseif vim.fn.executable("busctl") ~= 0 then -- Get the current color scheme from xdg-desktop-portal using busctl local result = vim.fn.system({ - "busctl", "--user", "call", "org.freedesktop.portal.Desktop", "/org/freedesktop/portal/desktop", - "org.freedesktop.portal.Settings", "ReadOne", "ss", "org.freedesktop.appearance", "color-scheme" + "busctl", + "--user", + "call", + "org.freedesktop.portal.Desktop", + "/org/freedesktop/portal/desktop", + "org.freedesktop.portal.Settings", + "ReadOne", + "ss", + "org.freedesktop.appearance", + "color-scheme", }) -- The result is in the form of "v u 0" for light and "v u 1" for dark local color_scheme = result:match("u%s+(%d+)") - if color_scheme == '1' then - background = 'dark' + if color_scheme == "1" then + background = "dark" end else end @@ -33,11 +41,13 @@ local function get_system_theme() return background end -if get_system_theme() == 'dark' then - vim.o.background = 'dark' - vim.cmd.colorscheme("catppuccin-mocha") -else - vim.o.background = 'light' - vim.cmd.colorscheme("catppuccin-latte") -end +vim.cmd.colorscheme("gruvbox-material") +-- if get_system_theme() == 'dark' then +-- vim.o.background = 'dark' +-- vim.cmd.colorscheme("catppuccin-mocha") +-- else +-- vim.o.background = 'light' +-- vim.cmd.colorscheme("catppuccin-latte") +-- end +-- diff --git a/home/dot_config/nvim/lua/plugins/appearance.lua b/home/dot_config/nvim/lua/plugins/appearance.lua index a932e20..e721dda 100644 --- a/home/dot_config/nvim/lua/plugins/appearance.lua +++ b/home/dot_config/nvim/lua/plugins/appearance.lua @@ -27,6 +27,13 @@ return { }, }, }, + { + "f4z3r/gruvbox-material.nvim", + name = "gruvbox-material", + lazy = false, + priority = 1000, + opts = {}, + }, { "rose-pine/neovim", name = "rose-pine", diff --git a/home/dot_config/nvim/lua/plugins/completion.lua b/home/dot_config/nvim/lua/plugins/completion.lua index 84bcd22..3d7abec 100644 --- a/home/dot_config/nvim/lua/plugins/completion.lua +++ b/home/dot_config/nvim/lua/plugins/completion.lua @@ -20,5 +20,5 @@ return { opts = {}, -- dev = true, -- dir = "~/Source/Forks/luasnip-latex-snippets.nvim/" - } + }, } diff --git a/nixcfgs/flake.lock b/nixcfgs/flake.lock index fd7cb73..9f74200 100644 --- a/nixcfgs/flake.lock +++ b/nixcfgs/flake.lock @@ -113,11 +113,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1763385902, - "narHash": "sha256-ZuM6Ji52YtonM84E8L7HlYquYs1xL19Fld33nFpXZd4=", + "lastModified": 1763946419, + "narHash": "sha256-bcgbx3Ps7dL9hE+op6OSMVAMkXcidZHVNsFuBKbCy0w=", "owner": "HeitorAugustoLN", "repo": "betterfox-nix", - "rev": "a1fb9f34cd5a0bbea43e744da998d54931184257", + "rev": "9c394344f04e0bb89eeeb1ed36917e1dbfa59bab", "type": "github" }, "original": { @@ -137,11 +137,11 @@ ] }, "locked": { - "lastModified": 1763172111, - "narHash": "sha256-QseFQKZgMq/kbHlrhfaNlwEyQ1H3J+UhnbgpAIEGpvA=", + "lastModified": 1763517499, + "narHash": "sha256-N5y55DwDNT+0kLFck2sy1+DcnLOZ/N05UEvZ2R5pmWo=", "owner": "caelestia-dots", "repo": "cli", - "rev": "d89c438284311e99148ece61054cd6f9bc8e8cb7", + "rev": "1cfd405eaa74e66f33e7790c5c6586676f03a395", "type": "github" }, "original": { @@ -159,11 +159,11 @@ "quickshell": "quickshell" }, "locked": { - "lastModified": 1763256383, - "narHash": "sha256-Vwct8SbZkfoTY0BbB0XVmXo5KsRIH4asV7QzXpjZ4b8=", + "lastModified": 1764132349, + "narHash": "sha256-nXYDlrLaqEmb7JJ1aAt1cC97EyMFNNtJ4i1Ma/WsQX8=", "owner": "caelestia-dots", "repo": "shell", - "rev": "58fe2962b6f515e879962953fcb4fcd9c8f39c32", + "rev": "24b313497f22f837577371675c145ba9b51d7ee5", "type": "github" }, "original": { @@ -177,11 +177,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1763724081, - "narHash": "sha256-hCgZsbaw21R9uL3iJwG8WT3VCMXVa7xjmxGRf0nwvL4=", + "lastModified": 1764325801, + "narHash": "sha256-LQ7tsrXs1wuB6KBwUctL3JlUsG/FWI2pCI6NkoO52dk=", "owner": "catppuccin", "repo": "nix", - "rev": "e4676e1fd9b09131feadd3df556fd1d3f31fdd2d", + "rev": "a696fed6b9b6aa89ef495842cdca3fc2a7cef0de", "type": "github" }, "original": { @@ -250,11 +250,11 @@ ] }, "locked": { - "lastModified": 1763772597, - "narHash": "sha256-N0387BO34qALZSFcWH4VjNaEQgaH6vzq96z4AmvxpAI=", + "lastModified": 1764377464, + "narHash": "sha256-xE2W9lDbBcxHiETe439JWcTYyKzZyfGVyuUneoFHbZo=", "owner": "petrkozorezov", "repo": "firefox-addons-nix", - "rev": "17708cf20e6e88e1c29bc3d65ac9af65f8f7ccdc", + "rev": "05e6a239a9c5cb433b66cc8315aed44fd88f8d36", "type": "github" }, "original": { @@ -317,11 +317,11 @@ ] }, "locked": { - "lastModified": 1762980239, - "narHash": "sha256-8oNVE8TrD19ulHinjaqONf9QWCKK+w4url56cdStMpM=", + "lastModified": 1763759067, + "narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "52a2caecc898d0b46b2b905f058ccc5081f842da", + "rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0", "type": "github" }, "original": { @@ -490,11 +490,11 @@ ] }, "locked": { - "lastModified": 1763837297, - "narHash": "sha256-o60Q4UcjzYgF3BjC5moJEs7bPIYedHWPVcFjeRaH/JE=", + "lastModified": 1764361670, + "narHash": "sha256-jgWzgpIaHbL3USIq0gihZeuy1lLf2YSfwvWEwnfAJUw=", "owner": "nix-community", "repo": "home-manager", - "rev": "f07573df41506a0890ae8529fa51fe60cf563f4a", + "rev": "780be8ef503a28939cf9dc7996b48ffb1a3e04c6", "type": "github" }, "original": { @@ -804,11 +804,11 @@ }, "import-tree": { "locked": { - "lastModified": 1763263999, - "narHash": "sha256-AZ4UkBJQKfaL9sX+/mzc1xBtcJk8hDQGkhjWX0Py5hU=", + "lastModified": 1763762820, + "narHash": "sha256-ZvYKbFib3AEwiNMLsejb/CWs/OL/srFQ8AogkebEPF0=", "owner": "vic", "repo": "import-tree", - "rev": "058bd03ac818ea349946323ae3c2837b4cab7f22", + "rev": "3c23749d8013ec6daa1d7255057590e9ca726646", "type": "github" }, "original": { @@ -827,11 +827,11 @@ "xwayland-satellite-unstable": "xwayland-satellite-unstable" }, "locked": { - "lastModified": 1763835287, - "narHash": "sha256-8wPX0t4wM6uLVpbRnU8yBqV2e93eXiYPiAJYzS6HLNc=", + "lastModified": 1764405884, + "narHash": "sha256-TnvBRPmcpcyinvLgsitHS7w5soSa6yNBfRYEI2TK1Ts=", "owner": "sodiboo", "repo": "niri-flake", - "rev": "5e06972e46f11274ae3dcb5175c45dc5b9e85410", + "rev": "10aae4855ee275f7d80d85f4328c24265fb20f1f", "type": "github" }, "original": { @@ -860,11 +860,11 @@ "niri-unstable": { "flake": false, "locked": { - "lastModified": 1763799335, - "narHash": "sha256-b6hgDHjrLgTp4Y8DD5woGChg0R+yH16m0ZWVi9BhjrA=", + "lastModified": 1764399944, + "narHash": "sha256-FC9eYtSmplgxllCX4/3hJq5J3sXWKLSc7at8ZUxycVw=", "owner": "YaLTeR", "repo": "niri", - "rev": "cfc01b895c0c7cbb9692852488675cc46693bd2a", + "rev": "b35bcae35b3f9665043c335e55ed5828af77db85", "type": "github" }, "original": { @@ -880,11 +880,11 @@ ] }, "locked": { - "lastModified": 1763505477, - "narHash": "sha256-nJRd4LY2kT3OELfHqdgWjvToNZ4w+zKCMzS2R6z4sXE=", + "lastModified": 1764161084, + "narHash": "sha256-HN84sByg9FhJnojkGGDSrcjcbeioFWoNXfuyYfJ1kBE=", "owner": "nix-darwin", "repo": "nix-darwin", - "rev": "3bda9f6b14161becbd07b3c56411f1670e19b9b5", + "rev": "e95de00a471d07435e0527ff4db092c84998698e", "type": "github" }, "original": { @@ -936,11 +936,11 @@ "nixpkgs": "nixpkgs_5" }, "locked": { - "lastModified": 1763819073, - "narHash": "sha256-oi+Nd8O+lWCj0Jh+8Px3UAo82HMTB2AaPiJsy5iUPt8=", + "lastModified": 1764432271, + "narHash": "sha256-XCZxe+UAiutOpR4vd2iT02uVw4Yb8UogNu4+ystCInE=", "owner": "kaylorben", "repo": "nixcord", - "rev": "0bb86069c738dd300458ebdcd93b05cd3204a155", + "rev": "5d37818d54213354ede10445c330104a25eeccf4", "type": "github" }, "original": { @@ -951,11 +951,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1763191728, - "narHash": "sha256-esRhOS0APE6k40Hs/jjReXg+rx+J5LkWw7cuWFKlwYA=", + "lastModified": 1763806073, + "narHash": "sha256-FHsEKDvfWpzdADWj99z7vBk4D716Ujdyveo5+A048aI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1d4c88323ac36805d09657d13a5273aea1b34f0c", + "rev": "878e468e02bfabeda08c79250f7ad583037f2227", "type": "github" }, "original": { @@ -997,11 +997,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1763622513, - "narHash": "sha256-1jQnuyu82FpiSxowrF/iFK6Toh9BYprfDqfs4BB+19M=", + "lastModified": 1764316264, + "narHash": "sha256-82L+EJU+40+FIdeG4gmUlOF1jeSwlf2AwMarrpdHF6o=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "c58bc7f5459328e4afac201c5c4feb7c818d604b", + "rev": "9a7b80b6f82a71ea04270d7ba11b48855681c4b0", "type": "github" }, "original": { @@ -1013,11 +1013,11 @@ }, "nixpkgs-stable_2": { "locked": { - "lastModified": 1763622513, - "narHash": "sha256-1jQnuyu82FpiSxowrF/iFK6Toh9BYprfDqfs4BB+19M=", + "lastModified": 1764316264, + "narHash": "sha256-82L+EJU+40+FIdeG4gmUlOF1jeSwlf2AwMarrpdHF6o=", "owner": "nixOS", "repo": "nixpkgs", - "rev": "c58bc7f5459328e4afac201c5c4feb7c818d604b", + "rev": "9a7b80b6f82a71ea04270d7ba11b48855681c4b0", "type": "github" }, "original": { @@ -1109,11 +1109,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1763421233, - "narHash": "sha256-Stk9ZYRkGrnnpyJ4eqt9eQtdFWRRIvMxpNRf4sIegnw=", + "lastModified": 1763966396, + "narHash": "sha256-6eeL1YPcY1MV3DDStIDIdy/zZCDKgHdkCmsrLJFiZf0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "89c2b2330e733d6cdb5eae7b899326930c2c0648", + "rev": "5ae3b07d8d6527c42f17c876e404993199144b6a", "type": "github" }, "original": { @@ -1141,11 +1141,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1763678758, - "narHash": "sha256-+hBiJ+kG5IoffUOdlANKFflTT5nO3FrrR2CA3178Y5s=", + "lastModified": 1764242076, + "narHash": "sha256-sKoIWfnijJ0+9e4wRvIgm/HgE27bzwQxcEmo2J/gNpI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "117cc7f94e8072499b0a7aa4c52084fa4e11cc9b", + "rev": "2fad6eac6077f03fe109c4d4eb171cf96791faa4", "type": "github" }, "original": { @@ -1173,11 +1173,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1763618868, - "narHash": "sha256-v5afmLjn/uyD9EQuPBn7nZuaZVV9r+JerayK/4wvdWA=", + "lastModified": 1764384123, + "narHash": "sha256-UoliURDJFaOolycBZYrjzd9Cc66zULEyHqGFH3QHEq0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a8d610af3f1a5fb71e23e08434d8d61a466fc942", + "rev": "59b6c96beacc898566c9be1052ae806f3835f87d", "type": "github" }, "original": { @@ -1189,11 +1189,11 @@ }, "nixpkgs_7": { "locked": { - "lastModified": 1763678758, - "narHash": "sha256-+hBiJ+kG5IoffUOdlANKFflTT5nO3FrrR2CA3178Y5s=", + "lastModified": 1764242076, + "narHash": "sha256-sKoIWfnijJ0+9e4wRvIgm/HgE27bzwQxcEmo2J/gNpI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "117cc7f94e8072499b0a7aa4c52084fa4e11cc9b", + "rev": "2fad6eac6077f03fe109c4d4eb171cf96791faa4", "type": "github" }, "original": { @@ -1241,11 +1241,11 @@ "nixpkgs": "nixpkgs_7" }, "locked": { - "lastModified": 1763839106, - "narHash": "sha256-Hc+lLe8tv5AGocqVBeobavqRlreipCmoAPGTMl18zlo=", + "lastModified": 1764430352, + "narHash": "sha256-TqKYm5P8f+pdjp2ScDUvr2AI02Z/Dls0TbqZXxoXPq8=", "owner": "nix-community", "repo": "NUR", - "rev": "262abd934836c79866f950dfb3093e1a0094b052", + "rev": "8fbb75c232610b00689964d4f6d69033f00ffac4", "type": "github" }, "original": { @@ -1289,11 +1289,11 @@ ] }, "locked": { - "lastModified": 1762784320, - "narHash": "sha256-odsk96Erywk5hs0dhArF38zb7Oe0q6LZ70gXbxAPKno=", + "lastModified": 1763909441, + "narHash": "sha256-56LwV51TX/FhgX+5LCG6akQ5KrOWuKgcJa+eUsRMxsc=", "owner": "nix-community", "repo": "plasma-manager", - "rev": "7911a0f8a44c7e8b29d031be3149ee8943144321", + "rev": "b24ed4b272256dfc1cc2291f89a9821d5f9e14b4", "type": "github" }, "original": { @@ -1334,11 +1334,11 @@ ] }, "locked": { - "lastModified": 1763210607, - "narHash": "sha256-gyEL9lw8oSbFbZ323vYUpIhcZLzudACEAQyCTkYh1WM=", + "lastModified": 1763629934, + "narHash": "sha256-jWz10RbNAyylJbH4cUTLS/CsDjkd8gxfT8OsIgQIgEg=", "ref": "refs/heads/master", - "rev": "0a7dcf30eaf438aa1ec72a9017cdb952df03f005", - "revCount": 704, + "rev": "ed036d514b0fdbce03158a0b331305be166f4555", + "revCount": 708, "type": "git", "url": "https://git.outfoxxed.me/outfoxxed/quickshell" }, @@ -1378,11 +1378,11 @@ ] }, "locked": { - "lastModified": 1763607916, - "narHash": "sha256-VefBA1JWRXM929mBAFohFUtQJLUnEwZ2vmYUNkFnSjE=", + "lastModified": 1764021963, + "narHash": "sha256-1m84V2ROwNEbqeS9t37/mkry23GBhfMt8qb6aHHmjuc=", "owner": "Mic92", "repo": "sops-nix", - "rev": "877bb495a6f8faf0d89fc10bd142c4b7ed2bcc0b", + "rev": "c482a1c1bbe030be6688ed7dc84f7213f304f1ec", "type": "github" }, "original": { @@ -1410,11 +1410,11 @@ "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1764191810, - "narHash": "sha256-rofXPD/9TGpHveo1MTlUfpnF0MCG1/uHUB9f0rosdqc=", + "lastModified": 1764254063, + "narHash": "sha256-V22JzkaTLF/GAL2LgqvOsJhAr8JbJsKaD8hnHjGwXfE=", "owner": "nix-community", "repo": "stylix", - "rev": "70c444a10d0c9ef71a25580dfa79af9cd43f3a5e", + "rev": "a1451bc40413870f0c7b576b751c1ca92055e323", "type": "github" }, "original": { @@ -1621,11 +1621,11 @@ "systems": "systems_5" }, "locked": { - "lastModified": 1763837811, - "narHash": "sha256-N/zray+TTgnBHvbXm20hZ8eiFPTudvMVCUdRqywF+Mw=", + "lastModified": 1764259715, + "narHash": "sha256-N2GgoJbnpMc7FWr+oiV6Gi7Z0Wlz/of/9rSOA0AR2PQ=", "owner": "abenz1267", "repo": "walker", - "rev": "2ddd6b93b3ecb500d5ef4622281f80536c918940", + "rev": "4899a7842097cf5c3bc595c79e8311780bac1188", "type": "github" }, "original": { @@ -1743,11 +1743,11 @@ "xwayland-satellite-unstable": { "flake": false, "locked": { - "lastModified": 1763704521, - "narHash": "sha256-ceYEV6PnvUN8Zixao4gpPuN+VT3B0SlAXKuPNHZhqUY=", + "lastModified": 1764366786, + "narHash": "sha256-yVCJ4Qe/JkdKDu0DddFdAQgDQVeF12nxH7zv3jtooV4=", "owner": "Supreeeme", "repo": "xwayland-satellite", - "rev": "f379ff5722a821212eb59ada9cf8e51cb3654aad", + "rev": "b362a3873710a42f7ac2d8ba03772d8290733934", "type": "github" }, "original": { @@ -1763,11 +1763,11 @@ ] }, "locked": { - "lastModified": 1763697957, - "narHash": "sha256-p6CTJoeM3EK9tcqm6lgnKZFVJiGHCzcCftkko4EpEb0=", + "lastModified": 1764216441, + "narHash": "sha256-wvxWNSm19K5zSmTkQNkYwxMBZXOuZCbA45jiT1R9myU=", "owner": "youwen5", "repo": "zen-browser-flake", - "rev": "9eb198a4d7ea4bd1284254780e3c22533f743d55", + "rev": "d620f0b8fac4e9b6ee2369fca071f4ea854399f6", "type": "github" }, "original": { diff --git a/nixcfgs/flake.nix b/nixcfgs/flake.nix index 51d1b1b..9a07804 100644 --- a/nixcfgs/flake.nix +++ b/nixcfgs/flake.nix @@ -118,6 +118,7 @@ xremap-flake.nixosModules.default sops-nix.nixosModules.sops catppuccin.nixosModules.catppuccin + stylix.nixosModules.default ./hosts/${hostname} {nixpkgs.overlays = overlays;} ]; diff --git a/nixcfgs/hosts/zephyrus/default.nix b/nixcfgs/hosts/zephyrus/default.nix index cf81ef0..177a763 100644 --- a/nixcfgs/hosts/zephyrus/default.nix +++ b/nixcfgs/hosts/zephyrus/default.nix @@ -61,6 +61,11 @@ algorithm = "lz4"; priority = 100; }; + stylix = { + enable = true; + autoEnable = true; + base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-hard.yaml"; + }; # Disable modem networking.modemmanager.enable = false; diff --git a/nixcfgs/modules/home/options.nix b/nixcfgs/modules/home/options.nix index 2441748..fb46a2d 100644 --- a/nixcfgs/modules/home/options.nix +++ b/nixcfgs/modules/home/options.nix @@ -1,55 +1,113 @@ { lib, config, + pkgs, ... -}: { - options.currentUser = { - defaultShell = lib.mkOption { - type = lib.types.enum ["zsh" "bash" "fish"]; - default = "zsh"; - description = "The default shell to use."; +}: let + inherit (lib) mkOption types mkIf; + cfg = config.my; # 简写引用,方便后续使用 +in { + options.my = { + # === 软件生态配置 (Software Ecosystem) === + desktop = { + preferredApps = { + shell = mkOption { + type = types.package; + default = pkgs.bash; + description = "The default shell package to use."; + example = pkgs.zsh; + }; + + interactiveShell = mkOption { + type = types.package; + default = pkgs.bash; + description = "The default interactive shell package. (spawn by terminal emulators)"; + example = pkgs.fish; + }; + + terminal = { + package = mkOption { + type = types.package; + default = pkgs.alacritty; + description = "The default terminal emulator package."; + example = pkgs.kitty; + }; + + execArg = mkOption { + type = types.str; + default = "-e"; + description = "The argument used to execute a command in the terminal."; + }; + }; + + fileManager = { + gui = mkOption { + type = types.package; + default = pkgs.thunar; + description = "The default GUI file explorer."; + example = pkgs.kdePackages.dolphin; + }; + + tui = mkOption { + type = types.package; + default = pkgs.yazi; + description = "The default TUI file explorer."; + example = pkgs.ranger; + }; + }; + }; + + style = { + iconTheme = { + # 分离包和名称:有些包名和主题名不一致 + package = mkOption { + type = types.package; + default = pkgs.kdePackages.breeze-icons; + description = "The package containing the icon theme."; + example = pkgs.papirus-icon-theme; + }; + light = mkOption { + type = types.str; + default = "Breeze"; + description = "The internal name of the icon theme (as used in GTK/QT settings)."; + example = "Papirus-Light"; + }; + dark = mkOption { + type = types.str; + default = "Breeze-Dark"; + description = "The internal name of the dark icon theme (as used in GTK/QT settings)."; + example = "Papirus-Dark"; + }; + }; + }; }; - defaultTerminal = lib.mkOption { - type = lib.types.str; - default = "ghostty"; - description = "The default terminal emulator."; - }; + # === 硬件/主机特性配置 (Hardware/Host Specifics) === + hardware = { + # 使用 nullOr 允许该功能被完全禁用(如果在没有背光的台式机上) + keyboardBacklight = mkOption { + type = types.nullOr (types.submodule { + options = { + device = mkOption { + type = types.str; + description = "Device identifier for brightnessctl."; + }; + step = mkOption { + type = types.str; + default = "5%"; # 稍微调小默认步进,更精细 + description = "Step percentage/integer for brightness adjustment."; + }; + }; + }); + default = null; + description = "Keyboard backlight configuration. Set to null to disable."; + }; - defaultTerminalRunner = lib.mkOption { - type = lib.types.str; - default = config.currentUser.defaultTerminal; - description = "The default terminal emulator to run CLI softwares directly"; - }; - - defaultExplorer = lib.mkOption { - type = lib.types.str; - default = "thunar"; - description = "The default file explorer"; - }; - - defaultTerminalExplorer = lib.mkOption { - type = lib.types.str; - default = "yazi"; - description = "The default file explorer with TUI"; - }; - - iconTheme = lib.mkOption { - type = lib.types.str; - default = "Breeze"; - description = "Default icon theme"; - }; - }; - options.currentHost = { - keyboardBacklightDevice = lib.mkOption { - type = lib.types.str; - default = ""; - description = "Device Identifier that used for brightnessctl, get the identifier via brightnessctl --list"; - }; - keyboardBacklightStep = lib.mkOption { - type = lib.types.str; - default = "34%"; - description = "Step to change keyboard backlight, integer or percentage accepted"; + isHeadless = mkOption { + type = types.bool; + default = false; + description = "Whether the current host acts as a headless server."; + }; }; }; } diff --git a/nixcfgs/modules/nixos/programs/libvirt.nix b/nixcfgs/modules/nixos/programs/libvirt.nix index e4650fa..fba3d9b 100644 --- a/nixcfgs/modules/nixos/programs/libvirt.nix +++ b/nixcfgs/modules/nixos/programs/libvirt.nix @@ -12,6 +12,8 @@ runAsRoot = true; swtpm.enable = true; }; + onShutdown = "shutdown"; + onBoot = "ignore"; }; users.users.js0ny = { extraGroups = ["libvirtd"]; diff --git a/nixcfgs/users/js0ny/config.nix b/nixcfgs/users/js0ny/config.nix index c6efc9a..a19f3af 100644 --- a/nixcfgs/users/js0ny/config.nix +++ b/nixcfgs/users/js0ny/config.nix @@ -1,9 +1,14 @@ -{ - currentUser = { - defaultShell = "zsh"; - defaultTerminal = "kitty"; - iconTheme = "Papirus"; - defaultExplorer = "dolphin"; - defaultTerminalExplorer = "yazi"; +{pkgs, ...}: { + my = { + desktop = { + preferredApps = { + shell = pkgs.zsh; + interactiveShell = pkgs.fish; + terminal = { + package = pkgs.kitty; + execArg = "-e"; + }; + }; + }; }; } diff --git a/nixcfgs/users/js0ny/default.nix b/nixcfgs/users/js0ny/default.nix index ed896fa..f26df15 100644 --- a/nixcfgs/users/js0ny/default.nix +++ b/nixcfgs/users/js0ny/default.nix @@ -9,7 +9,7 @@ in { imports = [ ../../modules/home/options.nix ../../modules/home/do-not-track.nix - ./config.nix + # ./config.nix ]; home.username = username; home.homeDirectory = @@ -29,6 +29,4 @@ in { enable = true; }; }; - - home.sessionVariables.TERMINAL = config.currentUser.defaultTerminal; } diff --git a/nixcfgs/users/js0ny/packages/cli.nix b/nixcfgs/users/js0ny/packages/cli.nix index 44fee16..523e16e 100644 --- a/nixcfgs/users/js0ny/packages/cli.nix +++ b/nixcfgs/users/js0ny/packages/cli.nix @@ -16,7 +16,6 @@ age aichat beancount - gnumake chezmoi curlie duf @@ -67,6 +66,7 @@ jless unar trash-cli + aria2 ] ++ ( if pkgs.stdenv.isDarwin diff --git a/nixcfgs/users/js0ny/packages/devtools.nix b/nixcfgs/users/js0ny/packages/devtools.nix new file mode 100644 index 0000000..49a09e8 --- /dev/null +++ b/nixcfgs/users/js0ny/packages/devtools.nix @@ -0,0 +1,28 @@ +{ + pkgs, + config, + ... +}: { + # Globally installed development tools + home.packages = with pkgs; [ + vscode-json-languageserver + alejandra + gnumake + nil + jq + yq-go + tokei + socat + shellcheck + ]; + home.sessionVariables = { + CARGO_HOME = "${config.xdg.dataHome}/cargo"; + GOPATH = "${config.xdg.dataHome}/go"; + PYTHON_HISTORY = "${config.xdg.stateHome}/python/history"; + }; + systemd.user.tmpfiles.rules = [ + "d ${config.xdg.dataHome}/cargo 0755 ${config.home.username} users -" + "d ${config.xdg.dataHome}/go 0755 ${config.home.username} users -" + "f ${config.xdg.stateHome}/python 0755 ${config.home.username} users -" + ]; +} diff --git a/nixcfgs/users/js0ny/packages/flatpak.nix b/nixcfgs/users/js0ny/packages/flatpak.nix index 1e8811e..ab5780e 100644 --- a/nixcfgs/users/js0ny/packages/flatpak.nix +++ b/nixcfgs/users/js0ny/packages/flatpak.nix @@ -79,7 +79,43 @@ in { sockets = ["wayland"]; }; }; - xdg.dataFile = appWrappers; + # xdg.dataFile = appWrappers; + xdg.dataFile = + { + # Patch for Hyprland (scale XWayland by hand) + "flatpak/exports/bin/com.qq.QQ" = { + text = '' + #!/bin/sh + + EXTRA_APP_ARGS="" + + if [ "$XDG_CURRENT_DESKTOP" = "Hyprland" ]; then + EXTRA_APP_ARGS="--force-device-scale-factor=1.5" + fi + + exec flatpak run --branch=stable --arch=x86_64 com.qq.QQ "$EXTRA_APP_ARGS" "$@" + ''; + enable = true; + executable = true; + }; + "flatpak/exports/share/applications/com.qq.QQ.desktop" = { + text = '' + [Desktop Entry] + Name=QQ + Exec=${config.xdg.dataHome}/flatpak/exports/bin/com.qq.QQ + Terminal=false + Type=Application + Icon=com.qq.QQ + StartupWMClass=QQ + Categories=Network; + Comment=QQ + X-Flatpak=com.qq.QQ + ''; + enable = true; + force = true; + }; + } + // appWrappers; home.activation.patchFlatpakDesktopFiles = lib.hm.dag.entryAfter ["writeBoundary"] '' ${lib.concatMapStringsSep "\n" (appid: '' DESKTOP_FILE="${config.xdg.dataHome}/flatpak/exports/share/applications/${appid}.desktop" diff --git a/nixcfgs/users/js0ny/packages/stylix.nix b/nixcfgs/users/js0ny/packages/stylix.nix index 191b1cb..99fc930 100644 --- a/nixcfgs/users/js0ny/packages/stylix.nix +++ b/nixcfgs/users/js0ny/packages/stylix.nix @@ -67,10 +67,10 @@ in { neovim.enable = false; firefox = { profileNames = ["default"]; - colorTheme.enable = false; # Firefox Color }; }; + base16Scheme = "${pkgs.base16-schemes}/share/themes/gruvbox-material-dark-hard.yaml"; image = ./wallpaper.jpg; polarity = "dark"; }; diff --git a/nixcfgs/users/js0ny/programs/desktop/gnome/default.nix b/nixcfgs/users/js0ny/programs/desktop/gnome/default.nix index fe0506f..ecc312e 100644 --- a/nixcfgs/users/js0ny/programs/desktop/gnome/default.nix +++ b/nixcfgs/users/js0ny/programs/desktop/gnome/default.nix @@ -1,6 +1,7 @@ { pkgs, config, + lib, ... }: { home.sessionVariables = { @@ -46,7 +47,7 @@ "org/gnome/desktop/interface" = { clock-show-seconds = true; clock-show-weekday = true; - icon-theme = "${config.currentUser.iconTheme}"; + icon-theme = "${config.my.desktop.style.iconTheme.dark}"; accent-color = "pink"; show-battery-percentage = true; cursor-theme = "Adwaita"; @@ -111,12 +112,12 @@ }; "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom-1" = { name = "Open Terminal via Win-R"; - command = "${config.currentUser.defaultTerminal}"; + command = "${lib.getExe config.my.desktop.preferredApps.terminal.package}"; binding = "r"; }; "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom-2" = { name = "Open Terminal via Ctrl-Alt-T"; - command = "${config.currentUser.defaultTerminal}"; + command = "${lib.getExe config.my.desktop.preferredApps.terminal.package}"; binding = "t"; }; "org/gnome/settings-daemon/plugins/media-keys" = { diff --git a/nixcfgs/users/js0ny/programs/desktop/plasma/default.nix b/nixcfgs/users/js0ny/programs/desktop/plasma/default.nix index 45958cb..4274a27 100644 --- a/nixcfgs/users/js0ny/programs/desktop/plasma/default.nix +++ b/nixcfgs/users/js0ny/programs/desktop/plasma/default.nix @@ -29,7 +29,7 @@ position = "center"; }; workspace = { - iconTheme = "${config.currentUser.iconTheme}"; + iconTheme = "${config.my.desktop.style.iconTheme.dark}"; colorScheme = "BreezeDark"; }; kwin = { diff --git a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/hyprland/keymaps.nix b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/hyprland/keymaps.nix index f11a20e..eebc598 100644 --- a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/hyprland/keymaps.nix +++ b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/hyprland/keymaps.nix @@ -4,14 +4,13 @@ lib, ... }: let - term = config.currentUser.defaultTerminal; - termRunner = config.currentUser.defaultTerminalRunner; - iconTheme = config.currentUser.iconTheme; - explorer = config.currentUser.defaultExplorer; - explorerTerm = config.currentUser.defaultTerminalExplorer; + term = lib.getExe config.my.desktop.preferredApps.terminal.package; + iconTheme = config.my.desktop.style.iconTheme.dark; + explorer = lib.getExe config.my.desktop.preferredApps.fileManager.gui; + explorerTerm = lib.getExe config.my.desktop.preferredApps.fileManager.tui; launcher = "walker"; - kbdBacklightDev = config.currentHost.keyboardBacklightDevice; - kbdBacklightStep = config.currentHost.keyboardBacklightStep; + kbdBacklightDev = config.my.hardware.keyboardBacklight.device; + kbdBacklightStep = config.my.hardware.keyboardBacklight.step; mainMod = "SUPER"; screenshotPath = "$HOME/Pictures/Screenshots/\"$(%Y-%m-%d_%H-%M-%S.png)\""; my = import ./scripts.nix {inherit pkgs;}; @@ -22,7 +21,7 @@ in { bind = [ # === Run Applications === "$mainMod, return, exec, ${term}" - "$mainMod SHIFT, return, exec, ${termRunner} --directory ~/Atelier -e nvim" + "$mainMod SHIFT, return, exec, ${term} --directory ~/Atelier -e nvim" "$mainMod, B, exec, ${lib.getExe my.launch-or-focus} firefox firefox" "$mainMod SHIFT, B, exec, firefox --private-window" "$mainMod, A, exec, kitty --class=kitty-terminal-popup -e aichat --session" @@ -34,11 +33,11 @@ in { ''$mainMod SHIFT, F, exec, hyprctl --batch "dispatch togglefloating ; dispatch resizeactive exact 1440 810 ; dispatch centerwindow 1;"'' "$mainMod SHIFT, M, fullscreen" "$mainMod, W, exec, ${launcher} -m windows" - "$mainMod, Apostrophe, exec, EDITOR_MINIMAL=1 ${termRunner} -o close_on_child_death=yes --class=${termRunner}-terminal-popup -e edit-clipboard --minimal" + "$mainMod, Apostrophe, exec, EDITOR_MINIMAL=1 ${term} -o close_on_child_death=yes --class=${term}-terminal-popup -e edit-clipboard --minimal" "$mainMod, V, exec, ${launcher} -m clipboard" "alt, space, exec, ${launcher} -m desktopapplications" "$mainMod, E, exec, ${explorer}" - "$mainMod SHIFT, E, exec, ${termRunner} -e ${explorerTerm}" + "$mainMod SHIFT, E, exec, ${term} -e ${explorerTerm}" "CTRL ALT, DELETE, exec, uwsm exit" "$mainMod, P, pseudo" "$mainMod, Y, togglesplit" diff --git a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/hyprland/window-rules.nix b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/hyprland/window-rules.nix index 247d02f..d452873 100644 --- a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/hyprland/window-rules.nix +++ b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/hyprland/window-rules.nix @@ -11,6 +11,7 @@ # Right Top "float, pin, size 25%, move 73% 10%, class:^(org.pulseaudio.pavucontrol)$" + "float, pin, size 25%, move 73% 10%, class:^(.bluetooth-manager-wrapped)$" # Right Top + no focus "noinitialfocus, float, pin, size 25%, move 73% 10%, class:^(org.kde.(dolphin|ark))$, title:^(Extracting|Compressing)(.*)$" "noinitialfocus, float, pin, size 25%, move 73% 10%, class:^(thunar)$, title:^(File Operation Progress)$" diff --git a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/keymaps.nix b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/keymaps.nix index 7f4cf19..caa3dec 100644 --- a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/keymaps.nix +++ b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/keymaps.nix @@ -4,14 +4,12 @@ lib, ... }: let - term = config.currentUser.defaultTerminal; - termRunner = config.currentUser.defaultTerminalRunner; - iconTheme = config.currentUser.iconTheme; - explorer = config.currentUser.defaultExplorer; - explorerTerm = config.currentUser.defaultTerminalExplorer; + term = lib.getExe config.my.desktop.preferredApps.terminal.package; + # TODO: Don't default to dark + iconTheme = config.my.desktop.style.iconTheme.dark; launcher = "walker"; - kbdBacklightDev = config.currentHost.keyboardBacklightDevice; - kbdBacklightStep = config.currentHost.keyboardBacklightStep; + kbdBacklightDev = config.my.hardware.keyboardBacklight.device; + kbdBacklightStep = config.my.hardware.keyboardBacklight.step; nirictl = import ./scripts.nix {inherit pkgs;}; in { home.packages = [ @@ -23,7 +21,7 @@ in { "Mod+B".action = spawn "${lib.getExe nirictl.focusOrLaunch}" "firefox" "firefox"; "Mod+Shift+B".hotkey-overlay.title = "Launch web browser in private mode"; "Mod+Shift+B".action = spawn "firefox" "--private-window"; - "Mod+A".action = spawn-sh "${termRunner} --class=terminal-popup -e aichat --session"; + "Mod+A".action = spawn-sh "${term} --class=terminal-popup -e aichat --session"; "Mod+Shift+A".hotkey-overlay.title = "Focus or launch CherryStudio (AI assistant)"; "Mod+Shift+A".action = spawn "${lib.getExe nirictl.focusOrLaunch}" "CherryStudio" "cherry-studio"; "Mod+O".hotkey-overlay.title = "Focus or launch Obsidian"; @@ -31,12 +29,12 @@ in { # TODO: Change "org.kde.dolphin" to a more generic explorer app id via config.currentUser "Mod+E".hotkey-overlay.title = "Focus or launch file explorer"; "Mod+E".action = spawn "${lib.getExe nirictl.focusOrLaunch}" "org.kde.dolphin" "dolphin"; - "Mod+T".action = spawn-sh "${termRunner} --class=terminal-popup"; - "Mod+Shift+T".action = spawn-sh "${termRunner} --class=${termRunner}-terminal-popup --working-directory='${config.home.homeDirectory}/.config/shells/nohist' -e nix develop"; + "Mod+T".action = spawn-sh "${term} --class=terminal-popup"; + "Mod+Shift+T".action = spawn-sh "${term} --class=${term}-terminal-popup --working-directory='${config.home.homeDirectory}/.config/shells/nohist' -e nix develop"; "Mod+Semicolon".action = spawn "neovide" "${config.home.homeDirectory}/Atelier"; "Mod+Apostrophe".action = - spawn-sh "EDITOR_MINIMAL=1 ${termRunner} -o close_on_child_death=yes --class=terminal-popup -e edit-clipboard --minimal"; + spawn-sh "EDITOR_MINIMAL=1 ${term} -o close_on_child_death=yes --class=terminal-popup -e edit-clipboard --minimal"; "Mod+Shift+Slash".action = show-hotkey-overlay; diff --git a/nixcfgs/users/js0ny/programs/desktop/wayland-wm/window-rules.nix b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/window-rules.nix new file mode 100644 index 0000000..7f9e9af --- /dev/null +++ b/nixcfgs/users/js0ny/programs/desktop/wayland-wm/window-rules.nix @@ -0,0 +1,87 @@ +{...}: { + workspaces = [ + { + id = 1; + name = "Master"; + matches = [ + { + class = "firefox"; + } + ]; + } + { + id = 2; + name = "Project"; + matches = [ + { + class = "code|dev.zed.Zed|Vitis IDE|Vivado"; + } + ]; + } + { + id = 3; + name = "Info"; + matches = [ + { + class = "discord|thunderbird|QQ|wechat|com.(telegram|ayugram).desktop|io.github.kukuruzka165.materialgram"; + } + ]; + } + { + id = 9; + name = "Background"; + matches = [ + { + class = "feishin|Cider"; + } + ]; + } + ]; + float-top-right-pin = [ + { + class = "org.pulseaudio.pavucontrol"; + } + { + class = ".bluetooth-manager-wrapped"; + } + ]; + float-center = [ + { + class = "com.(telegram|ayugram).desktop"; + title = "Media viewer"; + } + { + class = "io.github.kukuruzka165.materialgram"; + title = "Media viewer"; + } + { + class = "wechat"; + title = "图片和视频"; + } + { + class = "QQ"; + title = "图片查看器"; + } + { + class = "QQ"; + title = "群聊的聊天记录"; + } + { + class = "CherryStudio"; + title = "Cherry Studio Quick Assistant"; + } + { + class = "anki"; + title = "Add"; + } + { + class = "kitty-terminal-popup"; + } + { + title = "Open File|打开文件|Select a File|选择文件|Choose wallpaper|Open Folder|Save As|保存|Library|File Upload(.*)"; + } + { + class = "qt6ct"; + } + ]; +} diff --git a/nixcfgs/users/js0ny/programs/emacs.nix b/nixcfgs/users/js0ny/programs/emacs.nix index 5df0914..9947b02 100644 --- a/nixcfgs/users/js0ny/programs/emacs.nix +++ b/nixcfgs/users/js0ny/programs/emacs.nix @@ -20,6 +20,7 @@ nix-ts-mode flycheck highlight-indent-guides + magit ]; }; # TODO: tdlib version is too high diff --git a/nixcfgs/users/js0ny/programs/ghostty.nix b/nixcfgs/users/js0ny/programs/ghostty.nix index bb5a620..10488e7 100644 --- a/nixcfgs/users/js0ny/programs/ghostty.nix +++ b/nixcfgs/users/js0ny/programs/ghostty.nix @@ -1,6 +1,7 @@ { config, pkgs, + lib, ... }: { programs.ghostty = { @@ -14,7 +15,7 @@ else true; # Not ready settings = { - command = "${config.currentUser.defaultShell}"; + command = "${lib.getExe config.my.desktop.preferredApps.interactiveShell}"; font-size = 13; font-family = "Maple Mono NF CN"; # theme = light:Catppuccin Latte,dark:Catppuccin Mocha; diff --git a/nixcfgs/users/js0ny/programs/kitty.nix b/nixcfgs/users/js0ny/programs/kitty.nix index 8b3a2b3..391b1a8 100644 --- a/nixcfgs/users/js0ny/programs/kitty.nix +++ b/nixcfgs/users/js0ny/programs/kitty.nix @@ -1,6 +1,7 @@ { config, pkgs, + lib, ... }: let alt = @@ -8,6 +9,7 @@ then "cmd" else "alt"; in { + xdg.configFile."kitty/kitty.conf".force = true; programs.kitty = { enable = true; shellIntegration = { @@ -41,7 +43,7 @@ in { macos_option_as_alt = true; macos_quit_when_last_window_closed = true; enabled_layouts = "splits"; - shell = config.currentUser.defaultShell; + shell = lib.getExe config.my.desktop.preferredApps.interactiveShell; allow_remote_control = "socket-only"; listen_on = "unix:/tmp/kitty.sock"; confirm_os_window_close = 0; @@ -82,4 +84,33 @@ in { } else {}; }; + programs = { + bash.bashrcExtra = '' + if [ "$TERM" = "xterm-kitty" ]; then + alias ssh="kitty +kitten ssh" + alias icat="kitty +kitten icat" + fi + if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + alias clip="kitty +kitten clipboard" + fi + ''; + zsh.initContent = '' + if [ "$TERM" = "xterm-kitty" ]; then + alias ssh="kitty +kitten ssh" + alias icat="kitty +kitten icat" + fi + if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then + alias clip="kitty +kitten clipboard" + fi + ''; + fish.interactiveShellInit = '' + if test "$TERM" = "xterm-kitty" + abbr --add ssh "kitty +kitten ssh" + abbr --add icat "kitty +kitten icat" + end; + if test -n "$SSH_CLIENT" -o -n "$SSH_TTY" + abbr --add clip "kitty +kitten clipboard" + end; + ''; + }; } diff --git a/nixcfgs/users/js0ny/programs/miniserve.nix b/nixcfgs/users/js0ny/programs/miniserve.nix index 26bdaf7..d9cfa74 100644 --- a/nixcfgs/users/js0ny/programs/miniserve.nix +++ b/nixcfgs/users/js0ny/programs/miniserve.nix @@ -1,8 +1,12 @@ { pkgs, config, + lib, ... -}: { +}: let + term = lib.getExe config.my.desktop.preferredApps.terminal.package; + termArg = config.my.desktop.preferredApps.terminal.execArg; +in { home.packages = [pkgs.miniserve]; home.file.".local/share/kio/servicemenus/miniserve.desktop" = { enable = true; @@ -20,7 +24,7 @@ Name=Map Directory to Port 8080 Name[CN]=将目录映射到网上(8080) Icon=network-server - Exec=${config.currentUser.defaultTerminalRunner} -t "miniserve" -e miniserve "%f" --port 8080 + Exec=${term} --title "miniserve" ${termArg} miniserve "%f" --port 8080 ''; }; } diff --git a/nixcfgs/users/js0ny/programs/obsidian/default.nix b/nixcfgs/users/js0ny/programs/obsidian/default.nix index 881b10c..7cc5a73 100644 --- a/nixcfgs/users/js0ny/programs/obsidian/default.nix +++ b/nixcfgs/users/js0ny/programs/obsidian/default.nix @@ -1,4 +1,26 @@ -{...}: { +{pkgs, ...}: let + dailyNote = pkgs.writeShellScriptBin "daily-note" '' + VAULT_DIR="$HOME/Obsidian/00 - Journal/Daily" + DATE_STR=$(date +%Y-%m-%d) + FILE_PATH="$VAULT_DIR/$DATE_STR.md" + + if [ ! -d "$VAULT_DIR" ]; then + mkdir -p "$VAULT_DIR" + fi + + if [ ! -f "$FILE_PATH" ]; then + echo "# $DATE_STR" > "$FILE_PATH" + echo "" >> "$FILE_PATH" + echo "## Highlights" >> "$FILE_PATH" + echo "" >> "$FILE_PATH" + echo "## Log" >> "$FILE_PATH" + echo "" >> "$FILE_PATH" + echo "- $(date +%H:%M) " >> "$FILE_PATH" + fi + + nvim + "$FILE_PATH" + ''; +in { imports = [ ./vimrc-support.nix ]; @@ -11,4 +33,18 @@ }; }; }; + home.packages = [ + dailyNote + ]; + programs = { + bash.shellAliases = { + dn = "daily-note"; + }; + zsh.shellAliases = { + dn = "daily-note"; + }; + fish.shellAbbrs = { + dn = "daily-note"; + }; + }; } diff --git a/nixcfgs/users/js0ny/programs/shell/aliases.nix b/nixcfgs/users/js0ny/programs/shell/aliases.nix index abbe5dd..6a4541f 100644 --- a/nixcfgs/users/js0ny/programs/shell/aliases.nix +++ b/nixcfgs/users/js0ny/programs/shell/aliases.nix @@ -1,58 +1,71 @@ -{pkgs}: let +{ + pkgs, + lib, + config, + ... +}: let + inherit (lib) optionalAttrs; + + isDarwin = pkgs.stdenv.isDarwin; + isLinux = pkgs.stdenv.isLinux; + isHeadless = config.my.hardware.isHeadless; + commonAliases = { ni = "touch"; cls = "clear"; aic = "aichat -s"; aicc = "aichat -c"; - nrs = "sudo nixos-rebuild switch --flake ~/.dotfiles/nixcfgs"; - clip = "wl-copy"; - paste = "wl-paste"; - py = "nix run 'nixpkgs#python314'"; # Python Interactive Shell + py = "nix run 'nixpkgs#python3'"; }; + darwinAliases = { reboot = "sudo reboot"; clip = "pbcopy"; paste = "pbpaste"; ii = "open"; + brewi = "brew install"; brewr = "brew remove"; brewu = "brew upgrade && brew update"; brewc = "brew cleanup"; brewl = "brew list"; }; + linuxAliases = { ii = "xdg-open"; open = "xdg-open"; }; + + linuxGuiAliases = { + clip = "wl-copy"; + paste = "wl-paste"; + }; + posixFx = '' mt() { - mkdir -p $(dirname $1) && touch $1 + mkdir -p "$(dirname "$1")" && touch "$1" } mtv() { - mkdir -p $(dirname $1) && touch $1 && nvim $1 + mkdir -p "$(dirname "$1")" && touch "$1" && $EDITOR "$1" } ''; + fishFx = '' function mt mkdir -p (dirname $argv[1]) && touch $argv[1] end function mtv - mkdir -p (dirname $argv[1]) && touch $argv[1] && nvim $argv[1] + mkdir -p (dirname $argv[1]) && touch $argv[1] && $EDITOR $argv[1] end ''; in { aliases = commonAliases - // ( - if pkgs.stdenv.isLinux - then linuxAliases - else {} - ) - // ( - if pkgs.stdenv.isDarwin - then darwinAliases - else {} - ); + // (optionalAttrs isDarwin darwinAliases) + // (optionalAttrs isLinux ( + linuxAliases // (optionalAttrs (!isHeadless) linuxGuiAliases) + )); + inherit posixFx fishFx; } diff --git a/nixcfgs/users/js0ny/programs/shell/bash.nix b/nixcfgs/users/js0ny/programs/shell/bash.nix index 0d7985d..a96285e 100644 --- a/nixcfgs/users/js0ny/programs/shell/bash.nix +++ b/nixcfgs/users/js0ny/programs/shell/bash.nix @@ -1,5 +1,10 @@ -{pkgs, ...}: let - aliasCfg = import ./aliases.nix {pkgs = pkgs;}; +{ + pkgs, + config, + lib, + ... +}: let + aliasCfg = import ./aliases.nix {inherit pkgs config lib;}; in { programs.bash = { enable = true; diff --git a/nixcfgs/users/js0ny/programs/shell/fish.nix b/nixcfgs/users/js0ny/programs/shell/fish.nix index a8a3245..1be276f 100644 --- a/nixcfgs/users/js0ny/programs/shell/fish.nix +++ b/nixcfgs/users/js0ny/programs/shell/fish.nix @@ -1,5 +1,10 @@ -{pkgs, ...}: let - aliasCfg = import ./aliases.nix {pkgs = pkgs;}; +{ + pkgs, + config, + lib, + ... +}: let + aliasCfg = import ./aliases.nix {inherit pkgs config lib;}; in { programs.fish = { enable = true; @@ -42,7 +47,11 @@ in { bind -M insert alt-delete kill-line ''; # preferAbbrs = true; - shellAbbrs = aliasCfg.aliases; + shellAbbrs = + aliasCfg.aliases + // { + l = "ls -lah"; + }; }; programs.zed-editor.extensions = ["fish"]; -} \ No newline at end of file +} diff --git a/nixcfgs/users/js0ny/programs/shell/nu.nix b/nixcfgs/users/js0ny/programs/shell/nu.nix index b1953b1..a0cc54c 100644 --- a/nixcfgs/users/js0ny/programs/shell/nu.nix +++ b/nixcfgs/users/js0ny/programs/shell/nu.nix @@ -1,6 +1,4 @@ -{pkgs, ...}: let - aliases = import ./aliases.nix {pkgs = pkgs;}; -in { +{...}: { programs.nushell = { enable = true; shellAliases = { diff --git a/nixcfgs/users/js0ny/programs/shell/zsh.nix b/nixcfgs/users/js0ny/programs/shell/zsh.nix index 9812285..2aa02dd 100644 --- a/nixcfgs/users/js0ny/programs/shell/zsh.nix +++ b/nixcfgs/users/js0ny/programs/shell/zsh.nix @@ -1,9 +1,10 @@ { - config, pkgs, + config, + lib, ... }: let - aliasCfg = import ./aliases.nix {pkgs = pkgs;}; + aliasCfg = import ./aliases.nix {inherit pkgs config lib;}; in { home.packages = with pkgs; [ zsh-fzf-tab diff --git a/nixcfgs/users/js0ny/programs/vscode.nix b/nixcfgs/users/js0ny/programs/vscode.nix index b259bf9..714c232 100644 --- a/nixcfgs/users/js0ny/programs/vscode.nix +++ b/nixcfgs/users/js0ny/programs/vscode.nix @@ -1,5 +1,14 @@ -{pkgs, ...}: let +{ + pkgs, + config, + ... +}: let codeAlias = {"c" = "code";}; + codeReleasesConfigDir = [ + "Code" + "VSCodium" + "Antigravity" + ]; in { programs.vscode = { package = pkgs.vscode; @@ -17,6 +26,17 @@ in { ]; }; + # Remove default snippet dir before running this to avoid conflicts + xdg.configFile = builtins.listToAttrs (map (dir: { + name = "${dir}/User/snippets"; + value = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/lsp-snippets/snippets"; + force = true; + # recursive = true; + }; + }) + codeReleasesConfigDir); + catppuccin.vscode.profiles.default.enable = false; programs.fish.shellAbbrs = codeAlias; programs.bash.shellAliases = codeAlias; diff --git a/nixcfgs/users/js0ny/programs/zed-editor.nix b/nixcfgs/users/js0ny/programs/zed-editor.nix index dba46a9..1502980 100644 --- a/nixcfgs/users/js0ny/programs/zed-editor.nix +++ b/nixcfgs/users/js0ny/programs/zed-editor.nix @@ -1,4 +1,9 @@ -{pkgs, ...}: { +{ + pkgs, + config, + ... +}: { + xdg.configFile."zed/snippets".source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/.config/lsp-snippets/snippets"; programs.zed-editor = { enable = true; package = diff --git a/nixcfgs/users/js0ny/zephyrus.nix b/nixcfgs/users/js0ny/zephyrus.nix index 4aecb53..b61687f 100644 --- a/nixcfgs/users/js0ny/zephyrus.nix +++ b/nixcfgs/users/js0ny/zephyrus.nix @@ -1,5 +1,9 @@ # ~/.config/nixcfgs/users/js0ny/default.nix -{...}: { +{ + pkgs, + config, + ... +}: { imports = [ # General config ./default.nix @@ -10,6 +14,7 @@ # Packages ./packages/cli.nix ./packages/gui.nix + ./packages/devtools.nix ./packages/flatpak.nix ./packages/fonts.nix ./packages/stylix.nix @@ -83,10 +88,31 @@ nixpkgs.config.allowUnfree = true; - currentHost = { - keyboardBacklightDevice = "asus::kbd_backlight"; - keyboardBacklightStep = "1"; + my = { + desktop = { + preferredApps = { + shell = pkgs.zsh; + interactiveShell = pkgs.fish; + terminal = { + package = pkgs.kitty; + execArg = "-e"; + }; + fileManager = { + gui = pkgs.kdePackages.dolphin; + tui = pkgs.yazi; + }; + }; + }; + hardware = { + keyboardBacklight = { + device = "asus::kbd_backlight"; + step = "1"; + }; + isHeadless = false; + }; }; + home.sessionVariables.TERMINAL = config.my.desktop.preferredApps.terminal.package; + home.stateVersion = "25.05"; }