refactor home configuration into mixins

This commit is contained in:
Gabriel Fontes
2021-11-07 18:48:02 -03:00
parent 544963a018
commit ad954b7d5a
64 changed files with 750 additions and 459 deletions
+11 -12
View File
@@ -42,12 +42,12 @@
};
modules = [ (./hosts + "/${hostname}") ./modules/nixos ./overlays ];
};
# Make home configuration, given username, hostname, and system type
mkHome = { username, hostname, system }:
# Make home configuration, given username, required features, and system type
mkHome = { username, features, system }:
home-manager.lib.homeManagerConfiguration {
inherit username system;
extraSpecialArgs = {
inherit hostname nur impermanence nix-colors;
inherit nur impermanence nix-colors features;
};
configuration = ./users + "/${username}";
extraModules = [ ./modules/home-manager ./overlays ];
@@ -76,24 +76,23 @@
homeConfigurations = {
"misterio@atlas" = mkHome {
username = "misterio";
hostname = "atlas";
features = [ "cli" "desktop-sway" "games" "mining" "persistence" "rgb" "trusted" ];
system = "x86_64-linux";
};
"misterio@merope" = mkHome {
username = "misterio";
hostname = "merope";
features = [ "cli" "persistence" ];
system = "aarch64-linux";
};
"misterio@maia" = mkHome {
username = "misterio";
features = [ "cli" "persistence" ];
system = "x86_64-linux";
};
"layla@maia" = mkHome {
username = "layla";
hostname = "maia";
system = "x86_64-linux";
};
"misterio@maia" = mkHome {
username = "misterio";
hostname = "maia";
features = [ ];
system = "x86_64-linux";
};
};
View File
+9 -87
View File
@@ -1,96 +1,18 @@
{ pkgs, hostname, impermanence, nix-colors, nur, ... }:
{ lib, features, nur, ... }:
{
imports = [
impermanence.nixosModules.home-manager.impermanence
./direnv.nix
./fish.nix
./git.nix
./neofetch.nix
./nix-index.nix
./nvim.nix
./ranger.nix
./starship.nix
] ++ (if hostname == "atlas" then [
nix-colors.homeManagerModule
./rice.nix
./discord.nix
./element.nix
./ethminer.nix
./fira.nix
./gpg.nix
./gtk.nix
./kdeconnect.nix
./khard.nix
./khal.nix
./kitty.nix
./lutris.nix
./mail.nix
./mako.nix
./multimc.nix
./neomutt.nix
./obs.nix
./osu.nix
./pass.nix
./qt.nix
./qutebrowser.nix
./rgbdaemon.nix
#./runescape.nix
./slack.nix
./steam.nix
./sway.nix
./swayidle.nix
./swaylock.nix
./todoman.nix
./vdirsyncer.nix
./yuzu.nix
./waybar.nix
./zathura.nix
] else
[ ]);
programs.home-manager.enable = true;
imports = [ ./rice.nix ] ++
# Import each feature requested
lib.forEach features (f: ./features + "/${f}");
# Needed for basic operations
programs = {
home-manager.enable = true;
git.enable = true;
};
nixpkgs = {
config.allowUnfree = true;
overlays = [ nur.overlay ];
};
systemd.user.startServices = "sd-switch";
home.file.bin.source = ./scripts;
home.packages = with pkgs;
[
# Cli
bottom
cachix
pkgs.nur.repos.misterio.comma
exa
ncdu
rnix-lsp
] ++ (if hostname == "atlas" then [
setscheme
setwallpaper
amdgpu-clocks
# Gui apps
dragon-drop
imv
pavucontrol
spotify
wofi
xdg-utils
ydotool
] else if hostname == "merope" then [
pkgs.nur.repos.misterio.argononed
] else [ ]);
home.persistence = {
"/data/home/misterio" = {
directories = [ "Documents" "Downloads" "Pictures" "Videos" ];
allowOther = true;
};
};
}
-12
View File
@@ -1,12 +0,0 @@
{
programs.direnv = {
enable = true;
nix-direnv = {
enable = true;
enableFlakes = true;
};
};
home.persistence."/data/home/misterio".directories =
[ ".local/share/direnv" ];
}
+22
View File
@@ -0,0 +1,22 @@
{ pkgs, ... }:
{
imports = [
./nvim
./direnv.nix
./fish.nix
./git.nix
./neofetch.nix
./nix-index.nix
./ranger.nix
./starship.nix
];
home.packages = with pkgs; [
# Cli
pkgs.nur.repos.misterio.comma
bottom
cachix
exa
ncdu
rnix-lsp
];
}
+14
View File
@@ -0,0 +1,14 @@
{ lib, features, ... }:
{
programs.direnv = {
enable = true;
nix-direnv = {
enable = true;
enableFlakes = true;
};
};
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/home/misterio".directories = [ ".local/share/direnv" ];
};
}
@@ -5,13 +5,6 @@
aliases = { graph = "log --decorate --oneline --graph"; };
userName = "Gabriel Fontes";
userEmail = "eu@misterio.me";
signing = if hostname == "atlas" then {
signByDefault = true;
key = "CE707A2C17FAAC97907FF8EF2E54EA7BFE630916";
} else {
signByDefault = false;
key = "";
};
extraConfig = {
init = {
defaultBranch = "main";
@@ -65,43 +65,42 @@ let
background_color=
stdout="off"
'';
small = ''
print_info() {
info title
info "os" distro
info "kernel" kernel
info "shell" shell
info "wm" wm
info "term" term
info "memory" memory
info cols
}
block_range=(1 7)
block_width=2
ascii_distro="nixos_small"
'';
big = ''
print_info() {
info title
info underline
info "OS" distro
info "Kernel" kernel
info "Uptime" uptime
info "Packages" packages
info "Shell" shell
info "WM" wm
info "Term" term
info "CPU" cpu
info "Memory" memory
info "Disk" disk
info cols
}
block_range=(0 15)
block_width=3
ascii_distro="nixos"
'';
in {
home.packages = with pkgs; [ neofetch ];
xdg.configFile = {
"neofetch/config_small.conf".text = ''
print_info() {
info title
info "os" distro
info "kernel" kernel
info "shell" shell
info "wm" wm
info "term" term
info "memory" memory
info cols
}
block_range=(1 7)
block_width=2
ascii_distro="nixos_small"
'' + common;
"neofetch/config.conf".text = ''
print_info() {
info title
info underline
info "OS" distro
info "Kernel" kernel
info "Uptime" uptime
info "Packages" packages
info "Shell" shell
info "WM" wm
info "Term" term
info "CPU" cpu
info "Memory" memory
info "Disk" disk
info cols
}
block_range=(0 15)
block_width=3
ascii_distro="nixos"
'' + common;
};
xdg.configFile."neofetch/config.conf".text = small + common;
}
@@ -0,0 +1,8 @@
{ lib, features, ... }:
{
programs.nix-index.enable = true;
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/home/misterio".directories = [ ".cache/nix-index" ];
};
}
@@ -0,0 +1,92 @@
{ pkgs, ... }:
{
imports = [
./ui.nix
./lsp.nix
./syntax.nix
];
programs.neovim = {
enable = true;
extraConfig = ''
"Reload automatically
set autoread
au CursorHold,CursorHoldI * checktime
"Folding
set foldmethod=syntax
"Set fold level to highest in file
"so everything starts out unfolded at just the right level
autocmd BufWinEnter * let &foldlevel = max(map(range(1, line('$')), 'foldlevel(v:val)'))
"Tabs
set ts=4 sts=4 sw=4 "4 char-wide tab
autocmd FileType json,html,htmldjango,nix,scss,typescript setlocal ts=2 sts=2 sw=2 "2 char-wide overrides
set expandtab "Use spaces
"Options when composing mutt mail
autocmd FileType mail set noautoindent wrapmargin=0 textwidth=0 linebreak wrap formatoptions +=w
"Clipboard
set clipboard=unnamedplus
"Conceal
set conceallevel=2
"Fix nvim size according to terminal
"(https://github.com/neovim/neovim/issues/11330)
autocmd VimEnter * silent exec "!kill -s SIGWINCH" getpid()
"Line numbers
set number relativenumber
"Scroll up and down
nmap <C-j> <C-e>
nmap <C-k> <C-y>
'';
plugins = with pkgs.vimPlugins; [
# QOL
editorconfig-vim
vim-numbertoggle
vim-surround
vim-matchup
vim-fugitive
{ plugin = nvim-autopairs; config = "lua require('nvim-autopairs').setup{}"; }
{ plugin = better-escape-nvim; config = "lua require('better_escape').setup()"; }
{ plugin = bufdelete-nvim; config = "nmap <C-q> :Bdelete<CR>"; }
];
};
home.sessionVariables = { EDITOR = "nvim"; };
xdg.desktopEntries = {
nvim = {
name = "Neovim";
genericName = "Text Editor";
comment = "Edit text files";
exec = "nvim %F";
icon = "nvim";
mimeType = [
"text/english"
"text/plain"
"text/x-makefile"
"text/x-c++hdr"
"text/x-c++src"
"text/x-chdr"
"text/x-csrc"
"text/x-java"
"text/x-moc"
"text/x-pascal"
"text/x-tcl"
"text/x-tex"
"application/x-shellscript"
"text/x-c"
"text/x-c++"
];
terminal = true;
type = "Application";
categories = [ "Utility" "TextEditor" ];
};
};
}
+62
View File
@@ -0,0 +1,62 @@
{ pkgs, ...}:
{
programs.neovim.plugins = with pkgs.vimPlugins; [
# LSP
{
plugin = nvim-lspconfig;
config = ''
lua << EOF
local lspconfig = require('lspconfig')
lspconfig.rust_analyzer.setup{} -- Rust
lspconfig.clangd.setup{} -- C/C++
lspconfig.rnix.setup{} -- Nix
lspconfig.jsonls.setup{} -- JSON
lspconfig.sqls.setup{cmd = {"sqls", "-config", "sqls.yml"}} -- SQL
lspconfig.pylsp.setup{} -- Python
lspconfig.sumneko_lua.setup{cmd = {"lua-language-server"}} -- Lua
EOF
nmap gD :lua vim.lsp.buf.declaration()<CR>
nmap gd :lua vim.lsp.buf.definition()<CR>
nmap <space>e :lua vim.lsp.diagnostic.show_line_diagnostics()<CR>
nmap <space>f :lua vim.lsp.buf.formatting()<CR>
autocmd CursorHold <buf> :lua vim.lsp.buf.hover()<CR>
nmap K :lua vim.lsp.buf.hover()<CR>
'';
}
{ plugin = rust-tools-nvim; config = "lua require('rust-tools').setup{tools={autoSetHints = true}}"; }
# Completions
cmp-nvim-lsp
cmp-buffer
lspkind-nvim
{
plugin = nvim-cmp;
config = ''
lua << EOF
local cmp = require('cmp')
local lspkind = require('lspkind')
cmp.setup{
formatting = {
format = lspkind.cmp_format()
},
mapping = {
['<C-n>'] = cmp.mapping.select_next_item({
behavior = cmp.SelectBehavior.Insert }
),
['<C-m>'] = cmp.mapping.select_prev_item({
behavior = cmp.SelectBehavior.Insert }
),
['<C-e>'] = cmp.mapping.close(),
},
sources = {
{ name='nvim_lsp' },
{ name='buffer' },
},
}
EOF
'';
}
];
}
@@ -0,0 +1,11 @@
{ pkgs, ...}:
{
programs.neovim.plugins = with pkgs.vimPlugins; [
{ plugin = rust-vim; config = "let g:rust_fold = 1"; }
dart-vim-plugin
plantuml-syntax
vim-markdown
vim-nix
vim-toml
];
}
+312
View File
@@ -0,0 +1,312 @@
# Stuff i use to dynamically theme neovim without relying on notermguicolors
{ pkgs, config, ... }:
let
c = config.colorscheme.colors;
# Base16 lua colorscheme command
nvim-scheme = ''
require("base16-colorscheme").setup({
base00 = "#${c.base00}"; base01 = "#${c.base01}"; base02 = "#${c.base02}"; base03 = "#${c.base03}";
base04 = "#${c.base04}"; base05 = "#${c.base05}"; base06 = "#${c.base06}"; base07 = "#${c.base07}";
base08 = "#${c.base08}"; base09 = "#${c.base09}"; base0A = "#${c.base0A}"; base0B = "#${c.base0B}";
base0C = "#${c.base0C}"; base0D = "#${c.base0D}"; base0E = "#${c.base0E}"; base0F = "#${c.base0F}";
})
'';
bufferline-theme = ''
'';
in
{
# When configuration is written, reapply scheme
xdg.configFile."nvim/init.vim".onChange =
let
nvr = "${pkgs.neovim-remote}/bin/nvr";
in
''
${nvr} --serverlist | \
while read server; do
${nvr} --nostart -cc ':lua ${nvim-scheme}' --servername $server & \
done
'';
programs.neovim.plugins = with pkgs.vimPlugins; [
{
plugin = nvim-base16;
# Write scheme to configuration file
config = ''
lua << EOF
${nvim-scheme}
EOF
'';
}
{ plugin = nvim-web-devicons; config = "lua require('nvim-web-devicons').setup{}"; }
{ plugin = nvim-colorizer-lua; config = "lua require('colorizer').setup()"; }
{ plugin = gitsigns-nvim; config = "lua require('gitsigns').setup()"; }
{
plugin = nvim-tree-lua;
config = ''
lua require('nvim-tree').setup{}
nmap <C-p> :NvimTreeToggle<CR>
'';
}
{
plugin = feline-nvim;
config = ''
lua << EOF
local components = {
active = {
{{
provider = ' ',
hl = 'Normal',
}},
{{
provider = 'irineu'
}},
},
inactive = {
{{
provider = 'irineu'
}},
{{
provider = 'irineu'
}},
},
}
require('feline').setup({components = components})
EOF
'';
}
{
plugin = bufferline-nvim;
config = ''
nmap <C-h> :BufferLineCyclePrev<CR>
nmap <C-l> :BufferLineCycleNext<CR>
lua << EOF
require('bufferline').setup{
fill = {
guifg = comment_fg,
guibg = separator_background_color,
},
group_separator = {
guifg = comment_fg,
guibg = separator_background_color,
},
group_label = {
guibg = comment_fg,
guifg = separator_background_color,
},
tab = {
guifg = comment_fg,
guibg = background_color,
},
tab_selected = {
guifg = tabline_sel_bg,
guibg = normal_bg,
},
tab_close = {
guifg = comment_fg,
guibg = background_color,
},
close_button = {
guifg = comment_fg,
guibg = background_color,
},
close_button_visible = {
guifg = comment_fg,
guibg = visible_bg,
},
close_button_selected = {
guifg = normal_fg,
guibg = normal_bg,
},
background = {
guifg = comment_fg,
guibg = background_color,
},
buffer = {
guifg = comment_fg,
guibg = background_color,
},
buffer_visible = {
guifg = comment_fg,
guibg = visible_bg,
},
buffer_selected = {
guifg = normal_fg,
guibg = normal_bg,
gui = "bold,italic",
},
diagnostic = {
guifg = comment_diagnostic_fg,
guibg = background_color,
},
diagnostic_visible = {
guifg = comment_diagnostic_fg,
guibg = visible_bg,
},
diagnostic_selected = {
guifg = normal_diagnostic_fg,
guibg = normal_bg,
gui = "bold,italic",
},
info = {
guifg = comment_fg,
guisp = info_fg,
guibg = background_color,
},
info_visible = {
guifg = comment_fg,
guibg = visible_bg,
},
info_selected = {
guifg = info_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = info_fg,
},
info_diagnostic = {
guifg = comment_diagnostic_fg,
guisp = info_diagnostic_fg,
guibg = background_color,
},
info_diagnostic_visible = {
guifg = comment_diagnostic_fg,
guibg = visible_bg,
},
info_diagnostic_selected = {
guifg = info_diagnostic_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = info_diagnostic_fg,
},
warning = {
guifg = comment_fg,
guisp = warning_fg,
guibg = background_color,
},
warning_visible = {
guifg = comment_fg,
guibg = visible_bg,
},
warning_selected = {
guifg = warning_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = warning_fg,
},
warning_diagnostic = {
guifg = comment_diagnostic_fg,
guisp = warning_diagnostic_fg,
guibg = background_color,
},
warning_diagnostic_visible = {
guifg = comment_diagnostic_fg,
guibg = visible_bg,
},
warning_diagnostic_selected = {
guifg = warning_diagnostic_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = warning_diagnostic_fg,
},
error = {
guifg = comment_fg,
guibg = background_color,
guisp = error_fg,
},
error_visible = {
guifg = comment_fg,
guibg = visible_bg,
},
error_selected = {
guifg = error_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = error_fg,
},
error_diagnostic = {
guifg = comment_diagnostic_fg,
guibg = background_color,
guisp = error_diagnostic_fg,
},
error_diagnostic_visible = {
guifg = comment_diagnostic_fg,
guibg = visible_bg,
},
error_diagnostic_selected = {
guifg = error_diagnostic_fg,
guibg = normal_bg,
gui = "bold,italic",
guisp = error_diagnostic_fg,
},
modified = {
guifg = string_fg,
guibg = background_color,
},
modified_visible = {
guifg = string_fg,
guibg = visible_bg,
},
modified_selected = {
guifg = string_fg,
guibg = normal_bg,
},
duplicate_selected = {
guifg = duplicate_color,
gui = "italic",
guibg = normal_bg,
},
duplicate_visible = {
guifg = duplicate_color,
gui = "italic",
guibg = visible_bg,
},
duplicate = {
guifg = duplicate_color,
gui = "italic",
guibg = background_color,
},
separator_selected = {
guifg = separator_background_color,
guibg = normal_bg,
},
separator_visible = {
guifg = separator_background_color,
guibg = visible_bg,
},
separator = {
guifg = separator_background_color,
guibg = background_color,
},
indicator_selected = {
guifg = tabline_sel_bg,
guibg = normal_bg,
},
pick_selected = {
guifg = error_fg,
guibg = normal_bg,
gui = "bold,italic",
},
pick_visible = {
guifg = error_fg,
guibg = visible_bg,
gui = "bold,italic",
},
pick = {
guifg = error_fg,
guibg = background_color,
gui = "bold,italic",
},
}
}
EOF
'';
}
];
}
@@ -0,0 +1,32 @@
{ pkgs, ... }:
{
imports = [
./discord.nix
./element.nix
./fira.nix
./firefox.nix
./gtk.nix
./kdeconnect.nix
./kitty.nix
./mako.nix
./obs.nix
./qt.nix
./qutebrowser.nix
./slack.nix
./sway.nix
./swayidle.nix
./swaylock.nix
./waybar.nix
./zathura.nix
];
home.packages = with pkgs; [
dragon-drop
imv
pavucontrol
spotify
wofi
xdg-utils
ydotool
];
}
@@ -1,9 +1,13 @@
{ pkgs, config, ... }:
{ config, features, pkgs, lib, ... }:
let colors = config.colorscheme.colors;
in {
home.packages = with pkgs; [ discord discocss ];
home.persistence."/data/home/misterio".directories = [ ".config/discord" ];
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/home/misterio".directories = [ ".config/discord" ];
};
xdg.configFile."discocss/custom.css".text = ''
.theme-dark {
--header-primary: #${colors.base05};
@@ -1,11 +1,15 @@
{ pkgs, config, ... }:
{ pkgs, config, lib, features, ... }:
let
colorscheme = config.colorscheme;
colors = colorscheme.colors;
in {
home.packages = with pkgs; [ element-desktop ];
home.persistence."/data/home/misterio".directories = [ ".config/Element" ];
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/home/misterio".directories = [ ".config/Element" ];
};
xdg.configFile."Element/config.json".text = ''
{
"settingDefaults": {
@@ -1,4 +1,4 @@
{ pkgs, config, ... }:
{ pkgs, config, lib, features, ... }:
let
@@ -38,5 +38,7 @@ in {
"kdeconnect-scripts/fortune.sh".source = "${script-fortune}/bin/fortune";
};
home.persistence."/data/home/misterio".directories = [ ".config/kdeconnect" ];
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/home/misterio".directories = [ ".config/kdeconnect" ];
};
}
@@ -0,0 +1,9 @@
{ pkgs, features, lib, ... }:
{
home.packages = with pkgs; [ slack ];
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/home/misterio".directories = [ ".config/Slack" ];
};
}
@@ -1,4 +1,4 @@
{ lib, pkgs, config, ... }:
{ lib, features, pkgs, config, ... }:
let
colorscheme = config.colorscheme;
@@ -10,6 +10,9 @@ let
"ubuntu@vpn.uget.express"
];
# keyring
keyring = import ../trusted/keyring.nix { inherit pkgs; };
# Programs
discocss = "${pkgs.discocss}/bin/discocss";
grimshot = "${pkgs.sway-contrib.grimshot}/bin/grimshot";
@@ -238,9 +241,7 @@ in rec {
"Scroll_Lock" = "exec ${pass-wofi}";
# Lock or unlock gpg
"Shift+Scroll_Lock" = let
keyring = import ./keyring.nix { inherit pkgs; };
in ''
"Shift+Scroll_Lock" = lib.mkIf (builtins.elem "trusted" features) ''
exec ${keyring.isUnlocked} && \
(${keyring.lock} && ${notify-send} "Locked" "Cleared gpg passphrase cache" -i lock -t 3000) || \
${keyring.unlock}
@@ -1,7 +1,7 @@
{ pkgs, ... }:
{ pkgs, lib, features, ... }:
let
keyring = import ./keyring.nix { inherit pkgs; };
keyring = import ../trusted/keyring.nix { inherit pkgs; };
swaylock = "${pkgs.swaylock-effects}/bin/swaylock";
pactl = "${pkgs.pulseaudio}/bin/pactl";
pgrep = "${pkgs.procps}/bin/pgrep";
@@ -11,8 +11,6 @@ in {
# After 10 seconds of locked, mute mic
# After 20 seconds of locked, disable rgb lights and turn monitors off
xdg.configFile."swayidle/config".text = ''
timeout 240 '${keyring.lock}'
timeout 600 '${swaylock} --screenshots --daemonize'
timeout 10 '${pgrep} -x swaylock && ${pactl} set-source-mute @DEFAULT_SOURCE@ yes' resume '${pgrep} -x swaylock && ${pactl} set-source-mute @DEFAULT_SOURCE@ no'
@@ -23,5 +21,7 @@ in {
timeout 20 '${pgrep} -x swaylock && swaymsg "output * dpms off"' resume '${pgrep} -x swaylock && swaymsg "output * dpms on"'
timeout 620 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
'';
'' + (if builtins.elem "trusted" features then ''
timeout 240 '${keyring.lock}'
'' else "");
}
@@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{ config, features, lib, pkgs, ... }:
{
let
keyring = import ../trusted/keyring.nix { inherit pkgs; };
in {
programs.waybar = {
enable = true;
settings = [{
@@ -72,9 +74,7 @@
on-click = "${pkgs.kitty}/bin/kitty -e ${pkgs.neomutt}/bin/neomutt";
interval = 2;
};
"custom/gpg-agent" = let
keyring = import ./keyring.nix { inherit pkgs; };
in {
"custom/gpg-agent" = lib.mkIf (builtins.elem "trusted" features) {
# Check if GPG Agent is caching passphrase
exec = ''
${keyring.isUnlocked} && echo -e "\nGPG is unlocked" || echo -e "\nGPG is locked"
+10
View File
@@ -0,0 +1,10 @@
{
imports = [
./lutris.nix
./multimc.nix
./osu.nix
#./runescape.nix
./steam.nix
./yuzu.nix
];
}
@@ -1,4 +1,4 @@
{ pkgs, ... }: {
{ pkgs, lib, features, ... }: {
home.packages = [ pkgs.lutris ];
xdg.desktopEntries = {
@@ -18,7 +18,7 @@
};
};
home.persistence = {
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/games/misterio" = {
allowOther = true;
directories = [ "Games/Lutris" ".config/lutris" ".local/share/lutris" ];
@@ -0,0 +1,7 @@
{ pkgs, lib, features, ... }: {
home.packages = [ pkgs.multimc ];
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/games/misterio".directories = [ ".local/share/multimc" ];
};
}
+7
View File
@@ -0,0 +1,7 @@
{ pkgs, features, lib, ... }: {
home.packages = [ pkgs.osu-lazer ];
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/games/misterio".directories = [ ".local/share/osu" ];
};
}
@@ -1,10 +1,12 @@
{ pkgs, ... }: {
{ pkgs, features, lib, ... }: {
home.packages = with pkgs; [
runelite
nur.repos.misterio.runescape-launcher
];
home.persistence."/data/games/misterio".directories = [ "Jagex" ];
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/games/misterio".directories = [ "Jagex" ];
};
# Override .desktop for changing OSRS cache dir
# TODO: better way other than retyping the entire file?
@@ -1,7 +1,8 @@
{ pkgs, ... }: {
{ pkgs, features, lib, ... }: {
programs.mangohud.enable = true;
home.packages = [ pkgs.steam ];
home.persistence = {
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/games/misterio" = {
allowOther = true;
directories = [
@@ -1,7 +1,7 @@
{ pkgs, ... }: {
{ pkgs, features, lib, ... }: {
home.packages = [ pkgs.yuzu-mainline ];
home.persistence = {
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/games/misterio" = {
allowOther = true;
directories = [ "Games/Yuzu" ".config/yuzu" ".local/share/yuzu" ];
@@ -0,0 +1,13 @@
{ impermanence, ... }:
{
imports = [
impermanence.nixosModules.home-manager.impermanence
];
home.persistence = {
"/data/home/misterio" = {
directories = [ "Documents" "Downloads" "Pictures" "Videos" ];
allowOther = true;
};
};
}
@@ -0,0 +1,13 @@
{
imports = [
./git-sign.nix
./gpg.nix
./khal.nix
./khard.nix
./mail.nix
./neomutt.nix
./pass.nix
./todoman.nix
./vdirsyncer.nix
];
}
@@ -0,0 +1,8 @@
{
programs.git = {
signing = {
signByDefault = true;
key = "CE707A2C17FAAC97907FF8EF2E54EA7BFE630916";
};
};
}
@@ -1,6 +1,9 @@
{ pkgs, ... }: {
{ pkgs, features, lib, ... }: {
home.packages = with pkgs; [ pinentry-gnome ];
home.persistence."/data/home/misterio".directories = [ ".gnupg" ];
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/home/misterio".directories = [ ".gnupg" ];
};
services.gpg-agent = {
enable = true;
@@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, features, lib, ... }:
let
common = rec {
@@ -19,7 +19,9 @@ let
};
};
in {
home.persistence."/data/home/misterio".directories = [ "Mail" ];
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/home/misterio".directories = [ "Mail" ];
};
accounts.email = {
maildirBasePath = "Mail";
+11
View File
@@ -0,0 +1,11 @@
{ pkgs, features, lib, ... }: {
programs.password-store = {
enable = true;
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
};
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/home/misterio".directories = [ ".local/share/password-store" ];
};
}
@@ -1,9 +1,9 @@
{ pkgs, ... }:
{ pkgs, features, lib, ... }:
{
home.packages = with pkgs; [ vdirsyncer ];
home.persistence."/data/home/misterio" = {
directories = [
home.persistence = lib.mkIf (builtins.elem "persistence" features) {
"/data/home/misterio".directories = [
"Calendars"
"Contacts"
".local/share/vdirsyncer"
-5
View File
@@ -1,5 +0,0 @@
{ pkgs, ... }: {
home.packages = [ pkgs.multimc ];
home.persistence."/data/games/misterio".directories =
[ ".local/share/multimc" ];
}
-4
View File
@@ -1,4 +0,0 @@
{
programs.nix-index.enable = true;
home.persistence."/data/home/misterio".directories = [ ".cache/nix-index" ];
}
-38
View File
@@ -1,38 +0,0 @@
# Stuff i use to dynamically theme neovim without relying on notermguicolors
{ pkgs, config, ... }:
let
c = config.colorscheme.colors;
# Base16 lua colorscheme command
nvim-scheme = ''
require("base16-colorscheme").setup({
base00 = "#${c.base00}"; base01 = "#${c.base01}"; base02 = "#${c.base02}"; base03 = "#${c.base03}";
base04 = "#${c.base04}"; base05 = "#${c.base05}"; base06 = "#${c.base06}"; base07 = "#${c.base07}";
base08 = "#${c.base08}"; base09 = "#${c.base09}"; base0A = "#${c.base0A}"; base0B = "#${c.base0B}";
base0C = "#${c.base0C}"; base0D = "#${c.base0D}"; base0E = "#${c.base0E}"; base0F = "#${c.base0F}";
})
'';
in
{
# When configuration is written, reapply scheme
xdg.configFile."nvim/init.vim".onChange =
let
nvr = "${pkgs.neovim-remote}/bin/nvr";
in
''
${nvr} --serverlist | \
while read server; do
${nvr} --nostart -cc ':lua ${nvim-scheme}' --servername $server & \
done
'';
programs.neovim.plugins = [
{
plugin = pkgs.vimPlugins.nvim-base16;
# Write scheme to configuration file
config = ''
lua << EOF
${nvim-scheme}
EOF
'';
}
];
}
-199
View File
@@ -1,199 +0,0 @@
{ pkgs, ... }:
let
mermaid = pkgs.vimUtils.buildVimPlugin {
pname = "mermaid.vim";
version = "0.1";
src = pkgs.fetchFromGitHub {
owner = "mracos";
repo = "mermaid.vim";
rev = "5b61d983b979e95101bf85397510913376430739";
sha256 = "sha256-mSr/UEdEGgi/otVQUTETKHykTZVP2+5kYWUuRJc0xZ4=";
};
};
in
{
imports = [ ./nvim-theme.nix ];
programs.neovim = {
enable = true;
extraConfig = ''
"Reload automatically
set autoread
au CursorHold,CursorHoldI * checktime
"Folding
set foldmethod=syntax
"Set fold level to highest in file
"so everything starts out unfolded at just the right level
autocmd BufWinEnter * let &foldlevel = max(map(range(1, line('$')), 'foldlevel(v:val)'))
"Tabs
set ts=4 sts=4 sw=4 "4 char-wide tab
autocmd FileType json,html,htmldjango,nix,scss,typescript setlocal ts=2 sts=2 sw=2 "2 char-wide overrides
set expandtab "Use spaces
"Options when composing mutt mail
autocmd FileType mail set noautoindent wrapmargin=0 textwidth=0 linebreak wrap formatoptions +=w
"Clipboard
set clipboard=unnamedplus
"Conceal
set conceallevel=2
"Fix nvim size according to terminal
"(https://github.com/neovim/neovim/issues/11330)
autocmd VimEnter * silent exec "!kill -s SIGWINCH" getpid()
"Line numbers
set number relativenumber
"Scroll up and down
nmap <C-j> <C-e>
nmap <C-k> <C-y>
'';
plugins = with pkgs.vimPlugins; [
# LSP
{
plugin = nvim-lspconfig;
config = ''
lua << EOF
local lspconfig = require('lspconfig')
lspconfig.rust_analyzer.setup{} -- Rust
lspconfig.clangd.setup{} -- C/C++
lspconfig.rnix.setup{} -- Nix
lspconfig.jsonls.setup{} -- JSON
lspconfig.sqls.setup{cmd = {"sqls", "-config", "sqls.yml"}} -- SQL
lspconfig.pylsp.setup{} -- Python
lspconfig.sumneko_lua.setup{cmd = {"lua-language-server"}} -- Lua
EOF
nmap gD :lua vim.lsp.buf.declaration()<CR>
nmap gd :lua vim.lsp.buf.definition()<CR>
nmap <space>e :lua vim.lsp.diagnostic.show_line_diagnostics()<CR>
nmap <space>f :lua vim.lsp.buf.formatting()<CR>
autocmd CursorHold <buf> :lua vim.lsp.buf.hover()<CR>
nmap K :lua vim.lsp.buf.hover()<CR>
'';
}
{ plugin = rust-tools-nvim; config = "lua require('rust-tools').setup{tools={autoSetHints = true}}"; }
# Completions
cmp-nvim-lsp
cmp-buffer
lspkind-nvim
{
plugin = nvim-cmp;
config = ''
lua << EOF
local cmp = require('cmp')
local lspkind = require('lspkind')
cmp.setup{
formatting = {
format = lspkind.cmp_format()
},
mapping = {
['<C-n>'] = cmp.mapping.select_next_item({
behavior = cmp.SelectBehavior.Insert }
),
['<C-m>'] = cmp.mapping.select_prev_item({
behavior = cmp.SelectBehavior.Insert }
),
['<C-e>'] = cmp.mapping.close(),
},
sources = {
{ name='nvim_lsp' },
{ name='buffer' },
},
}
EOF
'';
}
# QOL
editorconfig-vim
vim-numbertoggle
vim-surround
vim-matchup
{ plugin = nvim-autopairs; config = "lua require('nvim-autopairs').setup{}"; }
{ plugin = better-escape-nvim; config = "lua require('better_escape').setup()"; }
{ plugin = bufdelete-nvim; config = "nmap <C-q> :Bdelete<CR>"; }
# UI
{ plugin = nvim-web-devicons; config = "lua require('nvim-web-devicons').setup{}"; }
{ plugin = nvim-colorizer-lua; config = "lua require('colorizer').setup()"; }
{ plugin = gitsigns-nvim; config = "lua require('gitsigns').setup()"; }
{
plugin = bufferline-nvim;
config = ''
lua require('bufferline').setup{}
nmap <C-h> :BufferLineCyclePrev<CR>
nmap <C-l> :BufferLineCycleNext<CR>
'';
}
{
plugin = nvim-tree-lua;
config = ''
lua require('nvim-tree').setup{}
nmap <C-p> :NvimTreeToggle<CR>
'';
}
{
plugin = feline-nvim;
config = ''
lua << EOF
local components = {
active = {},
inactive = {},
}
require('feline').setup()
EOF
'';
}
# Syntaxes
{ plugin = rust-vim; config = "let g:rust_fold = 1"; }
dart-vim-plugin
mermaid
plantuml-syntax
vim-markdown
vim-nix
vim-toml
];
};
home.sessionVariables = { EDITOR = "nvim"; };
xdg.desktopEntries = {
nvim = {
name = "Neovim";
genericName = "Text Editor";
comment = "Edit text files";
exec = "nvim %F";
icon = "nvim";
mimeType = [
"text/english"
"text/plain"
"text/x-makefile"
"text/x-c++hdr"
"text/x-c++src"
"text/x-chdr"
"text/x-csrc"
"text/x-java"
"text/x-moc"
"text/x-pascal"
"text/x-tcl"
"text/x-tex"
"application/x-shellscript"
"text/x-c"
"text/x-c++"
];
terminal = true;
type = "Application";
categories = [ "Utility" "TextEditor" ];
};
};
}
-4
View File
@@ -1,4 +0,0 @@
{ pkgs, ... }: {
home.packages = [ pkgs.osu-lazer ];
home.persistence."/data/games/misterio".directories = [ ".local/share/osu" ];
}
-10
View File
@@ -1,10 +0,0 @@
{ pkgs, ... }: {
programs.password-store = {
enable = true;
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
};
home.persistence."/data/home/misterio".directories =
[ ".local/share/password-store" ];
}
+9 -3
View File
@@ -3,10 +3,16 @@
with nix-colors.lib { inherit pkgs; };
let
currentWallpaper = import ./current-wallpaper.nix;
currentMode = import ./current-mode.nix;
currentScheme = import ./current-scheme.nix;
currentScheme = "spaceduck";
currentWallpaper = null;
currentMode = null;
in {
imports = [ nix-colors.homeManagerModule ];
home.packages = with pkgs; [
setscheme
setwallpaper
];
colorscheme = if currentScheme != null
then nix-colors.colorSchemes.${currentScheme}
else colorschemeFromPicture {
View File
-6
View File
@@ -1,6 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [ slack ];
home.persistence."/data/home/misterio".directories = [ ".config/Slack" ];
}