From 841d3ccdb2e4d006aba18ad65e6f215d0a4962ef Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Sun, 18 Feb 2024 23:19:16 +0530 Subject: [PATCH] [feat] Add stuff for anyrun --- config/nix/common/home.nix | 16 ++- config/nix/flake.lock | 223 ++++++++++++++++++++++++++++------- config/nix/flake.nix | 22 +++- config/nix/linux/anyrun.nix | 71 +++++++++-- config/nix/linux/ironbar.nix | 2 +- config/nvim/lua/lsp.lua | 4 + config/nvim/lua/plugins.lua | 8 +- 7 files changed, 287 insertions(+), 59 deletions(-) diff --git a/config/nix/common/home.nix b/config/nix/common/home.nix index 649e2f7c..bdf7b19d 100644 --- a/config/nix/common/home.nix +++ b/config/nix/common/home.nix @@ -16,11 +16,11 @@ in { gtk = { enable = true; theme = { - name = "Catppuccin-Mocha-Normal-Dark"; + name = "Catppuccin-Mocha-Standard-Mauve-Dark"; package = pkgs.catppuccin-gtk.override { + variant = "mocha"; size = "standard"; accents = [ "mauve" ]; - variant = "mocha"; tweaks = [ "normal" ]; }; }; @@ -39,9 +39,11 @@ in { }; home.packages = with pkgs; [ + handlr-regex gnome.nautilus webcord-vencord spotify + spotify-player htop-vim lsof wl-clipboard @@ -61,9 +63,17 @@ in { fzf clang ncpamixer - neovim-nightly + # neovim-nightly + neovim yubikey-agent (nerdfonts.override { fonts = [ "Hasklig" ]; }) + (pkgs.writeShellApplication { + name = "xdg-open"; + runtimeInputs = [ handlr-regex ]; + text = '' + handlr open "$@" + ''; + }) mpv # # It is sometimes useful to fine-tune packages, for example, by applying diff --git a/config/nix/flake.lock b/config/nix/flake.lock index 254facff..161cea5e 100644 --- a/config/nix/flake.lock +++ b/config/nix/flake.lock @@ -47,6 +47,52 @@ "type": "github" } }, + "anyrun-nixos-options": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1704902043, + "narHash": "sha256-YL5ANmzWJAe3IhsuqTccxZIdkQX0tYt9dt9oNw0QwAY=", + "owner": "n3oney", + "repo": "anyrun-nixos-options", + "rev": "aed824957538e65dc3bea414aadbe5e2de611f49", + "type": "github" + }, + "original": { + "owner": "n3oney", + "repo": "anyrun-nixos-options", + "type": "github" + } + }, + "anyrun-rink": { + "inputs": { + "flake-utils": [ + "anyrun-rink", + "rust-overlay", + "flake-utils" + ], + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay_2" + }, + "locked": { + "dirtyRev": "0fd7377026e800022e661ae887b99a8ce7f1846d-dirty", + "dirtyShortRev": "0fd7377-dirty", + "lastModified": 1708266468, + "narHash": "sha256-z2KAA2Jtphn8+psnDDZClhXG3N7zwNfBFrVu5lqrK6w=", + "type": "git", + "url": "file:///home/servius/Projects/anyrun-rink" + }, + "original": { + "type": "git", + "url": "file:///home/servius/Projects/anyrun-rink" + } + }, "crane": { "inputs": { "nixpkgs": [ @@ -106,6 +152,24 @@ } }, "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1690933134, + "narHash": "sha256-ab989mN63fQZBFrkk4Q8bYxQCktuHmBIBqUG1jl6/FQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "59cf3f1447cfc75087e7273b04b31e689a8599fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { "inputs": { "nixpkgs-lib": [ "neovim-nightly-overlay", @@ -126,7 +190,7 @@ "type": "github" } }, - "flake-parts_3": { + "flake-parts_4": { "inputs": { "nixpkgs-lib": [ "neovim-nightly-overlay", @@ -178,8 +242,9 @@ "type": "github" }, "original": { - "id": "flake-utils", - "type": "indirect" + "owner": "numtide", + "repo": "flake-utils", + "type": "github" } }, "flake-utils_3": { @@ -195,15 +260,32 @@ "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" + "id": "flake-utils", + "type": "indirect" } }, "flake-utils_4": { "inputs": { "systems": "systems_4" }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_5": { + "inputs": { + "systems": "systems_5" + }, "locked": { "lastModified": 1701680307, "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", @@ -220,7 +302,7 @@ }, "hercules-ci-effects": { "inputs": { - "flake-parts": "flake-parts_3", + "flake-parts": "flake-parts_4", "nixpkgs": [ "neovim-nightly-overlay", "nixpkgs" @@ -267,14 +349,14 @@ "nixpkgs": [ "nixpkgs" ], - "rust-overlay": "rust-overlay_2" + "rust-overlay": "rust-overlay_3" }, "locked": { - "lastModified": 1708134405, - "narHash": "sha256-ktSi+D3lj7eStJVHCcmsizQlVvVW8GaCEYjKnPCGt7k=", + "lastModified": 1708270612, + "narHash": "sha256-T5aQ/lnW7wlIDpg7QEb32eYswAFSndFM+kfRk8uNHwQ=", "owner": "JakeStanger", "repo": "ironbar", - "rev": "31505c71400256af69b67039b44cb3ce9f0a953f", + "rev": "180a5205b9eb316e4b2916ae2ed0b2198912b9cd", "type": "github" }, "original": { @@ -285,7 +367,7 @@ }, "naersk": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1698420672, @@ -303,7 +385,7 @@ }, "neovim-flake": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_5", "nixpkgs": [ "neovim-nightly-overlay", "nixpkgs" @@ -311,11 +393,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1708127071, - "narHash": "sha256-z6z7evR8VBCqM5JGKvRU6oHvdD41j/X+369QiYTzWAk=", + "lastModified": 1708040042, + "narHash": "sha256-8iloeE/jALIKcOcYKgTlI9i7iDW7n52Epqps27jGklU=", "owner": "neovim", "repo": "neovim", - "rev": "5fd1bac65ed07310eda5fd976b651cc493002849", + "rev": "04dfa2eea914086a9f42a5a00a33e9524f9fded4", "type": "github" }, "original": { @@ -328,22 +410,25 @@ "neovim-nightly-overlay": { "inputs": { "flake-compat": "flake-compat", - "flake-parts": "flake-parts_2", + "flake-parts": "flake-parts_3", "hercules-ci-effects": "hercules-ci-effects", "neovim-flake": "neovim-flake", - "nixpkgs": "nixpkgs_3" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { - "lastModified": 1708128234, - "narHash": "sha256-NR/X3NlzS4G5XY2ZkdfXdPyEDU0OZdcF+2tElSbm5RI=", + "lastModified": 1708041826, + "narHash": "sha256-zW7F31gW4HCBYcImcXxold4ntZdlEr/NTlMVhEMA5dw=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "957f6857d74f012760dac4437cc03e6475c69d81", + "rev": "1afaeebc41dab1029b855b17d78f2348e8dd49e3", "type": "github" }, "original": { "owner": "nix-community", "repo": "neovim-nightly-overlay", + "rev": "1afaeebc41dab1029b855b17d78f2348e8dd49e3", "type": "github" } }, @@ -354,11 +439,11 @@ ] }, "locked": { - "lastModified": 1707707289, - "narHash": "sha256-YuDt/eSTXMEHv8jS8BEZJgqCcG8Tr3cyqaZjJFXZHsw=", + "lastModified": 1708231718, + "narHash": "sha256-IZdieFWvhBkxoOFMDejqLUYqD94WN6k0YSpw0DFy+4g=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "44f50a5ecaab72a61d5fd8e5c5717bc4bf9c25dd", + "rev": "0e6857fa1d632637488666c08e7b02c08e3178f8", "type": "github" }, "original": { @@ -383,7 +468,41 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1690881714, + "narHash": "sha256-h/nXluEqdiQHs1oSgkOOWF+j8gcJMWhwnZ9PFabN6q0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9e1960bc196baf6881340d53dccb203a951745a2", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { + "locked": { + "lastModified": 1706487304, + "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1706683685, "narHash": "sha256-FtPPshEpxH/ewBOsdKBNhlsL2MLEFv1hEnQ19f/bFsQ=", @@ -397,22 +516,6 @@ "type": "indirect" } }, - "nixpkgs_3": { - "locked": { - "lastModified": 1708093448, - "narHash": "sha256-gohEm3/NVyu7WINFhRf83yJH8UM2ie/KY9Iw3VN6fiE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "c7763249f02b7786b4ca36e13a4d7365cfba162f", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_4": { "locked": { "lastModified": 1708118438, @@ -433,7 +536,9 @@ "inputs": { "anyrun": "anyrun", "anyrun-hyprwin": "anyrun-hyprwin", - "flake-utils": "flake-utils_2", + "anyrun-nixos-options": "anyrun-nixos-options", + "anyrun-rink": "anyrun-rink", + "flake-utils": "flake-utils_3", "home-manager": "home-manager", "ironbar": "ironbar", "neovim-nightly-overlay": "neovim-nightly-overlay", @@ -462,7 +567,26 @@ }, "rust-overlay_2": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1708135817, + "narHash": "sha256-EUMO/K3+Wgh0THOLoRXhxrh6G/pQ7BlJ8No+ciy1nKA=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "c77e68d33a84ce3f9e86905c0f2ef78d5defad28", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_3": { + "inputs": { + "flake-utils": "flake-utils_4", "nixpkgs": [ "ironbar", "nixpkgs" @@ -541,6 +665,21 @@ "repo": "default", "type": "github" } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/config/nix/flake.nix b/config/nix/flake.nix index 9258d639..8cbe9651 100644 --- a/config/nix/flake.nix +++ b/config/nix/flake.nix @@ -13,7 +13,12 @@ url = "github:LnL7/nix-darwin"; inputs.nixpkgs.follows = "nixpkgs"; }; - neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay"; + neovim-nightly-overlay = { + url = + "github:nix-community/neovim-nightly-overlay/1afaeebc41dab1029b855b17d78f2348e8dd49e3"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + anyrun = { url = "github:Kirottu/anyrun"; inputs.nixpkgs.follows = "nixpkgs"; @@ -22,6 +27,17 @@ url = "github:uttarayan21/anyrun-hyprwin"; inputs.nixpkgs.follows = "nixpkgs"; }; + anyrun-nixos-options = { + url = "github:n3oney/anyrun-nixos-options"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + anyrun-rink = { + # url = "github:uttarayan21/anyrun-rink"; + url = "git+file:///home/servius/Projects/anyrun-rink"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + ironbar = { url = "github:JakeStanger/ironbar"; inputs.nixpkgs.follows = "nixpkgs"; @@ -82,8 +98,12 @@ anyrun-overlay = final: prev: { anyrun = inputs.anyrun.packages.${prev.system}.anyrun; hyprwin = inputs.anyrun-hyprwin.packages.${prev.system}.hyprwin; + nixos-options = + inputs.anyrun-nixos-options.packages.${prev.system}.default; + anyrun-rink = inputs.anyrun-rink.packages.${prev.system}.default; }; overlays = [ inputs.neovim-nightly-overlay.overlay anyrun-overlay ]; + # overlays = [ anyrun-overlay ]; in { nixosConfigurations = let devices = nixos_devices; in import ./nixos { diff --git a/config/nix/linux/anyrun.nix b/config/nix/linux/anyrun.nix index 01f21682..b5408998 100644 --- a/config/nix/linux/anyrun.nix +++ b/config/nix/linux/anyrun.nix @@ -1,42 +1,91 @@ -{ inputs, pkgs, ... }: { +{ inputs, pkgs, osConfig, ... }: { imports = [ inputs.anyrun.nixosModules.home-manager ]; programs.anyrun = { enable = true; config = { plugins = with inputs.anyrun.packages.${pkgs.system}; [ - inputs.anyrun-hyprwin.packages.${pkgs.system}.hyprwin - rink + inputs.anyrun-nixos-options.packages.${pkgs.system}.default + inputs.anyrun-hyprwin.packages.${pkgs.system}.default + inputs.anyrun-rink.packages.${pkgs.system}.default + # rink applications websearch shell translate symbols + kidex ]; x = { fraction = 0.5; }; y = { fraction = 0.3; }; height = { absolute = 0; }; width = { absolute = 1000; }; showResultsImmediately = true; + maxEntries = 10; layer = "overlay"; }; extraConfigFiles = { + "nixos-options.ron".text = let + nixos-options = osConfig.system.build.manual.optionsJSON + + "/share/doc/nixos/options.json"; + hm-options = inputs.home-manager.packages.${pkgs.system}.docs-json + + "/share/doc/home-manager/options.json"; + # or alternatively if you wish to read any other documentation options, such as home-manager + # get the docs-json package from the home-manager flake + # hm-options = inputs.home-manager.packages.${pkgs.system}.docs-json + "/share/doc/home-manager/options.json"; + # options = builtins.toJSON { + # ":nix" = [nixos-options]; + # ":hm" = [hm-options]; + # ":something-else" = [some-other-option]; + # ":nall" = [nixos-options hm-options some-other-option]; + # }; + options = builtins.toJSON { + ":nix" = [ nixos-options ]; + ":hm" = [ hm-options ]; + }; + + in '' + Config( + options: ${options}, + max_entries: Some(10), + ) + ''; "shell.ron".text = '' Config( prefix: "", shell: None, ) ''; - "handlr.ron".text = '' - Config( - prefix: "", - log: None, - ) - ''; "websearch.ron".text = '' Config( - prefix: "?" - engines: [Google, DuckDuckGo] + prefix: "?", + engines: [ + Google, + DuckDuckGo, + Custom ( + name: "Nix Packages", + url: "search.nixos.org/packages?query={}" + ), + Custom ( + name: "docs.rs", + url: "docs.rs/releases/search?query={}" + ), + Custom ( + name: "NixOS options", + url: "search.nixos.org/options?query={}" + ), + ] + ) + ''; + "rink.ron".text = '' + Config( + currency: Some("${ + builtins.toFile "currency.units" '' + !category currencies "Currencies" + usd USD + inr INR + '' + }"), ) ''; }; diff --git a/config/nix/linux/ironbar.nix b/config/nix/linux/ironbar.nix index 33616a72..2ca3bb81 100644 --- a/config/nix/linux/ironbar.nix +++ b/config/nix/linux/ironbar.nix @@ -30,7 +30,7 @@ }; DP-1 = { position = "bottom"; - icon_theme = "Paper-Mono-Dark"; + icon_theme = "Papirus-Dark"; end = [ { type = "sys_info"; diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua index 994b5008..fa27648c 100644 --- a/config/nvim/lua/lsp.lua +++ b/config/nvim/lua/lsp.lua @@ -3,6 +3,8 @@ local lspstatus = require 'lsp-status' local cmp_nvim_lsp = require 'cmp_nvim_lsp' local capabilities = cmp_nvim_lsp.default_capabilities() + +if not vim.fn.filereadable('/etc/nix/nix.conf') then ( require("mason-lspconfig").setup_handlers { function(server_name) -- default handler (optional) lspconfig[server_name].setup { @@ -48,3 +50,5 @@ require("mason-lspconfig").setup_handlers { }; end } +) +end diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index a9d93cb7..22b7d082 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -164,9 +164,15 @@ return require('lazy').setup({ "williamboman/mason-lspconfig.nvim", config = function() require("mason-lspconfig").setup({ - ensure_installed = { "lua_ls", "rust_analyzer", "pylsp" }, automatic_installation = true, }) + -- if not vim.fn.filereadable("/etc/nix/nix.conf") then ( + -- require("mason-lspconfig").setup({ + -- ensure_installed = { "lua_ls" }, + -- automatic_installation = true, + -- }) + -- ) + -- end end, lazy = false, },