legacy artemis config - needs refactor

This commit is contained in:
Callum Leslie 2024-08-30 17:08:21 +01:00
parent aba3aceed8
commit 961d41b9bf
Signed by: cleslie
GPG key ID: D382C4AFEECEAA90
34 changed files with 1572 additions and 12 deletions

54
home/default.nix Normal file
View file

@ -0,0 +1,54 @@
{
inputs,
config,
pkgs,
...
}: {
imports = [./programs ./services];
programs.home-manager.enable = true;
home = {
username = "c";
homeDirectory = "/home/c";
};
home.packages = with pkgs; [
libsecret
bitwarden
betterbird
wl-clipboard
(discord.override {
withOpenASAR = true;
})
brightnessctl
playerctl
pwvucontrol
tldr
grc
fd
rofi-rbw-wayland
wtype
mullvad-vpn
spotify
gnumake
delta
slurp
grim
clang-tools
clang
ghq
gst
udiskie
rustup
ripgrep
zig
ghc
xh
unzip
just
inputs.nixvim.packages."x86_64-linux".default # nixvim
];
home.stateVersion = "24.05";
}

View file

@ -0,0 +1,13 @@
{
config,
inputs,
pkgs,
...
}: {
programs.alacritty = {
enable = true;
settings = {
env = {TERM = "xterm-256color";};
};
};
}

24
home/programs/default.nix Normal file
View file

@ -0,0 +1,24 @@
{
inputs,
config,
pkgs,
...
}: {
imports = [
./hypr
./waybar
./git
./fish
./rofi
./rbw
./firefox
./tmux
./alacritty
./direnv
];
programs = {
gpg.enable = true;
wpaperd.enable = true;
};
}

View file

@ -0,0 +1,14 @@
{
config,
inputs,
pkgs,
...
}: {
programs.direnv = {
enable = true;
nix-direnv.enable = true;
config.global = {
hide_env_diff = true;
};
};
}

View file

@ -0,0 +1,60 @@
{
config,
inputs,
pkgs,
...
}: {
programs.firefox = {
enable = true;
policies = {
DisablePocket = true;
DisableTelemetry = true;
};
profiles.c = {
bookmarks = [
{
name = "NixOS";
toolbar = true;
bookmarks = [
{
name = "Packages";
url = "https://search.nixos.org";
}
{
name = "Wiki";
url = "https://nixos.wiki";
}
];
}
{
name = "News";
toolbar = true;
bookmarks = [
{
name = "Al Jazeera";
url = "https://aljazeera.com";
}
];
}
];
containers = {};
settings = {};
userChrome = "";
userContent = "";
extensions = with inputs.firefox-addons.packages."x86_64-linux"; [
bitwarden
ublock-origin
darkreader
youtube-shorts-block
privacy-badger
return-youtube-dislikes
];
};
};
}

View file

@ -0,0 +1,58 @@
{
config,
inputs,
pkgs,
...
}: {
programs.fish = {
enable = true;
interactiveShellInit = ''
set fish_greeting
trap __trap_exit_tmux EXIT
'';
shellAliases = {v = "nvim";};
functions = {
__trap_exit_tmux = {
body = ''
test (tmux list-windows | wc -l) = 1 || exit
test (tmux list-panes | wc -l) = 1 || exit
tmux switch-client -t main
'';
};
};
plugins = with pkgs.fishPlugins; [
{
name = "z";
inherit (z) src;
}
{
name = "hydro";
inherit (hydro) src;
}
{
name = "sponge";
inherit (sponge) src;
}
{
name = "grc";
inherit (grc) src;
}
{
name = "done";
inherit (done) src;
}
{
name = "fzf-fish";
inherit (fzf-fish) src;
}
{
name = "forgit";
inherit (forgit) src;
}
];
};
}

View file

@ -0,0 +1,44 @@
{
config,
inputs,
pkgs,
...
}: {
programs.git = {
enable = true;
userName = "Callum Leslie";
userEmail = "git@cleslie.uk";
signing.key = "D382C4AFEECEAA90";
signing.signByDefault = true;
ignores = [".direnv/"];
includes = [
{
condition = "gitdir:~/repos/projects.cs.nott.ac.uk/";
contents = {
user = {
email = "psycl6@nottingham.ac.uk";
signingKey = "5A944DF89B6F65AC";
};
credential = {helper = "store";};
};
}
];
extraConfig = {
core = {
longpaths = true;
autocrlf = false;
};
init = {defaultBranch = "main";};
push = {autoSetupRemote = true;};
ghq = {root = "~/repos";};
};
diff-so-fancy.enable = true;
};
}

