misc: overlays

This commit is contained in:
ooks-io 2023-08-25 13:36:54 +12:00
parent d9641c1f31
commit 42b54e7b55
5 changed files with 23 additions and 129 deletions

View file

@ -30,7 +30,7 @@
homeManagerModules = import ./modules/home-manager;
overlays = import ./overlays { inherit inputs outputs; };
#overlays = import ./overlays { inherit inputs outputs; };
packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; });
devShells = forEachSystem (pkgs: import ./shell.nix { inherit pkgs; });

View file

@ -1,64 +1,11 @@
{ config, pkgs, lib, ... }:
# Let-In ----------------------------------------------------------------------------------------{{{
let
inherit (lib) concatStringsSep optional;
inherit (config.lib.file) mkOutOfStoreSymlink;
# customNvChad = ./nvchad-custom;
populateEnv = ./populate-nvim-env.py;
populateEnvScript = ''
mkdir -p ${config.xdg.dataHome}/nvim/site/plugin
${pkgs.python39}/bin/python ${populateEnv} -o ${config.xdg.dataHome}/nvim/site/plugin
'';
# }}}
in
{ pkgs, ... }:
{
# Neovim
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.neovim.enable
programs.neovim.enable = true;
programs.neovim.viAlias = true;
programs.neovim.vimAlias = true;
# Config and plugins ------------------------------------------------------------------------- {{{
xdg.configFile."nvim" = {
source = "${pkgs.nvchad}";
};
home.packages = with pkgs; [
nvchad
(pkgs.writeShellScriptBin "update-nvim-env" ''
#
# update-nvim-env
#
# Update neovim env such that it can be used in neovide or other GUIs.
${populateEnvScript}
'')
];
home.activation.neovim = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
echo "Populating neovim env..."
${populateEnvScript}
'';
programs.bash.initExtra = lib.mkAfter ''
export EDITOR="${config.programs.neovim.package}/bin/nvim"
'';
programs.zsh.initExtra = lib.mkAfter ''
export EDITOR="${config.programs.neovim.package}/bin/nvim"
'';
home.sessionVariables.EDITOR = "nvim";
# Required packages -------------------------------------------------------------------------- {{{
programs.neovim.extraPackages = with pkgs; [
nodejs_20
gcc
];
# }}}
}
# vim: foldmethod=marker

View file

@ -1,72 +0,0 @@
#!/bin/env python3
import os
from collections import OrderedDict
import argparse
KEYS = [
# PATH
"PATH",
"CS154_ADMIN",
"BREW_PREFIX",
"CONDA_PYTHON_EXE",
"SPACESHIP_ROOT",
"COLORFGBG",
"XPC_SERVICE_NAME",
"_CE_M",
"XPC_FLAGS",
"LANG",
# terminal
"VISUAL",
"LESS",
"LOGNAME",
"COLORTERM",
"HISTFILE",
"LC_TERMINAL",
"LC_TERMINAL_VERSION",
"ITERM_SESSION_ID",
"ITERM_PROFILE",
"TERM_SESSION_ID",
"TERM_PROGRAM",
"STARSHIP_SESSION_KEY",
"STARSHIP_CONFIG",
"VI_MODE_SET_CURSOR",
"_",
"LSCOLORS",
"ZSH",
"EDITOR",
# XDG
"XDG_DATA_HOME",
"XDG_STATE_HOME",
"XDG_CACHE_HOME",
"XDG_CONFIG_HOME",
]
def main(output_path):
env = os.environ.copy()
env = OrderedDict(sorted(env.items()))
dst_file = "{}/env.lua".format(output_path)
with open(dst_file, "w") as f:
for key, value in env.items():
if key in KEYS:
if key == "PATH":
f.write('vim.env.PATH = vim.env.PATH .. ":{}"\n'.format(value))
continue
f.write('vim.fn.setenv("{}", "{}")\n'.format(key, value))
f.close()
if __name__ == "__main__":
home_directory = os.path.expanduser("~")
parser = argparse.ArgumentParser("Neovim Populate Env")
parser.add_argument(
"-o",
"--output",
required=False,
help="Output Path",
type=str,
default="{}/.config/nvim/lua/toutaboc".format(home_directory),
)
args = parser.parse_args()
main(args.output)

View file

@ -11,7 +11,7 @@ in
nixpkgs = {
config = {
overlays = builtins.attrValues outputs.overlays;
#overlays = builtins.attrValues outputs.overlays;
allowUnfree = true;
allowUnfreePredicate = (_: true);
permittedInsecurePackages = [

View file

@ -1,5 +1,24 @@
# This file defines overlays
{ inputs, ... }:
{
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs { pkgs = final; };
}
# This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays
modifications = final: prev: {
# example = prev.example.overrideAttrs (oldAttrs: rec {
# ...
# });
};
# When applied, the unstable nixpkgs set (declared in the flake inputs) will
# be accessible through 'pkgs.unstable'
unstable-packages = final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
}