From 4ee5d31fcfe3e27e4ab3fdbe91305848fd362e0b Mon Sep 17 00:00:00 2001 From: iiogama Date: Fri, 1 Mar 2024 19:20:02 -0800 Subject: [PATCH] Final commit before merge --- cores/base/default.nix | 153 +++++++------ cores/base/home.nix | 23 -- cores/cli/default.nix | 56 +---- cores/cli/home.nix | 60 ++---- cores/gui/default.nix | 154 +++++++------ flake.lock | 12 +- flake.nix | 1 + hosts/buckwheat/configuration.nix | 7 +- hosts/buckwheat/home.nix | 2 + modules/home-manager/bash.nix | 202 ++++++++++-------- modules/home-manager/foot.nix | 7 + modules/home-manager/gpg.nix | 7 + modules/home-manager/nb.nix | 30 +++ modules/home-manager/neovim.nix | 37 ++++ modules/home-manager/river.nix | 65 +++--- modules/home-manager/tmux.nix | 4 + modules/home-manager/waybar.nix | 29 +-- modules/home-manager/waybar.nix.bak | 77 ------- modules/nixos/browsers/default.nix | 2 + modules/nixos/defense/clamav.nix | 9 + .../defense/{default.nix => endlessh.nix} | 4 +- modules/nixos/defense/packages.nix | 7 + modules/nixos/media/default.nix | 9 + modules/nixos/office/default.nix | 3 + modules/nixos/office/samba.nix | 51 +++++ modules/nixos/virtualisation/default.nix | 1 - modules/packages/river-bsp-layout/result | 1 - todos/20240116194420.todo.md | 33 ++- 28 files changed, 549 insertions(+), 497 deletions(-) create mode 100644 modules/home-manager/gpg.nix create mode 100644 modules/home-manager/nb.nix create mode 100644 modules/home-manager/neovim.nix delete mode 100644 modules/home-manager/waybar.nix.bak create mode 100644 modules/nixos/defense/clamav.nix rename modules/nixos/defense/{default.nix => endlessh.nix} (90%) create mode 100644 modules/nixos/defense/packages.nix create mode 100644 modules/nixos/office/samba.nix delete mode 120000 modules/packages/river-bsp-layout/result diff --git a/cores/base/default.nix b/cores/base/default.nix index 403c26b..8148e16 100644 --- a/cores/base/default.nix +++ b/cores/base/default.nix @@ -1,6 +1,9 @@ # Base configuration.nix { config, lib, pkgs, inputs, user, ... }: { + boot = { + tmp.cleanOnBoot = true; + }; nix = { settings.auto-optimise-store = true; settings.allowed-users = [ "@wheel" ]; @@ -18,86 +21,8 @@ keep-derivations = true ''; }; - boot = { - tmp.cleanOnBoot = true; - }; nixpkgs.config.allowUnfree = true; networking.networkmanager.enable = true; - time.timeZone = "America/Los_Angeles"; - i18n.defaultLocale = "${user.locale}"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "${user.locale}"; - LC_IDENTIFICATION = "${user.locale}"; - LC_MEASUREMENT = "${user.locale}"; - LC_MONETARY = "${user.locale}"; - LC_NAME = "${user.locale}"; - LC_NUMERIC = "${user.locale}"; - LC_PAPER = "${user.locale}"; - LC_TELEPHONE = "${user.locale}"; - LC_TIME = "${user.locale}"; - }; - - services = { - cron = { - enable = true; - systemCronJobs = [ - # Clean logs older than 2d - "0 20 * * * root journalctl --vacuum-time=2d" - ]; - }; - openssh = { - enable = true; - settings = { - PasswordAuthentication = false; - KbdInteractiveAuthentication = false; - PermitRootLogin = "no"; - }; - allowSFTP = false; # Don't set this if you need sftp - extraConfig = '' - AllowTcpForwarding yes - X11Forwarding no - AllowAgentForwarding no - AllowStreamLocalForwarding no - AuthenticationMethods publickey - ''; - }; - }; - - # Define a user account. Don't forget to set a password with ‘passwd’ - users.users.${user.name} = { - isNormalUser = true; - extraGroups = [ "networkmanager" "wheel" ]; - initialPassword = "hunter2"; - packages = with pkgs; [ - bottom - eva - links2 - nix-du - nmap - ranger - ]; - }; - - programs = { - mtr.enable = true; - gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; - git = { - enable = true; - }; - neovim = { - enable = true; - defaultEditor = true; - viAlias = true; - vimAlias = true; - }; - tmux = { - enable = true; - }; - }; - environment = { defaultPackages = with pkgs; [ perl @@ -105,11 +30,79 @@ strace ]; systemPackages = with pkgs; [ + bottom curl + eva + ranger wget ]; }; - system = { - stateVersion = "23.11"; + programs.git = { + enable = true; + }; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + programs.mtr = { + enable = true; + }; + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + }; + programs.tmux = { + enable = true; + clock24 = true; + escapeTime = 250; + historyLimit = 8000; + keyMode = "vi"; + newSession = false; + terminal = "screen-256color"; + }; + services.cron = { + enable = true; + systemCronJobs = [ + # Clean logs older than 2d + "0 20 * * * root journalctl --vacuum-time=2d" + ]; + }; + services.openssh = { + enable = true; + settings = { + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + PermitRootLogin = "no"; + }; + allowSFTP = false; # Don't set this if you need sftp + extraConfig = '' + AllowTcpForwarding yes + X11Forwarding no + AllowAgentForwarding no + AllowStreamLocalForwarding no + AuthenticationMethods publickey + ''; + }; + users.users.${user.name} = { + isNormalUser = true; + extraGroups = [ "networkmanager" "wheel" ]; + initialPassword = "hunter2"; + }; + time.timeZone = "${user.timezone}"; + i18n = { + defaultLocale = "${user.locale}"; + extraLocaleSettings = { + LC_ADDRESS = "${user.locale}"; + LC_IDENTIFICATION = "${user.locale}"; + LC_MEASUREMENT = "${user.locale}"; + LC_MONETARY = "${user.locale}"; + LC_NAME = "${user.locale}"; + LC_NUMERIC = "${user.locale}"; + LC_PAPER = "${user.locale}"; + LC_TELEPHONE = "${user.locale}"; + LC_TIME = "${user.locale}"; + }; }; } diff --git a/cores/base/home.nix b/cores/base/home.nix index 93830d9..eb8490a 100644 --- a/cores/base/home.nix +++ b/cores/base/home.nix @@ -14,10 +14,6 @@ dataHome = "${config.home.homeDirectory}/.local/share"; stateHome = "${config.home.homeDirectory}/.local/state"; }; - programs.fzf = { - enable = true; - tmux.enableShellIntegration = true; - }; programs.git = { enable = true; userName = "${user.long}"; @@ -32,12 +28,6 @@ }; }; }; - programs.neovim = { - enable = true; - defaultEditor = true; - viAlias = true; - vimAlias = true; - }; programs.password-store = { enable = true; package = pkgs.pass.withExtensions (exts: [ exts.pass-otp exts.pass-import ]); @@ -46,17 +36,4 @@ PASSWORD_STORE_CLIP_TIME = "60"; }; }; - programs.tmux = { - enable = true; - baseIndex = 1; - clock24 = true; - escapeTime = 250; - historyLimit = 8000; - keyMode = "vi"; - mouse = false; - newSession = false; - prefix = "C-b"; - terminal = "screen-256color"; - }; - home.stateVersion = "23.11"; } diff --git a/cores/cli/default.nix b/cores/cli/default.nix index 2ad487c..649ddea 100644 --- a/cores/cli/default.nix +++ b/cores/cli/default.nix @@ -7,9 +7,8 @@ environment = { localBinInPath = true; variables = { - #MAILRC="$XDG_CONFIG_HOME/mail/mailrc" - #allowing environmental variable is needed for a mosh connection - LC_CTYPE = "en_US.UTF-8"; + # Environmental variable needed for mosh connections + LC_CTYPE = "${user.locale}"; }; }; services = { @@ -17,51 +16,6 @@ enable = true; mountOnMedia = true; }; - samba = { - enable = true; - # You will still need to set up the user accounts to begin with: - # $ sudo smbpasswd -a yourusername - # This adds to the [global] section: - extraConfig = '' - browseable = yes - smb encrypt = required - ''; - shares = { - homes = { - browseable = "no"; # note: each home will be browseable; the "homes" share will not. - "read only" = "no"; - "guest ok" = "no"; - }; - }; - }; - # mDNS - # This part may be optional for your needs, but I find it makes browsing in Dolphin easier, - # and it makes connecting from a local Mac possible. - avahi = { - enable = true; - nssmdns4 = true; - publish = { - enable = true; - addresses = true; - domain = true; - hinfo = true; - userServices = true; - workstation = true; - }; - extraServiceFiles = { - smb = '' - - - - %h - - _smb._tcp - 445 - - - ''; - }; - }; }; sound.enable = true; hardware.pulseaudio.enable = false; @@ -80,14 +34,16 @@ exiftool gpg-tui killall + links2 mediainfo nb + nix-du + nmap oed pdfgrep pinentry + ripgrep tmux-xpanes ueberzugpp - #Emacs - emacs-nox ]; } diff --git a/cores/cli/home.nix b/cores/cli/home.nix index a053d1f..d97bfac 100644 --- a/cores/cli/home.nix +++ b/cores/cli/home.nix @@ -27,49 +27,23 @@ videos = "${config.home.homeDirectory}/Videos"; }; }; - programs = { - go = { - goPath = "${config.xdg.dataHome}/go"; - }; - neovim = { - extraConfig = '' - syntax enable - set wrap - set nospell - set linebreak - set number - set relativenumber - set splitbelow - set splitright - set tabstop=4 - set shiftwidth=4 - if filereadable(expand(".vim-project")) - source .vim-project - endif - let g:limelight_conceal_ctermfg = 'block' - ''; - plugins = with pkgs.vimPlugins; [ - goyo-vim - limelight-vim - neorg - neorg-telescope - telescope-nvim - vim-numbertoggle - vim-nix - vimwiki - ]; - }; - yt-dlp = { - extraConfig = '' - --update - ''; - settings = { - embed-thumbnail = true; - embed-subs = true; - sub-langs = "all"; - downloader = "aria2c"; - downloader-args = "aria2c:'-c -x8 -s8 -k1M'"; - }; + programs.fzf = { + enable = true; + tmux.enableShellIntegration = true; + }; + programs.go = { + goPath = "${config.xdg.dataHome}/go"; + }; + programs.yt-dlp = { + extraConfig = '' + --update + ''; + settings = { + embed-thumbnail = true; + embed-subs = true; + sub-langs = "all"; + downloader = "aria2c"; + downloader-args = "aria2c:'-c -x8 -s8 -k1M'"; }; }; } diff --git a/cores/gui/default.nix b/cores/gui/default.nix index 52fb39f..2dcd10c 100644 --- a/cores/gui/default.nix +++ b/cores/gui/default.nix @@ -4,79 +4,22 @@ imports = [ ../cli ]; - environment = { - variables = { - BROWSER = "${user.browser}"; - TERMINAL = "${user.term}"; - VISUAL = "$EDITOR"; - }; - }; - xdg.mime = { - enable = true; - defaultApplications = { - "image/*" = [ - "imv.desktop" - ]; - "text/*" = [ - "${user.browser}.desktop" - ]; - "video/*" = [ - "mpv.desktop" - ]; - }; - }; - services = { - # To add the Flathub repo, run: - # $ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo - flatpak.enable = true; - dbus.enable = true; - seatd.enable = true; - }; - fonts.packages = with pkgs; [ - comic-mono - noto-fonts - noto-fonts-cjk - noto-fonts-emoji - fira-code - fira-code-symbols - dina-font - ]; - programs = { - dconf.enable = true; - river = { - enable = true; - extraPackages = with pkgs; [ - ]; - }; - }; - users.users.${user.name}.packages = with pkgs; [ - glib - ]; - environment.systemPackages = with pkgs; [ - bemenu - bemoji - cliphist - foot - grim - kanshi - libnotify - mako - networkmanagerapplet - slurp - swappy - swaylock - swww - tessen - waybar - wev - wf-recorder - wl-clipboard - wtype - xdg-utils - xdragon - ]; xdg = { autostart.enable = true; + mime = { + enable = true; + defaultApplications = { + "image/*" = [ + "imv.desktop" + ]; + "text/*" = [ + "${user.browser}.desktop" + ]; + "video/*" = [ + "mpv.desktop" + ]; + }; + }; portal = { enable = true; xdgOpenUsePortal = true; @@ -86,6 +29,75 @@ configPackages = [ pkgs.xdg-desktop-portal-wlr ]; + wlr = { + enable = true; + }; }; }; + environment = { + systemPackages = with pkgs; [ + libnotify + networkmanagerapplet + xdragon + xdg-utils + ]; + variables = { + BROWSER = "${user.browser}"; + TERMINAL = "${user.term}"; + VISUAL = "$EDITOR"; + }; + }; + fonts.packages = with pkgs; [ + comic-mono + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + fira-code + fira-code-symbols + fira-code-nerdfont + dina-font + ]; + programs.dconf = { + enable = true; + }; + programs.gnupg.agent = { + pinentryFlavor = "qt"; + }; + programs.river = { + enable = true; + extraPackages = with pkgs; [ + bemenu + bemoji + cliphist + foot + grim + kanshi + mako + pinentry-bemenu + river-tag-overlay + slurp + swappy + swaylock + swww + tessen + waybar + wev + wf-recorder + wl-clipboard + wtype + ]; + }; + # Run the following to add the Flathub repo: `flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo` + services.flatpak = { + enable = true; + }; + services.dbus = { + enable = true; + }; + services.seatd = { + enable = true; + }; + users.users.${user.name}.packages = with pkgs; [ + glib + ]; } diff --git a/flake.lock b/flake.lock index 18edf6e..5cafaf8 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1707683400, - "narHash": "sha256-Zc+J3UO1Xpx+NL8UB6woPHyttEy9cXXtm+0uWwzuYDc=", + "lastModified": 1708806879, + "narHash": "sha256-MSbxtF3RThI8ANs/G4o1zIqF5/XlShHvwjl9Ws0QAbI=", "owner": "nix-community", "repo": "home-manager", - "rev": "21b078306a2ab68748abf72650db313d646cf2ca", + "rev": "4ee704cb13a5a7645436f400b9acc89a67b9c08a", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1707689078, - "narHash": "sha256-UUGmRa84ZJHpGZ1WZEBEUOzaPOWG8LZ0yPg1pdDF/yM=", + "lastModified": 1708984720, + "narHash": "sha256-gJctErLbXx4QZBBbGp78PxtOOzsDaQ+yw1ylNQBuSUY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f9d39fb9aff0efee4a3d5f4a6d7c17701d38a1d8", + "rev": "13aff9b34cc32e59d35c62ac9356e4a41198a538", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index e42a303..396a730 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,7 @@ browser = "mullvad-browser"; term = "foot"; locale = "en_US.UTF-8"; + timezone = "America/Los_Angeles"; }; lib = nixpkgs.lib; in { diff --git a/hosts/buckwheat/configuration.nix b/hosts/buckwheat/configuration.nix index 86dc2ad..195941e 100644 --- a/hosts/buckwheat/configuration.nix +++ b/hosts/buckwheat/configuration.nix @@ -17,9 +17,6 @@ in wireless.enable = false; }; services = { - transmission = { - enable = true; - }; davfs2 = { enable = true; }; @@ -52,14 +49,16 @@ in }; }; users.users.${user.name} = { - extraGroups = [ "davfs2" "transmission" ]; + extraGroups = [ "davfs2" ]; packages = with pkgs; [ bitwarden btfs cava lavat + nushell python311Packages.eyeD3 tagutil ]; }; + system.stateVersion = "23.11"; } diff --git a/hosts/buckwheat/home.nix b/hosts/buckwheat/home.nix index dfc0963..4b2e4b5 100644 --- a/hosts/buckwheat/home.nix +++ b/hosts/buckwheat/home.nix @@ -6,6 +6,7 @@ ../../modules/home-manager/cava.nix ../../modules/home-manager/foot.nix ../../modules/home-manager/mako.nix + ../../modules/home-manager/neovim.nix ../../modules/home-manager/river.nix ../../modules/home-manager/senpai.nix ../../modules/home-manager/swappy.nix @@ -47,4 +48,5 @@ # }; #}; }; + home.stateVersion = "23.11"; } diff --git a/modules/home-manager/bash.nix b/modules/home-manager/bash.nix index 525aae3..24d3835 100644 --- a/modules/home-manager/bash.nix +++ b/modules/home-manager/bash.nix @@ -1,92 +1,124 @@ { pkgs, config, user, ... }: { - home = { - file = { - ".bash_login" = { - enable = true; - text = '' - [[ -f ~/.bashrc ]] && . ~/.bashrc - if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" -eq 1 ]; then - exec river + home.file = { + ".bash_login" = { + enable = true; + text = '' + [[ -f ~/.bashrc ]] && . ~/.bashrc + if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" -eq 1 ]; then + exec river + fi + ''; + }; + ".bash_logout" = { + enable = true; text = '' + if [ "$SHLVL" = 1 ]; then + [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q + fi + ''; + }; + ".bashrc" = { + enable = true; + text = '' + # Source global definitions + if [ -f /etc/bashrc ]; then + . /etc/bashrc + fi + set -o vi + unset HISTFILE + # Aliases + alias mkfoo='. $HOME/.local/bin/mkfoo.sh' + alias ed='ed -p "> "' + alias info='info --vi-keys' + # Functions + function ranstr() { + COUNT=$1 + head -c $COUNT /dev/random | base64 | head -c $COUNT + } + function get-ssh() { + if [ ! -f $HOME/.ssh/id_ed25519.pub ]; then + ssh-keygen -t ed25519 -C "${user.email}" fi - ''; - }; - ".bash_logout" = { - enable = true; - text = '' - if [ "$SHLVL" = 1 ]; then - [ -x /usr/bin/clear_console ] && /usr/bin/clear_console -q - fi - ''; - }; - ".bashrc" = { - enable = true; - text = '' - # Source global definitions - if [ -f /etc/bashrc ]; then - . /etc/bashrc - fi - set -o vi - unset HISTFILE - # Aliases - alias mkfoo='. $HOME/.local/bin/mkfoo.sh' - alias ed='ed -p "> "' - # Functions - function get-ssh() { - if [ ! -f $HOME/.ssh/id_ed25519.pub ]; then - ssh-keygen -t ed25519 -C "${user.email}" - fi - cat $HOME/.ssh/id_ed25519.pub - } - function home() { - cd - clear - } - function search() { - surfraw $(surfraw -elvi | fzf | awk '{print $1;}') - } - function mkcd { - mkdir -p $1 - cd $1 - } - - # fe [FUZZY PATTERN] - Open the selected file with the default editor - # - Bypass fuzzy finder if there's only one match (--select-1) - # - Exit if there's no match (--exit-0) - function fe() { - IFS=' - ' - files=$(fzf --query="$1" --multi --select-1 --exit-0) - [ -n "$files" ] && "$EDITOR" "$files" - } - - # Environmental Variables - # Uncomment the following line if you don't like systemctl's auto-paging feature: - export SYSTEMD_PAGER= - export PS1="\n\u@\h:\w (\j)\n$? \$ " - export LIBSEAT_BACKEND=logind - export BEMENU_OPTS="--fn 'Comic Mono 12'\ - --tb '#6272a4'\ - --tf '#f8f8f2'\ - --fb '#282a36'\ - --ff '#f8f8f2'\ - --nb '#282a36'\ - --nf '#6272a4'\ - --hb '#44475a'\ - --hf '#50fa7b'\ - --sb '#44475a'\ - --sf '#50fa7b'\ - --scb '#282a36'\ - --scf '#ff79c6'\ - --hp '10'\ - --binding 'vim'\ - --vim-esc-exits\ - --ignorecase\ - --no-overlap" + cat $HOME/.ssh/id_ed25519.pub + } + function home() { + cd + clear + } + function search() { + surfraw $(surfraw -elvi | fzf | awk '{print $1;}') + } + function mkcd { + mkdir -p $1 + cd $1 + } + + # fe [FUZZY PATTERN] - Open the selected file with the default editor + # - Bypass fuzzy finder if there's only one match (--select-1) + # - Exit if there's no match (--exit-0) + function fe() { + IFS=' + ' + files=$(fzf --query="$1" --multi --select-1 --exit-0) + [ -n "$files" ] && "$EDITOR" "$files" + } + + # Environmental Variables + # Uncomment the following line if you don't like systemctl's auto-paging feature: + export SYSTEMD_PAGER= + export PS1="\n\u@\h:\w (\j)\n$? \$ " + export INPUTRC="$XDG_CONFIG_HOME/inputrc" + export LIBSEAT_BACKEND=logind + export BEMENU_OPTS="--fn 'Comic Mono 12'\ + --tb '#6272a4'\ + --tf '#f8f8f2'\ + --fb '#282a36'\ + --ff '#f8f8f2'\ + --nb '#282a36'\ + --nf '#6272a4'\ + --hb '#44475a'\ + --hf '#50fa7b'\ + --sb '#44475a'\ + --sf '#50fa7b'\ + --scb '#282a36'\ + --scf '#ff79c6'\ + --hp '10'\ + --binding 'vim'\ + --vim-esc-exits\ + --ignorecase\ + --no-overlap" - eval "$(zoxide init bash)" - ''; - }; + eval "$(zoxide init bash)" + ''; + }; + }; + xdg.configFile = { + "inputrc" = { + enable = true; + executable = true; + text = '' + $include /etc/inputrc + set completion-ignore-case on + set completion-map-case on + set show-all-if-ambiguous on + set show-all-if-unmodified on + set completion-query-items 0 + set bell-style none + set blink-matching-paren on + set colored-completion-prefix on + set colored-stats on + set completion-prefix-display-length 5 + set menu-complete-display-prefix on + set horizontal-scroll-mode on + set mark-directories on + set skip-completed-text on + set visibile-stats on + $if Bash + set completion-map-case on + $end + "\t": menu-complete + "\e[Z": menu-complete-backward + ''; }; }; } diff --git a/modules/home-manager/foot.nix b/modules/home-manager/foot.nix index bc5441a..77865ff 100644 --- a/modules/home-manager/foot.nix +++ b/modules/home-manager/foot.nix @@ -30,6 +30,13 @@ selection-background = "44475a"; urls = "8be9fd"; }; + url = { + launch = "xdg-open $\{url\}"; + protocols = "http, https, ftp, ftps, file, gemini, gopher"; + }; + key-bindings = { + show-urls-copy = "Control+Shift+y"; + }; }; }; } diff --git a/modules/home-manager/gpg.nix b/modules/home-manager/gpg.nix new file mode 100644 index 0000000..fcf9f5b --- /dev/null +++ b/modules/home-manager/gpg.nix @@ -0,0 +1,7 @@ +{ pkgs, config, ... }: +{ + programs.gpg = { + enable = true; + homedir = "${config.xdg.dataHome}/gnupg"; + }; +} diff --git a/modules/home-manager/nb.nix b/modules/home-manager/nb.nix new file mode 100644 index 0000000..2b93362 --- /dev/null +++ b/modules/home-manager/nb.nix @@ -0,0 +1,30 @@ +{ pkgs, config, user, ... }: +{ + home = { + file = { + ".nbrc" = { + enable = true; + text = '' + #!/usr/bin/env bash + ############################################################################### + # .nbrc + # + # Configuration file for `nb`, a command line note-taking, bookmarking, + # and knowledge base application with encryption, search, Git-backed syncing, + # and more in a single portable script. + # + # Edit this file manually or manage settings using the `nb settings` + # subcommand. Configuration options are set as environment variables, eg: + # export NB_ENCRYPTION_TOOL=gpg + # + # https://github.com/xwmx/nb + ############################################################################### + + export NB_DIR="${NB_DIR:-/home/ii/Documents/notes}" # Set by `nb` • Fri Nov 3 10:12:09 PM PDT 2023 + + export NB_COLOR_THEME="${NB_COLOR_THEME:-unicorn}" # Set by `nb` • Sun Nov 5 04:21:55 PM PST 2023 + ''; + }; + }; + }; +} diff --git a/modules/home-manager/neovim.nix b/modules/home-manager/neovim.nix new file mode 100644 index 0000000..e1f954f --- /dev/null +++ b/modules/home-manager/neovim.nix @@ -0,0 +1,37 @@ +# CLI home.nix +{ config, lib, pkgs, inputs, user, ... }: +{ + programs.neovim = { + enable = true; + extraConfig = '' + syntax enable + set wrap + set nospell + set linebreak + set number + set relativenumber + set splitbelow + set splitright + set tabstop=4 + set shiftwidth=4 + let mapleader = " " + if filereadable(expand(".vim-project")) + source .vim-project + endif + let g:limelight_conceal_ctermfg = 'block' + nnoremap ff Telescope find_files + nnoremap fg Telescope live_grep + nnoremap fb Telescope buffers + nnoremap fh Telescope help_tags + ''; + plugins = with pkgs.vimPlugins; [ + goyo-vim + limelight-vim + plenary-nvim + telescope-nvim + vim-numbertoggle + vim-nix + vimwiki + ]; + }; +} diff --git a/modules/home-manager/river.nix b/modules/home-manager/river.nix index 4bfbf92..6b64304 100644 --- a/modules/home-manager/river.nix +++ b/modules/home-manager/river.nix @@ -14,8 +14,11 @@ LOCKSCREEN="swaylock" # Autostart + riverctl spawn "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river" + riverctl spawn "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river" riverctl spawn "kanshi" riverctl spawn "waybar" + riverctl spawn "river-tag-overlay --border-width 0 --square-inactive-background-colour "0x282A36" --square-inactive-border-colour "0x282A36" --square-padding 0 --square-inner-padding 4 --square-size 18 --anchors 1:0:0:1 --timeout 2000" riverctl spawn "mako" riverctl spawn "wl-paste --type text --watch cliphist store" riverctl spawn "wl-paste --type image --watch cliphist store" @@ -41,9 +44,11 @@ riverctl map normal Super L focus-view next riverctl map normal Alt Tab focus-view next riverctl map normal Alt+Shift Tab focus-view previous - riverctl map normal Super Tab spawn "riverctl focus-previous-tags; notify-send '$tags tag focused';" - riverctl map normal Super Bracketleft focus-output previous - riverctl map normal Super Bracketright focus-output next + riverctl map normal Super P focus-previous-tags + riverctl map normal Super Tab focus-output next + + riverctl map normal Super U focus-output next + riverctl map normal Super+Shift U send-to-output next # Move Controls riverctl map normal Super+Shift H swap previous @@ -51,9 +56,8 @@ riverctl map normal Super+Shift K swap previous riverctl map normal Super+Shift L swap next riverctl map normal Super+Shift Space zoom - riverctl map normal Super+Shift Tab spawn "riverctl send-to-previous-tags; notify-send '$tags tag applied';" - riverctl map normal Super+Shift Bracketleft send-to-output previous - riverctl map normal Super+Shift Bracketright send-to-output next + riverctl map normal Super+Shift P send-to-previous-tags + riverctl map normal Super+Shift Tab send-to-output next # Layout Controls riverctl map normal Super+Alt H send-layout-cmd rivertile "main-ratio -0.05" @@ -66,7 +70,7 @@ riverctl map normal Super Left send-layout-cmd rivertile "main-location left" # Floating Controls - riverctl map normal Super F toggle-float + riverctl map normal Super+Shift F toggle-float riverctl map normal Super+Control H move left 100 riverctl map normal Super+Control J move down 100 riverctl map normal Super+Control K move up 100 @@ -93,38 +97,54 @@ tags=$((1 << ($i - 1))) # Super+[1-9] to focus tag [0-8] - riverctl map normal Super $i spawn "riverctl set-focused-tags $tags; notify-send '$tags tag focused';" + riverctl map normal Super $i spawn "riverctl set-focused-tags $tags" # Super+Shift+[1-9] to tag focused view with tag [0-8] - riverctl map normal Super+Shift $i spawn "riverctl set-view-tags $tags; notify-send '$tags tag applied';" + riverctl map normal Super+Shift $i spawn "riverctl set-view-tags $tags" # Super+Control+[1-9] to toggle focus of tag [0-8] - riverctl map normal Super+Control $i spawn "riverctl toggle-focused-tags $tags; notify-send 'Tag $tags toggled';" + riverctl map normal Super+Control $i spawn "riverctl toggle-focused-tags $tags" # Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view - riverctl map normal Super+Shift+Control $i spawn "riverctl toggle-view-tags $tags; notiy-send 'Tag $tags assignment toggle';" + riverctl map normal Super+Shift+Control $i spawn "riverctl toggle-view-tags $tags" done + MINIMIZED=$((1 << 20 )) + riverctl map normal Super M toggle-focused-tags ''${MINIMIZED} + riverctl map normal Super+Shift M set-view-tags ''${MINIMIZED} + ALL_BUT_MINIMIZED=$(( ((1 << 32) - 1 ) ^ $MINIMIZED )) + riverctl spawn-tagmask ''${ALL_BUT_MINIMIZED} # Super+0 to focus all tags # Super+Shift+0 to tag focused view with all tags all_tags=$(((1 << 32) - 1)) - riverctl map normal Super 0 spawn "riverctl set-focused-tags $all_tags; notify-send 'All tags focus toggle';" - riverctl map normal Super+Shift 0 spawn "riverctl set-view-tags $all_tags; notify-send 'All tags assignment toggle';" + riverctl map normal Super 0 spawn "riverctl set-focused-tags $all_tags" + riverctl map normal Super+Shift 0 spawn "riverctl set-view-tags $all_tags" # Toggle fullscreen riverctl map normal None F11 toggle-fullscreen - riverctl map normal Super Z toggle-fullscreen + riverctl map normal Super F toggle-fullscreen - # Declare a passthrough mode. This mode has only a single mapping to return to - # normal mode. This makes it useful for testing a nested wayland compositor + # Passthrough Mode riverctl declare-mode passthrough - - # Super+F11 to enter passthrough mode riverctl map normal Super F11 enter-mode passthrough - - # Super+F11 to return to normal mode riverctl map passthrough Super F11 enter-mode normal + # Command Mode + riverctl declare-mode command + riverctl map normal Super B enter-mode command + riverctl map command None+Shift Comma spawn 'playerctl previous' + riverctl map command None Space spawn 'playerctl play-pause' + riverctl map command None+Shift Period spawn 'playerctl next' + riverctl map command None 1 spawn 'mullvad-browser' + riverctl map command None 2 spawn 'librewolf' + riverctl map command None 3 spawn 'libreoffice' + riverctl map command None 4 spawn 'thunderbird' + riverctl map command None 5 spawn 'discord' + riverctl map command None 6 spawn 'signal-desktop' + riverctl map command None 9 spawn 'steam' + riverctl map command None Z spawn 'riverctl toggle-fullscreen; riverctl enter-mode normal' + riverctl map command None Escape enter-mode normal + # Various media key mapping examples for both normal and locked mode which do # not have a modifier for mode in normal locked @@ -146,11 +166,6 @@ riverctl map $mode None XF86MonBrightnessUp spawn 'light -A 5' riverctl map $mode None XF86MonBrightnessDown spawn 'light -U 5' done - MINIMIZED=$((1 << 20 )) - riverctl map normal Super M toggle-focused-tags ''${MINIMIZED} - riverctl map normal Super+Shift M set-view-tags ''${MINIMIZED} - ALL_BUT_MINIMIZED=$(( ((1 << 32) - 1 ) ^ $MINIMIZED )) - riverctl spawn-tagmask ''${ALL_BUT_MINIMIZED} # Set keyboard repeat rate riverctl set-repeat 50 300 diff --git a/modules/home-manager/tmux.nix b/modules/home-manager/tmux.nix index c1ea896..3363b0b 100644 --- a/modules/home-manager/tmux.nix +++ b/modules/home-manager/tmux.nix @@ -1,6 +1,10 @@ { pkgs, config, ... }: { programs.tmux = { + enable = true; + baseIndex = 1; + prefix = "C-b"; + mouse = false; extraConfig = '' # Do not rename windows automatically set-option -g allow-rename off diff --git a/modules/home-manager/waybar.nix b/modules/home-manager/waybar.nix index 4286c57..2122245 100644 --- a/modules/home-manager/waybar.nix +++ b/modules/home-manager/waybar.nix @@ -10,10 +10,8 @@ "position": "top", "height": 20, "fixed-center": false, - "modules-left": [ - "river/mode" - ], "modules-right": [ + "tray", "clock" ], "clock": { @@ -21,7 +19,13 @@ "tooltip-format": "{:%Y %B}\n{calendar}", "format-alt": "{:%Y-%m-%d}", "interval": 1 - } + }, + "tray": { + "icon-size": 16, + "spacing": 4, + "show-passive-items": true, + "reverse-direction": true + } }, { "exclusive": false, @@ -29,21 +33,8 @@ "height": 20, "fixed-center": false, "modules-left": [ - "user" - ], - "modules-right": [ - "tray" - ], - "user": { - "format": "{work_d}:{work_H}:{work_M}", - "interval": 1 - }, - "tray": { - "icon-size": 16, - "spacing": 4, - "show-passive-items": true, - "reverse-direction": true - } + "river/mode" + ] }] ''; }; diff --git a/modules/home-manager/waybar.nix.bak b/modules/home-manager/waybar.nix.bak deleted file mode 100644 index 49d7f67..0000000 --- a/modules/home-manager/waybar.nix.bak +++ /dev/null @@ -1,77 +0,0 @@ -{ pkgs, config, ... }: -{ - programs.waybar = { - enable = true; - settings = [{ - topBar = { - exclusive = false; - position = "top"; - height = 22; - spacing = 16; - modules-left = [ "user" ]; - modules-right = [ "clock" ]; - "user" = { - format = "{work_d}:{work_H}:{work_M}:{work_S}"; - interval = 1; - }; - "clock" = { - format = "{:%H:%M:%S}"; - tooltip-format = "{:%Y %B}\n{calendar}"; - format-alt = "{:%Y-%m-%d}"; - interval = 1; - }; - }; - bottomBar = { - exclusive = false; - position = "bottom"; - height = 22; - spacing = 16; - fixed-center = false; - modules-left = [ "river/mode" ]; - modules-right = [ "tray" ]; - "tray" = { - icon-size = 18; - spacing = 4; - }; - }; - }]; - style = '' - * { - background: transparent; - color: #F2F2F8; - } - #user { - background: #282A36; - border-style: solid; - border-bottom-right-radius: 5px; - border-width: 0 2 2 0; - border-color: #BD93F9; - padding: 0 8 0 8; - } - #clock { - background: #282A36; - border-style: solid; - border-bottom-left-radius: 5px; - border-width: 0 0 2 2; - border-color: #BD93F9; - padding: 0 8 0 8; - } - #mode { - background: #282A36; - border-style: solid; - border-top-right-radius: 5px; - border-width: 2 2 0 0; - border-color: #BD93F9; - padding: 0 8 0 8; - } - #tray { - background: #282A36; - border-style: solid; - border-top-left-radius: 5px; - border-width: 2 0 0 2; - border-color: #BD93F9; - padding: 0 4 0 8; - } - ''; - }; -} diff --git a/modules/nixos/browsers/default.nix b/modules/nixos/browsers/default.nix index cb7a702..0ad0511 100644 --- a/modules/nixos/browsers/default.nix +++ b/modules/nixos/browsers/default.nix @@ -4,10 +4,12 @@ users.users.${user.name}.packages = with pkgs; [ lagrange librewolf + luakit mullvad-browser offpunk #onionshare-gui surfraw tor-browser-bundle-bin + xurls ]; } diff --git a/modules/nixos/defense/clamav.nix b/modules/nixos/defense/clamav.nix new file mode 100644 index 0000000..dd65c3a --- /dev/null +++ b/modules/nixos/defense/clamav.nix @@ -0,0 +1,9 @@ +# ClamAV Nixos Configuration +{ config, lib, pkgs, ... }: +{ + services.clamav = { + daemon.enable = true; + daemon.settings = { + }; + }; +} diff --git a/modules/nixos/defense/default.nix b/modules/nixos/defense/endlessh.nix similarity index 90% rename from modules/nixos/defense/default.nix rename to modules/nixos/defense/endlessh.nix index 94bc70c..a1c974f 100644 --- a/modules/nixos/defense/default.nix +++ b/modules/nixos/defense/endlessh.nix @@ -1,5 +1,5 @@ -# All configuration.nix -{ config, lib, pkgs, inputs, user, ... }: +# Enlessh Nixos Configuration +{ config, lib, pkgs, ... }: { services = { openssh = { diff --git a/modules/nixos/defense/packages.nix b/modules/nixos/defense/packages.nix new file mode 100644 index 0000000..c3286e7 --- /dev/null +++ b/modules/nixos/defense/packages.nix @@ -0,0 +1,7 @@ +# Defense Packages Configuration +{ config, lib, pkgs, ... }: +{ + users.users.${user.name}.packages = with pkgs; [ + lynis + ]; +} diff --git a/modules/nixos/media/default.nix b/modules/nixos/media/default.nix index 448b537..430fd58 100644 --- a/modules/nixos/media/default.nix +++ b/modules/nixos/media/default.nix @@ -9,7 +9,16 @@ imv mangal mpv + playerctl yt-dlp ytfzf ]; + nixpkgs.overlays = [ + (self: super: { + mpv = super.mpv.override { + scripts = [ self.mpvScripts.mpris ]; + #scripts = [ self.mpvScripts.visualizer ]; + }; + }) + ]; } diff --git a/modules/nixos/office/default.nix b/modules/nixos/office/default.nix index 3652571..3204540 100644 --- a/modules/nixos/office/default.nix +++ b/modules/nixos/office/default.nix @@ -1,6 +1,9 @@ # Office packages configuration.nix { config, lib, pkgs, inputs, user, ... }: { + imports = [ + ./samba.nix + ]; users.users.${user.name}.packages = with pkgs; [ ledger libreoffice diff --git a/modules/nixos/office/samba.nix b/modules/nixos/office/samba.nix new file mode 100644 index 0000000..f245360 --- /dev/null +++ b/modules/nixos/office/samba.nix @@ -0,0 +1,51 @@ +# SMB configuration +{ config, lib, pkgs, inputs, user, ... }: +{ + services = { + samba = { + enable = true; + # You will still need to set up the user accounts to begin with: + # $ sudo smbpasswd -a yourusername + # This adds to the [global] section: + extraConfig = '' + browseable = yes + smb encrypt = required + ''; + shares = { + homes = { + browseable = "no"; # note: each home will be browseable; the "homes" share will not. + "read only" = "no"; + "guest ok" = "no"; + }; + }; + }; + # mDNS + # This part may be optional for your needs, but I find it makes browsing in Dolphin easier, + # and it makes connecting from a local Mac possible. + avahi = { + enable = true; + nssmdns4 = true; + publish = { + enable = true; + addresses = true; + domain = true; + hinfo = true; + userServices = true; + workstation = true; + }; + extraServiceFiles = { + smb = '' + + + + %h + + _smb._tcp + 445 + + + ''; + }; + }; + }; +} diff --git a/modules/nixos/virtualisation/default.nix b/modules/nixos/virtualisation/default.nix index 3c81697..9a8a7f8 100644 --- a/modules/nixos/virtualisation/default.nix +++ b/modules/nixos/virtualisation/default.nix @@ -9,7 +9,6 @@ systemPackages = with pkgs; [ nixos-shell quickemu - quickgui virtiofsd ]; }; diff --git a/modules/packages/river-bsp-layout/result b/modules/packages/river-bsp-layout/result deleted file mode 120000 index 67fe8f7..0000000 --- a/modules/packages/river-bsp-layout/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/gyd032m3q6hlsvpy6ax5kyim0ps1hal3-river-bsp-layout-1.1.1 \ No newline at end of file diff --git a/todos/20240116194420.todo.md b/todos/20240116194420.todo.md index 4787240..5aff354 100644 --- a/todos/20240116194420.todo.md +++ b/todos/20240116194420.todo.md @@ -1,12 +1,25 @@ -# [ ] Web Services +# [ ] Web Services Wishlist -soju/senpai -jellyfin -bitwarden -searx -miniflux -ssh -http -gemini -gopher +## Services +- https:// + - Git + - Blog + - Wiki + - Files + - Icecast + - Miniflux + - Bitwarden + - Jellyfin + - Searx + - Fediverse +- gemini:// +- gopher:// +- ircs:// + - soju/senpai +- ssh:// +- rtmp:// +- Borg backups +- SMB shares +- Tor relay +- Firewall