feat: idempotent installation with WPlug

std
Hung 2023-06-11 21:21:01 -07:00
parent 63900e1117
commit a5186b204c
7 changed files with 110 additions and 98 deletions

View File

@ -301,11 +301,11 @@
"paisano": "paisano" "paisano": "paisano"
}, },
"locked": { "locked": {
"lastModified": 1682269418, "lastModified": 1686502488,
"narHash": "sha256-0fdUrQMkXMuK1/6D1Y+gbGXIWChiIRnlbYvo4dmNfVE=", "narHash": "sha256-sLSiDkU9oNpcl1QEge0xVviD7N87iVdrwl7l9i+6mxQ=",
"owner": "divnix", "owner": "divnix",
"repo": "hive", "repo": "hive",
"rev": "669cdfcf61823d33f11a4fe5ee1f3c34903f4eaa", "rev": "e8b46fa4d2917dfd456f3f040e9761262b4648d2",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -504,11 +504,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1686020360, "lastModified": 1686412476,
"narHash": "sha256-Wee7lIlZ6DIZHHLiNxU5KdYZQl0iprENXa/czzI6Cj4=", "narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4729ffac6fd12e26e5a8de002781ffc49b0e94b7", "rev": "21951114383770f96ae528d0ae68824557768e81",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -804,11 +804,11 @@
"yants": "yants_2" "yants": "yants_2"
}, },
"locked": { "locked": {
"lastModified": 1686006649, "lastModified": 1686337240,
"narHash": "sha256-6sdvFtQyx7SZoki1MlO2+3Xns4jmR34FEjlXawQdwhk=", "narHash": "sha256-JedAsyUIbSIhVrRWSl0R3lSWemVWsHg0w3MuzW7h4tg=",
"owner": "divnix", "owner": "divnix",
"repo": "std", "repo": "std",
"rev": "d6bcee9c35fb4a905b51c39e4d5ca842e9a421eb", "rev": "1bd99cec90a5cee8575f45dbc193d6dd860a5f35",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -37,5 +37,6 @@
devShells = std.harvest [ [ "dotfiles" "devshells" ] ]; devShells = std.harvest [ [ "dotfiles" "devshells" ] ];
# nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ]; # nixosConfigurations = std.pick [ [ "dotfiles" "nixos" ] ];
# homeConfigurations = std.pick [ [ "dotfiles" "home" ] ]; # homeConfigurations = std.pick [ [ "dotfiles" "home" ] ];
homeModules = std.pick [["repo" "home-modules"]];
}; };
} }

View File