View file

@ -0,0 +1,167 @@
{
config,
inputs,
pkgs,
...
}: {
wayland.windowManager.hyprland = {
enable = true;
systemd.enable = true;
xwayland.enable = true;
# TODO: move to nix config over text
settings = {
"monitor" = ",prefered,auto,1";
general = {
gaps_in = 0;
gaps_out = 0;
border_size = 1;
};
decoration = {
drop_shadow = true;
shadow_range = 4;
shadow_render_power = 3;
};
animations = {
enabled = true;
bezier = "myBezier, 0.05, 0.9, 0.1, 1.05";
animation = [
"windows, 1, 1, default, popin"
"fade, 1, 7, default"
"workspaces, 1, 1, default, fade"
];
};
dwindle = {
pseudotile = true;
preserve_split = true;
no_gaps_when_only = 1;
};
master = {
no_gaps_when_only = 1;
};
gestures.workspace_swipe = false;
misc = {
enable_swallow = true;
swallow_regex = "Alacritty";
disable_hyprland_logo = true;
disable_splash_rendering = true;
};
input = {
kb_layout = "gb,us";
kb_variant = ",workman";
kb_model = "";
kb_options = "ctrl:nocaps, grp:alt_shift_toggle";
kb_rules = "";
follow_mouse = true;
touchpad = {
natural_scroll = true;
scroll_factor = 0.3;
};
sensitivity = 0.5;
accel_profile = "flat";
scroll_method = "2fg";
};
"$mainMod" = "SUPER";
bind =
[
"$mainMod, q, killactive"
"$mainMod SHIFT, q, exit"
"$mainMod, F, fullscreen"
"$mainMod SHIFT, f, togglefloating"
"$mainMod, d, exec, rofi -show drun"
"$mainMod, w, exec, rofi -show window"
"$mainMod, p, exec, rofi-rbw --no-folder"
"$mainMod, s, togglesplit"
"$mainMod SHIFT, r, exec, hyprctl reload"
"$mainMod, return, exec, alacritty -e tmux new -A -s main"
"$mainMod SHIFT, return, exec, [float; pin] alacritty -e tmux new -A -s main"
"$mainMod, b, workspace, name:web"
"$mainMod, n, workspace, name:chat"
"$mainMod, m, workspace, name:media"
"$mainMod, v, workspace, name:mail"
"$mainMod SHIFT, b, movetoworkspace, name:web"
"$mainMod SHIFT, n, movetoworkspace, name:chat"
"$mainMod SHIFT, m, movetoworkspace, name:media"
"$mainMod SHIFT, v, movetoworkspace, name:mail"
"$mainMod CTRL, b, moveworkspacetomonitor, name:web current"
"$mainMod CTRL, n, moveworkspacetomonitor, name:chat current"
"$mainMod CTRL, m, moveworkspacetomonitor, name:media current"
"$mainMod CTRL, v, moveworkspacetomonitor, name:mail current"
"$mainMod CTRL, b, workspace, name:web"
"$mainMod CTRL, n, workspace, name:chat"
"$mainMod CTRL, m, workspace, name:media"
"$mainMod CTRL, v, workspace, name:mail"
"$mainMod, h, movefocus, l"
"$mainMod, l, movefocus, r"
"$mainMod, k, movefocus, u"
"$mainMod, j, movefocus, d"
"$mainMod SHIFT, h, movewindow, l"
"$mainMod SHIFT, l, movewindow, r"
"$mainMod SHIFT, k, movewindow, u"
"$mainMod SHIFT, j, movewindow, d"
''SHIFT, Print, exec, grim -g "$(slurp)" - | wl-copy''
", Print, exec, grim - | wl-copy"
]
++ (builtins.concatLists (builtins.genList (x: let
ws = let c = (x + 1) / 10; in builtins.toString (x + 1 - (c * 10));
in [
"$mainMod, ${ws}, workspace, ${toString (x + 1)}"
"$mainMod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
"$mainMod CTRL, ${ws}, moveworkspacetomonitor, ${
toString (x + 1)
} current"
"$mainMod CTRL, ${ws}, workspace, ${toString (x + 1)}"
])
10));
workspace = [
"name:web, on-created-empty: firefox"
"name:chat, on-created-empty: discord"
"name:media, on-created-empty: spotify"
"name:mail, on-created-empty: betterbird"
];
bindm = [
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
bindle = [
", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
", XF86AudioMute , exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioMicMute , exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
", XF86AudioPlay , exec, playerctl play-pause"
", XF86AudioPause , exec, playerctl play-pause"
", XF86AudioNext , exec, playerctl next"
", XF86AudioPrev , exec, playerctl previous"
", XF86MonBrightnessUp, exec, brightnessctl -c backlight set +5%"
", XF86MonBrightnessDown, exec, brightnessctl -c backlight set 5%-"
];
exec = [
"pkill wpaperd & sleep 0.5 && wpaperd"
"pkill waybar & sleep 0.5 && waybar"
"pkill mako & sleep 0.5 && mako"
];
exec-once = ["blueman-tray" "mullvad-gui" "udiskie -t"];
};
};
}

