dotfiles/nix-conf/home-manager/home.nix

140 lines
4.8 KiB
Nix
Raw Normal View History

# This is a nix module, with an additional wrapper from home-manager
# myHome, myLib is injected from extraSpecialArgs in flake.nix
# This file represents the base settings for each machine
# Additional configurations goes to profiles/<user>
# or inlined in flake.nix
{ config # Represents the realized final configuration
, pkgs # This is by default just ``= import <nixpkgs>{}`
2022-11-09 11:35:28 +00:00
, myHome
2022-12-08 21:00:53 +00:00
, myLib
, option # The options we're given, this might be useful for typesafety?
, proj_root
2022-11-09 11:35:28 +00:00
, ...
}:
2022-12-03 06:43:44 +00:00
let
nvim_pkgs = [
# Yes, I desperately want neovim to work out-of-the-box without flake.nix for now
# I want at least python LSP to work everywhere because it's basically
# an alternative to bash script when I move to OpenColo
# pkgs.gccStdenv
pkgs.gcc
pkgs.tree-sitter
pkgs.fzf # file name fuzzy search
2022-12-26 11:34:17 +00:00
pkgs.sumneko-lua-language-server
pkgs.ripgrep # content fuzzy search
pkgs.zk # Zettelkasten (limited support)
pkgs.fd # Required by a Telescope plugin (?)
2022-12-03 06:43:44 +00:00
pkgs.stdenv.cc.cc.lib
rust_pkgs
pkgs.rust-analyzer
2022-12-03 06:43:44 +00:00
# Python3 as alternative to bash scripts :^)
# (pkgs.python310Full.withPackages (pypkgs: [
# # python-lsp-server's dependencies is absolutely astronomous
# # pypkgs.python-lsp-server # python-lsp. Now we'll have to tell mason to look for this
# pypkgs.pynvim # nvim provider
2022-12-03 10:08:54 +00:00
# pypkgs.ujson # pylsp seems to rely on this. satisfy it lol
2022-12-03 06:43:44 +00:00
# ]))
];
rust_pkgs = (pkgs.rust-bin.selectLatestNightlyWith
(
toolchain:
toolchain.default.override {
extensions = [ "rust-src" ];
}
));
# NOTE: Failure 1: buildInputs is pretty much ignored
# my_neovim = pkgs.neovim-unwrapped.overrideDerivation (old: {
# # TODO: is there a more beautiful way to override propagatedBuildInputs?
# name = "hungtr-" + old.name;
# buildInputs = (old.buildInputs or []) ++ [
# pkgs.tree-sitter # highlighting
# rust_pkgs # for potentially rust-analyzer
# pkgs.fzf
# pkgs.ripgrep
# pkgs.zk
# pkgs.fd
# ];
# NOTE: Failure 2: propagatedBuildInputs probably only concerns dyn libs
# });
# NOTE: Failure 3: must be unwrapped neovim because home-manager does the wrapping
# my_neovim = pkgs.neovim;
# NOTE: Add packages to nvim_pkgs instead, so that it's available at userspace
# and is added to the path after wrapping.
# check: nix repl `homeConfigurations.hungtr.config.programs.neovim.finalPackage.buildCommand`
# see: :/--suffix.*PATH
# there should be mentions of additional packages
my_neovim = pkgs.neovim-unwrapped;
2022-12-08 21:00:53 +00:00
inherit (myLib) fromYaml;
2022-12-03 06:43:44 +00:00
in
2022-11-06 20:23:10 +00:00
{
home = {
username = myHome.username;
homeDirectory = myHome.homeDirectory;
stateVersion = myHome.stateVersion or "22.05";
};
home.packages = pkgs.lib.unique ([
2022-12-23 22:51:04 +00:00
# pkgs.ncdu
pkgs.rclone # cloud file operations
pkgs.htop # system diagnostics in CLI
pkgs.ripgrep # content fuzzy search
pkgs.unzip # compression
pkgs.zip # compression
# cool utilities
pkgs.yq # Yaml adaptor for jq (only pretty print, little query)
pkgs.xorg.xclock # TODO: only include if have GL # For testing GL installation
pkgs.logseq # TODO: only include if have GL # Obsidian alt
pkgs.mosh # Parsec for SSH
2022-12-15 19:45:30 +00:00
# pkgs.nixops_unstable # nixops v2 # insecure for now
pkgs.lynx # Web browser at your local terminal
2022-12-21 22:49:03 +00:00
# Personal management
pkgs.keepass # password manager. wish there is a keepass-query
2022-12-21 22:49:03 +00:00
# pkgs.tailscale # VPC;; This should be installed in system-nix
2022-12-15 19:30:14 +00:00
pkgs.python310 # dev packages should be in project
2022-11-09 15:35:44 +00:00
# pkgs.python310.numpy
# pkgs.python310Packages.tensorflow
# pkgs.python310Packages.scikit-learn
] ++ (myHome.packages or [ ])
# ++ nvim_pkgs
);
2022-11-06 20:23:10 +00:00
2022-11-06 22:22:09 +00:00
## Configs ##
xdg.configFile."nvim/init.lua".source = "${proj_root.config.path}//neovim/init.lua";
xdg.configFile."zk/config.toml".source = "${proj_root.config.path}//zk/config.toml";
2022-11-06 22:22:09 +00:00
## Programs ##
2022-11-09 13:00:23 +00:00
programs.jq = {
enable = true;
};
# TODO: override the original package, inject tree-sitter and stuffs
2022-12-01 02:17:06 +00:00
programs.neovim = {
enable = true;
package = my_neovim;
2022-12-01 02:17:06 +00:00
viAlias = true;
vimAlias = true;
withPython3 = true;
withNodeJs = true;
2022-12-03 10:08:54 +00:00
extraPackages = nvim_pkgs;
# only for here for archive-documentation
2022-12-01 08:18:39 +00:00
# extraPython3Packages = (pypkgs: [
2022-12-03 10:08:54 +00:00
# # pypkgs.python-lsp-server
2022-12-01 08:18:39 +00:00
# pypkgs.ujson
# ]);
2022-12-01 02:17:06 +00:00
# I use vim-plug, so I probably don't require packaging
# extraConfig actually writes to init-home-manager.vim (not lua)
# https://github.com/nix-community/home-manager/pull/3287
2022-12-03 06:43:44 +00:00
# extraConfig = builtins.readFile "${proj_root}/neovim/init.lua";
2022-12-01 02:17:06 +00:00
};
# not exist in home-manager
# have to do it at system level
# services.ntp.enable = true; # automatic time
2022-12-24 04:11:56 +00:00
programs.nix-index = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
2022-11-06 20:23:10 +00:00
}