From 13871c1ff9d99e660ba41b06c842a0402ad9b040 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sat, 11 Dec 2021 15:29:12 +0100 Subject: [PATCH] Add lots of new nix config --- nixpkgs/home.nix | 75 +++------ nixpkgs/misc/mimetypes.nix | 142 +++++++++++++++++ nixpkgs/programs/alacritty.nix | 42 +++-- nixpkgs/programs/gh.nix | 10 +- nixpkgs/programs/git.nix | 32 ++-- nixpkgs/programs/ncmpcpp.nix | 110 ++++++------- nixpkgs/programs/neovim.nix | 29 +++- nixpkgs/programs/newsboat.nix | 12 +- nixpkgs/programs/qutebrowser.nix | 12 ++ nixpkgs/programs/rofi.nix | 12 +- nixpkgs/programs/tmux.nix | 56 ++++--- nixpkgs/programs/vscode.nix | 82 +++++----- nixpkgs/programs/zathura.nix | 10 +- nixpkgs/programs/zsh.nix | 67 ++++---- nixpkgs/secret/.gitignore | 17 ++ nixpkgs/secret/README.md | 36 +++++ nixpkgs/secret/default.nix | 7 + nixpkgs/secret/programs/chromium/default.nix | 7 + nixpkgs/secret/programs/default.nix | 8 + nixpkgs/secret/programs/newsboat/default.nix | 6 + .../secret/programs/qutebrowser/default.nix | 7 + nixpkgs/secret/ssh/hosts/default.nix | 8 + nixpkgs/secret/ssh/hosts/pvv.nix | 100 ++++++++++++ nixpkgs/secret/update.sh | 2 + nixpkgs/services/dunst.nix | 24 +++ nixpkgs/services/mpd.nix | 12 +- nixpkgs/services/picom.nix | 57 +++---- nixpkgs/services/stalonetray.nix | 36 +++-- nixpkgs/services/sxhkd.nix | 150 +++++++++--------- 29 files changed, 796 insertions(+), 372 deletions(-) create mode 100644 nixpkgs/misc/mimetypes.nix create mode 100644 nixpkgs/programs/qutebrowser.nix create mode 100644 nixpkgs/secret/.gitignore create mode 100644 nixpkgs/secret/README.md create mode 100644 nixpkgs/secret/default.nix create mode 100644 nixpkgs/secret/programs/chromium/default.nix create mode 100644 nixpkgs/secret/programs/default.nix create mode 100644 nixpkgs/secret/programs/newsboat/default.nix create mode 100644 nixpkgs/secret/programs/qutebrowser/default.nix create mode 100644 nixpkgs/secret/ssh/hosts/default.nix create mode 100644 nixpkgs/secret/ssh/hosts/pvv.nix create mode 100755 nixpkgs/secret/update.sh create mode 100644 nixpkgs/services/dunst.nix diff --git a/nixpkgs/home.nix b/nixpkgs/home.nix index f2134fa..ff6eb24 100644 --- a/nixpkgs/home.nix +++ b/nixpkgs/home.nix @@ -9,6 +9,8 @@ in _module.args.colorTheme = colorTheme; imports = [ + ./misc/mimetypes.nix + ./programs/alacritty.nix ./programs/comma.nix ./programs/emacs.nix @@ -17,11 +19,20 @@ in ./programs/ncmpcpp.nix ./programs/neovim.nix ./programs/newsboat.nix + ./programs/qutebrowser.nix ./programs/rofi.nix ./programs/tmux.nix ./programs/vscode.nix ./programs/zathura.nix ./programs/zsh.nix + + ./services/dunst.nix + ./services/mpd.nix + ./services/picom.nix + ./services/stalonetray.nix + ./services/sxhkd.nix + + ./secret/ssh/hosts ]; xsession = { @@ -33,14 +44,11 @@ in }; programs = { - home-manager.enable = true; + home-manager.enable = true; bat.enable = true; - - # bottom.enable = true; - + bottom.enable = true; exa.enable = true; - feh.enable = true; fzf = { @@ -52,6 +60,7 @@ in irssi.enable = true; lazygit.enable = true; mpv.enable = true; + ssh.enable = true; man = { enable = true; @@ -60,19 +69,9 @@ in obs-studio.enable = true; - qutebrowser = { - enable = true; - aliases = {}; - searchEngines = {}; - settings = {}; - keyBindings = {}; - # quickmarks = {}; - extraConfig = ''''; - }; - skim = { enable = true; - defaultCommand ="fd --type f"; + defaultCommand ="fd --type f"; }; texlive = { @@ -85,12 +84,6 @@ in zoxide.enable = true; }; - services.mpd = import ./services/mpd.nix args; - services.picom = import ./services/picom.nix; - services.stalonetray = import ./services/stalonetray.nix (args // { inherit colorTheme; }); - services.sxhkd = import ./services/sxhkd.nix args; - - home = { stateVersion = "21.05"; username = "h7x4"; @@ -101,11 +94,14 @@ in asciidoctor audacity beets + biber calibre castnow citra + cool-retro-term copyq czkawka + darktable desmume discord diskonaut @@ -116,8 +112,10 @@ in fd ffmpeg geogebra + gnome.gnome-font-viewer google-chrome # gpgtui + graphviz # hck hexyl imagemagick @@ -132,6 +130,7 @@ in lastpass-cli lazydocker libreoffice-fresh + light lolcat maim mdcat @@ -197,34 +196,12 @@ in ]; }; - services.gnome-keyring.enable = true; - - services.dropbox.enable = true; - services.dunst = { - enable = true; - iconTheme = { - package = pkgs.gnome.adwaita-icon-theme; - name = "Adwaita"; - size = "32x32"; - }; - settings = { - global = { - geometry = "300x5-30+50"; - transparency = 10; - frame_color = "#eceff1"; - font = "Droid Sans 9"; - }; - urgency_normal = { - background = "#37474f"; - foreground = "#eceff1"; - timeout = 10; - }; - }; + services = { + gnome-keyring.enable = true; + dropbox.enable = true; + network-manager-applet.enable = true; + # redshift.enable = true; }; - services.network-manager-applet.enable = true; - - # services.redshift.enable = true; - } diff --git a/nixpkgs/misc/mimetypes.nix b/nixpkgs/misc/mimetypes.nix new file mode 100644 index 0000000..5c4371b --- /dev/null +++ b/nixpkgs/misc/mimetypes.nix @@ -0,0 +1,142 @@ +{ lib, ... }: + +let + + # Applications + google-chrome = "google-chrome.desktop"; + gimp = "gimp.desktop"; + inkscape = "org.inkscape.Inkscape.desktop"; + vscode = "code.desktop"; + mpv = "mpv.desktop"; + zathura = "org.pwmt.zathura.desktop"; + sxiv = "sxiv.desktop"; + font-viewer = "org.gnome.font-viewer.desktop"; + + # Formats + "3g2-audio" = "audio/3gpp"; + "3g2-video" = "video/3gpp"; + "3gp-audio" = "audio/3gpp"; + "3gp-video" = "video/3gpp"; + aac = "audio/aac"; + avi = "video/x-msvideo"; + bmp = "image/bmp"; + cbr = "application/vnd.comicbook+rar"; + cbrx = "application/x-cbr"; + cbz = "application/vnd.comicbook+zip"; + cbzx = "application/x-cbz"; + djvu = "image/vnd.djvu"; + epub = "application/epub+zip"; + flv = "video/x-flv"; + gif = "image/gif"; + html = "text/html"; + http = "x-scheme-handler/http"; + https = "x-scheme-handler/https"; + ico = "image/vnd.microsoft.icon"; + icox = "image/x-icon"; + ini = "application/x-wine-extension-ini"; + jpg = "image/jpeg"; + m4v = "video/x-m4v"; + mkv = "video/x-matroska"; + mov = "video/quicktime"; + mp3 = "audio/mpeg"; + mp4 = "video/mp4"; + mpeg = "video/mpeg"; + ogg = "audio/ogg"; + ogv = "video/ogg"; + opus = "audio/opus"; + otf = "font/otf"; + pdf = "application/pdf"; + pic = "image/x-pict"; + png = "image/png"; + psd = "image/vnd.adobe.photoshop"; + svg = "image/svg+xml"; + tiff = "image/tiff"; + ttf = "font/ttf"; + txt = "text/plain"; + url = "application/x-mswinurl"; + wav = "audio/wav"; + wavx = "audio/x-wav"; + webm-audio = "audio/webm"; + webm-video = "video/webm"; + webp = "image/webp"; + wmv = "video/x-ms-wmv"; + woff = "font/woff"; + woff2 = "font/woff2"; + xbm = "image/x-xbitmap"; + xcf = "image/x-xcf"; + xhtml = "application/xhtml+xml"; + xml = "text/xml"; + xpm = "image/x-xpixmap"; + + + # Generalizations + audio-player = mpv; + gui-text-editor = vscode; + image-viewer = sxiv; + pdf-viewer = zathura; + video-player = mpv; + web-browser = google-chrome; + +in { + + xdg.mimeApps = { + enable = true; + # associations.added = {}; + # associations.removed = {}; + defaultApplications = { + ${"3g2-audio"} = audio-player; + ${"3g2-video"} = video-player; + ${"3gp-audio"} = audio-player; + ${"3gp-video"} = video-player; + ${aac} = audio-player; + ${avi} = video-player; + ${bmp} = image-viewer; + ${cbrx} = zathura; + ${cbr} = zathura; + ${cbzx} = zathura; + ${cbz} = zathura; + ${djvu} = pdf-viewer; + ${epub} = zathura; + ${flv} = video-player; + ${gif} = image-viewer; + ${html} = web-browser; + ${https} = web-browser; + ${http} = web-browser; + ${icox} = image-viewer; + ${ico} = image-viewer; + ${jpg} = image-viewer; + ${m4v} = video-player; + ${mkv} = video-player; + ${mov} = video-player; + ${mp3} = audio-player; + ${mp4} = video-player; + ${mpeg} = video-player; + ${ogg} = audio-player; + ${ogv} = video-player; + ${opus} = audio-player; + ${otf} = font-viewer; + ${pdf} = pdf-viewer; + ${pic} = image-viewer; + ${png} = image-viewer; + ${psd} = gimp; + ${svg} = image-viewer; + ${tiff} = image-viewer; + ${ttf} = font-viewer; + ${txt} = gui-text-editor; + ${url} = web-browser; + ${wav} = audio-player; + ${webm-audio} = audio-player; + ${webm-video} = video-player; + ${webp} = image-viewer; + ${wmv} = video-player; + ${woff2} = font-viewer; + ${woff} = font-viewer; + ${xbm} = image-viewer; + ${xcf} = gimp; + ${xhtml} = web-browser; + ${xml} = gui-text-editor; + ${xpm} = image-viewer; + }; + }; +} + diff --git a/nixpkgs/programs/alacritty.nix b/nixpkgs/programs/alacritty.nix index e0168b2..28a8ff3 100644 --- a/nixpkgs/programs/alacritty.nix +++ b/nixpkgs/programs/alacritty.nix @@ -1,25 +1,49 @@ { lib, pkgs, colorTheme, ... }: { - programs.alacritty = { enable = true; settings = { window.padding = { x = 15; y = 15; }; font = { normal = { family = "Fira Code"; style = "Retina"; }; bold.family = "Fira Code"; italic.family = "Fira Code"; size = 12.0; }; + programs.alacritty = { + enable = true; + settings = { + window.padding = { x = 15; y = 15; }; + + font = { + normal = { + family = "Fira Code"; + style = "Retina"; + }; + bold.family = "Fira Code"; + italic.family = "Fira Code"; + size = 12.0; + }; + colors = - let - pColors = [ "foreground" "background" ]; + let + inherit (lib.attrsets) getAttrs filterAttrs; + inherit (lib.lists) any; + primaryColors = [ "foreground" "background" ]; in { - primary = lib.attrsets.getAttrs pColors colorTheme.default; - normal = lib.attrsets.filterAttrs (n: v: pColors ? n) colorTheme.default; + primary = getAttrs primaryColors colorTheme.default; + normal = let + removePrimaryColorAttrs = n: v: !(any (pc: n ? pc) primaryColors); + in filterAttrs removePrimaryColorAttrs colorTheme.default; }; - + background_opacity = 1.0; - + cursor = { style = "Block"; blinking = "On"; unfocused_hollow = true; }; - + + bell = { + animation = "EaseOutExpo"; + color = "0xffffff"; + duration = 20; + }; + live_config_reload = true; - + shell = { program = "${pkgs.zsh}/bin/zsh"; args = [ "--login" ]; diff --git a/nixpkgs/programs/gh.nix b/nixpkgs/programs/gh.nix index 7348813..31deb60 100644 --- a/nixpkgs/programs/gh.nix +++ b/nixpkgs/programs/gh.nix @@ -2,10 +2,12 @@ { programs.gh = { enable = true; - gitProtocol = "ssh"; - aliases = { - co = "pr checkout"; - pv = "pr view"; + settings = { + gitProtocol = "ssh"; + aliases = { + co = "pr checkout"; + pv = "pr view"; + }; }; }; } diff --git a/nixpkgs/programs/git.nix b/nixpkgs/programs/git.nix index 0a759f7..62a44e5 100644 --- a/nixpkgs/programs/git.nix +++ b/nixpkgs/programs/git.nix @@ -3,10 +3,10 @@ programs.git = { enable = true; package = pkgs.gitFull; - + userName = "h7x4"; userEmail = "h7x4abk3g@protonmail.com"; - + aliases = { aliases = "!git config --get-regexp alias | sed -re 's/alias\\.(\\S*)\\s(.*)$/\\1 = \\2/g'"; uncommit = "reset --soft HEAD^"; @@ -15,62 +15,62 @@ # unstage = "rm --cached "; unstage = "restore --staged "; delete-merged = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d"; - + mkbr = "checkout -b"; mvbr = "branch -m"; rmbr = "branch -d"; rrmbr = "push origin --delete"; - + graph = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"; graphv = "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all"; g = "!git graph"; }; - + extraConfig = { core = { whitespace = "space-before-tab,-indent-with-non-tab,trailing-space"; - + precomposeunicode = false; untrackedCache = true; - + editor = "nvim"; pager = "less"; }; - + "color \"branch\"".upstream = "cyan"; color.ui = "auto"; - + init.defaultBranch = "main"; fetch.prune = true; pull.rebase = true; push.default = "current"; - + merge = { tool = "nvimdiff"; conflictstyle = "diff3"; colorMoved = "zebra"; }; - + mergetool.keepBackup = false; "mergetool \"nvimdiff\"".cmd = "nvim -d $BASE $LOCAL $REMOTE $MERGED -c '$wincmd w' -c 'wincmd J'"; - + diff = { mnemonicPrefix = true; renames = true; tool = "nvimdiff"; }; - + grep = { break = true; heading= true; lineNumber = true; extendedRegexp = true; }; - + github.user = "h7x4abk3g"; - + web.browser = "google-chrome-stable"; - + "filter \"lfs\"" = { required = true; smudge = "git-lfs smudge -- %f"; diff --git a/nixpkgs/programs/ncmpcpp.nix b/nixpkgs/programs/ncmpcpp.nix index 895acf9..c6f873c 100644 --- a/nixpkgs/programs/ncmpcpp.nix +++ b/nixpkgs/programs/ncmpcpp.nix @@ -3,59 +3,59 @@ programs.ncmpcpp = { enable = true; package = pkgs.ncmpcpp.override { visualizerSupport = true; }; - + bindings = [ # { key = "j"; command = "scroll_down"; } { key = "mouse"; command = "mouse_event"; } - + { key = "up"; command = "scroll_up"; } { key = "shift-up"; command = ["select_item" "scroll_up"]; } - + { key = "down"; command = "scroll_down"; } { key = "shift-down"; command = ["select_item" "scroll_down"]; } - + { key = "["; command = "scroll_up_album"; } { key = "]"; command = "scroll_down_album"; } { key = "{"; command = "scroll_up_artist"; } { key = "}"; command = "scroll_down_artist"; } - + { key = "page_up"; command = "page_up"; } { key = "page_down"; command = "page_down"; } - + { key = "home"; command = "move_home"; } { key = "end"; command = "move_end"; } { key = "insert"; command = "select_item"; } - + { key = "enter"; command = "enter_directory"; } { key = "enter"; command = "toggle_output"; } { key = "enter"; command = "run_action"; } { key = "enter"; command = "play_item"; } - + { key = "space"; command = "add_item_to_playlist"; } { key = "space"; command = "toggle_lyrics_update_on_song_change"; } { key = "space"; command = "toggle_visualization_type"; } - + #CHANGE { key = "d"; command = "delete_playlist_items"; } - + { key = "delete"; command = "delete_browser_items"; } { key = "delete"; command = "delete_stored_playlist"; } - + { key = "right"; command = "next_column"; } { key = "right"; command = "slave_screen"; } { key = "right"; command = "volume_up"; } { key = "+"; command = "volume_up"; } - + { key = "left"; command = "previous_column"; } { key = "left"; command = "master_screen"; } { key = "left"; command = "volume_down"; } { key = "-"; command = "volume_down"; } - + { key = ":"; command = "execute_command"; } { key = "tab"; command = "next_screen"; } { key = "shift-tab"; command = "previous_screen"; } { key = "f1"; command = "show_help"; } - + { key = "1"; command = "show_playlist"; } { key = "2"; command = "show_browser"; } { key = "2"; command = "change_browse_mode"; } @@ -69,20 +69,20 @@ { key = "8"; command = "show_visualizer"; } { key = "="; command = "show_clock"; } { key = "@"; command = "show_server_info"; } - + { key = "s"; command = "stop"; } { key = "p"; command = "pause"; } { key = ">"; command = "next"; } { key = "<"; command = "previous"; } - + { key = "ctrl-h"; command = "jump_to_parent_directory"; } { key = "ctrl-h"; command = "replay_song"; } { key = "backspace"; command = "jump_to_parent_directory"; } { key = "backspace"; command = "replay_song"; } - + { key = "f"; command = "seek_forward"; } { key = "b"; command = "seek_backward"; } - + { key = "r"; command = "toggle_repeat"; } { key = "z"; command = "toggle_random"; } { key = "y"; command = "save_tag_changes"; } @@ -154,41 +154,41 @@ { key = "`"; command = "add_random_items"; } { key = "ctrl-p"; command = "set_selected_items_priority"; } { key = "q"; command = "quit"; } - + # the t key isn't used and it's easier to press than /, so lets use it - { key = "t"; command = "find"; } + { key = "t"; command = "find"; } { key = "t"; command = "find_item_forward"; } - - { key = "+"; command = "show_clock"; } + + { key = "+"; command = "show_clock"; } { key = "="; command = "volume_up"; } - - { key = "j"; command = "scroll_down"; } + + { key = "j"; command = "scroll_down"; } { key = "k"; command = "scroll_up"; } - - { key = "ctrl-u"; command = "page_up"; } + + { key = "ctrl-u"; command = "page_up"; } #push_characters "kkkkkkkkkkkkkkk" - { key = "ctrl-d"; command = "page_down"; } + { key = "ctrl-d"; command = "page_down"; } #push_characters "jjjjjjjjjjjjjjj" - - { key = "h"; command = "previous_column"; } + + { key = "h"; command = "previous_column"; } { key = "l"; command = "next_column"; } - + { key = "."; command = "show_lyrics"; } - - { key = "n"; command = "next_found_item"; } + + { key = "n"; command = "next_found_item"; } { key = "N"; command = "previous_found_item"; } - + # not used but bound - { key = "J"; command = "move_sort_order_down"; } + { key = "J"; command = "move_sort_order_down"; } { key = "K"; command = "move_sort_order_up"; } ]; - + settings = { lyrics_directory = "~/music/.lyrics"; - + playlist_disable_highlight_delay = 0; message_delay_time = 5; - + # - 0 - default window color (discards all other colors) # - 1 - black # - 2 - red @@ -203,7 +203,7 @@ # - u - underline text # - r - reverse colors # - a - use alternative character set - + song_list_format = "{%a - }{%t}|{$8%f$9}$R{$3(%l)$9}"; song_status_format = "{{%a{ \"%b\"{ (%y)}} - }{%t}}|{%f}"; song_library_format = "{%n - }{%t}|{%f}"; @@ -219,23 +219,23 @@ selected_item_prefix = "$6"; selected_item_suffix = "$9"; modified_item_prefix = "$3> $9"; - + song_window_title_format = "{%a - }{%t}|{%f}"; - + browser_sort_mode = "name"; browser_sort_format = "{%a - }{%t}|{%f} {(%l)}"; - + song_columns_list_format = "(10)[green]{a} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l}"; # song_columns_list_format = "(10)[green]{a} (50)[black]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l}"; - + execute_on_song_change = ""; - + execute_on_player_state_change = ""; playlist_show_mpd_host = "no"; playlist_show_remaining_time = "no"; playlist_shorten_total_times = "no"; playlist_separate_albums = "no"; - + playlist_display_mode = "columns"; browser_display_mode = "classic"; search_engine_display_mode = "classic"; @@ -247,11 +247,11 @@ volume_change_step = 2; autocenter_mode = "no"; centered_cursor = "no"; - + progressbar_look = "─⊙╶"; # progressbar_look = "◾◾◽"; # progressbar_look = "=> "; - + default_place_to_search_in = "database"; user_interface = "classic"; data_fetching_delay = "yes"; @@ -265,23 +265,23 @@ header_text_scrolling = "yes"; cyclic_scrolling = "no"; lines_scrolled = 2; - + # lyrics_fetchers = "azlyrics, genius, sing365, lyricsmania, metrolyrics, justsomelyrics, jahlyrics, plyrics, tekstowo, internet"; follow_now_playing_lyrics = "no"; fetch_lyrics_for_current_song_in_background = "no"; store_lyrics_in_song_dir = "no"; generate_win32_compatible_filenames = "yes"; allow_for_physical_item_deletion = "no"; - + lastfm_preferred_language = "en"; space_add_mode = "add_remove"; show_hidden_files_in_local_browser = "no"; - + screen_switcher_mode = "playlist, browser"; startup_screen = "playlist"; startup_slave_screen = ""; startup_slave_screen_focus = "no"; - + locked_screen_width_part = "50"; ask_for_locked_screen_width_part = "yes"; jump_to_now_playing_song_at_start = "yes"; @@ -290,9 +290,9 @@ display_volume_level = "yes"; display_bitrate = "yes"; display_remaining_time = "no"; - + ignore_leading_the = "no"; - + ignore_diacritics = "no"; block_search_constraints_change_if_items_found = "yes"; mouse_support = "yes"; @@ -302,11 +302,11 @@ tag_editor_extended_numeration = "no"; media_library_sort_by_mtime = "no"; enable_window_title = "no"; - + search_engine_default_search_mode = 1; external_editor = "vim"; use_console_editor = "yes"; - + colors_enabled = "yes"; empty_tag_color = "cyan"; header_window_color = "cyan"; @@ -326,7 +326,7 @@ alternative_ui_separator_color = "black:b"; window_border_color = "green"; active_window_border = "red"; - + # visualizer_fifo_path = "/tmp/mpd.fifo"; # visualizer_output_name = "my_fifo"; # visualizer_sync_interval = "30"; diff --git a/nixpkgs/programs/neovim.nix b/nixpkgs/programs/neovim.nix index a1359c9..2d56ed8 100644 --- a/nixpkgs/programs/neovim.nix +++ b/nixpkgs/programs/neovim.nix @@ -1,14 +1,12 @@ -{pkgs, ...}: +{ pkgs, home, colorTheme, ... }: { programs.neovim = { enable = true; - # defaultEditor = true; + viAlias = true; vimAlias = true; vimdiffAlias = true; - extraConfig = '' - set clipboard+=unnamedplus - ''; + plugins = with pkgs.vimPlugins; [ vim-commentary vim-gitgutter @@ -23,12 +21,33 @@ limelight-vim vim-tmux-navigator vim-polyglot + lightline-vim + { + plugin = rainbow; + config = '' + let g:rainbow_active = 1 + ''; + } { plugin = vim-monokai; config = '' colorscheme monokai + autocmd ColorScheme * highlight Normal ctermbg=0 + autocmd ColorScheme * highlight LineNr ctermbg=0 + autocmd ColorScheme * highlight CursorLineNR ctermbg=0 ctermfg=208 + autocmd ColorScheme * highlight SignColumn ctermbg=0 + autocmd ColorScheme * highlight GitGutterAdd ctermbg=0 + autocmd ColorScheme * highlight GitGutterChange ctermbg=0 + autocmd ColorScheme * highlight GitGutterDelete ctermbg=0 ''; } ]; + + extraConfig = '' + set clipboard+=unnamedplus + set number relativenumber + ''; }; + + home.sessionVariables = { EDITOR = "nvim"; }; } diff --git a/nixpkgs/programs/newsboat.nix b/nixpkgs/programs/newsboat.nix index 6de4f4c..541f846 100644 --- a/nixpkgs/programs/newsboat.nix +++ b/nixpkgs/programs/newsboat.nix @@ -1,4 +1,4 @@ -{ ... }: +{ lib, ... }: let defaultBrowser = "google-chrome-stable %u"; videoViewer = "mpv %u"; @@ -8,12 +8,12 @@ in { autoReload = true; maxItems = 50; browser = defaultBrowser; - extraConfig = builtins.concatStringsSep "\n" [ + extraConfig = lib.strings.concatStringsSep "\n" [ '' macro m set browser "${videoViewer}"; open-in-browser ; set browser "${defaultBrowser}" macro l set browser "${defaultBrowser}"; open-in-browser ; set browser "${defaultBrowser}" '' - + # Unbind keys '' unbind-key ENTER @@ -22,7 +22,7 @@ in { unbind-key J unbind-key K '' - + # Bind keys - vim style '' bind-key j down @@ -30,7 +30,7 @@ in { bind-key l open bind-key h quit '' - + # Theme '' color background default default @@ -41,7 +41,7 @@ in { color info default black color article default default '' - + # Highlights '' highlight all "---.*---" yellow diff --git a/nixpkgs/programs/qutebrowser.nix b/nixpkgs/programs/qutebrowser.nix new file mode 100644 index 0000000..a85fab1 --- /dev/null +++ b/nixpkgs/programs/qutebrowser.nix @@ -0,0 +1,12 @@ +{ ... }: +{ + programs.qutebrowser = { + enable = true; + aliases = {}; + searchEngines = {}; + settings = {}; + keyBindings = {}; + # quickmarks = {}; + extraConfig = ''''; + }; +} diff --git a/nixpkgs/programs/rofi.nix b/nixpkgs/programs/rofi.nix index 1331edb..18301b0 100644 --- a/nixpkgs/programs/rofi.nix +++ b/nixpkgs/programs/rofi.nix @@ -2,7 +2,7 @@ { programs.rofi = { enable = true; - + # plugins = with pkgs; [ # rofi-emoji # rofi-mpd @@ -12,15 +12,15 @@ # rofi-power-menu # rofi-file-browser # ]; - + font = "Droid Sans 12"; - theme = ../../rofi/themes/blank.rasi; - + theme = ../../general/.config/rofi/themes/blank.rasi; + extraConfig = { - modi = "window,run,drun,ssh,windowcd,file-browser"; + modi = "window,run,drun,ssh,windowcd"; show-icons = true; drun-display-format = "{name}"; - fullscreen = false; + # fullscreen = false; threads = 0; matching = "fuzzy"; scroll-method = 0; diff --git a/nixpkgs/programs/tmux.nix b/nixpkgs/programs/tmux.nix index fc6f707..60ec3fd 100644 --- a/nixpkgs/programs/tmux.nix +++ b/nixpkgs/programs/tmux.nix @@ -5,15 +5,21 @@ baseIndex = 1; clock24 = true; escapeTime = 0; - # keyMode = "vi"; + keyMode = "vi"; prefix = "C-a"; plugins = with pkgs.tmuxPlugins; [ - + fingers + fpp + pain-control + prefix-highlight + sidebar + tmux-fzf + urlview ]; extraConfig = '' # Don't rename windows automatically after rename with ',' set-option -g allow-rename off - + set -g mouse on set -q -g status-utf8 on setw -q -g utf8 on @@ -21,50 +27,50 @@ set -g base-index 1 # windows starts at 1 setw -g monitor-activity on set -g visual-activity on - + # Length of tmux status line set -g status-left-length 30 set -g status-right-length 150 - + set -g base-index 1 set -g pane-base-index 0 - + ###################### ######## KEYS ######## ###################### - + # Split panes using $P-[gh] bind h split-window -h -c "#{pane_current_path}" bind g split-window -v -c "#{pane_current_path}" unbind '"' # Unbind default vertical split unbind % # Unbind default horizontal split - + # Reload config using $P-r unbind r bind r \ source-file $XDG_CONFIG_HOME/tmux/tmux.conf\;\ display-message 'Reloaded tmux.conf' - + # Switch panes using Alt-[hjkl] bind -n C-h select-pane -L bind -n C-j select-pane -D bind -n C-k select-pane -U bind -n C-l select-pane -R - + # Resize pane using Alt-Shift-[hjkl] - bind -n M-H resize-pane -L 5 - bind -n M-J resize-pane -D 5 - bind -n M-K resize-pane -U 5 - bind -n M-L resize-pane -R 5 - + bind -n M-H resize-pane -L 5 + bind -n M-J resize-pane -D 5 + bind -n M-K resize-pane -U 5 + bind -n M-L resize-pane -R 5 + # Fullscreen current pane using $P-Alt-z unbind z - bind M-z resize-pane -Z - + bind M-z resize-pane -Z + # Kill pane using $P-Backspace unbind & bind BSpace killp - + # Swap clock-mode and new-window # New tab: $P-t # Clock mode: $P-c @@ -72,26 +78,26 @@ unbind t bind c clock-mode bind t new-window - - # Setup 'y' to yank (copy) + + # Setup 'y' to yank (copy) bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy" bind-key -T copy-mode-vi 'V' send -X select-line bind-key -T copy-mode-vi 'r' send -X rectangle-toggle - + ###################### ### DESIGN CHANGES ### ###################### - - set-option -g status-left '#[bg=blue]#[fg=black,bold] ###S #[bg=default] #[fg=green]#(~/.scripts/tmux/fcitx) #[fg=red]%H:%M ' + + set-option -g status-left '#{prefix_highlight} #[bg=blue]#[fg=black,bold] ###S #[bg=default] #[fg=green]#(~/.scripts/tmux/fcitx) #[fg=red]%H:%M ' set-option -g status-right '#[fg=red]#(~/.scripts/tmux/mpd)' set-window-option -g window-status-current-style fg=magenta set-option -g status-style 'bg=black fg=default' set-option -g default-shell '${pkgs.zsh}/bin/zsh' - + set -g status-position bottom set -g status-interval 4 set -g status-justify centre # center align window list - + setw -g status-bg default setw -g window-status-format '#[bg=#888888]#[fg=black,bold] #I #[bg=default] #[fg=#888888]#W ' setw -g window-status-current-format '#[fg=black,bold]#[bg=cyan] #I #[fg=cyan]#[bg=default] #W ' diff --git a/nixpkgs/programs/vscode.nix b/nixpkgs/programs/vscode.nix index 95f964a..0b9d2ba 100644 --- a/nixpkgs/programs/vscode.nix +++ b/nixpkgs/programs/vscode.nix @@ -1,6 +1,6 @@ { pkgs, lib, ... }: -let mapPrefixToSet = prefix: set: +let mapPrefixToSet = prefix: set: with lib; attrsets.mapAttrs' (k: v: attrsets.nameValuePair ("${prefix}.${k}") v) set; vs-liveshare = pkgs.callPackage ./vscode-extensions/vsliveshare.nix {}; @@ -13,7 +13,7 @@ in # package = pkgs.vscodium; # package = pkgs.vscode-fhsWithPackages (ps: with ps; [rustup zlib]); # package = pkgs.vscode-fhs; - + userSettings = let editor = mapPrefixToSet "editor" { fontFamily = "Fira Code"; @@ -36,14 +36,14 @@ in wordWrap = "off"; # "bracketPairColorization.enabled" = true; }; - + zen = mapPrefixToSet "zenMode" { centerLayout = true; hideStatusBar = false; hideLineNumbers = false; hideTabs = false; }; - + vim = mapPrefixToSet "vim" { useSystemClipboard = true; "statusBarColorControl" = true; @@ -61,7 +61,7 @@ in "" = true; }; }; - + workbench = mapPrefixToSet "workbench" { "settings.enableNaturalLanguageSearch" = false; enableExperiments = false; @@ -80,7 +80,7 @@ in "*.ipynb" = "jupyter.notebook.ipynb"; }; }; - + python = mapPrefixToSet "python" { "analysis.completeFunctionParens" = true; "formatting.provider" = "yapf"; @@ -90,28 +90,28 @@ in "autoComplete.addBrackets" = true; languageServer = "Pylance"; }; - + java = mapPrefixToSet "java" { "configuration.checkProjectSettingsExclusions" = false; "test.report.showAfterExecution" = "always"; "test.report.position" = "currentView"; "refactor.renameFromFileExplorer" = "preview"; }; - + sync = mapPrefixToSet "sync" { autoUpload = true; autoDownload = true; quietSync = true; gist = "86e19852a95d31a278ad1a516b40556b"; }; - + svg = mapPrefixToSet "svgviewer" { transparencygrid = true; enableautopreview = true; previewcolumn = "Beside"; showzoominout = true; }; - + indentRainbow = mapPrefixToSet "indentRainbow" { errorColor = "rgb(255, 0, 0)"; colors = [ # http://colrd.com/palette/38436/ @@ -136,7 +136,7 @@ in "java" ]; }; - + in editor // indentRainbow // @@ -159,7 +159,7 @@ in "terminal.integrated.fontSize" = 14; "vsintellicode.modify.editor.suggestSelection" = "automaticallyOverrodeDefaultValue"; "window.zoomLevel" = 2; - + # This setting does not support language overrides "files.exclude" = { # Java @@ -168,9 +168,9 @@ in "**/.settings" = true; "**/.factorypath" = true; }; - + # Extensions - + "bracket-pair-colorizer-2.colorMode" = "Consecutive"; "bracket-pair-colorizer-2.forceIterationColorCycle" = true; "bracket-pair-colorizer-2.colors" = [ @@ -182,119 +182,119 @@ in "#ff0030" ]; "docker.showStartPage" = false; - + "errorLens.errorColor" = "rgba(240,0,0,0.1)"; "errorLens.warningColor" = "rgba(180,180,0,0.1)"; - + "jupyter.askForKernelRestart" = false; - + "keyboard-quickfix.showActionNotification" = false; - + "latex-workshop.latex.autoBuild.run" = "onFileChange"; "latex-workshop.view.pdf.viewer" = "tab"; - + "liveshare.presence" = true; "liveshare.showInStatusBar" = "whileCollaborating"; - + "liveServer.settings.port" = 5500; - + "material-icon-theme.folders.associations" = { ui = "layout"; bloc = "controller"; }; - + "redhat.telemetry.enabled" = false; - + "sonarlint.rules" = { "java:S3358" = { "level" = "off"; }; }; - + # Language overrides - + "dart.previewFlutterUiGuides" = true; "dart.previewFlutterUiGuidesCustomTracking" = true; "dart.previewLsp" = true; - + "[dart]" = { "editor.defaultFormatter" = "Dart-Code.dart-code"; }; - + "[html]" = { "editor.formatOnSave" = false; "editor.defaultFormatter" = "lonefy.vscode-JS-CSS-HTML-formatter"; }; - + "[javascript]" = { "editor.formatOnSave" = false; "editor.defaultFormatter" = "vscode.typescript-language-features"; }; - + "[json]" = { "editor.formatOnSave" = true; }; - + "[jsonc]" = { "editor.defaultFormatter" = "vscode.json-language-features"; }; }; - + keybindings = [ { key = "ctrl+[Period]"; command = "keyboard-quickfix.openQuickFix"; when = "editorHasCodeActionsProvider && editorTextFocus && !editorReadonly"; } - + { key = "alt+k"; command = "selectPrevSuggestion"; when = "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"; } - + { key = "alt+j"; command = "selectNextSuggestion"; when = "suggestWidgetMultipleSuggestions && suggestWidgetVisible && textInputFocus"; } - + { key = "alt+k"; command = "editor.action.moveLinesUpAction"; when = "editorTextFocus && !editorReadonly && !suggestWidgetVisible"; } - + { key = "alt+j"; command = "editor.action.moveLinesDownAction"; when = "editorTextFocus && !editorReadonly && !suggestWidgetVisible"; } - + { key = "alt+j"; command = "workbench.action.quickOpenNavigateNext"; when = "inQuickOpen"; } - + { key = "alt+k"; command = "workbench.action.quickOpenNavigatePrevious"; when = "inQuickOpen"; } - + { key = "alt+f"; command = "editor.action.formatDocument"; when = "editorTextFocus && !editorReadonly"; } - + { key = "alt+o"; command = "editor.action.insertLineAfter"; when = "textInputFocus && !editorReadonly"; } - + { key = "alt+shift+o"; command = "editor.action.insertLineBefore"; @@ -307,7 +307,7 @@ in # ms-vsliveshare.vsliveshare redhat.java wholroyd.jinja - bbenoist.Nix + bbenoist.nix # jock.svg vscodevim.vim haskell.haskell diff --git a/nixpkgs/programs/zathura.nix b/nixpkgs/programs/zathura.nix index 8c214a3..bba7591 100644 --- a/nixpkgs/programs/zathura.nix +++ b/nixpkgs/programs/zathura.nix @@ -4,18 +4,18 @@ enable = true; options = { selection-clipboard = "clipboard"; - + default-bg = "#f2e3bd"; - + completion-bg = "#f2e3bd"; completion-fg = "#5fd7a7"; - + statusbar-bg = "#f2e3bd"; statusbar-fg = "#008ec4"; - + inputbar-bg = "#f2e3bd"; inputbar-fg = "#c30771"; - + recolor = true; recolor-lightcolor = "#f2e3bd"; # recolor-darkcolor = "#000000"; diff --git a/nixpkgs/programs/zsh.nix b/nixpkgs/programs/zsh.nix index 35c348b..a772358 100644 --- a/nixpkgs/programs/zsh.nix +++ b/nixpkgs/programs/zsh.nix @@ -5,8 +5,16 @@ dotDir = ".config/zsh"; # enableSyntaxHighlighting = true; defaultKeymap = "viins"; - + plugins = [ + # { + # name = "nix-zsh-shell-integration"; + # src = pkgs.nix-zsh-shell-integration; + # } + { + name = "zsh-fast-syntax-highlighting"; + src = pkgs.zsh-fast-syntax-highlighting; + } { name = "zsh-completions"; src = pkgs.zsh-completions; @@ -30,12 +38,12 @@ # file = "p10k.zsh"; # } ]; - + localVariables = { POWERLEVEL9K_LEFT_PROMPT_ELEMENTS = ["dir" "vcs"]; # NIX_PATH = ''$HOME/.nix-defexpr/channels$\{NIX_PATH:+:}$NIX_PATH''; }; - + shellAliases = with pkgs; let sedColor = @@ -50,27 +58,28 @@ join = lib.strings.concatStringsSep " "; in { - + # This for some reason uses an outdated version of hm # hs = "${pkgs.home-manager}/bin/home-manager switch"; - + hms = "home-manager switch"; - nos = "sudo ${nixos-rebuild}/bin/nixos-rebuild switch"; + nxr = "sudo ${nixos-rebuild}/bin/nixos-rebuild switch"; + nxc = "sudoedit /etc/nixos/configuration.nix"; ns = "nix-shell"; # Having 'watch' with a space after as an alias, enables it to expand other aliases watch = "${procps}/bin/watch "; - + m = "${ncmpcpp}/bin/ncmpcpp"; p = "${python39Packages.ipython}/bin/ipython"; - + lls = "${coreutils}/bin/ls"; ls = "${exa}/bin/exa"; la = "${exa}/bin/exa -lah --changed --time-style long-iso --git --group"; lsa = "la"; killall = "echo \"killall is dangerous on non-gnu platforms. Using 'pkill -x'\"; pkill -x"; - + youtube-dl-list = join [ "${youtube-dl}/bin/youtube-dl" "-f \"bestvideo[ext=mp4]+bestaudio[e=m4a]/bestvideo+bestaudio\"" @@ -84,39 +93,41 @@ "-f \"bestaudio[ext=m4a]/best\"" "-o \"%(playlist_index)s-%(title)s.%(ext)s\"" ]; - + skusho = "${maim}/bin/maim --hidecursor --nokeyboard $(echo $SCREENSHOT_DIR)/$(date_%s).png"; skushoclip = shellPipe [ "${maim}/bin/maim --hidecursor --nokeyboard --select" "${xclip}/bin/xclip -selection clipboard -target image/png -in" ]; - + view-latex = "${texlive.combined.scheme-full}/bin/latexmk -pdf -pvc main.tex"; - + reload-tmux = "${tmux}/bin/tmux source $HOME/.config/tmux/tmux.conf"; - + ag="${ripgrep}/bin/rg"; - + dp = "${dropbox-cli}/bin/dropbox"; - + cd = "z"; - + ccp = "${coreutils}/bin/cp"; cp = "${rsync}/bin/rsync --progress --human-readable"; cpr = "${rsync}/bin/rsync --progress --human-readable --recursive"; - + ccat = "${coreutils}/bin/cat"; cat = "${bat}/bin/bat"; - + htop = "${bottom}/bin/bottom"; - + ps = "${procs}/bin/procs"; - + fin = "${fd}/bin/fd"; ip = "ip -c"; - + + regex-escapechars = "echo \"[\\^$.|?*+()\""; + connectedIps = shellPipe [ "netstat -tn 2>/dev/null" "grep :$1" @@ -145,9 +156,9 @@ "sed ${colorAliasNames} ${removeNixLinks}" "column -ts $'\\t'" ]; - - - ports = let + + + ports = let colorSlashes = colorRed "/" {middle = "/";}; colorFirstColumn = colorRed "(^[^ ]+)" {middle = "\\1";}; in @@ -159,7 +170,7 @@ "column -t" "sed -r ${colorFirstColumn} ${colorSlashes}" ]; - + } // (let @@ -182,9 +193,9 @@ nthCdsAsNameValuePairs = n: map (cmd: nameValuePair cmd (realCommand n)) (nthCds n); allCdNameValuePairs = (flatten (map nthCdsAsNameValuePairs (range 1 9))); - in - builtins.listToAttrs allCdNameValuePairs); - + in + lib.attrsets.listToAttrs allCdNameValuePairs); + initExtra = '' source ${config.home.homeDirectory}/${dotDir}/p10k.zsh ''; diff --git a/nixpkgs/secret/.gitignore b/nixpkgs/secret/.gitignore new file mode 100644 index 0000000..4af8d57 --- /dev/null +++ b/nixpkgs/secret/.gitignore @@ -0,0 +1,17 @@ + +# Ignore everything +* + +# Sincde it's not possible to re-include a file if a +# parent directory of that file is excluded, we need to +# reinclude all directories. +!/**/ + +# Root level exceptions +!/**/default.nix +!.gitignore +!update.sh +!README.md + +# Other exceptions +!ssh/hosts/pvv.nix diff --git a/nixpkgs/secret/README.md b/nixpkgs/secret/README.md new file mode 100644 index 0000000..5e05f5d --- /dev/null +++ b/nixpkgs/secret/README.md @@ -0,0 +1,36 @@ +# Secrets + + + +## Structure + + +``` +. +├── common +│ ├── browser-bookmarks.nix +│ └── browser-engines.nix +├── programs +│ ├── chromium +│ │ ├── bookmarks.nix +│ │ ├── default.nix +│ │ └── engines.nix +│ ├── newsboat +│ │ ├── default.nix +│ │ └── sources.nix +│ ├── qutebrowser +│ │ ├── bookmarks.nix +│ │ ├── default.nix +│ │ └── engines.nix +│ └── default.nix +├── ssh +│ └── hosts +│ ├── default.nix +│ ├── home.nix +│ ├── ntnu.nix +│ ├── pvv.nix +│ └── users.nix +├── default.nix +├── README.md +└── update.sh +``` diff --git a/nixpkgs/secret/default.nix b/nixpkgs/secret/default.nix new file mode 100644 index 0000000..c32f2a1 --- /dev/null +++ b/nixpkgs/secret/default.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + imports = [ + ./programs + ./ssh/hosts + ]; +} diff --git a/nixpkgs/secret/programs/chromium/default.nix b/nixpkgs/secret/programs/chromium/default.nix new file mode 100644 index 0000000..00bfafc --- /dev/null +++ b/nixpkgs/secret/programs/chromium/default.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + imports = [ + ./bookmarks.nix + ./engines.nix + ]; +} diff --git a/nixpkgs/secret/programs/default.nix b/nixpkgs/secret/programs/default.nix new file mode 100644 index 0000000..aac34ab --- /dev/null +++ b/nixpkgs/secret/programs/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + imports = [ + ./chromium + ./newsboat + ./qutebrowser + ]; +} diff --git a/nixpkgs/secret/programs/newsboat/default.nix b/nixpkgs/secret/programs/newsboat/default.nix new file mode 100644 index 0000000..cf263d9 --- /dev/null +++ b/nixpkgs/secret/programs/newsboat/default.nix @@ -0,0 +1,6 @@ +{ ... }: +{ + imports = [ + ./sources + ]; +} diff --git a/nixpkgs/secret/programs/qutebrowser/default.nix b/nixpkgs/secret/programs/qutebrowser/default.nix new file mode 100644 index 0000000..00bfafc --- /dev/null +++ b/nixpkgs/secret/programs/qutebrowser/default.nix @@ -0,0 +1,7 @@ +{ ... }: +{ + imports = [ + ./bookmarks.nix + ./engines.nix + ]; +} diff --git a/nixpkgs/secret/ssh/hosts/default.nix b/nixpkgs/secret/ssh/hosts/default.nix new file mode 100644 index 0000000..aa6b92a --- /dev/null +++ b/nixpkgs/secret/ssh/hosts/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + imports = [ + ./pvv.nix + ./ntnu.nix + ./home.nix + ]; +} diff --git a/nixpkgs/secret/ssh/hosts/pvv.nix b/nixpkgs/secret/ssh/hosts/pvv.nix new file mode 100644 index 0000000..68a2426 --- /dev/null +++ b/nixpkgs/secret/ssh/hosts/pvv.nix @@ -0,0 +1,100 @@ +{ lib, ... }: +let + users = import ./users.nix; + inherit (users.pvv) normalUser adminUser; + + # http://www.pvv.ntnu.no/pvv/Maskiner + normalMachines = [ + [ "hildring" "pvv-login" "pvv" ] + "demiurgen" + "eirin" + [ "jokum" "pvv-nix" ] + "isvegg" + [ "microbel" "pvv-users" "pvv-mail" ] + ]; + + rootMachines = [ + [ "knakelibrak" "pvv-databases" ] + [ "spikkjeposche" "pvv-web" "pvv-wiki" "pvv-webmail" ] + "sleipner" + "fenris" + "balduzius" + "joshua" + "skrotnisse" + "principal" + "tom" + "monty" + + { + names = ["dvask"]; + proxyJump = "monty"; + } + + [ "innovation" "pvv-minecraft" ] + ]; + + normalizeValueType = let + inherit (lib.strings) isString concatStringsSep; + inherit (lib.lists) isList; + inherit (lib.attrsets) filterAttrs; + in + machine: + if (isString machine) then (normalizeValueType [machine]) + else if (isList machine) then (normalizeValueType { names = machine; }) + else ({ name = concatStringsSep " " machine.names; } // (removeAttrs machine ["names"])); + + # TODO: Merge the following two functions. They have too much code in common. + convertNormalMachines = let + inherit (lib.trivial) pipe; + inherit (lib.attrsets) listToAttrs; + inherit (lib.lists) head; + inherit (lib.strings) split; + + convertNormalMachine = normalizedMachine: + rec { + inherit (normalizedMachine) name; + value = ({ + hostname = "${head (split " " name)}.pvv.org"; + user = normalUser; + } // removeAttrs normalizedMachine ["name"]); + }; + + pipeline = [ + (ms: map normalizeValueType ms) + (ms: map convertNormalMachine ms) + listToAttrs + ]; + in machines: pipe machines pipeline; + + convertAdminMachines = let + inherit (lib.trivial) pipe; + inherit (lib.attrsets) listToAttrs; + inherit (lib.lists) head; + inherit (lib.strings) split; + + convertAdminMachine = normalizedMachine: + rec { + inherit (normalizedMachine) name; + value = ({ + hostname = "${head (split " " name)}.pvv.org"; + user = adminUser; + proxyJump = "hildring"; + } // removeAttrs normalizedMachine ["name"]); + }; + + pipeline = [ + (ms: map normalizeValueType ms) + (ms: map convertAdminMachine ms) + listToAttrs + ]; + in machines: pipe machines pipeline; + +in + { + programs.ssh.matchBlocks = let + concatSets = lib.lists.foldl (s1: s2: s1 // s2) {}; + in concatSets [ + (convertNormalMachines normalMachines) + (convertAdminMachines rootMachines) + ]; + } diff --git a/nixpkgs/secret/update.sh b/nixpkgs/secret/update.sh new file mode 100755 index 0000000..c839548 --- /dev/null +++ b/nixpkgs/secret/update.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +perl -0777 -pi -e '$tree=`exa -I XX* --tree --group-directories-first`; s/\n```\n(?:.|\n)+```/\n```\n$tree```/' README.md diff --git a/nixpkgs/services/dunst.nix b/nixpkgs/services/dunst.nix new file mode 100644 index 0000000..9ebbe21 --- /dev/null +++ b/nixpkgs/services/dunst.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: +{ + services.dunst = { + enable = true; + iconTheme = { + package = pkgs.gnome.adwaita-icon-theme; + name = "Adwaita"; + size = "32x32"; + }; + settings = { + global = { + geometry = "300x5-30+50"; + transparency = 10; + frame_color = "#eceff1"; + font = "Droid Sans 9"; + }; + urgency_normal = { + background = "#37474f"; + foreground = "#eceff1"; + timeout = 10; + }; + }; + }; +} diff --git a/nixpkgs/services/mpd.nix b/nixpkgs/services/mpd.nix index 1391d2e..f206682 100644 --- a/nixpkgs/services/mpd.nix +++ b/nixpkgs/services/mpd.nix @@ -1,8 +1,10 @@ { config, ... }: -rec { - enable = true; - musicDirectory = "${config.services.dropbox.path}/music/music"; - # musicDirectory = "${config.home.homeDirectory}/music"; - playlistDirectory = "${musicDirectory}/playlists/MPD"; +{ + services.mpd = rec { + enable = true; + musicDirectory = "${config.services.dropbox.path}/music/music"; + # musicDirectory = "${config.home.homeDirectory}/music"; + playlistDirectory = "${musicDirectory}/playlists/MPD"; + }; } diff --git a/nixpkgs/services/picom.nix b/nixpkgs/services/picom.nix index 5ceb762..e98d59c 100644 --- a/nixpkgs/services/picom.nix +++ b/nixpkgs/services/picom.nix @@ -1,34 +1,37 @@ +{ ... }: { - enable = true; + services.picom = { + enable = true; - blur = true; - blurExclude = [ - "class_g = 'slop'" - "class_g = 'XAVA'" - "class_g = 'lattedock'" - "class_g = 'latte-dock'" - "window_type = 'dock'" - "window_type = 'desktop'" - "_GTK_FRAME_EXTENTS@:c" - ]; + blur = true; + blurExclude = [ + "class_g = 'slop'" + "class_g = 'XAVA'" + "class_g = 'lattedock'" + "class_g = 'latte-dock'" + "window_type = 'dock'" + "window_type = 'desktop'" + "_GTK_FRAME_EXTENTS@:c" + ]; - fade = true; - fadeSteps = [ "0.1" "0.1" ]; - fadeExclude = []; + fade = true; + fadeSteps = [ "0.1" "0.1" ]; + fadeExclude = []; - shadow = true; - shadowOffsets = [ (-7) (-7) ]; - shadowOpacity = "0.25"; - shadowExclude = [ - "class_g = 'XAVA'" - "class_g = 'stalonetray'" - "class_g = 'lattedock'" - "class_g = 'latte-dock'" - ]; - noDockShadow = true; - noDNDShadow = true; + shadow = true; + shadowOffsets = [ (-7) (-7) ]; + shadowOpacity = "0.25"; + shadowExclude = [ + "class_g = 'XAVA'" + "class_g = 'stalonetray'" + "class_g = 'lattedock'" + "class_g = 'latte-dock'" + ]; + noDockShadow = true; + noDNDShadow = true; - vSync = true; + vSync = true; - extraOptions = ''''; + extraOptions = ''''; + }; } diff --git a/nixpkgs/services/stalonetray.nix b/nixpkgs/services/stalonetray.nix index a458c8d..584abfb 100644 --- a/nixpkgs/services/stalonetray.nix +++ b/nixpkgs/services/stalonetray.nix @@ -1,21 +1,23 @@ { colorTheme, ... }: { - enable = true; - config = { - decorations = "none"; - transparent = false; - dockapp_mode = "none"; - geometry = "8x1-0+0"; - background = colorTheme.default.background; - kludges = "force_icons_size"; - grow_gravity = "NW"; - icon_gravity = "NW"; - icon_size = 30; - sticky = true; - window_type = "dock"; - window_layer = "bottom"; - no_shrink = true; - skip_taskbar = true; - slot_size = 40; + services.stalonetray = { + enable = true; + config = { + decorations = "none"; + transparent = false; + dockapp_mode = "none"; + geometry = "8x1-0+0"; + background = colorTheme.default.background; + kludges = "force_icons_size"; + grow_gravity = "NW"; + icon_gravity = "NW"; + icon_size = 30; + sticky = true; + window_type = "dock"; + window_layer = "bottom"; + no_shrink = true; + skip_taskbar = true; + slot_size = 40; + }; }; } diff --git a/nixpkgs/services/sxhkd.nix b/nixpkgs/services/sxhkd.nix index b03bcce..99aeb2a 100644 --- a/nixpkgs/services/sxhkd.nix +++ b/nixpkgs/services/sxhkd.nix @@ -1,77 +1,79 @@ { pkgs, ... }: { - enable = true; - keybindings = { - - # make sxhkd reload its configuration files: - "super + Escape" = "pkill -USR1 -x sxhkd && ${pkgs.libnotify}/bin/notify-send -t 3000 \"sxhkd configuration reloaded\""; - - # Applications - "super + w" = "${pkgs.emacs}/bin/emacs"; - - "super + e" = "$FILEBROWSER"; - - "super + s" = "$BROWSER"; - - "super + r" = "${pkgs.rofi}/bin/rofi -show drun"; - - # Volume - - "super + {@F7,@F8}" = "${pkgs.alsaUtils}/bin/amixer set Master 2%{-,+}"; - - "{XF86AudioLowerVolume,XF86AudioRaiseVolume}" = "${pkgs.alsaUtils}/bin/amixer set Master 2%{-,+}"; - - "XF86AudioMute" = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; - - # Music - - "super + p" = "${pkgs.mpc_cli}/bin/mpc toggle"; - - "XF86AudioPlay" = "${pkgs.mpc_cli}/bin/mpc toggle"; - "XF86AudioPrev" = "${pkgs.mpc_cli}/bin/mpc prev"; - "XF86AudioNext" = "${pkgs.mpc_cli}/bin/mpc next"; - - # Monitor - - "XF86MonBrightnessUp" = "${pkgs.light}/bin/light -A 5"; - "XF86MonBrightnessDown" = "${pkgs.light}/bin/light -U 5"; - - "@Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard --select | ${pkgs.xclip}/bin/xclip -selection clipboard -target image/png -in"; - - "shift + @Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard $SCREENSHOT_DIR/$(date +%s).png"; - - # TODO: Add boomer as package - # "super + @Print" = "boomer"; - - # Misc - - "super + a" = "${pkgs.copyq}/bin/copyq toggle"; - - # fcitx - "super + {b,n,m}" = "${pkgs.fcitx}/bin/fcitx-remote -s {mozc,fcitx-keyboard-no,fcitx-keyboard-us}"; - - # fcitx5 - # "super + {b,n,m}" = "${pkgs.fcitx5}/bin/fcitx5-remote -s {mozc,keyboard-no,keyboard-us}"; - - # TODO: fix - # "super + v" = "${pkgs.rofi}/bin/rofi -modi lpass:$HOME/.scripts/rofi/lpass/rofi-lpass -show lpass"; - - "super + minus" = "${pkgs.xcalib}/bin/xcalib -invert -alter"; - - # ¯\_(ツ)_/¯ - # "super + shift + s" - # sleep 0.3; \ - # ${pkgs.xdotool}/bin/xdotool key U00AF; \ - # ${pkgs.xdotool}/bin/xdotool key U005C; \ - # ${pkgs.xdotool}/bin/xdotool key U005F; \ - # ${pkgs.xdotool}/bin/xdotool key U0028; \ - # ${pkgs.xdotool}/bin/xdotool key U30C4; \ - # ${pkgs.xdotool}/bin/xdotool key U0029; \ - # ${pkgs.xdotool}/bin/xdotool key U005F; \ - # ${pkgs.xdotool}/bin/xdotool key U002F; \ - # ${pkgs.xdotool}/bin/xdotool key U00AF - - # é - "super + shift + e" = "sleep 0.3; ${pkgs.xdotool}/bin/xdotool key U00E9"; - }; + services.sxhkd = { + enable = true; + keybindings = { + + # make sxhkd reload its configuration files: + "super + Escape" = "pkill -USR1 -x sxhkd && ${pkgs.libnotify}/bin/notify-send -t 3000 \"sxhkd configuration reloaded\""; + + # Applications + "super + w" = "${pkgs.emacs}/bin/emacs"; + + "super + e" = "$FILEBROWSER"; + + "super + s" = "$BROWSER"; + + "super + r" = "${pkgs.rofi}/bin/rofi -show drun"; + + # Volume + + "super + {@F7,@F8}" = "${pkgs.alsaUtils}/bin/amixer set Master 2%{-,+}"; + + "{XF86AudioLowerVolume,XF86AudioRaiseVolume}" = "${pkgs.alsaUtils}/bin/amixer set Master 2%{-,+}"; + + "XF86AudioMute" = "${pkgs.pulseaudio}/bin/pactl set-sink-mute @DEFAULT_SINK@ toggle"; + + # Music + + "super + p" = "${pkgs.mpc_cli}/bin/mpc toggle"; + + "XF86AudioPlay" = "${pkgs.mpc_cli}/bin/mpc toggle"; + "XF86AudioPrev" = "${pkgs.mpc_cli}/bin/mpc prev"; + "XF86AudioNext" = "${pkgs.mpc_cli}/bin/mpc next"; + + # Monitor + + "XF86MonBrightnessUp" = "${pkgs.light}/bin/light -A 5"; + "XF86MonBrightnessDown" = "${pkgs.light}/bin/light -U 5"; + + "@Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard --select | ${pkgs.xclip}/bin/xclip -selection clipboard -target image/png -in"; + + "shift + @Print" = "${pkgs.maim}/bin/maim --hidecursor --nokeyboard $SCREENSHOT_DIR/$(date +%s).png"; + + # TODO: Add boomer as package + # "super + @Print" = "boomer"; + + # Misc + + "super + a" = "${pkgs.copyq}/bin/copyq toggle"; + + # fcitx + "super + {b,n,m}" = "${pkgs.fcitx}/bin/fcitx-remote -s {mozc,fcitx-keyboard-no,fcitx-keyboard-us}"; + + # fcitx5 + # "super + {b,n,m}" = "${pkgs.fcitx5}/bin/fcitx5-remote -s {mozc,keyboard-no,keyboard-us}"; + + # TODO: fix + # "super + v" = "${pkgs.rofi}/bin/rofi -modi lpass:$HOME/.scripts/rofi/lpass/rofi-lpass -show lpass"; + + "super + minus" = "${pkgs.xcalib}/bin/xcalib -invert -alter"; + + # ¯\_(ツ)_/¯ + # "super + shift + s" + # sleep 0.3; \ + # ${pkgs.xdotool}/bin/xdotool key U00AF; \ + # ${pkgs.xdotool}/bin/xdotool key U005C; \ + # ${pkgs.xdotool}/bin/xdotool key U005F; \ + # ${pkgs.xdotool}/bin/xdotool key U0028; \ + # ${pkgs.xdotool}/bin/xdotool key U30C4; \ + # ${pkgs.xdotool}/bin/xdotool key U0029; \ + # ${pkgs.xdotool}/bin/xdotool key U005F; \ + # ${pkgs.xdotool}/bin/xdotool key U002F; \ + # ${pkgs.xdotool}/bin/xdotool key U00AF + + # é + "super + shift + e" = "sleep 0.3; ${pkgs.xdotool}/bin/xdotool key U00E9"; + }; + }; }