@ -8,6 +8,7 @@
-- - zk @ https://github.com/mickael-menu/zk -- - zk @ https://github.com/mickael-menu/zk
-- - prettierd @ npm install -g @fsouza/prettierd -- - prettierd @ npm install -g @fsouza/prettierd
-- Auto-installs vim-plug
vim.cmd([[ vim.cmd([[
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
let plug_path = data_dir . '/autoload/plug.vim' let plug_path = data_dir . '/autoload/plug.vim'
@ -20,83 +21,102 @@ endif
-- vim-plug -- vim-plug
local Plug = vim.fn['plug#'] local Plug = vim.fn['plug#']
-- prepare a list of installed plugins from rtp
local installed_plugins = {}
-- NOTE: nvim_list_runtime_paths will expand wildcard paths for us.
for _, path in ipairs(vim.api.nvim_list_runtime_paths()) do
local last_folder_start = path:find("/[^/]*$")
if last_folder_start then
local plugin_name = path:sub(last_folder_start + 1)
installed_plugins[plugin_name] = true
end
end
-- Do Plug if plugin not yet linked in `rtp`. This takes care of Nix-compatibility
local function WPlug(plugin_path, ...)
local plugin_name = plugin_path:match("/([^/]+)$")
if not installed_plugins[plugin_name] then
Plug(plugin_path, ...)
end
end
vim.call('plug#begin') vim.call('plug#begin')
-- libs and dependencies -- libs and dependencies
-- Plug('nvim-lua/plenary.nvim') -- The base of all plugins -- Plug('nvim-lua/plenary.nvim') -- The base of all plugins
-- plugins -- plugins
-- Plug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua WPlug('tjdevries/nlua.nvim') -- adds symbols of vim stuffs in init.lua
-- Plug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting WPlug('nvim-treesitter/nvim-treesitter') -- language parser engine for highlighting
-- Plug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects WPlug('nvim-treesitter/nvim-treesitter-textobjects') -- more text objects
-- Plug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser WPlug('nvim-telescope/telescope.nvim', { branch = '0.1.x' }) -- file browser
-- TODO: this might need to be taken extra care in our Nix config -- TODO: this might need to be taken extra care in our Nix config
-- What this Plug declaration means is this repo needs to be built on our running environment -- What this WPlug declaration means is this repo needs to be built on our running environment
-- ----- -- -----
-- What to do: -- What to do:
-- - Run `make` at anytime before Nix is done on this repository -- - Run `make` at anytime before Nix is done on this repository
-- - Might mean that we fetch this repository, run make, and copy to destination folder -- - Might mean that we fetch this repository, run make, and copy to destination folder
-- - Make sure that if we run `make` at first Plug run, that `make` is idempotent -- - Make sure that if we run `make` at first WPlug run, that `make` is idempotent
-- OR -- OR
-- Make sure that Plug does not run `make` and use the output it needs -- Make sure that WPlug does not run `make` and use the output it needs
-- Plug('nvim-telescope/telescope-fzf-native.nvim', WPlug('nvim-telescope/telescope-fzf-native.nvim',
-- { ['do'] = 'make >> /tmp/log 2>&1' }) { ['do'] = 'make >> /tmp/log 2>&1' })
-- Plug('nvim-telescope/telescope-file-browser.nvim') WPlug('nvim-telescope/telescope-file-browser.nvim')
-- cmp: auto-complete/suggestions -- cmp: auto-complete/suggestions
-- Plug('neovim/nvim-lspconfig') -- built-in LSP configurations WPlug('neovim/nvim-lspconfig') -- built-in LSP configurations
-- Plug('hrsh7th/cmp-nvim-lsp') WPlug('hrsh7th/cmp-nvim-lsp')
-- Plug('hrsh7th/cmp-path') WPlug('hrsh7th/cmp-path')
-- Plug('hrsh7th/cmp-buffer') WPlug('hrsh7th/cmp-buffer')
-- Plug('hrsh7th/cmp-cmdline') WPlug('hrsh7th/cmp-cmdline')
-- Plug('hrsh7th/nvim-cmp') WPlug('hrsh7th/nvim-cmp')
-- Plug('onsails/lspkind-nvim') WPlug('onsails/lspkind-nvim')
Plug('yioneko/nvim-yati', { tag = '*' }) -- copium: fix Python indent auto-correct from smart-indent WPlug('yioneko/nvim-yati', { tag = '*' }) -- copium: fix Python indent auto-correct from smart-indent
Plug('nathanalderson/yang.vim') WPlug('nathanalderson/yang.vim')
-- Plug('tzachar/cmp-tabnine', { ['do'] = './install.sh' }) -- WPlug('tzachar/cmp-tabnine', { ['do'] = './install.sh' })
-- DevExp -- DevExp
-- Plug('windwp/nvim-autopairs') -- matches pairs like [] (),... WPlug('windwp/nvim-autopairs') -- matches pairs like [] (),...
-- Plug('windwp/nvim-ts-autotag') -- matches tags <body>hello</body> WPlug('windwp/nvim-ts-autotag') -- matches tags <body>hello</body>
-- Plug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer WPlug('NMAC427/guess-indent.nvim') -- guesses the indentation of an opened buffer
-- Plug('j-hui/fidget.nvim') -- Progress bar for LSP WPlug('j-hui/fidget.nvim') -- Progress bar for LSP
Plug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines WPlug('numToStr/Comment.nvim') -- "gc" to comment visual regions/lines
Plug('lewis6991/gitsigns.nvim') -- add git info to sign columns WPlug('lewis6991/gitsigns.nvim') -- add git info to sign columns
Plug('tpope/vim-fugitive') -- git commands in nvim WPlug('tpope/vim-fugitive') -- git commands in nvim
Plug('williamboman/mason.nvim') -- LSP, debuggers,... package manager WPlug('williamboman/mason.nvim') -- LSP, debuggers,... package manager
Plug('williamboman/mason-lspconfig.nvim') -- lsp config for mason WPlug('williamboman/mason-lspconfig.nvim') -- lsp config for mason
-- Plug('ThePrimeagen/harpoon') -- 1-click through marked files per project WPlug('ThePrimeagen/harpoon') -- 1-click through marked files per project
Plug('TimUntersberger/neogit') -- Easy-to-see git status WPlug('TimUntersberger/neogit') -- Easy-to-see git status
Plug('folke/trouble.nvim') -- File-grouped workspace diagnostics WPlug('folke/trouble.nvim') -- File-grouped workspace diagnostics
Plug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands WPlug('tpope/vim-dispatch') -- Allows quick build/compile/test vim commands
Plug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein" WPlug('clojure-vim/vim-jack-in') -- Clojure: ":Boot", ":Clj", ":Lein"
Plug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator WPlug('radenling/vim-dispatch-neovim') -- Add support for neovim's terminal emulator
-- Plug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs) -- WPlug('Olical/conjure') -- REPL on the source for Clojure (and other LISPs)
Plug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*) WPlug('gennaro-tedesco/nvim-jqx') -- JSON formatter (use :Jqx*)
Plug('kylechui/nvim-surround') -- surrounds with tags/parenthesis WPlug('kylechui/nvim-surround') -- surrounds with tags/parenthesis
Plug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration WPlug('simrat39/rust-tools.nvim') -- config rust-analyzer and nvim integration
-- UI & colorscheme -- UI & colorscheme
Plug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts WPlug('simrat39/inlay-hints.nvim') -- type-hints with pseudo-virtual texts
-- Plug('gruvbox-community/gruvbox') -- theme provider WPlug('gruvbox-community/gruvbox') -- theme provider
Plug('nvim-lualine/lualine.nvim') -- fancy status line WPlug('nvim-lualine/lualine.nvim') -- fancy status line
Plug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines WPlug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines
Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes WPlug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes
Plug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog WPlug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog
Plug('folke/todo-comments.nvim') -- Highlights TODO WPlug('folke/todo-comments.nvim') -- Highlights TODO
-- other utilities -- other utilities
Plug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope WPlug('nvim-treesitter/nvim-treesitter-context') -- Top one-liner context of func/class scope
Plug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs WPlug('nvim-treesitter/playground') -- Sees Treesitter AST - less hair pulling, more PRs
Plug('saadparwaiz1/cmp_luasnip') -- snippet engine WPlug('saadparwaiz1/cmp_luasnip') -- snippet engine
-- Plug('L3MON4D3/LuaSnip') -- snippet engine WPlug('L3MON4D3/LuaSnip') -- snippet engine
-- Plug('mickael-menu/zk-nvim') -- Zettelkasten WPlug('mickael-menu/zk-nvim') -- Zettelkasten
-- Switch cases: -- Switch cases:
-- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust) -- `gsp` -> PascalCase (classes), `gsc` -> camelCase (Java), `gs_` -> snake_case (C/C++/Rust)
-- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case -- `gsu` -> UPPER_CASE (CONSTs), `gsk` -> kebab-case (Clojure), `gsK` -> Title-Kebab-Case
-- `gs.` -> dot.case (R) -- `gs.` -> dot.case (R)
Plug('arthurxavierx/vim-caser') -- switch cases WPlug('arthurxavierx/vim-caser') -- switch cases
Plug('~/local_repos/ts-ql') -- workspace code intelligence WPlug('~/local_repos/ts-ql') -- workspace code intelligence
--------- ---------
vim.call('plug#end') vim.call('plug#end')

View File

@ -17,7 +17,7 @@ in
config.programs.ssh = { config.programs.ssh = {
inherit (cfg) enable; inherit (cfg) enable;
forwardAgent = true; forwardAgent = true;
extraConfig = builtins.readFile "${proj_root.config.path}/ssh/config"; includes = ["${proj_root.config.path}/ssh/config"];
}; };
} }

View File

@ -818,11 +818,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1686142265, "lastModified": 1686391840,
"narHash": "sha256-IP0xPa0VYqxCzpqZsg3iYGXarUF+4r2zpkhwdHy9WsM=", "narHash": "sha256-5S0APl6Mfm6a37taHwvuf11UHnAX0+PnoWQbsYbMUnc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "39c7d0a97a77d3f31953941767a0822c94dc01f5", "rev": "0144ac418ef633bfc9dbd89b8c199ad3a617c59f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -953,11 +953,11 @@
"topiary": "topiary" "topiary": "topiary"
}, },
"locked": { "locked": {
"lastModified": 1686147433, "lastModified": 1686315162,
"narHash": "sha256-KqDqUGNfXcOwh6fkHMbH4a2W6k/W7S7wC/mxstlORwo=", "narHash": "sha256-KZZRTXSpxJDDGVbEdyTR/4Mu2COSMtrim+5iL7qwDTw=",
"owner": "tweag", "owner": "tweag",
"repo": "nickel", "repo": "nickel",
"rev": "dc6804acd123257460eef60d615da2eb0a8aca78", "rev": "9fed1326c9306d7c339884584702ce570764beaf",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1197,11 +1197,11 @@
}, },
"nixpkgs_12": { "nixpkgs_12": {
"locked": { "locked": {
"lastModified": 1686020360, "lastModified": 1686412476,
"narHash": "sha256-Wee7lIlZ6DIZHHLiNxU5KdYZQl0iprENXa/czzI6Cj4=", "narHash": "sha256-inl9SVk6o5h75XKC79qrDCAobTD1Jxh6kVYTZKHzewA=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "4729ffac6fd12e26e5a8de002781ffc49b0e94b7", "rev": "21951114383770f96ae528d0ae68824557768e81",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -1768,11 +1768,11 @@
"nixpkgs": "nixpkgs_13" "nixpkgs": "nixpkgs_13"
}, },
"locked": { "locked": {
"lastModified": 1686105195, "lastModified": 1686537156,
"narHash": "sha256-tBTKW+oqfT86Mvq/nm8Tkk3pzhJFXJWXJrj71cTF7lE=", "narHash": "sha256-mJD80brS6h6P4jzwdKID0S9RvfyiruxgJbXvPPIDqF0=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "1279a72003f5e4b08c8eca1101d8f57452a539f9", "rev": "e75da5cfc7da874401decaa88f4ccb3b4d64d20d",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@ -80,11 +80,10 @@
nerd_font_module = { config, pkgs, ... }: { nerd_font_module = { config, pkgs, ... }: {
fonts.fontconfig.enable = true; fonts.fontconfig.enable = true;
home.packages = [ home.packages = [
(pkgs.nerdfonts.override { fonts = [ "DroidSansMono" ]; }) # list of fonts are available at https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/data/fonts/nerdfonts/shas.nix
(pkgs.nerdfonts.override { fonts = [ "Hack" ]; })
]; ];
# For some reasons, Windows es in the font name as DroidSansMono NF base.alacritty.font.family = "Hack Nerd Font Mono";
# so we need to override this
base.alacritty.font.family = "DroidSansMono Nerd Font";
}; };
in in
{ {
@ -184,14 +183,14 @@
{ {
base.private_chromium.enable = false; base.private_chromium.enable = false;
} }
nerd_font_module
{ {
base.graphics.enable = false; base.graphics.enable = false;
# don't want to deal with GL stuffs on mac yet :/ # don't want to deal with GL stuffs on mac yet :/
base.graphics.useNixGL.defaultPackage = null; base.graphics.useNixGL.defaultPackage = null;
# FIXME: this actually does not exist # FIXME: this actually does not exist
base.keepass.path = "/Users/htran/keepass.kdbx"; # base.keepass.path = "/Users/htran/keepass.kdbx";
base.alacritty.font.size = 11.0; base.alacritty.font.size = 11.0;
base.alacritty.font.family = "DroidSansM Nerd Font";
base.git.name = "Hung"; base.git.name = "Hung";
base.git.email = "htran@egihosting.com"; base.git.email = "htran@egihosting.com";
} }
@ -232,23 +231,6 @@
}; };
}; };
}; };
# NOTE: This is never actually tested. This is for Ubuntu@Felia
# "ubuntu_admin" = home-manager.lib.homeManagerConfiguration {
# inherit pkgs;
# modules = [
# ./home.nix
# ];
# extraSpecialArgs = {
# myLib = lib;
# myHome = {
# username = "ubuntu_admin";
# homeDirectory = "/home/ubuntu_admin";
# shellInitExtra = ''
# '' + x11_wsl;
# };
# };
# };
# Personal laptop # Personal laptop
hwtr = home-manager.lib.homeManagerConfiguration { hwtr = home-manager.lib.homeManagerConfiguration {
inherit pkgs; inherit pkgs;

View File

@ -0,0 +1,9 @@
{inputs, cell}: {
nerd_font_module = {config, pkgs, ...}: {
fonts.fontconfig.enable = true;
home.packages = [
(pkgs.nerdfonts.override { fonts = [ "Hack" ]; })
];
base.alacritty.font.family = "Hack Nerd Font Mono";
};
}