diff options
Diffstat (limited to 'profiles')
| -rw-r--r-- | profiles/core/home.nix | 209 | ||||
| -rw-r--r-- | profiles/core/neovim.nix | 6 | ||||
| -rw-r--r-- | profiles/homeserver/transmission.nix | 105 | ||||
| -rw-r--r-- | profiles/vmware-guest.nix | 88 |
4 files changed, 239 insertions, 169 deletions
diff --git a/profiles/core/home.nix b/profiles/core/home.nix index f3a2500..7aed1db 100644 --- a/profiles/core/home.nix +++ b/profiles/core/home.nix @@ -4,7 +4,8 @@ config, pkgs, ... -}: with lib; { +}: +with lib; { programs.tmux = { enable = true; extraConfig = '' @@ -58,35 +59,68 @@ mimeApps = optionalAttrs (!machine.isDarwin) { enable = true; defaultApplications = { - "text/x-shellscript" = ["text.desktop"]; - "application/x-bittorrent" = ["torrent.desktop"]; - "text/plain" = ["text.desktop"]; - "application/postscript" = ["pdf.desktop"]; - "application/pdf" = ["pdf.desktop"]; - "image/png" = ["img.desktop"]; - "image/jpeg" = ["img.desktop"]; - "image/gif" = ["img.desktop"]; - "application/rss+xml" = ["rss.desktop"]; - "video/x-matroska" = ["video.desktop"]; - "video/mp4" = ["video.desktop"]; - "x-scheme-handler/lbry" = ["lbry.desktop"]; - "inode/directory" = ["file.desktop"]; - "application/x-ica" = ["wfica.desktop"]; - "x-scheme-handler/magnet" = ["torrent.desktop"]; - "x-scheme-handler/mailto" = ["mail.desktop"]; - "x-scheme-handler/msteams" = ["teams.desktop"]; + "text/x-shellscript" = ["text.desktop"]; + "application/x-bittorrent" = ["torrent.desktop"]; + "text/plain" = ["text.desktop"]; + "application/postscript" = ["pdf.desktop"]; + "application/pdf" = ["pdf.desktop"]; + "image/png" = ["img.desktop"]; + "image/jpeg" = ["img.desktop"]; + "image/gif" = ["img.desktop"]; + "application/rss+xml" = ["rss.desktop"]; + "video/x-matroska" = ["video.desktop"]; + "video/mp4" = ["video.desktop"]; + "x-scheme-handler/lbry" = ["lbry.desktop"]; + "inode/directory" = ["file.desktop"]; + "application/x-ica" = ["wfica.desktop"]; + "x-scheme-handler/magnet" = ["torrent.desktop"]; + "x-scheme-handler/mailto" = ["mail.desktop"]; + "x-scheme-handler/msteams" = ["teams.desktop"]; }; }; - desktopEntries = with pkgs; optionalAttrs (!machine.isDarwin) { - text = { type = "Application"; name = "Text editor"; exec = "${st}/bin/st -e nvim %u"; }; - file = { type = "Application"; name = "File Manager"; exec = "${st}/bin/st -e lfub %u"; }; - torrent = { type = "Application"; name = "Torrent"; exec = "${coreutils}/bin/env transadd %U"; }; - img = { type = "Application"; name = "Image Viewer"; exec = "${sxiv}/bin/sxiv -a %u"; }; - video = { type = "Application"; name = "Video Viewer"; exec = "${mpv}/bin/mpv -quiet %f"; }; - mail = { type = "Application"; name = "Mail"; exec = "${st}/bin/st -e neomutt %u"; }; - pdf = { type = "Application"; name = "PDF reader"; exec = "${zathura}/bin/zathura %u"; }; - rss = { type = "Application"; name = "RSS feed addition"; exec = "${coreutils}/bin/env rssadd %u"; }; - }; + desktopEntries = with pkgs; + optionalAttrs (!machine.isDarwin) { + text = { + type = "Application"; + name = "Text editor"; + exec = "${st}/bin/st -e nvim %u"; + }; + file = { + type = "Application"; + name = "File Manager"; + exec = "${st}/bin/st -e lfub %u"; + }; + torrent = { + type = "Application"; + name = "Torrent"; + exec = "${coreutils}/bin/env transadd %U"; + }; + img = { + type = "Application"; + name = "Image Viewer"; + exec = "${sxiv}/bin/sxiv -a %u"; + }; + video = { + type = "Application"; + name = "Video Viewer"; + exec = "${mpv}/bin/mpv -quiet %f"; + }; + mail = { + type = "Application"; + name = "Mail"; + exec = "${st}/bin/st -e neomutt %u"; + }; + pdf = { + type = "Application"; + name = "PDF reader"; + exec = "${zathura}/bin/zathura %u"; + }; + rss = { + type = "Application"; + name = "RSS feed addition"; + exec = "${coreutils}/bin/env rssadd %u"; + }; + }; }; # programs.ssh = { @@ -111,17 +145,17 @@ programs.readline = { enable = true; extraConfig = '' - $if mode=vi + $if mode=vi - set keymap vi-command - # these are for vi-command mode - Control-l: clear-screen + set keymap vi-command + # these are for vi-command mode + Control-l: clear-screen - set keymap vi-insert - # these are for vi-insert mode - Control-l: clear-screen - $endif - ''; + set keymap vi-insert + # these are for vi-insert mode + Control-l: clear-screen + $endif + ''; }; programs = { @@ -161,6 +195,12 @@ echo "Pnsh exited badly :(" } fi + export MANPAGER='nvim +Man!' + export EDITOR="nvim" + export TERMINAL="st" + export PATH="''${KREW_ROOT:-$HOME/.krew}/bin:$PATH" + export PASSWORD_STORE_GPG_OPTS='--no-throw-keyids' + export GNUPGHOME="''${HOME}/.gnupg" export LOCALE_ARCHIVE_2_27="/nix/store/l8hm9q8ndlg2rvav47y7549llh6npznf-glibc-locales-2.39-52/lib/locale/locale-archive" export PASSWORD_STORE_DIR="''${HOME}/sync/password-store" @@ -168,6 +208,9 @@ export XDG_CONFIG_HOME="''${HOME}/.config" export XDG_DATA_HOME="''${HOME}/.local/share" export XDG_STATE_HOME="''${HOME}/.local/state" + export PATH="$PATH:$HOME/.local/bin:/opt/homebrew/bin:${config.my.home}/.krew/bin:${config.my.home}/.cargo/bin:${pkgs.ncurses}/bin" + export STARSHIP_CONFIG="''${HOME}/.config/starship.toml" + command -v nu >/dev/null 2>&1 && exec nu --login # Use vim keys in tab complete menu: export ZLE_REMOVE_SUFFIX_CHARS=$' ,=\t\n;&|/@' @@ -178,7 +221,6 @@ bindkey -M menuselect 'j' vi-down-line-or-history set -o emacs - # Use lf to switch directories and bind it to ctrl-o lfcd () { tmp="$(mktemp -uq)" @@ -316,11 +358,6 @@ } export ZLE_REMOVE_SUFFIX_CHARS=$' ,=\t\n;&|/@' - export MANPAGER='nvim +Man!' - export EDITOR="nvim" - export TERMINAL="st" - export PATH="''${KREW_ROOT:-$HOME/.krew}/bin:$PATH" - export PASSWORD_STORE_GPG_OPTS='--no-throw-keyids' # Workarounds for completion here... command -v zoxide >/dev/null 2>&1 && eval "$(zoxide init zsh)" @@ -339,8 +376,6 @@ [[ -f ~/.cache/wal/sequences ]] && (cat ~/.cache/wal/sequences &) unset LD_PRELOAD - export PATH="$PATH:$HOME/.local/bin:/opt/homebrew/bin:${config.my.home}/.krew/bin:${config.my.home}/.cargo/bin:${pkgs.ncurses}/bin" - alias g="git " alias t="terraform " alias c="xclip -f | xclip -sel c -f " @@ -348,7 +383,11 @@ alias k="kubectl " alias d="docker " alias l="ls --color=auto" - alias s="${if machine.isDarwin then "sudo darwin-rebuild switch --flake ~/nix-config" else "sudo nixos-rebuild switch --flake /nix-config"}" + alias s="${ + if machine.isDarwin + then "sudo darwin-rebuild switch --flake ~/nix-config" + else "sudo nixos-rebuild switch --flake /nix-config" + }" alias b="/run/current-system/bin/switch-to-configuration boot" alias v="vi " alias e="vi " @@ -365,45 +404,49 @@ bash = { enable = false; bashrcExtra = '' - export EDITOR="nvim" - export TERMINAL="st" - ( command -v brew ) &>/dev/null && eval "$(/opt/homebrew/bin/brew shellenv)" - ( command -v docker ) &>/dev/null && eval "$(docker completion bash)" - ( command -v kubectl ) &>/dev/null && eval "$(kubectl completion bash)" - ( command -v zoxide ) &>/dev/null && eval "$(zoxide init bash)" - export PATH="$PATH:$HOME/.local/bin:/opt/homebrew/bin:${config.my.home}/.krew/bin:${config.my.home}/.cargo/bin:${pkgs.ncurses}/bin" - [[ -f ~/.cache/wal/sequences ]] && (cat ~/.cache/wal/sequences &) - unset LD_PRELOAD - # include nix.sh if it exists - - export COLORTERM=truecolor - export GPG_TTY="$(tty)" - gpgconf --launch gpg-agent - - if [ ! -S ~/.ssh/ssh_auth_sock ]; then - eval `ssh-agent` - ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock - fi - export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock - ssh-add -l > /dev/null || ssh-add ~/.ssh/id_ed25519_sk - ''; + export EDITOR="nvim" + export TERMINAL="st" + ( command -v brew ) &>/dev/null && eval "$(/opt/homebrew/bin/brew shellenv)" + ( command -v docker ) &>/dev/null && eval "$(docker completion bash)" + ( command -v kubectl ) &>/dev/null && eval "$(kubectl completion bash)" + ( command -v zoxide ) &>/dev/null && eval "$(zoxide init bash)" + export PATH="$PATH:$HOME/.local/bin:/opt/homebrew/bin:${config.my.home}/.krew/bin:${config.my.home}/.cargo/bin:${pkgs.ncurses}/bin" + [[ -f ~/.cache/wal/sequences ]] && (cat ~/.cache/wal/sequences &) + unset LD_PRELOAD + # include nix.sh if it exists + + export COLORTERM=truecolor + export GPG_TTY="$(tty)" + gpgconf --launch gpg-agent + + if [ ! -S ~/.ssh/ssh_auth_sock ]; then + eval `ssh-agent` + ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock + fi + export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock + ssh-add -l > /dev/null || ssh-add ~/.ssh/id_ed25519_sk + ''; shellAliases = { - k9s = "k9s "; - k = "kubectl "; - d = "docker "; - ls = "ls --color=auto"; - s = "${if machine.isDarwin then "darwin-rebuild" else "sudo nixos-rebuild"} switch --flake ${config.my.home}/flake#${config.networking.hostName}"; - b = "/run/current-system/bin/switch-to-configuration boot"; - v = "nvim"; - M = "xrandr --output HDMI1 --auto --output eDP1 --off"; - m = "xrandr --output eDP1 --auto --output HDMI1 --off"; - mM = "xrandr --output eDP1 --auto --output HDMI1 --off"; - newflake = "nix flake new -t ~/flake "; + k9s = "k9s "; + k = "kubectl "; + d = "docker "; + ls = "ls --color=auto"; + s = "${ + if machine.isDarwin + then "darwin-rebuild" + else "sudo nixos-rebuild" + } switch --flake ${config.my.home}/flake#${config.networking.hostName}"; + b = "/run/current-system/bin/switch-to-configuration boot"; + v = "nvim"; + M = "xrandr --output HDMI1 --auto --output eDP1 --off"; + m = "xrandr --output eDP1 --auto --output HDMI1 --off"; + mM = "xrandr --output eDP1 --auto --output HDMI1 --off"; + newflake = "nix flake new -t ~/flake "; ansible-flake = "nix flake new -t ~/flake#ansible "; - go-flake = "nix flake new -t ~/flake#go "; - lock-pass = "gpgconf --kill gpg-agent"; - use-gpg-ssh = "export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)"; - use-fido-ssh = "export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock"; + go-flake = "nix flake new -t ~/flake#go "; + lock-pass = "gpgconf --kill gpg-agent"; + use-gpg-ssh = "export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)"; + use-fido-ssh = "export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock"; }; }; }; diff --git a/profiles/core/neovim.nix b/profiles/core/neovim.nix index 894d11c..e3a141d 100644 --- a/profiles/core/neovim.nix +++ b/profiles/core/neovim.nix @@ -45,7 +45,6 @@ plugins = with pkgs.vimPlugins; [ # highlighting nvim-treesitter.withAllGrammars - avante-nvim playground gruvbox-material kanagawa-nvim @@ -94,6 +93,11 @@ conjure vim-racket nvim-parinfer + + # ai :( + render-markdown + avante-nvim + nui-nvim ]; }; }; diff --git a/profiles/homeserver/transmission.nix b/profiles/homeserver/transmission.nix index 4be0d1b..8d047d7 100644 --- a/profiles/homeserver/transmission.nix +++ b/profiles/homeserver/transmission.nix @@ -1,34 +1,47 @@ -{ config, lib, ... }: with lib; let - multimediaUsernames = [ - "prowlarr" - "sonarr" - "radarr" - "bazarr" - "jellyfin" - "transmission" - ]; - mkMultimediaUsers = names: mergeAttrsList (imap0 (i: name: {${name} = { - uid = 2007 + i; - isSystemUser = true; - group = name; - createHome = false; - };}) names); - mkMultimediaGroups = names: mergeAttrsList (map (name: {${name} = { };}) names); - in { +{ + config, + lib, + ... +}: +with lib; let + multimediaUsernames = [ + "prowlarr" + "sonarr" + "radarr" + "bazarr" + "jellyfin" + "transmission" + ]; + mkMultimediaUsers = names: + mergeAttrsList (imap0 (i: name: { + ${name} = { + uid = 2007 + i; + isSystemUser = true; + group = name; + createHome = false; + }; + }) + names); + mkMultimediaGroups = names: mergeAttrsList (map (name: {${name} = {};}) names); +in { virtualisation.docker.rootless = { enable = true; setSocketVariable = true; }; - users.groups = { - multimedia = { - gid = 1994; - members = multimediaUsernames; - }; - } // mkMultimediaGroups multimediaUsernames; - users.users = { - ${my.username}.extraGroups = [ "multimedia" ]; - } // mkMultimediaUsers multimediaUsernames; + users.groups = + { + multimedia = { + gid = 1994; + members = multimediaUsernames; + }; + } + // mkMultimediaGroups multimediaUsernames; + users.users = + { + ${my.username}.extraGroups = ["multimedia"]; + } + // mkMultimediaUsers multimediaUsernames; systemd.tmpfiles.rules = [ "d /data 0770 - multimedia - -" @@ -36,13 +49,13 @@ services.nginx = { virtualHosts = { - "sonarr.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:8989"; }; }; - "radarr.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:7878"; }; }; - "bazarr.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:${toString config.services.bazarr.listenPort}"; }; }; + "sonarr.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:8989";};}; + "radarr.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:7878";};}; + "bazarr.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:${toString config.services.bazarr.listenPort}";};}; # "readarr.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:8787"; }; }; - "prowlarr.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:9696"; }; }; - "transmission.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:9091"; }; }; - "jellyfin.${my.domain}" = { locations."/" = { proxyPass = "http://127.0.0.1:8096"; }; }; + "prowlarr.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:9696";};}; + "transmission.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:9091";};}; + "jellyfin.${my.domain}" = {locations."/" = {proxyPass = "http://127.0.0.1:8096";};}; }; }; # services = { @@ -53,6 +66,8 @@ # readarr = { enable = true; group = "multimedia"; }; # prowlarr = { enable = true; }; # }; + + # TODO: use one shared data drive virtualisation.oci-containers = { backend = "docker"; containers = { @@ -64,7 +79,8 @@ PGID = "${toString config.users.groups.multimedia.gid}"; }; volumes = [ - "/data/config/prowlarr/data:/config" + # "/data/config/prowlarr/data:/config" + "/data:/data" ]; }; bazarr = { @@ -75,8 +91,9 @@ PGID = "${toString config.users.groups.multimedia.gid}"; }; volumes = [ - "/data/media:/data" - "/data/config/bazarr/data:/config" + # "/data/media:/data" + # "/data/config/bazarr/data:/config" + "/data:/data" ]; }; radarr = { @@ -87,8 +104,8 @@ PGID = "${toString config.users.groups.multimedia.gid}"; }; volumes = [ + # "/data/config/radarr/data:/config" "/data:/data" - "/data/config/radarr/data:/config" ]; }; sonarr = { @@ -99,8 +116,8 @@ PGID = "${toString config.users.groups.multimedia.gid}"; }; volumes = [ + # "/data/config/sonarr/data:/config" "/data:/data" - "/data/config/sonarr/data:/config" ]; }; jellyfin = { @@ -108,18 +125,20 @@ extraOptions = ["--net=host"]; user = "${toString config.users.users.jellyfin.uid}:${toString config.users.groups.multimedia.gid}"; volumes = [ - "/data/media:/media" - "/data/config/jellyfin/config:/config" - "/data/config/jellyfin/cache:/cache" + # "/data/media:/media" + # "/data/config/jellyfin/config:/config" + # "/data/config/jellyfin/cache:/cache" + "/data:/data" ]; }; transmission = { image = "haugene/transmission-openvpn"; extraOptions = ["--cap-add=NET_ADMIN" "--group-add=${toString config.users.groups.multimedia.gid}"]; volumes = [ - "/data/config/ovpn:/etc/openvpn/custom" - "/data/config/transmission:/config" - "/data/torrents:/data/torrents" + # "/data/config/ovpn:/etc/openvpn/custom" + # "/data/config/transmission:/config" + # "/data/torrents:/data/torrents" + "/data:/data" ]; ports = [ "9091:9091" diff --git a/profiles/vmware-guest.nix b/profiles/vmware-guest.nix index 7dc8ef2..5f1d7af 100644 --- a/profiles/vmware-guest.nix +++ b/profiles/vmware-guest.nix @@ -2,18 +2,21 @@ # for aarch64 to disable certain features and add support. I'm unsure # how to upstream this because I just don't use certain features... maybe # making them toggle-able? I'm not sure. - -{ config, lib, pkgs, ... }: - -with lib; - -let - cfg = config.virtualisation.vmware.guest; - open-vm-tools = if cfg.headless then pkgs.open-vm-tools-headless else pkgs.open-vm-tools; -in { + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.virtualisation.vmware.guest; + open-vm-tools = + if cfg.headless + then pkgs.open-vm-tools-headless + else pkgs.open-vm-tools; +in { imports = [ - (mkRenamedOptionModule [ "services" "vmwareGuest" ] [ "virtualisation" "vmware" "guest" ]) + (mkRenamedOptionModule ["services" "vmwareGuest"] ["virtualisation" "vmware" "guest"]) ]; options.virtualisation.vmware.guest = { @@ -26,44 +29,46 @@ in }; config = mkIf cfg.enable { - assertions = [ { - assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 || pkgs.stdenv.isAarch64; - message = "VMWare guest is not currently supported on ${pkgs.stdenv.hostPlatform.system}"; - } ]; + assertions = [ + { + assertion = pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64 || pkgs.stdenv.isAarch64; + message = "VMWare guest is not currently supported on ${pkgs.stdenv.hostPlatform.system}"; + } + ]; - boot.initrd.availableKernelModules = [ "mptspi" ]; + boot.initrd.availableKernelModules = ["mptspi"]; # boot.initrd.kernelModules = [ "vmw_pvscsi" ]; - environment.systemPackages = [ open-vm-tools ]; + environment.systemPackages = [open-vm-tools]; - systemd.services.vmware = - { description = "VMWare Guest Service"; - wantedBy = [ "multi-user.target" ]; - after = [ "display-manager.service" ]; - unitConfig.ConditionVirtualization = "vmware"; - serviceConfig.ExecStart = "${open-vm-tools}/bin/vmtoolsd"; - }; + systemd.services.vmware = { + description = "VMWare Guest Service"; + wantedBy = ["multi-user.target"]; + after = ["display-manager.service"]; + unitConfig.ConditionVirtualization = "vmware"; + serviceConfig.ExecStart = "${open-vm-tools}/bin/vmtoolsd"; + }; # Mount the vmblock for drag-and-drop and copy-and-paste. systemd.mounts = [ { description = "VMware vmblock fuse mount"; - documentation = [ "https://github.com/vmware/open-vm-tools/blob/master/open-vm-tools/vmblock-fuse/design.txt" ]; + documentation = ["https://github.com/vmware/open-vm-tools/blob/master/open-vm-tools/vmblock-fuse/design.txt"]; unitConfig.ConditionVirtualization = "vmware"; what = "${open-vm-tools}/bin/vmware-vmblock-fuse"; where = "/run/vmblock-fuse"; type = "fuse"; options = "subtype=vmware-vmblock,default_permissions,allow_other"; - wantedBy = [ "multi-user.target" ]; + wantedBy = ["multi-user.target"]; } ]; - security.wrappers.vmware-user-suid-wrapper = - { setuid = true; - owner = "root"; - group = "root"; - source = "${open-vm-tools}/bin/vmware-user-suid-wrapper"; - }; + security.wrappers.vmware-user-suid-wrapper = { + setuid = true; + owner = "root"; + group = "root"; + source = "${open-vm-tools}/bin/vmware-user-suid-wrapper"; + }; environment.etc.vmware-tools.source = "${open-vm-tools}/etc/vmware-tools/*"; @@ -72,20 +77,19 @@ in # modules = [ xf86inputvmmouse ]; config = '' - Section "InputClass" - Identifier "VMMouse" - MatchDevicePath "/dev/input/event*" - MatchProduct "ImPS/2 Generic Wheel Mouse" - Driver "vmmouse" - EndSection - ''; + Section "InputClass" + Identifier "VMMouse" + MatchDevicePath "/dev/input/event*" + MatchProduct "ImPS/2 Generic Wheel Mouse" + Driver "vmmouse" + EndSection + ''; displayManager.sessionCommands = '' - ${open-vm-tools}/bin/vmware-user-suid-wrapper - ''; + ${open-vm-tools}/bin/vmware-user-suid-wrapper + ''; }; - services.udev.packages = [ open-vm-tools ]; + services.udev.packages = [open-vm-tools]; }; } - |