View file

@ -0,0 +1,6 @@
{
"diagnostics.globals": [
"vim",
"lsp_on_attach"
]
}

View file

@ -0,0 +1,314 @@
{
config,
inputs,
pkgs,
lib,
...
}: {
programs.neovim = let
leaders = ''
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
'';
toLua = str: ''
lua << EOF
${leaders}
${str}
EOF
'';
toLuaFile = file: ''
lua << EOF
${leaders}
${builtins.readFile file}
EOF
'';
toLuaFileLSP = file: ''
lua << EOF
${leaders}
${builtins.readFile ./plugin/lsp/lsp-keys.lua}
${builtins.readFile file}
EOF
'';
fromGit = ref: rev: repo:
pkgs.vimUtils.buildVimPlugin {
pname = "${lib.strings.sanitizeDerivationName repo}";
version = ref;
src = builtins.fetchGit {
url = "https://github.com/${repo}.git";
inherit ref;
inherit rev;
};
};
# always installs latest version
pluginGit = fromGit "HEAD";
in {
enable = true;
# package = pkgs.neovim-nightly;
extraPackages = with pkgs; [
# Rust
rust-analyzer
cargo
rustc
rustfmt
# YAML
yaml-language-server
# JSON
nodePackages.vscode-json-languageserver
# Go
gopls
# Typescript
nodePackages.typescript
nodePackages.typescript-language-server
# Javascript
eslint_d
# Python
nodePackages.pyright
black
# Util
ripgrep
fzf
# C-Family
clang-tools
# Shell
shellcheck
shfmt
# Lua
lua-language-server
selene
stylua
# Nix
rnix-lsp
nixfmt
statix
# LLM
ollama
# Haskell
haskellPackages.haskell-debug-adapter
haskellPackages.haskell-language-server
haskellPackages.fourmolu
ghc
# Docker
dockerfile-language-server-nodejs
docker-compose-language-service
];
defaultEditor = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraLuaConfig = ''
${builtins.readFile ./options.lua}
'';
plugins = with pkgs.vimPlugins; [
{
plugin = nvim-lspconfig;
config = toLuaFileLSP ./plugin/lsp/lsp.lua;
}
{
plugin = crates-nvim;
config = toLua "require('crates').setup()";
}
{
plugin = rustaceanvim;
config = toLuaFileLSP ./plugin/lsp/rust.lua;
}
{
plugin = haskell-tools-nvim;
config = toLuaFileLSP ./plugin/lsp/haskell.lua;
}
{
plugin = SchemaStore-nvim;
config = toLuaFileLSP ./plugin/lsp/schemastore.lua;
}
{
plugin = todo-comments-nvim;
config =
toLua
"require('todo-comments').setup(); vim.api.nvim_set_keymap('n', '<leader>vtd', ':TodoTelescope<CR>', { noremap = true });";
}
{
plugin = comment-nvim;
config = toLua "require('Comment').setup()";
}
{
plugin = onedark-nvim;
config = "colorscheme onedark";
}
neodev-nvim
{
plugin = nvim-cmp;
config = toLuaFile ./plugin/cmp.lua;
}
{
plugin = telescope-nvim;
config = toLuaFile ./plugin/telescope.lua;
}
{
plugin =
pluginGit "951b163e55ce7639eb320c450bde9283c4fe968b"
"laytan/cloak.nvim";
config = toLuaFile ./plugin/cloak.lua;
}
{
plugin =
pluginGit "41ad952c8269fa7aa3a4b8a5abb44541cb628313"
"David-Kunz/gen.nvim";
config = toLuaFile ./plugin/gen.lua;
}
{
plugin = nvim-dap;
config = toLuaFile ./plugin/debugger.lua;
}
{
plugin =
pluginGit "fd35a46f4b7c1b244249266bdcb2da3814f01724"
"xiyaowong/transparent.nvim";
config = toLua "require('transparent').setup{}";
}
nvim-dap-ui
telescope-dap-nvim
nvim-dap-virtual-text
telescope-fzf-native-nvim
cmp_luasnip
cmp-nvim-lsp
luasnip
friendly-snippets
{
plugin = hardtime-nvim;
config = toLua "require('hardtime').setup()";
}
{
plugin = nvim-surround;
config = toLua "require('nvim-surround').setup{}";
}
{
plugin = harpoon;
config = toLuaFile ./plugin/harpoon.lua;
}
{
plugin = lualine-nvim;
config =
toLua
"require('lualine').setup{options = {icons_enabled = true, theme = 'onedark', component_separators = '|', section_separators = ''}, sections = { lualine_a = { { 'buffers', } } }}";
}
{
plugin = nvim-autopairs;
config = toLua "require('nvim-autopairs').setup {}";
}
{
plugin = leap-nvim;
config = toLua "require('leap.user').add_default_mappings()";
}
{
plugin = none-ls-nvim;
config = toLuaFile ./plugin/lsp/none-ls.lua;
}
{
plugin = oil-nvim;
config = toLuaFile ./plugin/oil.lua;
}
{
plugin = zen-mode-nvim;
config = toLuaFile ./plugin/zen.lua;
}
twilight-nvim
nvim-web-devicons
{
plugin = undotree;
config =
toLua "vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle)";
}
{
plugin = gitsigns-nvim;
config = toLuaFile ./plugin/gitsigns.lua;
}
{
plugin = nvim-treesitter.withPlugins (p: [
p.tree-sitter-nix
p.tree-sitter-vim
p.tree-sitter-bash
p.tree-sitter-lua
p.tree-sitter-python
p.tree-sitter-rust
p.tree-sitter-json
p.tree-sitter-c
p.tree-sitter-comment
p.tree-sitter-javascript
p.tree-sitter-fish
p.tree-sitter-dockerfile
p.tree-sitter-cpp
p.tree-sitter-git_config
p.tree-sitter-git_rebase
p.tree-sitter-gitattributes
p.tree-sitter-gitcommit
p.tree-sitter-gitignore
p.tree-sitter-markdown
p.tree-sitter-markdown_inline
p.tree-sitter-make
p.tree-sitter-norg
p.tree-sitter-ssh_config
p.tree-sitter-typescript
p.tree-sitter-tsx
p.tree-sitter-haskell
p.tree-sitter-yaml
p.tree-sitter-zig
]);
config = toLuaFile ./plugin/treesitter.lua;
}
vim-nix
];
};
}

View file

@ -0,0 +1,15 @@
{
config,
inputs,
pkgs,
...
}: {
programs.rbw = {
enable = true;
settings = {
base_url = "https://vaultwarden.cleslie.uk";
email = "cal@callumleslie.me";
pinentry = pkgs.pinentry-gnome3;
};
};
}

View file

@ -0,0 +1,12 @@
{
config,
inputs,
pkgs,
...
}: {
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
#theme = "Arc-Dark";
};
}

View file

@ -0,0 +1,71 @@
{
config,
inputs,
pkgs,
...
}: {
programs.tmux = {
enable = true;
shortcut = "x";
baseIndex = 0;
escapeTime = 0;
clock24 = true;
mouse = true;
plugins = with pkgs.tmuxPlugins; [
sensible
yank
{
plugin = onedark-theme;
extraConfig = "\n";
}
{
plugin = resurrect;
extraConfig = ''
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
'';
}
{
plugin = continuum;
extraConfig = ''
set -g @continuum-restore 'on'
set -g @continuum-boot 'off'
set -g @continuum-save-interval '10'
'';
}
];
extraConfig = ''
set-option -g status-position top
set-option -g default-terminal "tmux-256color"
set-option -sa terminal-features ',xterm-256color:RGB'
set-window-option -g mode-keys vi
bind / split-window -h -c "#{pane_current_path}"
bind \\ split-window -v -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
bind-key -r s run-shell "tmux display-popup -E 'tmux-sessionizer -s'"
bind-key -r f run-shell "tmux display-popup -E 'tmux-sessionizer -p'"
bind-key -r m run-shell "tmux switch-client -t main"
bind S choose-tree
bind -r k select-pane -U
bind -r j select-pane -D
bind -r h select-pane -L
bind -r l select-pane -R
'';
};
home.packages = [
(pkgs.writeShellApplication {
name = "tmux-sessionizer";
runtimeInputs = [pkgs.tmux pkgs.ghq];
text = ''
${builtins.readFile ./tmux-sessionizer.sh}
'';
})
];
}

View file

@ -0,0 +1,59 @@
#!/bin/env bash
pick_session() {
selected=$(ghq list -p | fzf || exit 0)
if [[ -z $selected ]]; then
exit 0
fi
selected_name=$(basename "$selected" | tr . _)
tmux_running=$(pgrep tmux)
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
tmux new-session -s "$selected_name" -c "$selected"
exit 0
fi
if ! tmux has-session -t="$selected_name" 2>/dev/null; then
tmux new-session -ds "$selected_name" -c "$selected"
fi
tmux switch-client -t "$selected_name"
}
switch_session() {
selected=$(tmux list-sessions -F "#{session_name}" | fzf || exit 0)
if [[ -z $selected ]]; then
exit 0
fi
tmux switch-client -t "$selected"
}
selections=()
while getopts "sp" opt; do
case ${opt} in
p) selections+=("pick") ;;
s) selections+=("switch") ;;
\?)
echo "Invalid usage"
exit
;;
esac
done 2>/dev/null
case ${#selections[@]} in
1) selection=${selections[0]} ;;
*)
echo "Please make exactly one selection (-p or -s)" >&2
exit 1
;;
esac
shift $((OPTIND - 1))
case $selection in
"pick") pick_session ;;
"switch") switch_session ;;
esac

View file

@ -0,0 +1,94 @@
{
config,
inputs,
pkgs,
...
}: {
programs.waybar = {
enable = true;
package = pkgs.waybar.override {
hyprlandSupport = true;
swaySupport = false;
};
systemd.enable = false;
settings = {
mainBar = {
layer = "top";
position = "bottom";
height = 20;
modules-left = ["hyprland/workspaces" "hyprland/submap"];
modules-center = ["hyprland/window"];
modules-right = ["temperature" "wireplumber" "backlight" "battery" "clock" "tray"];
clock = {
tooltip = false;
interval = 1;
format = "{:%H:%M}";
format-alt = "{:%d %B %Y, %A}";
};
battery = {
states = {
full = 99;
good = 98;
normal = 98;
warning = 20;
critical = 10;
};
format = "{icon} {capacity}%";
format-good = "{icon} {capacity}%";
format-full = " {capacity}%";
format-icons = ["" "" "" "" ""];
tooltip = false;
};
wireplumber = {
on-click = "${pkgs.pwvucontrol}/bin/pwvucontrol";
format = "{icon} {volume}%";
format-muted = "";
format-icons = ["" "" ""];
tooltip = false;
};
backlight = {
format = "{icon} {percent}%";
format-icons = ["" "" "" ""];
tooltip = false;
};
tray = {
icon-size = 18;
spacing = 4;
show-passive-items = true;
tooltip = false;
};
temperature = {
thermal-zone = 0;
format = "{icon} {temperatureC}°C";
format-icons = [""];
interval = 30;
tooltip = false;
};
};
};
style = ''
* {
min-height: 0;
border: none;
border-radius: 0;
margin: 0px;
font-size: 13px;
}
#workspaces button {
margin: 0px;
padding: 0 5px;
}
#workspaces button.focused, #workspaces button.active {
border-bottom: 3px solid @base05;
}
#workspaces button:hover {
background: alpha(@base05, 1);
color: @base00;
}
'';
};
}

16
home/services/default.nix Normal file
View file

@ -0,0 +1,16 @@
{
inputs,
config,
pkgs,
...
}: {
imports = [./mako];
services = {
network-manager-applet.enable = true;
mpris-proxy.enable = true;
gpg-agent = {
enable = true;
enableSshSupport = true;
};
};
}

View file

@ -0,0 +1,11 @@
{
config,
inputs,
pkgs,
...
}: {
services.mako = {
enable = true;
defaultTimeout = 7000;
};
}