diff --git a/base.nix b/base.nix index 5f50cf7..2f3f9fe 100644 --- a/base.nix +++ b/base.nix @@ -1,5 +1,6 @@ { config, lib, pkgs, options, ... }: { - imports = [ ./modules/apps.nix ./modules/dev.nix ]; + imports = + [ ./modules/apps.nix ./modules/dev.nix ./modules/services.nix ./jawz.nix ]; system = { copySystemConfiguration = true; stateVersion = "23.11"; diff --git a/home-manager/default.nix b/home-manager/default.nix index 938be4a..07813e0 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -24,7 +24,6 @@ in { ''download -u jawz -i "$(cat $LW | fzf --multi --exact -i)"''; cp = "cp -i"; mv = "mv -i"; - mkcd = ''mkdir -pv "$1" && cd "$1" || exit''; mkdir = "mkdir -p"; rm = "trash"; ".." = "cd .."; @@ -41,21 +40,21 @@ in { jc = "journalctl --user -xefu"; open-gallery = '' cd /mnt/pool/scrapping/JawZ/gallery-dl && - xdg-open "$(fd . ./ Husbands -tdirectory -d 1 | fzf -i)"''; + xdg-open "$(fd . ./ Husbands -tdirectory -d 1 | fzf -i)"''; unique-extensions = '' fd -tf | rev | cut -d. -f1 | rev | - tr '[:upper:]' '[:lower:]' | sort | - uniq --count | sort -rn''; + tr '[:upper:]' '[:lower:]' | sort | + uniq --count | sort -rn''; }; enableVteIntegration = true; initExtra = '' $HOME/.local/bin/pokemon-colorscripts -r --no-title - # Lists + list_root="${config.xdg.configHome}"/jawz/lists/jawz export LW=$list_root/watch.txt export LI=$list_root/instant.txt export LC=$list_root/comic.txt - export command_timeout=30 + export command_timeout=60 if command -v fzf-share >/dev/null; then source "$(fzf-share)/key-bindings.bash" @@ -64,11 +63,12 @@ in { nixos-reload () { NIXOSDIR=/home/jawz/Development/NixOS - nix-store --add-fixed sha256 $NIXOSDIR/scripts/PureRef-1.11.1_x64.Appimage - nixfmt $NIXOSDIR/workstation/*.nix + nix-store --add-fixed sha256 \ + $NIXOSDIR/PureRef-1.11.1_x64.Appimage + fd --full-path $NIXOSDIR -e nix -x nixfmt \; sudo unbuffer nixos-rebuild switch -I \ - nixos-config="$NIXOSDIR/hosts/$HOSTNAME/configuration.nix" \ - |& nom + nixos-config="$NIXOSDIR/hosts/$HOSTNAME/configuration.nix" \ + |& nom } ''; }; diff --git a/hosts/miniserver/configuration.nix b/hosts/miniserver/configuration.nix index 099b34c..d8569ba 100644 --- a/hosts/miniserver/configuration.nix +++ b/hosts/miniserver/configuration.nix @@ -9,48 +9,46 @@ let "https://github.com/nix-community/home-manager/archive/release-${version}.tar.gz"; unstable = import (builtins.fetchTarball "https://github.com/nixos/nixpkgs/tarball/master") { - config = config.nixpkgs.config; - }; - jawzManageLibrary = pkgs.writeScriptBin - "manage-library" (builtins.readFile ../scripts/manage-library.sh); - jawzTasks = pkgs.writeScriptBin - "tasks" (builtins.readFile ../scripts/tasks.sh); - jawzSubs = pkgs.writeScriptBin - "sub-sync" (builtins.readFile ../scripts/sub-sync.sh); - jawzStream = pkgs.writeScriptBin - "stream-dl" (builtins.readFile ../scripts/stream-dl.sh); -in -{ # Remember to close this bracket at the end of the document + config = config.nixpkgs.config; + }; + jawzManageLibrary = pkgs.writeScriptBin "manage-library" + (builtins.readFile ../scripts/manage-library.sh); + jawzTasks = + pkgs.writeScriptBin "tasks" (builtins.readFile ../scripts/tasks.sh); + jawzSubs = + pkgs.writeScriptBin "sub-sync" (builtins.readFile ../scripts/sub-sync.sh); + jawzStream = + pkgs.writeScriptBin "stream-dl" (builtins.readFile ../scripts/stream-dl.sh); +in { # Remember to close this bracket at the end of the document -imports = [ - ./fstab.nix - ./servers.nix - ./docker.nix - # ./mail.nix - # ./openldap.nix - # - (import "${home-manager}/nixos") -]; + imports = [ + ./fstab.nix + ./servers.nix + ./docker.nix + # ./mail.nix + # ./openldap.nix + # + (import "${home-manager}/nixos") + ]; -powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; -networking = { - useDHCP = lib.mkDefault true; - enableIPv6 = false; - hostName = "miniserver"; - networkmanager.enable = true; - extraHosts = '' - 192.168.1.64 workstation - 192.168.1.69 server - ''; - firewall = let - open_firewall_ports = [ - 51413 # torrent sedding - 9091 # qbittorrent - 2049 # nfs - ]; - open_firewall_port_ranges = [ ]; - in - { + powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; + networking = { + useDHCP = lib.mkDefault true; + enableIPv6 = false; + hostName = "miniserver"; + networkmanager.enable = true; + extraHosts = '' + 192.168.1.64 workstation + 192.168.1.69 server + ''; + firewall = let + open_firewall_ports = [ + 51413 # torrent sedding + 9091 # qbittorrent + 2049 # nfs + ]; + open_firewall_port_ranges = [ ]; + in { enable = true; allowPing = true; allowedTCPPorts = open_firewall_ports; @@ -58,26 +56,25 @@ networking = { allowedTCPPortRanges = open_firewall_port_ranges; allowedUDPPortRanges = open_firewall_port_ranges; }; -}; - -time.timeZone = "America/Mexico_City"; -i18n = { - defaultLocale = "en_CA.UTF-8"; - extraLocaleSettings = { - LC_MONETARY = "es_MX.UTF-8"; }; -}; -console = { - font = "Lat2-Terminus16"; - keyMap = "us"; - # useXkbConfig = true; # use xkbOptions in tty. -}; -system = { - copySystemConfiguration = true; - stateVersion = "${version}"; -}; -nix = let featuresList = [ + time.timeZone = "America/Mexico_City"; + i18n = { + defaultLocale = "en_CA.UTF-8"; + extraLocaleSettings = { LC_MONETARY = "es_MX.UTF-8"; }; + }; + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + # useXkbConfig = true; # use xkbOptions in tty. + }; + + system = { + copySystemConfiguration = true; + stateVersion = "${version}"; + }; + nix = let + featuresList = [ "nixos-test" "benchmark" "big-parallel" @@ -85,605 +82,597 @@ nix = let featuresList = [ "gccarch-${cpuArchitecture}" "gccarch-znver3" ]; - in - { - gc = { - automatic = true; - dates = "weekly"; - }; - buildMachines = [ { + in { + gc = { + automatic = true; + dates = "weekly"; + }; + buildMachines = [{ hostName = "workstation"; system = "x86_64-linux"; sshUser = "nixremote"; maxJobs = 14; speedFactor = 1; supportedFeatures = featuresList; - } ]; - distributedBuilds = true; - settings = { - cores = 3; - auto-optimise-store = true; - trusted-users = [ "nixremote" ]; - system-features = featuresList; - substituters = [ - "https://nix-gaming.cachix.org" - "https://nixpkgs-python.cachix.org" - "https://devenv.cachix.org" - "https://cuda-maintainers.cachix.org" - ]; - trusted-public-keys = [ - "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" - "nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU=" - "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" - "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" - ]; - }; -}; - -security = { - acme = { - acceptTerms = true; - defaults.email = myEmail; - }; - rtkit.enable = true; - sudo = { - enable = true; - wheelNeedsPassword = false; - }; - pam.loginLimits = [{ - domain = "*"; - type = "soft"; - item = "nofile"; - value = "8192"; - }]; -}; - -nixpkgs = { - hostPlatform = lib.mkDefault "x86_64-linux"; - config = { - allowUnfree = true; - permittedInsecurePackages = [ - "openssl-1.1.1w" - ]; - }; - # localSystem = { - # gcc.arch = cpuArchitecture; - # gcc.tune = cpuArchitecture; - # system = "x86_64-linux"; - # }; -}; - -users = { - groups.nixremote = { - name = "nixremote"; - gid = 555; - }; - users.nixremote = { - isNormalUser = true; - createHome = true; - group = "nixremote"; - home = "/var/nixremote/"; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICiyTwryzw8CblPldplDpVUkXD9C1fXVgO8LeXdE5cuR root@workstation" - "" - ]; - }; -}; -users.users.jawz = { - isNormalUser = true; - extraGroups = [ "wheel" "networkmanager" "docker" - "scanner" "lp" "piracy" "kavita" - "render" "video" - ]; - initialPassword = "password"; - openssh = { - authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB5GaQM4N+yGAByibOFQOBVMV/6TjOfaGIP+NunMiK76 gpodeacero\cdreyes@100CDREYES" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMkpeIV9G26W2/e9PsjBx3sNwPGoicJ807ExRGh4KjhW jawz@server" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH2wtsaMvfEUm//2YnFHyrc16o+TOXXBfIGPJ9nL8RMp jawz@workstation" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBEblxSDhWPEo33crSjooeUg4W02ruENxHLmmBqCuIo jawz@galaxy" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN6HsajaTL+nTJtSIu00M5WJwgt/7fyU59gBr2R7tbnv root@server" - ]; - }; - -packages = (with pkgs; [ - -hunspell -hunspellDicts.it_IT -hunspellDicts.es_MX -hunspellDicts.en_CA - -symbola - -unstable.yt-dlp # downloads videos from most video websites -unstable.gallery-dl # similar to yt-dlp but for most image gallery websites - -fd # modern find, faster searches -fzf # fuzzy finder! super cool and useful -gdu # disk-space utility, somewhat useful -du-dust # rusty du -trash-cli # oop! didn't meant to delete that -eza # like ls but with colors -rmlint # probably my favourite app, amazing dupe finder that integrates well with BTRFS -smartmontools # check hard drie health - -jawzManageLibrary -jawzTasks -jawzSubs -jawzStream -(writeScriptBin "ffmpeg4discord" (builtins.readFile ../scripts/ffmpeg4discord.py)) -(writeScriptBin "ffmpreg" (builtins.readFile ../scripts/ffmpreg.sh)) -(writeScriptBin "split-dir" (builtins.readFile ../scripts/split-dir.sh)) -(writeScriptBin "pika-list" (builtins.readFile ../scripts/pika-list.sh)) -(writeScriptBin "run" (builtins.readFile ../scripts/run.sh)) -(writeScriptBin "find-dup-episodes" (builtins.readFile ../scripts/find-dup-episodes.sh)) - -tldr # man for retards - -# SH -bats # testing system, required by Exercism -bashdb # autocomplete -shellcheck # linting -shfmt # a shell parser and formatter - -# NIX -expect # keep color when nom'ing -nix-output-monitor # autistic nix builds -nixfmt # linting -cachix # why spend time compiling? - -# PYTHON. -(python3.withPackages (ps: with ps; [ - flake8 # wraper for pyflakes, pycodestyle and mccabe - isort # sort Python imports - nose # testing and running python scripts - pyflakes # checks source code for errors - pytest # framework for writing tests - speedtest-cli # check internet speed from the comand line - editorconfig # follow rules of contributin - black # Python code formatter - pylint # bug and style checker for python -])) # base language - -]) ++ (with pkgs.python3Packages; [ -(buildPythonApplication rec { - pname = "download"; - version = "1.5"; - src = ../scripts/download/.; - doCheck = false; - buildInputs = [ setuptools ]; - propagatedBuildInputs = - [ pyyaml types-pyyaml ]; -}) -(buildPythonApplication rec { - pname = "ffpb"; - version = "0.4.1"; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-7eVqbLpMHS1sBw2vYS4cTtyVdnnknGtEI8190VlXflk="; - }; - doCheck = false; - buildInputs = [ setuptools ]; - propagatedBuildInputs = - [ tqdm ]; -}) -# (buildPythonApplication rec { -# pname = "qbit_manage"; -# version = "4.0.3"; -# src = fetchPypi { -# inherit pname version; -# sha256 = "sha256-7eVqbLpMHS1sBw2vYS4cTtyVdnnknGtEI8190VlXflk="; -# }; -# doCheck = true; -# buildInputs = [ setuptools ]; -# propagatedBuildInputs = -# [ gitpython requests retrying ruamel-yaml schedule unstable.qbittorrent-api ]; -# }) - -]) ++ (with pkgs.nodePackages; [ - # Language servers - dockerfile-language-server-nodejs - yaml-language-server - bash-language-server - vscode-json-languageserver - pyright - - markdownlint-cli # Linter - prettier # Linter - pnpm # Package manager - -]); }; # <--- end of package list - -home-manager = { - useUserPackages = true; - useGlobalPkgs = true; - users.jawz = { config, pkgs, ... }:{ - home.stateVersion = "${version}"; - -programs.bash = { - enable = true; - historyFile = "\${XDG_STATE_HOME}/bash/history"; - historyControl = [ "erasedups" "ignorespace" ]; - shellAliases = { - hh = "hstr"; - ls = "eza --icons --group-directories-first"; - edit = "emacsclient -t"; - comic = "download -u jawz -i \"$(cat $LC | fzf --multi --exact -i)\""; - gallery = "download -u jawz -i \"$(cat $LW | fzf --multi --exact -i)\""; - cp = "cp -i"; - mv = "mv -i"; - mkcd = "mkdir -pv \"$1\" && cd \"$1\" || exit"; - mkdir = "mkdir -p"; - rm = "trash"; - ".." = "cd .."; - "..." = "cd ../.."; - ".3" = "cd ../../.."; - ".4" = "cd ../../../.."; - ".5" = "cd ../../../../.."; - dl = "download -u jawz -i"; - e = "edit"; - c = "cat"; - f = "fzf --multi --exact -i"; - sc = "systemctl --user"; - jc = "journalctl --user -xefu"; - open-gallery = "cd /mnt/pool/scrapping/JawZ/gallery-dl && - xdg-open $(fd . ./ Husbands -tdirectory -d 1 | fzf -i)\""; - unique-extensions = "fd -tf | rev | cut -d. -f1 | rev | - tr '[:upper:]' '[:lower:]' | sort | - uniq --count | sort -rn"; - }; - enableVteIntegration = true; - initExtra = '' - $HOME/.local/bin/pokemon-colorscripts -r --no-title - # Lists - list_root="${config.xdg.configHome}"/jawz/lists/jawz - export LW=$list_root/watch.txt - export LI=$list_root/instant.txt - export LC=$list_root/comic.txt - export command_timeout=30 - - if command -v fzf-share >/dev/null; then - source "$(fzf-share)/key-bindings.bash" - source "$(fzf-share)/completion.bash" - fi - - nixos-reload () { - nixfmt /home/jawz/Development/NixOS/miniserver/*.nix - sudo unbuffer nixos-rebuild switch -I nixos-config=/home/jawz/Development/NixOS/miniserver/configuration.nix |& nom - } - ''; -}; - -xdg = { - enable = true; - userDirs = { - enable = true; - createDirectories = false; - desktop = "${config.home.homeDirectory}"; - documents = "${config.home.homeDirectory}/Documents"; - download = "${config.home.homeDirectory}/Downloads"; - music = "${config.home.homeDirectory}/Music"; - pictures = "${config.home.homeDirectory}/Pictures"; - templates = "${config.xdg.dataHome}/Templates"; - videos = "${config.home.homeDirectory}/Videos"; - }; - configFile = { - "wgetrc".source = ../dotfiles/wget/wgetrc; - "configstore/update-notifier-npm-check.json".source = ../dotfiles/npm/update-notifier-npm-check.json; - "npm/npmrc".source = ../dotfiles/npm/npmrc; - "gallery-dl/config.json".source = ../dotfiles/gallery-dl/config.json; - "htop/htoprc".source = ../dotfiles/htop/htoprc; - "python/pythonrc".source = ../dotfiles/pythonrc; - "unpackerr.conf".source = ../dotfiles/unpackerr.conf; - }; -}; - -programs = { - helix = { - enable = true; - }; - hstr.enable = true; - emacs.enable = true; - direnv = { - enable = true; - enableBashIntegration = true; - nix-direnv.enable = true; - }; - bat = { - enable = true; - config = { - pager = "less -FR"; - theme = "base16"; - }; - extraPackages = with pkgs.bat-extras; [ - batman # man pages - batpipe # piping - batgrep # ripgrep - batdiff # this is getting crazy! - batwatch # probably my next best friend - prettybat # trans your sourcecode! - ]; - }; - git = { - enable = true; - userName = "${myName}"; - userEmail = "${myEmail}"; - }; - htop = { - enable = true; - package = pkgs.htop-vim; - }; -}; - -services = { - lorri.enable = true; - emacs = { - enable = true; - defaultEditor = true; - package = pkgs.emacs; - startWithUserSession = "graphical"; - }; -}; - -}; }; - -environment = { - systemPackages = with pkgs; [ - wget - jellyfin-ffmpeg # coolest video converter! - mediainfo - dlib - fd - ripgrep - ]; - variables = rec { - # PATH - XDG_CACHE_HOME = "\${HOME}/.cache"; - XDG_CONFIG_HOME = "\${HOME}/.config"; - XDG_BIN_HOME = "\${HOME}/.local/bin"; - XDG_DATA_HOME = "\${HOME}/.local/share"; - XDG_STATE_HOME = "\${HOME}/.local/state"; - - # DEV PATH - CABAL_DIR = "${XDG_CACHE_HOME}/cabal"; - CARGO_HOME = "${XDG_DATA_HOME}/cargo"; - GEM_HOME = "${XDG_DATA_HOME}/ruby/gems"; - GEM_PATH = "${XDG_DATA_HOME}/ruby/gems"; - GEM_SPEC_CACHE = "${XDG_DATA_HOME}/ruby/specs"; - GOPATH = "${XDG_DATA_HOME}/go"; - NPM_CONFIG_USERCONFIG = "${XDG_CONFIG_HOME}/npm/npmrc"; - PNPM_HOME = "${XDG_DATA_HOME}/pnpm"; - PSQL_HISTORY="${XDG_DATA_HOME}/psql_history"; - REDISCLI_HISTFILE="${XDG_DATA_HOME}/redis/rediscli_history"; - WINEPREFIX="${XDG_DATA_HOME}/wine"; - PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/pythonrc"; - STACK_ROOT="${XDG_DATA_HOME}/stack"; - - # OPTIONS - HISTFILE = "${XDG_STATE_HOME}/bash/history"; - LESSHISTFILE = "-"; - GHCUP_USE_XDG_DIRS = "true"; - RIPGREP_CONFIG_PATH = "${XDG_CONFIG_HOME}/ripgrep/ripgreprc"; - ELECTRUMDIR = "${XDG_DATA_HOME}/electrum"; - VISUAL = "emacsclient -ca emacs"; - WGETRC = "${XDG_CONFIG_HOME}/wgetrc"; - XCOMPOSECACHE = "${XDG_CACHE_HOME}/X11/xcompose"; - "_JAVA_OPTIONS" = "-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java"; - DOCKER_CONFIG="${XDG_CONFIG_HOME}/docker"; - - # NVIDIA - CUDA_CACHE_PATH = "${XDG_CACHE_HOME}/nv"; - - # Themes - # WEBKIT_DISABLE_COMPOSITING_MODE = "1"; - CALIBRE_USE_SYSTEM_THEME = "1"; - - PATH = [ - "\${HOME}/.local/bin" - "${XDG_CONFIG_HOME}/emacs/bin" - "${XDG_DATA_HOME}/npm/bin" - "${XDG_DATA_HOME}/pnpm" - ]; - - # needed for tensorflow - # CUDA_PATH = "${pkgs.cudatoolkit}"; - # # LD_LIBRARY_PATH = "${pkgs.linuxPackages.nvidia_x11}/lib:${pkgs.ncurses5}/lib"; - # EXTRA_LDFLAGS = "-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"; - # EXTRA_CCFLAGS = "-I/usr/include"; - }; -}; - -programs = { - starship.enable = true; - tmux.enable = true; - fzf.fuzzyCompletion = true; - neovim = { - enable = true; - vimAlias = true; - }; - gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; -}; - -services = { - # minidlna = { - # enable = true; - # openFirewall = true; - # settings = { - # inotify = "yes"; - # media_dir = [ - # "/mnt/pool/glue" - # ]; - # }; - # }; - avahi = { - enable = true; - nssmdns = true; - }; - fstrim.enable = true; - smartd.enable = true; - btrfs.autoScrub = { - enable = true; - fileSystems = [ - "/" - "/mnt/pool" - ]; - }; - openssh = { - enable = true; - openFirewall = true; - startWhenNeeded = true; + }]; + distributedBuilds = true; settings = { - PasswordAuthentication = false; - KbdInteractiveAuthentication = false; + cores = 3; + auto-optimise-store = true; + trusted-users = [ "nixremote" ]; + system-features = featuresList; + substituters = [ + "https://nix-gaming.cachix.org" + "https://nixpkgs-python.cachix.org" + "https://devenv.cachix.org" + "https://cuda-maintainers.cachix.org" + ]; + trusted-public-keys = [ + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" + "nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU=" + "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" + "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" + ]; }; }; -}; -systemd = { - packages = let - pkgs = import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/9957cd48326fe8dbd52fdc50dd2502307f188b0d.tar.gz"; - }) {}; - - myPkg = pkgs.qbittorrent-nox; -in [ myPkg ]; - services = { - "qbittorrent-nox@jawz" = { + security = { + acme = { + acceptTerms = true; + defaults.email = myEmail; + }; + rtkit.enable = true; + sudo = { enable = true; - overrideStrategy = "asDropin"; - wantedBy = [ "multi-user.target" ]; + wheelNeedsPassword = false; + }; + pam.loginLimits = [{ + domain = "*"; + type = "soft"; + item = "nofile"; + value = "8192"; + }]; + }; + + nixpkgs = { + hostPlatform = lib.mkDefault "x86_64-linux"; + config = { + allowUnfree = true; + permittedInsecurePackages = [ "openssl-1.1.1w" ]; + }; + # localSystem = { + # gcc.arch = cpuArchitecture; + # gcc.tune = cpuArchitecture; + # system = "x86_64-linux"; + # }; + }; + + users = { + groups.nixremote = { + name = "nixremote"; + gid = 555; + }; + users.nixremote = { + isNormalUser = true; + createHome = true; + group = "nixremote"; + home = "/var/nixremote/"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICiyTwryzw8CblPldplDpVUkXD9C1fXVgO8LeXdE5cuR root@workstation" + "" + ]; }; }; - timers = { - }; - user = { - services = { - "stream@" = { - description = "monitors a stream channel for online streams."; - restartIfChanged = true; - wantedBy = [ "default.target" ]; - path = [ - pkgs.nix - jawzStream - ]; - serviceConfig = { - Restart = "on-failure"; - RestartSec = 30; - ExecStart = "${jawzStream}/bin/stream-dl %I"; + users.users.jawz = { + isNormalUser = true; + extraGroups = [ + "wheel" + "networkmanager" + "docker" + "scanner" + "lp" + "piracy" + "kavita" + "render" + "video" + ]; + initialPassword = "password"; + openssh = { + authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB5GaQM4N+yGAByibOFQOBVMV/6TjOfaGIP+NunMiK76 gpodeacerocdreyes@100CDREYES" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMkpeIV9G26W2/e9PsjBx3sNwPGoicJ807ExRGh4KjhW jawz@server" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH2wtsaMvfEUm//2YnFHyrc16o+TOXXBfIGPJ9nL8RMp jawz@workstation" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBEblxSDhWPEo33crSjooeUg4W02ruENxHLmmBqCuIo jawz@galaxy" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN6HsajaTL+nTJtSIu00M5WJwgt/7fyU59gBr2R7tbnv root@server" + ]; + }; + + packages = (with pkgs; [ + + hunspell + hunspellDicts.it_IT + hunspellDicts.es_MX + hunspellDicts.en_CA + + symbola + + unstable.yt-dlp # downloads videos from most video websites + unstable.gallery-dl # similar to yt-dlp but for most image gallery websites + + fd # modern find, faster searches + fzf # fuzzy finder! super cool and useful + gdu # disk-space utility, somewhat useful + du-dust # rusty du + trash-cli # oop! didn't meant to delete that + eza # like ls but with colors + rmlint # probably my favourite app, amazing dupe finder that integrates well with BTRFS + smartmontools # check hard drie health + + jawzManageLibrary + jawzTasks + jawzSubs + jawzStream + (writeScriptBin "ffmpeg4discord" + (builtins.readFile ../scripts/ffmpeg4discord.py)) + (writeScriptBin "ffmpreg" (builtins.readFile ../scripts/ffmpreg.sh)) + (writeScriptBin "split-dir" (builtins.readFile ../scripts/split-dir.sh)) + (writeScriptBin "pika-list" (builtins.readFile ../scripts/pika-list.sh)) + (writeScriptBin "run" (builtins.readFile ../scripts/run.sh)) + (writeScriptBin "find-dup-episodes" + (builtins.readFile ../scripts/find-dup-episodes.sh)) + + tldr # man for retards + + # SH + bats # testing system, required by Exercism + bashdb # autocomplete + shellcheck # linting + shfmt # a shell parser and formatter + + # NIX + expect # keep color when nom'ing + nix-output-monitor # autistic nix builds + nixfmt # linting + cachix # why spend time compiling? + + # PYTHON. + (python3.withPackages (ps: + with ps; [ + flake8 # wraper for pyflakes, pycodestyle and mccabe + isort # sort Python imports + nose # testing and running python scripts + pyflakes # checks source code for errors + pytest # framework for writing tests + speedtest-cli # check internet speed from the comand line + editorconfig # follow rules of contributin + black # Python code formatter + pylint # bug and style checker for python + ])) # base language + + ]) ++ (with pkgs.python3Packages; [ + (buildPythonApplication rec { + pname = "download"; + version = "1.5"; + src = ../scripts/download/.; + doCheck = false; + buildInputs = [ setuptools ]; + propagatedBuildInputs = [ pyyaml types-pyyaml ]; + }) + (buildPythonApplication rec { + pname = "ffpb"; + version = "0.4.1"; + src = fetchPypi { + inherit pname version; + sha256 = "sha256-7eVqbLpMHS1sBw2vYS4cTtyVdnnknGtEI8190VlXflk="; }; - }; - # unpackerr = { - # enable = true; - # restartIfChanged = true; - # description = "Run unpackerr"; - # wantedBy = [ "default.target" ]; - # serviceConfig = { - # Restart = "on-failure"; - # RestartSec = 30; - # ExecStart = "${pkgs.unpackerr}/bin/unpackerr -c /home/jawz/.config/unpackerr.conf"; + doCheck = false; + buildInputs = [ setuptools ]; + propagatedBuildInputs = [ tqdm ]; + }) + # (buildPythonApplication rec { + # pname = "qbit_manage"; + # version = "4.0.3"; + # src = fetchPypi { + # inherit pname version; + # sha256 = "sha256-7eVqbLpMHS1sBw2vYS4cTtyVdnnknGtEI8190VlXflk="; # }; - # }; - manage-library = { + # doCheck = true; + # buildInputs = [ setuptools ]; + # propagatedBuildInputs = + # [ gitpython requests retrying ruamel-yaml schedule unstable.qbittorrent-api ]; + # }) + + ]) ++ (with pkgs.nodePackages; [ + # Language servers + dockerfile-language-server-nodejs + yaml-language-server + bash-language-server + vscode-json-languageserver + pyright + + markdownlint-cli # Linter + prettier # Linter + pnpm # Package manager + + ]); + }; # <--- end of package list + + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + users.jawz = { config, pkgs, ... }: { + home.stateVersion = "${version}"; + + programs.bash = { enable = true; - restartIfChanged = true; - description = "Run the manage library bash script"; - wantedBy = [ "default.target" ]; - path = [ - pkgs.nix - jawzManageLibrary - ]; - serviceConfig = { - Restart = "on-failure"; - RestartSec = 30; - ExecStart = "${jawzManageLibrary}/bin/manage-library"; + historyFile = "\${XDG_STATE_HOME}/bash/history"; + historyControl = [ "erasedups" "ignorespace" ]; + shellAliases = { + hh = "hstr"; + ls = "eza --icons --group-directories-first"; + edit = "emacsclient -t"; + comic = ''download -u jawz -i "$(cat $LC | fzf --multi --exact -i)"''; + gallery = + ''download -u jawz -i "$(cat $LW | fzf --multi --exact -i)"''; + cp = "cp -i"; + mv = "mv -i"; + mkcd = ''mkdir -pv "$1" && cd "$1" || exit''; + mkdir = "mkdir -p"; + rm = "trash"; + ".." = "cd .."; + "..." = "cd ../.."; + ".3" = "cd ../../.."; + ".4" = "cd ../../../.."; + ".5" = "cd ../../../../.."; + dl = "download -u jawz -i"; + e = "edit"; + c = "cat"; + f = "fzf --multi --exact -i"; + sc = "systemctl --user"; + jc = "journalctl --user -xefu"; + open-gallery = '' + cd /mnt/pool/scrapping/JawZ/gallery-dl && + xdg-open $(fd . ./ Husbands -tdirectory -d 1 | fzf -i)"''; + unique-extensions = '' + fd -tf | rev | cut -d. -f1 | rev | + tr '[:upper:]' '[:lower:]' | sort | + uniq --count | sort -rn''; + }; + enableVteIntegration = true; + initExtra = '' + $HOME/.local/bin/pokemon-colorscripts -r --no-title + # Lists + list_root="${config.xdg.configHome}"/jawz/lists/jawz + export LW=$list_root/watch.txt + export LI=$list_root/instant.txt + export LC=$list_root/comic.txt + export command_timeout=30 + + if command -v fzf-share >/dev/null; then + source "$(fzf-share)/key-bindings.bash" + source "$(fzf-share)/completion.bash" + fi + + nixos-reload () { + nixfmt /home/jawz/Development/NixOS/miniserver/*.nix + sudo unbuffer nixos-rebuild switch -I nixos-config=/home/jawz/Development/NixOS/miniserver/configuration.nix |& nom + } + ''; + }; + + xdg = { + enable = true; + userDirs = { + enable = true; + createDirectories = false; + desktop = "${config.home.homeDirectory}"; + documents = "${config.home.homeDirectory}/Documents"; + download = "${config.home.homeDirectory}/Downloads"; + music = "${config.home.homeDirectory}/Music"; + pictures = "${config.home.homeDirectory}/Pictures"; + templates = "${config.xdg.dataHome}/Templates"; + videos = "${config.home.homeDirectory}/Videos"; + }; + configFile = { + "wgetrc".source = ../dotfiles/wget/wgetrc; + "configstore/update-notifier-npm-check.json".source = + ../dotfiles/npm/update-notifier-npm-check.json; + "npm/npmrc".source = ../dotfiles/npm/npmrc; + "gallery-dl/config.json".source = ../dotfiles/gallery-dl/config.json; + "htop/htoprc".source = ../dotfiles/htop/htoprc; + "python/pythonrc".source = ../dotfiles/pythonrc; + "unpackerr.conf".source = ../dotfiles/unpackerr.conf; }; }; - tasks = { - restartIfChanged = true; - description = "Run a tasks script which keeps a lot of things organized"; - wantedBy = [ "default.target" ]; - path = [ - pkgs.nix - jawzTasks - ]; - serviceConfig = { - Restart = "on-failure"; - RestartSec = 30; - ExecStart = "${jawzTasks}/bin/tasks"; + + programs = { + helix = { enable = true; }; + hstr.enable = true; + emacs.enable = true; + direnv = { + enable = true; + enableBashIntegration = true; + nix-direnv.enable = true; + }; + bat = { + enable = true; + config = { + pager = "less -FR"; + theme = "base16"; + }; + extraPackages = with pkgs.bat-extras; [ + batman # man pages + batpipe # piping + batgrep # ripgrep + batdiff # this is getting crazy! + batwatch # probably my next best friend + prettybat # trans your sourcecode! + ]; + }; + git = { + enable = true; + userName = "${myName}"; + userEmail = "${myEmail}"; + }; + htop = { + enable = true; + package = pkgs.htop-vim; }; }; - qbit_manage = let qbit_dir = "/home/jawz/Development/Git/qbit_manage"; in { - restartIfChanged = true; - description = "Tidy up my torrents"; - wantedBy = [ "default.target" ]; - path = [ - pkgs.python3 - pkgs.pipenv - ]; - serviceConfig = { - Restart = "on-failure"; - RestartSec = 30; - ExecStart = "${qbit_dir}/venv/bin/python3 ${qbit_dir}/qbit_manage.py -r -c ${qbit_dir}/config.yml"; + + services = { + lorri.enable = true; + emacs = { + enable = true; + defaultEditor = true; + package = pkgs.emacs; + startWithUserSession = "graphical"; }; }; + + }; + }; + + environment = { + systemPackages = with pkgs; [ + wget + jellyfin-ffmpeg # coolest video converter! + mediainfo + dlib + fd + ripgrep + ]; + variables = rec { + # PATH + XDG_CACHE_HOME = "\${HOME}/.cache"; + XDG_CONFIG_HOME = "\${HOME}/.config"; + XDG_BIN_HOME = "\${HOME}/.local/bin"; + XDG_DATA_HOME = "\${HOME}/.local/share"; + XDG_STATE_HOME = "\${HOME}/.local/state"; + + # DEV PATH + CABAL_DIR = "${XDG_CACHE_HOME}/cabal"; + CARGO_HOME = "${XDG_DATA_HOME}/cargo"; + GEM_HOME = "${XDG_DATA_HOME}/ruby/gems"; + GEM_PATH = "${XDG_DATA_HOME}/ruby/gems"; + GEM_SPEC_CACHE = "${XDG_DATA_HOME}/ruby/specs"; + GOPATH = "${XDG_DATA_HOME}/go"; + NPM_CONFIG_USERCONFIG = "${XDG_CONFIG_HOME}/npm/npmrc"; + PNPM_HOME = "${XDG_DATA_HOME}/pnpm"; + PSQL_HISTORY = "${XDG_DATA_HOME}/psql_history"; + REDISCLI_HISTFILE = "${XDG_DATA_HOME}/redis/rediscli_history"; + WINEPREFIX = "${XDG_DATA_HOME}/wine"; + PYTHONSTARTUP = "${XDG_CONFIG_HOME}/python/pythonrc"; + STACK_ROOT = "${XDG_DATA_HOME}/stack"; + + # OPTIONS + HISTFILE = "${XDG_STATE_HOME}/bash/history"; + LESSHISTFILE = "-"; + GHCUP_USE_XDG_DIRS = "true"; + RIPGREP_CONFIG_PATH = "${XDG_CONFIG_HOME}/ripgrep/ripgreprc"; + ELECTRUMDIR = "${XDG_DATA_HOME}/electrum"; + VISUAL = "emacsclient -ca emacs"; + WGETRC = "${XDG_CONFIG_HOME}/wgetrc"; + XCOMPOSECACHE = "${XDG_CACHE_HOME}/X11/xcompose"; + "_JAVA_OPTIONS" = "-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java"; + DOCKER_CONFIG = "${XDG_CONFIG_HOME}/docker"; + + # NVIDIA + CUDA_CACHE_PATH = "${XDG_CACHE_HOME}/nv"; + + # Themes + # WEBKIT_DISABLE_COMPOSITING_MODE = "1"; + CALIBRE_USE_SYSTEM_THEME = "1"; + + PATH = [ + "\${HOME}/.local/bin" + "${XDG_CONFIG_HOME}/emacs/bin" + "${XDG_DATA_HOME}/npm/bin" + "${XDG_DATA_HOME}/pnpm" + ]; + + # needed for tensorflow + # CUDA_PATH = "${pkgs.cudatoolkit}"; + # # LD_LIBRARY_PATH = "${pkgs.linuxPackages.nvidia_x11}/lib:${pkgs.ncurses5}/lib"; + # EXTRA_LDFLAGS = "-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"; + # EXTRA_CCFLAGS = "-I/usr/include"; + }; + }; + + programs = { + starship.enable = true; + tmux.enable = true; + fzf.fuzzyCompletion = true; + neovim = { + enable = true; + vimAlias = true; + }; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + services = { + # minidlna = { + # enable = true; + # openFirewall = true; + # settings = { + # inotify = "yes"; + # media_dir = [ + # "/mnt/pool/glue" + # ]; + # }; + # }; + avahi = { + enable = true; + nssmdns = true; + }; + fstrim.enable = true; + smartd.enable = true; + btrfs.autoScrub = { + enable = true; + fileSystems = [ "/" "/mnt/pool" ]; + }; + openssh = { + enable = true; + openFirewall = true; + startWhenNeeded = true; + settings = { + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + }; }; - timers = let - streamTimer = { + }; + + systemd = { + packages = let + pkgs = import (builtins.fetchTarball { + url = + "https://github.com/NixOS/nixpkgs/archive/9957cd48326fe8dbd52fdc50dd2502307f188b0d.tar.gz"; + }) { }; + + myPkg = pkgs.qbittorrent-nox; + in [ myPkg ]; + services = { + "qbittorrent-nox@jawz" = { enable = true; - description = "monitors a stream channel for online streams."; - wantedBy = [ "timers.target" ]; - timerConfig = { - OnBootSec = "5min"; - OnUnitActiveSec = "65min"; - RandomizedDelaySec = 30; + overrideStrategy = "asDropin"; + wantedBy = [ "multi-user.target" ]; + }; + }; + timers = { }; + user = { + services = { + "stream@" = { + description = "monitors a stream channel for online streams."; + restartIfChanged = true; + wantedBy = [ "default.target" ]; + path = [ pkgs.nix jawzStream ]; + serviceConfig = { + Restart = "on-failure"; + RestartSec = 30; + ExecStart = "${jawzStream}/bin/stream-dl %I"; + }; + }; + # unpackerr = { + # enable = true; + # restartIfChanged = true; + # description = "Run unpackerr"; + # wantedBy = [ "default.target" ]; + # serviceConfig = { + # Restart = "on-failure"; + # RestartSec = 30; + # ExecStart = "${pkgs.unpackerr}/bin/unpackerr -c /home/jawz/.config/unpackerr.conf"; + # }; + # }; + manage-library = { + enable = true; + restartIfChanged = true; + description = "Run the manage library bash script"; + wantedBy = [ "default.target" ]; + path = [ pkgs.nix jawzManageLibrary ]; + serviceConfig = { + Restart = "on-failure"; + RestartSec = 30; + ExecStart = "${jawzManageLibrary}/bin/manage-library"; + }; + }; + tasks = { + restartIfChanged = true; + description = + "Run a tasks script which keeps a lot of things organized"; + wantedBy = [ "default.target" ]; + path = [ pkgs.nix jawzTasks ]; + serviceConfig = { + Restart = "on-failure"; + RestartSec = 30; + ExecStart = "${jawzTasks}/bin/tasks"; + }; + }; + qbit_manage = let qbit_dir = "/home/jawz/Development/Git/qbit_manage"; + in { + restartIfChanged = true; + description = "Tidy up my torrents"; + wantedBy = [ "default.target" ]; + path = [ pkgs.python3 pkgs.pipenv ]; + serviceConfig = { + Restart = "on-failure"; + RestartSec = 30; + ExecStart = + "${qbit_dir}/venv/bin/python3 ${qbit_dir}/qbit_manage.py -r -c ${qbit_dir}/config.yml"; + }; }; }; - in { - "stream@johnneal911" = streamTimer // { }; - "stream@uk2011boy" = streamTimer // { }; - "stream@tommy9x6" = streamTimer // { }; - "stream@brocollirob" = streamTimer // { }; - "stream@tomayto\\x20picarto" = streamTimer // { }; - tasks = { - enable = true; - description = "Run a tasks script which keeps a lot of things organized"; - wantedBy = [ "timers.target" ]; - timerConfig = { - OnCalendar = "*:0/10"; + timers = let + streamTimer = { + enable = true; + description = "monitors a stream channel for online streams."; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "5min"; + OnUnitActiveSec = "65min"; + RandomizedDelaySec = 30; + }; }; - }; - manage-library = { - enable = true; - description = "Run the manage library bash script"; - wantedBy = [ "timers.target" ]; - timerConfig = { - OnCalendar = "00:30"; + in { + "stream@johnneal911" = streamTimer // { }; + "stream@uk2011boy" = streamTimer // { }; + "stream@tommy9x6" = streamTimer // { }; + "stream@brocollirob" = streamTimer // { }; + "stream@tomayto\\x20picarto" = streamTimer // { }; + tasks = { + enable = true; + description = + "Run a tasks script which keeps a lot of things organized"; + wantedBy = [ "timers.target" ]; + timerConfig = { OnCalendar = "*:0/10"; }; }; - }; - qbit_manage = { - enable = true; - description = "Tidy up my torrents"; - wantedBy = [ "timers.target" ]; - timerConfig = { - OnCalendar = "*:0/10"; + manage-library = { + enable = true; + description = "Run the manage library bash script"; + wantedBy = [ "timers.target" ]; + timerConfig = { OnCalendar = "00:30"; }; + }; + qbit_manage = { + enable = true; + description = "Tidy up my torrents"; + wantedBy = [ "timers.target" ]; + timerConfig = { OnCalendar = "*:0/10"; }; }; }; }; }; -}; -fonts.fontconfig.enable = true; + fonts.fontconfig.enable = true; -hardware = { - cpu.intel.updateMicrocode = lib.mkDefault true; - opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; + hardware = { + cpu.intel.updateMicrocode = lib.mkDefault true; + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; }; -}; } diff --git a/hosts/server/configuration.nix b/hosts/server/configuration.nix index ab20c98..2c79969 100644 --- a/hosts/server/configuration.nix +++ b/hosts/server/configuration.nix @@ -9,49 +9,47 @@ let "https://github.com/nix-community/home-manager/archive/release-${version}.tar.gz"; unstable = import (builtins.fetchTarball "https://github.com/nixos/nixpkgs/tarball/master") { - config = config.nixpkgs.config; - }; - jawzManageLibrary = pkgs.writeScriptBin - "manage-library" (builtins.readFile ../scripts/manage-library.sh); - jawzTasks = pkgs.writeScriptBin - "tasks" (builtins.readFile ../scripts/tasks.sh); - jawzSubs = pkgs.writeScriptBin - "sub-sync" (builtins.readFile ../scripts/sub-sync.sh); - jawzStream = pkgs.writeScriptBin - "stream-dl" (builtins.readFile ../scripts/stream-dl.sh); -in -{ # Remember to close this bracket at the end of the document + config = config.nixpkgs.config; + }; + jawzManageLibrary = pkgs.writeScriptBin "manage-library" + (builtins.readFile ../scripts/manage-library.sh); + jawzTasks = + pkgs.writeScriptBin "tasks" (builtins.readFile ../scripts/tasks.sh); + jawzSubs = + pkgs.writeScriptBin "sub-sync" (builtins.readFile ../scripts/sub-sync.sh); + jawzStream = + pkgs.writeScriptBin "stream-dl" (builtins.readFile ../scripts/stream-dl.sh); +in { # Remember to close this bracket at the end of the document -imports = [ - ./fstab.nix - ./servers.nix - ./docker.nix - # ./mail.nix - # ./openldap.nix - # - (import "${home-manager}/nixos") -]; + imports = [ + ./fstab.nix + ./servers.nix + ./docker.nix + # ./mail.nix + # ./openldap.nix + # + (import "${home-manager}/nixos") + ]; -powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; -networking = { - useDHCP = lib.mkDefault true; - enableIPv6 = false; - hostName = "server"; - networkmanager.enable = true; - extraHosts = '' - 192.168.1.64 workstation - 192.168.1.100 miniserver - ''; - firewall = let - open_firewall_ports = [ - 6969 # HentaiAtHome - 51413 # torrent sedding - 9091 # qbittorrent - 2049 # nfs - ]; - open_firewall_port_ranges = [ ]; - in - { + powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; + networking = { + useDHCP = lib.mkDefault true; + enableIPv6 = false; + hostName = "server"; + networkmanager.enable = true; + extraHosts = '' + 192.168.1.64 workstation + 192.168.1.100 miniserver + ''; + firewall = let + open_firewall_ports = [ + 6969 # HentaiAtHome + 51413 # torrent sedding + 9091 # qbittorrent + 2049 # nfs + ]; + open_firewall_port_ranges = [ ]; + in { enable = true; allowPing = true; allowedTCPPorts = open_firewall_ports; @@ -59,26 +57,25 @@ networking = { allowedTCPPortRanges = open_firewall_port_ranges; allowedUDPPortRanges = open_firewall_port_ranges; }; -}; - -time.timeZone = "America/Mexico_City"; -i18n = { - defaultLocale = "en_CA.UTF-8"; - extraLocaleSettings = { - LC_MONETARY = "es_MX.UTF-8"; }; -}; -console = { - font = "Lat2-Terminus16"; - keyMap = "us"; - # useXkbConfig = true; # use xkbOptions in tty. -}; -system = { - copySystemConfiguration = true; - stateVersion = "${version}"; -}; -nix = let featuresList = [ + time.timeZone = "America/Mexico_City"; + i18n = { + defaultLocale = "en_CA.UTF-8"; + extraLocaleSettings = { LC_MONETARY = "es_MX.UTF-8"; }; + }; + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + # useXkbConfig = true; # use xkbOptions in tty. + }; + + system = { + copySystemConfiguration = true; + stateVersion = "${version}"; + }; + nix = let + featuresList = [ "nixos-test" "benchmark" "big-parallel" @@ -86,631 +83,633 @@ nix = let featuresList = [ "gccarch-${cpuArchitecture}" "gccarch-znver3" ]; - in - { - gc = { - automatic = true; - dates = "weekly"; - }; - buildMachines = [ { + in { + gc = { + automatic = true; + dates = "weekly"; + }; + buildMachines = [{ hostName = "workstation"; system = "x86_64-linux"; sshUser = "nixremote"; maxJobs = 14; speedFactor = 1; supportedFeatures = featuresList; - } ]; - distributedBuilds = true; - settings = { - cores = 6; - auto-optimise-store = true; - trusted-users = [ "nixremote" ]; - system-features = featuresList; - substituters = [ - "https://nix-gaming.cachix.org" - "https://nixpkgs-python.cachix.org" - "https://devenv.cachix.org" - "https://cuda-maintainers.cachix.org" - ]; - trusted-public-keys = [ - "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" - "nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU=" - "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" - "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" - ]; - }; -}; - -security = { - acme = { - acceptTerms = true; - defaults.email = myEmail; - }; - rtkit.enable = true; - sudo = { - enable = true; - wheelNeedsPassword = false; - }; - pam.loginLimits = [{ - domain = "*"; - type = "soft"; - item = "nofile"; - value = "8192"; - }]; -}; - -nixpkgs = { - hostPlatform = lib.mkDefault "x86_64-linux"; - config = { - allowUnfree = true; - permittedInsecurePackages = [ - "openssl-1.1.1w" - ]; - }; - # localSystem = { - # gcc.arch = cpuArchitecture; - # gcc.tune = cpuArchitecture; - # system = "x86_64-linux"; - # }; -}; - -users = { - groups.nixremote = { - name = "nixremote"; - gid = 555; - }; - users.nixremote = { - isNormalUser = true; - createHome = true; - group = "nixremote"; - home = "/var/nixremote/"; - openssh.authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICiyTwryzw8CblPldplDpVUkXD9C1fXVgO8LeXdE5cuR root@workstation" - ]; - }; -}; -users.users.jawz = { - isNormalUser = true; - extraGroups = [ "wheel" "networkmanager" "docker" - "scanner" "lp" "piracy" "kavita" - "render" "video" - ]; - initialPassword = "password"; - openssh = { - authorizedKeys.keys = [ - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB5GaQM4N+yGAByibOFQOBVMV/6TjOfaGIP+NunMiK76 gpodeacero\cdreyes@100CDREYES" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH2wtsaMvfEUm//2YnFHyrc16o+TOXXBfIGPJ9nL8RMp jawz@workstation" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBEblxSDhWPEo33crSjooeUg4W02ruENxHLmmBqCuIo jawz@galaxy" - ]; - }; - -packages = (with pkgs; [ - -hunspell -hunspellDicts.it_IT -hunspellDicts.es_MX -hunspellDicts.en_CA - -symbola - -unstable.yt-dlp # downloads videos from most video websites -unstable.gallery-dl # similar to yt-dlp but for most image gallery websites - -fd # modern find, faster searches -fzf # fuzzy finder! super cool and useful -gdu # disk-space utility, somewhat useful -du-dust # rusty du -trash-cli # oop! didn't meant to delete that -eza # like ls but with colors -rmlint # probably my favourite app, amazing dupe finder that integrates well with BTRFS -smartmontools # check hard drie health - -jawzManageLibrary -jawzTasks -jawzSubs -jawzStream -(writeScriptBin "ffmpeg4discord" (builtins.readFile ../scripts/ffmpeg4discord.py)) -(writeScriptBin "ffmpreg" (builtins.readFile ../scripts/ffmpreg.sh)) -(writeScriptBin "split-dir" (builtins.readFile ../scripts/split-dir.sh)) -(writeScriptBin "pika-list" (builtins.readFile ../scripts/pika-list.sh)) -(writeScriptBin "run" (builtins.readFile ../scripts/run.sh)) -(writeScriptBin "find-dup-episodes" (builtins.readFile ../scripts/find-dup-episodes.sh)) - -tldr # man for retards - -# SH -bats # testing system, required by Exercism -bashdb # autocomplete -shellcheck # linting -shfmt # a shell parser and formatter - -# NIX -expect # keep color when nom'ing -nix-output-monitor # autistic nix builds -nixfmt # linting -cachix # why spend time compiling? - -# PYTHON. -(python3.withPackages (ps: with ps; [ - flake8 # wraper for pyflakes, pycodestyle and mccabe - isort # sort Python imports - nose # testing and running python scripts - pyflakes # checks source code for errors - pytest # framework for writing tests - speedtest-cli # check internet speed from the comand line - editorconfig # follow rules of contributin - black # Python code formatter - pylint # bug and style checker for python -])) # base language - -]) ++ (with pkgs.python3Packages; [ -(buildPythonApplication rec { - pname = "download"; - version = "1.5"; - src = ../scripts/download/.; - doCheck = false; - buildInputs = [ setuptools ]; - propagatedBuildInputs = - [ pyyaml types-pyyaml ]; -}) -(buildPythonApplication rec { - pname = "ffpb"; - version = "0.4.1"; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-7eVqbLpMHS1sBw2vYS4cTtyVdnnknGtEI8190VlXflk="; - }; - doCheck = false; - buildInputs = [ setuptools ]; - propagatedBuildInputs = - [ tqdm ]; -}) -# (buildPythonApplication rec { -# pname = "qbit_manage"; -# version = "4.0.3"; -# src = fetchPypi { -# inherit pname version; -# sha256 = "sha256-7eVqbLpMHS1sBw2vYS4cTtyVdnnknGtEI8190VlXflk="; -# }; -# doCheck = true; -# buildInputs = [ setuptools ]; -# propagatedBuildInputs = -# [ gitpython requests retrying ruamel-yaml schedule unstable.qbittorrent-api ]; -# }) - -]) ++ (with pkgs.nodePackages; [ - # Language servers - dockerfile-language-server-nodejs - yaml-language-server - bash-language-server - vscode-json-languageserver - pyright - - markdownlint-cli # Linter - prettier # Linter - pnpm # Package manager - -]); }; # <--- end of package list - -home-manager = { - useUserPackages = true; - useGlobalPkgs = true; - users.jawz = { config, pkgs, ... }:{ - home.stateVersion = "${version}"; - -programs.bash = { - enable = true; - historyFile = "\${XDG_STATE_HOME}/bash/history"; - historyControl = [ "erasedups" "ignorespace" ]; - shellAliases = { - hh = "hstr"; - ls = "eza --icons --group-directories-first"; - edit = "emacsclient -t"; - comic = "download -u jawz -i \"$(cat $LC | fzf --multi --exact -i)\""; - gallery = "download -u jawz -i \"$(cat $LW | fzf --multi --exact -i)\""; - cp = "cp -i"; - mv = "mv -i"; - mkcd = "mkdir -pv \"$1\" && cd \"$1\" || exit"; - mkdir = "mkdir -p"; - rm = "trash"; - ".." = "cd .."; - "..." = "cd ../.."; - ".3" = "cd ../../.."; - ".4" = "cd ../../../.."; - ".5" = "cd ../../../../.."; - dl = "download -u jawz -i"; - e = "edit"; - c = "cat"; - f = "fzf --multi --exact -i"; - sc = "systemctl --user"; - jc = "journalctl --user -xefu"; - open-gallery = "cd /mnt/pool/scrapping/JawZ/gallery-dl && - xdg-open $(fd . ./ Husbands -tdirectory -d 1 | fzf -i)\""; - unique-extensions = "fd -tf | rev | cut -d. -f1 | rev | - tr '[:upper:]' '[:lower:]' | sort | - uniq --count | sort -rn"; - }; - enableVteIntegration = true; - initExtra = '' - $HOME/.local/bin/pokemon-colorscripts -r --no-title - # Lists - list_root="${config.xdg.configHome}"/jawz/lists/jawz - export LW=$list_root/watch.txt - export LI=$list_root/instant.txt - export LC=$list_root/comic.txt - export command_timeout=30 - - if command -v fzf-share >/dev/null; then - source "$(fzf-share)/key-bindings.bash" - source "$(fzf-share)/completion.bash" - fi - - nixos-reload () { - nixfmt /home/jawz/Development/NixOS/server/*.nix - sudo unbuffer nixos-rebuild switch -I nixos-config=/home/jawz/Development/NixOS/server/configuration.nix |& nom - } - ''; -}; - -xdg = { - enable = true; - userDirs = { - enable = true; - createDirectories = false; - desktop = "${config.home.homeDirectory}"; - documents = "${config.home.homeDirectory}/Documents"; - download = "${config.home.homeDirectory}/Downloads"; - music = "${config.home.homeDirectory}/Music"; - pictures = "${config.home.homeDirectory}/Pictures"; - templates = "${config.xdg.dataHome}/Templates"; - videos = "${config.home.homeDirectory}/Videos"; - }; - configFile = { - "wgetrc".source = ../dotfiles/wget/wgetrc; - "configstore/update-notifier-npm-check.json".source = ../dotfiles/npm/update-notifier-npm-check.json; - "npm/npmrc".source = ../dotfiles/npm/npmrc; - "gallery-dl/config.json".source = ../dotfiles/gallery-dl/config.json; - "htop/htoprc".source = ../dotfiles/htop/htoprc; - "python/pythonrc".source = ../dotfiles/pythonrc; - }; -}; - -programs = { - helix = { - enable = true; - }; - hstr.enable = true; - emacs.enable = true; - direnv = { - enable = true; - enableBashIntegration = true; - nix-direnv.enable = true; - }; - bat = { - enable = true; - config = { - pager = "less -FR"; - theme = "base16"; - }; - extraPackages = with pkgs.bat-extras; [ - batman # man pages - batpipe # piping - batgrep # ripgrep - batdiff # this is getting crazy! - batwatch # probably my next best friend - prettybat # trans your sourcecode! - ]; - }; - git = { - enable = true; - userName = "${myName}"; - userEmail = "${myEmail}"; - }; - htop = { - enable = true; - package = pkgs.htop-vim; - }; -}; - -services = { - lorri.enable = true; - emacs = { - enable = true; - defaultEditor = true; - package = pkgs.emacs; - startWithUserSession = "graphical"; - }; -}; - -}; }; - -environment = { - systemPackages = with pkgs; [ - wget - jellyfin-ffmpeg # coolest video converter! - mediainfo - dlib - fd - ripgrep - ]; - variables = rec { - # PATH - XDG_CACHE_HOME = "\${HOME}/.cache"; - XDG_CONFIG_HOME = "\${HOME}/.config"; - XDG_BIN_HOME = "\${HOME}/.local/bin"; - XDG_DATA_HOME = "\${HOME}/.local/share"; - XDG_STATE_HOME = "\${HOME}/.local/state"; - - # DEV PATH - CABAL_DIR = "${XDG_CACHE_HOME}/cabal"; - CARGO_HOME = "${XDG_DATA_HOME}/cargo"; - GEM_HOME = "${XDG_DATA_HOME}/ruby/gems"; - GEM_PATH = "${XDG_DATA_HOME}/ruby/gems"; - GEM_SPEC_CACHE = "${XDG_DATA_HOME}/ruby/specs"; - GOPATH = "${XDG_DATA_HOME}/go"; - NPM_CONFIG_USERCONFIG = "${XDG_CONFIG_HOME}/npm/npmrc"; - PNPM_HOME = "${XDG_DATA_HOME}/pnpm"; - PSQL_HISTORY="${XDG_DATA_HOME}/psql_history"; - REDISCLI_HISTFILE="${XDG_DATA_HOME}/redis/rediscli_history"; - WINEPREFIX="${XDG_DATA_HOME}/wine"; - PYTHONSTARTUP="${XDG_CONFIG_HOME}/python/pythonrc"; - STACK_ROOT="${XDG_DATA_HOME}/stack"; - - # OPTIONS - HISTFILE = "${XDG_STATE_HOME}/bash/history"; - LESSHISTFILE = "-"; - GHCUP_USE_XDG_DIRS = "true"; - RIPGREP_CONFIG_PATH = "${XDG_CONFIG_HOME}/ripgrep/ripgreprc"; - ELECTRUMDIR = "${XDG_DATA_HOME}/electrum"; - VISUAL = "emacsclient -ca emacs"; - WGETRC = "${XDG_CONFIG_HOME}/wgetrc"; - XCOMPOSECACHE = "${XDG_CACHE_HOME}/X11/xcompose"; - "_JAVA_OPTIONS" = "-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java"; - DOCKER_CONFIG="${XDG_CONFIG_HOME}/docker"; - - # NVIDIA - CUDA_CACHE_PATH = "${XDG_CACHE_HOME}/nv"; - - # Themes - # WEBKIT_DISABLE_COMPOSITING_MODE = "1"; - CALIBRE_USE_SYSTEM_THEME = "1"; - - PATH = [ - "\${HOME}/.local/bin" - "\${XDG_CONFIG_HOME}/emacs/bin" - "\${XDG_DATA_HOME}/npm/bin" - "\${XDG_DATA_HOME}/pnpm" - ]; - - # needed for tensorflow - # CUDA_PATH = "${pkgs.cudatoolkit}"; - # # LD_LIBRARY_PATH = "${pkgs.linuxPackages.nvidia_x11}/lib:${pkgs.ncurses5}/lib"; - # EXTRA_LDFLAGS = "-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"; - # EXTRA_CCFLAGS = "-I/usr/include"; - }; -}; - -programs = { - starship.enable = true; - tmux.enable = true; - fzf.fuzzyCompletion = true; - neovim = { - enable = true; - vimAlias = true; - }; - gnupg.agent = { - enable = true; - enableSSHSupport = true; - }; -}; - -services = { - minidlna = { - enable = true; - openFirewall = true; + }]; + distributedBuilds = true; settings = { - inotify = "yes"; - media_dir = [ - "/mnt/pool/glue" + cores = 6; + auto-optimise-store = true; + trusted-users = [ "nixremote" ]; + system-features = featuresList; + substituters = [ + "https://nix-gaming.cachix.org" + "https://nixpkgs-python.cachix.org" + "https://devenv.cachix.org" + "https://cuda-maintainers.cachix.org" + ]; + trusted-public-keys = [ + "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" + "nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU=" + "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" + "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" ]; }; }; - avahi = { - enable = true; - nssmdns = true; + + security = { + acme = { + acceptTerms = true; + defaults.email = myEmail; + }; + rtkit.enable = true; + sudo = { + enable = true; + wheelNeedsPassword = false; + }; + pam.loginLimits = [{ + domain = "*"; + type = "soft"; + item = "nofile"; + value = "8192"; + }]; }; - fstrim.enable = true; - smartd.enable = true; - btrfs.autoScrub = { - enable = true; - fileSystems = [ - "/" - "/mnt/pool" + + nixpkgs = { + hostPlatform = lib.mkDefault "x86_64-linux"; + config = { + allowUnfree = true; + permittedInsecurePackages = [ "openssl-1.1.1w" ]; + }; + # localSystem = { + # gcc.arch = cpuArchitecture; + # gcc.tune = cpuArchitecture; + # system = "x86_64-linux"; + # }; + }; + + users = { + groups.nixremote = { + name = "nixremote"; + gid = 555; + }; + users.nixremote = { + isNormalUser = true; + createHome = true; + group = "nixremote"; + home = "/var/nixremote/"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICiyTwryzw8CblPldplDpVUkXD9C1fXVgO8LeXdE5cuR root@workstation" + ]; + }; + }; + users.users.jawz = { + isNormalUser = true; + extraGroups = [ + "wheel" + "networkmanager" + "docker" + "scanner" + "lp" + "piracy" + "kavita" + "render" + "video" ]; - }; - openssh = { - enable = true; - openFirewall = true; - startWhenNeeded = true; - settings = { - PasswordAuthentication = false; - KbdInteractiveAuthentication = false; + initialPassword = "password"; + openssh = { + authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB5GaQM4N+yGAByibOFQOBVMV/6TjOfaGIP+NunMiK76 gpodeacerocdreyes@100CDREYES" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH2wtsaMvfEUm//2YnFHyrc16o+TOXXBfIGPJ9nL8RMp jawz@workstation" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBEblxSDhWPEo33crSjooeUg4W02ruENxHLmmBqCuIo jawz@galaxy" + ]; }; - }; -}; -systemd = { - packages = let - pkgs = import (builtins.fetchTarball { - url = "https://github.com/NixOS/nixpkgs/archive/9957cd48326fe8dbd52fdc50dd2502307f188b0d.tar.gz"; - }) {}; + packages = (with pkgs; [ - myPkg = pkgs.qbittorrent-nox; -in [ myPkg ]; - services = { - # "qbittorrent-nox@jawz" = { - # enable = true; - # overrideStrategy = "asDropin"; - # wantedBy = [ "multi-user.target" ]; - # }; - # sub-sync = { - # restartIfChanged = true; - # description = "syncronizes subtitles downloaded & modified today"; - # wantedBy = [ "default.target" ]; - # path = [ - # pkgs.bash - # pkgs.nix - # jawzSubs - # ]; - # serviceConfig = { - # Restart = "on-failure"; - # RestartSec = 30; - # ExecStart = "${jawzSubs}/bin/sub-sync all"; - # Type = "forking"; - # User = "root"; - # }; - # }; - }; - timers = { - # sub-sync = { - # enable = true; - # description = "syncronizes subtitles downloaded & modified today"; - # wantedBy = [ "timers.target" ]; - # timerConfig = { - # OnCalendar = "22:00"; - # }; - # }; - }; - user = { - services = { - "stream@" = { - description = "monitors a stream channel for online streams."; - restartIfChanged = true; - wantedBy = [ "default.target" ]; - path = [ - pkgs.nix - jawzStream - ]; - serviceConfig = { - Restart = "on-failure"; - RestartSec = 30; - ExecStart = "${jawzStream}/bin/stream-dl %I"; + hunspell + hunspellDicts.it_IT + hunspellDicts.es_MX + hunspellDicts.en_CA + + symbola + + unstable.yt-dlp # downloads videos from most video websites + unstable.gallery-dl # similar to yt-dlp but for most image gallery websites + + fd # modern find, faster searches + fzf # fuzzy finder! super cool and useful + gdu # disk-space utility, somewhat useful + du-dust # rusty du + trash-cli # oop! didn't meant to delete that + eza # like ls but with colors + rmlint # probably my favourite app, amazing dupe finder that integrates well with BTRFS + smartmontools # check hard drie health + + jawzManageLibrary + jawzTasks + jawzSubs + jawzStream + (writeScriptBin "ffmpeg4discord" + (builtins.readFile ../scripts/ffmpeg4discord.py)) + (writeScriptBin "ffmpreg" (builtins.readFile ../scripts/ffmpreg.sh)) + (writeScriptBin "split-dir" (builtins.readFile ../scripts/split-dir.sh)) + (writeScriptBin "pika-list" (builtins.readFile ../scripts/pika-list.sh)) + (writeScriptBin "run" (builtins.readFile ../scripts/run.sh)) + (writeScriptBin "find-dup-episodes" + (builtins.readFile ../scripts/find-dup-episodes.sh)) + + tldr # man for retards + + # SH + bats # testing system, required by Exercism + bashdb # autocomplete + shellcheck # linting + shfmt # a shell parser and formatter + + # NIX + expect # keep color when nom'ing + nix-output-monitor # autistic nix builds + nixfmt # linting + cachix # why spend time compiling? + + # PYTHON. + (python3.withPackages (ps: + with ps; [ + flake8 # wraper for pyflakes, pycodestyle and mccabe + isort # sort Python imports + nose # testing and running python scripts + pyflakes # checks source code for errors + pytest # framework for writing tests + speedtest-cli # check internet speed from the comand line + editorconfig # follow rules of contributin + black # Python code formatter + pylint # bug and style checker for python + ])) # base language + + ]) ++ (with pkgs.python3Packages; [ + (buildPythonApplication rec { + pname = "download"; + version = "1.5"; + src = ../scripts/download/.; + doCheck = false; + buildInputs = [ setuptools ]; + propagatedBuildInputs = [ pyyaml types-pyyaml ]; + }) + (buildPythonApplication rec { + pname = "ffpb"; + version = "0.4.1"; + src = fetchPypi { + inherit pname version; + sha256 = "sha256-7eVqbLpMHS1sBw2vYS4cTtyVdnnknGtEI8190VlXflk="; }; - }; - # unpackerr = { - # enable = true; - # restartIfChanged = true; - # description = "Run unpackerr"; - # wantedBy = [ "default.target" ]; - # serviceConfig = { - # Restart = "on-failure"; - # RestartSec = 30; - # ExecStart = "${pkgs.unpackerr}/bin/unpackerr -c /home/jawz/.config/unpackerr.conf"; + doCheck = false; + buildInputs = [ setuptools ]; + propagatedBuildInputs = [ tqdm ]; + }) + # (buildPythonApplication rec { + # pname = "qbit_manage"; + # version = "4.0.3"; + # src = fetchPypi { + # inherit pname version; + # sha256 = "sha256-7eVqbLpMHS1sBw2vYS4cTtyVdnnknGtEI8190VlXflk="; # }; - # }; - # manage-library = { - # enable = true; - # restartIfChanged = true; - # description = "Run the manage library bash script"; - # wantedBy = [ "default.target" ]; - # path = [ - # pkgs.bash - # pkgs.nix - # jawzManageLibrary - # ]; - # serviceConfig = { - # Restart = "on-failure"; - # RestartSec = 30; - # ExecStart = "${jawzManageLibrary}/bin/manage-library"; - # }; - # }; - # tasks = { - # restartIfChanged = true; - # description = "Run a tasks script which keeps a lot of things organized"; - # wantedBy = [ "default.target" ]; - # path = [ - # pkgs.bash - # pkgs.nix - # jawzTasks - # ]; - # serviceConfig = { - # Restart = "on-failure"; - # RestartSec = 30; - # ExecStart = "${jawzTasks}/bin/tasks"; - # }; - # }; - # qbit_manage = let qbit_dir = "/home/jawz/Development/Git/qbit_manage"; in { - # restartIfChanged = true; - # description = "Tidy up my torrents"; - # wantedBy = [ "default.target" ]; - # path = [ - # pkgs.python3 - # pkgs.pipenv - # ]; - # serviceConfig = { - # Restart = "on-failure"; - # RestartSec = 30; - # ExecStart = "${qbit_dir}/.venv/bin/python3 ${qbit_dir}/qbit_manage.py -r -c ${qbit_dir}/config.yml"; - # }; - # }; - }; - timers = let - streamTimer = { + # doCheck = true; + # buildInputs = [ setuptools ]; + # propagatedBuildInputs = + # [ gitpython requests retrying ruamel-yaml schedule unstable.qbittorrent-api ]; + # }) + + ]) ++ (with pkgs.nodePackages; [ + # Language servers + dockerfile-language-server-nodejs + yaml-language-server + bash-language-server + vscode-json-languageserver + pyright + + markdownlint-cli # Linter + prettier # Linter + pnpm # Package manager + + ]); + }; # <--- end of package list + + home-manager = { + useUserPackages = true; + useGlobalPkgs = true; + users.jawz = { config, pkgs, ... }: { + home.stateVersion = "${version}"; + + programs.bash = { enable = true; - description = "monitors a stream channel for online streams."; - wantedBy = [ "timers.target" ]; - timerConfig = { - OnBootSec = "5min"; - OnUnitActiveSec = "65min"; - RandomizedDelaySec = 30; + historyFile = "\${XDG_STATE_HOME}/bash/history"; + historyControl = [ "erasedups" "ignorespace" ]; + shellAliases = { + hh = "hstr"; + ls = "eza --icons --group-directories-first"; + edit = "emacsclient -t"; + comic = ''download -u jawz -i "$(cat $LC | fzf --multi --exact -i)"''; + gallery = + ''download -u jawz -i "$(cat $LW | fzf --multi --exact -i)"''; + cp = "cp -i"; + mv = "mv -i"; + mkcd = ''mkdir -pv "$1" && cd "$1" || exit''; + mkdir = "mkdir -p"; + rm = "trash"; + ".." = "cd .."; + "..." = "cd ../.."; + ".3" = "cd ../../.."; + ".4" = "cd ../../../.."; + ".5" = "cd ../../../../.."; + dl = "download -u jawz -i"; + e = "edit"; + c = "cat"; + f = "fzf --multi --exact -i"; + sc = "systemctl --user"; + jc = "journalctl --user -xefu"; + open-gallery = '' + cd /mnt/pool/scrapping/JawZ/gallery-dl && + xdg-open $(fd . ./ Husbands -tdirectory -d 1 | fzf -i)"''; + unique-extensions = '' + fd -tf | rev | cut -d. -f1 | rev | + tr '[:upper:]' '[:lower:]' | sort | + uniq --count | sort -rn''; + }; + enableVteIntegration = true; + initExtra = '' + $HOME/.local/bin/pokemon-colorscripts -r --no-title + # Lists + list_root="${config.xdg.configHome}"/jawz/lists/jawz + export LW=$list_root/watch.txt + export LI=$list_root/instant.txt + export LC=$list_root/comic.txt + export command_timeout=30 + + if command -v fzf-share >/dev/null; then + source "$(fzf-share)/key-bindings.bash" + source "$(fzf-share)/completion.bash" + fi + + nixos-reload () { + nixfmt /home/jawz/Development/NixOS/server/*.nix + sudo unbuffer nixos-rebuild switch -I nixos-config=/home/jawz/Development/NixOS/server/configuration.nix |& nom + } + ''; + }; + + xdg = { + enable = true; + userDirs = { + enable = true; + createDirectories = false; + desktop = "${config.home.homeDirectory}"; + documents = "${config.home.homeDirectory}/Documents"; + download = "${config.home.homeDirectory}/Downloads"; + music = "${config.home.homeDirectory}/Music"; + pictures = "${config.home.homeDirectory}/Pictures"; + templates = "${config.xdg.dataHome}/Templates"; + videos = "${config.home.homeDirectory}/Videos"; + }; + configFile = { + "wgetrc".source = ../dotfiles/wget/wgetrc; + "configstore/update-notifier-npm-check.json".source = + ../dotfiles/npm/update-notifier-npm-check.json; + "npm/npmrc".source = ../dotfiles/npm/npmrc; + "gallery-dl/config.json".source = ../dotfiles/gallery-dl/config.json; + "htop/htoprc".source = ../dotfiles/htop/htoprc; + "python/pythonrc".source = ../dotfiles/pythonrc; }; }; - in { - "stream@johnneal911" = streamTimer // { }; - "stream@uk2011boy" = streamTimer // { }; - "stream@tomayto\\x20picarto" = streamTimer // { }; - "stream@retrohurricaneLIVE\\x20picarto" = streamTimer // { }; - # tasks = { + + programs = { + helix = { enable = true; }; + hstr.enable = true; + emacs.enable = true; + direnv = { + enable = true; + enableBashIntegration = true; + nix-direnv.enable = true; + }; + bat = { + enable = true; + config = { + pager = "less -FR"; + theme = "base16"; + }; + extraPackages = with pkgs.bat-extras; [ + batman # man pages + batpipe # piping + batgrep # ripgrep + batdiff # this is getting crazy! + batwatch # probably my next best friend + prettybat # trans your sourcecode! + ]; + }; + git = { + enable = true; + userName = "${myName}"; + userEmail = "${myEmail}"; + }; + htop = { + enable = true; + package = pkgs.htop-vim; + }; + }; + + services = { + lorri.enable = true; + emacs = { + enable = true; + defaultEditor = true; + package = pkgs.emacs; + startWithUserSession = "graphical"; + }; + }; + + }; + }; + + environment = { + systemPackages = with pkgs; [ + wget + jellyfin-ffmpeg # coolest video converter! + mediainfo + dlib + fd + ripgrep + ]; + variables = rec { + # PATH + XDG_CACHE_HOME = "\${HOME}/.cache"; + XDG_CONFIG_HOME = "\${HOME}/.config"; + XDG_BIN_HOME = "\${HOME}/.local/bin"; + XDG_DATA_HOME = "\${HOME}/.local/share"; + XDG_STATE_HOME = "\${HOME}/.local/state"; + + # DEV PATH + CABAL_DIR = "${XDG_CACHE_HOME}/cabal"; + CARGO_HOME = "${XDG_DATA_HOME}/cargo"; + GEM_HOME = "${XDG_DATA_HOME}/ruby/gems"; + GEM_PATH = "${XDG_DATA_HOME}/ruby/gems"; + GEM_SPEC_CACHE = "${XDG_DATA_HOME}/ruby/specs"; + GOPATH = "${XDG_DATA_HOME}/go"; + NPM_CONFIG_USERCONFIG = "${XDG_CONFIG_HOME}/npm/npmrc"; + PNPM_HOME = "${XDG_DATA_HOME}/pnpm"; + PSQL_HISTORY = "${XDG_DATA_HOME}/psql_history"; + REDISCLI_HISTFILE = "${XDG_DATA_HOME}/redis/rediscli_history"; + WINEPREFIX = "${XDG_DATA_HOME}/wine"; + PYTHONSTARTUP = "${XDG_CONFIG_HOME}/python/pythonrc"; + STACK_ROOT = "${XDG_DATA_HOME}/stack"; + + # OPTIONS + HISTFILE = "${XDG_STATE_HOME}/bash/history"; + LESSHISTFILE = "-"; + GHCUP_USE_XDG_DIRS = "true"; + RIPGREP_CONFIG_PATH = "${XDG_CONFIG_HOME}/ripgrep/ripgreprc"; + ELECTRUMDIR = "${XDG_DATA_HOME}/electrum"; + VISUAL = "emacsclient -ca emacs"; + WGETRC = "${XDG_CONFIG_HOME}/wgetrc"; + XCOMPOSECACHE = "${XDG_CACHE_HOME}/X11/xcompose"; + "_JAVA_OPTIONS" = "-Djava.util.prefs.userRoot=${XDG_CONFIG_HOME}/java"; + DOCKER_CONFIG = "${XDG_CONFIG_HOME}/docker"; + + # NVIDIA + CUDA_CACHE_PATH = "${XDG_CACHE_HOME}/nv"; + + # Themes + # WEBKIT_DISABLE_COMPOSITING_MODE = "1"; + CALIBRE_USE_SYSTEM_THEME = "1"; + + PATH = [ + "\${HOME}/.local/bin" + "\${XDG_CONFIG_HOME}/emacs/bin" + "\${XDG_DATA_HOME}/npm/bin" + "\${XDG_DATA_HOME}/pnpm" + ]; + + # needed for tensorflow + # CUDA_PATH = "${pkgs.cudatoolkit}"; + # # LD_LIBRARY_PATH = "${pkgs.linuxPackages.nvidia_x11}/lib:${pkgs.ncurses5}/lib"; + # EXTRA_LDFLAGS = "-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"; + # EXTRA_CCFLAGS = "-I/usr/include"; + }; + }; + + programs = { + starship.enable = true; + tmux.enable = true; + fzf.fuzzyCompletion = true; + neovim = { + enable = true; + vimAlias = true; + }; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + }; + + services = { + minidlna = { + enable = true; + openFirewall = true; + settings = { + inotify = "yes"; + media_dir = [ "/mnt/pool/glue" ]; + }; + }; + avahi = { + enable = true; + nssmdns = true; + }; + fstrim.enable = true; + smartd.enable = true; + btrfs.autoScrub = { + enable = true; + fileSystems = [ "/" "/mnt/pool" ]; + }; + openssh = { + enable = true; + openFirewall = true; + startWhenNeeded = true; + settings = { + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + }; + }; + }; + + systemd = { + packages = let + pkgs = import (builtins.fetchTarball { + url = + "https://github.com/NixOS/nixpkgs/archive/9957cd48326fe8dbd52fdc50dd2502307f188b0d.tar.gz"; + }) { }; + + myPkg = pkgs.qbittorrent-nox; + in [ myPkg ]; + services = { + # "qbittorrent-nox@jawz" = { # enable = true; - # description = "Run a tasks script which keeps a lot of things organized"; - # wantedBy = [ "timers.target" ]; - # timerConfig = { - # OnCalendar = "*:0/10"; - # }; + # overrideStrategy = "asDropin"; + # wantedBy = [ "multi-user.target" ]; # }; - # manage-library = { - # enable = true; - # description = "Run the manage library bash script"; - # wantedBy = [ "timers.target" ]; - # timerConfig = { - # OnCalendar = "00:30"; - # }; - # }; - # qbit_manage = { - # enable = true; - # description = "Tidy up my torrents"; - # wantedBy = [ "timers.target" ]; - # timerConfig = { - # OnCalendar = "*:0/10"; + # sub-sync = { + # restartIfChanged = true; + # description = "syncronizes subtitles downloaded & modified today"; + # wantedBy = [ "default.target" ]; + # path = [ + # pkgs.bash + # pkgs.nix + # jawzSubs + # ]; + # serviceConfig = { + # Restart = "on-failure"; + # RestartSec = 30; + # ExecStart = "${jawzSubs}/bin/sub-sync all"; + # Type = "forking"; + # User = "root"; # }; # }; }; + timers = { + # sub-sync = { + # enable = true; + # description = "syncronizes subtitles downloaded & modified today"; + # wantedBy = [ "timers.target" ]; + # timerConfig = { + # OnCalendar = "22:00"; + # }; + # }; + }; + user = { + services = { + "stream@" = { + description = "monitors a stream channel for online streams."; + restartIfChanged = true; + wantedBy = [ "default.target" ]; + path = [ pkgs.nix jawzStream ]; + serviceConfig = { + Restart = "on-failure"; + RestartSec = 30; + ExecStart = "${jawzStream}/bin/stream-dl %I"; + }; + }; + # unpackerr = { + # enable = true; + # restartIfChanged = true; + # description = "Run unpackerr"; + # wantedBy = [ "default.target" ]; + # serviceConfig = { + # Restart = "on-failure"; + # RestartSec = 30; + # ExecStart = "${pkgs.unpackerr}/bin/unpackerr -c /home/jawz/.config/unpackerr.conf"; + # }; + # }; + # manage-library = { + # enable = true; + # restartIfChanged = true; + # description = "Run the manage library bash script"; + # wantedBy = [ "default.target" ]; + # path = [ + # pkgs.bash + # pkgs.nix + # jawzManageLibrary + # ]; + # serviceConfig = { + # Restart = "on-failure"; + # RestartSec = 30; + # ExecStart = "${jawzManageLibrary}/bin/manage-library"; + # }; + # }; + # tasks = { + # restartIfChanged = true; + # description = "Run a tasks script which keeps a lot of things organized"; + # wantedBy = [ "default.target" ]; + # path = [ + # pkgs.bash + # pkgs.nix + # jawzTasks + # ]; + # serviceConfig = { + # Restart = "on-failure"; + # RestartSec = 30; + # ExecStart = "${jawzTasks}/bin/tasks"; + # }; + # }; + # qbit_manage = let qbit_dir = "/home/jawz/Development/Git/qbit_manage"; in { + # restartIfChanged = true; + # description = "Tidy up my torrents"; + # wantedBy = [ "default.target" ]; + # path = [ + # pkgs.python3 + # pkgs.pipenv + # ]; + # serviceConfig = { + # Restart = "on-failure"; + # RestartSec = 30; + # ExecStart = "${qbit_dir}/.venv/bin/python3 ${qbit_dir}/qbit_manage.py -r -c ${qbit_dir}/config.yml"; + # }; + # }; + }; + timers = let + streamTimer = { + enable = true; + description = "monitors a stream channel for online streams."; + wantedBy = [ "timers.target" ]; + timerConfig = { + OnBootSec = "5min"; + OnUnitActiveSec = "65min"; + RandomizedDelaySec = 30; + }; + }; + in { + "stream@johnneal911" = streamTimer // { }; + "stream@uk2011boy" = streamTimer // { }; + "stream@tomayto\\x20picarto" = streamTimer // { }; + "stream@retrohurricaneLIVE\\x20picarto" = streamTimer // { }; + # tasks = { + # enable = true; + # description = "Run a tasks script which keeps a lot of things organized"; + # wantedBy = [ "timers.target" ]; + # timerConfig = { + # OnCalendar = "*:0/10"; + # }; + # }; + # manage-library = { + # enable = true; + # description = "Run the manage library bash script"; + # wantedBy = [ "timers.target" ]; + # timerConfig = { + # OnCalendar = "00:30"; + # }; + # }; + # qbit_manage = { + # enable = true; + # description = "Tidy up my torrents"; + # wantedBy = [ "timers.target" ]; + # timerConfig = { + # OnCalendar = "*:0/10"; + # }; + # }; + }; + }; }; -}; -fonts.fontconfig.enable = true; + fonts.fontconfig.enable = true; -hardware = { - nvidia = { - modesetting.enable = true; - powerManagement.enable = true; + hardware = { + nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + }; + cpu.intel.updateMicrocode = lib.mkDefault true; + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + }; }; - cpu.intel.updateMicrocode = lib.mkDefault true; - opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - }; -}; } diff --git a/hosts/workstation/configuration.nix b/hosts/workstation/configuration.nix index 6e20cc5..3b428cc 100644 --- a/hosts/workstation/configuration.nix +++ b/hosts/workstation/configuration.nix @@ -10,17 +10,31 @@ in { ./hardware-configuration.nix ../../base.nix ../../gnome.nix - ../../jawz.nix ../../home-manager/default.nix - ../../services/network.nix - ../../services/nvidia.nix - ../../services/printing.nix - ../../services/sound.nix - ../../services/systemd-user/tasks.nix - ../../modules/apps.nix - ../../modules/dev.nix + # ../../services/systemd-user/tasks.nix ]; - myGaming.enable = true; + my = { + apps = { + art.enable = true; + dictionaries.enable = true; + fonts.enable = true; + gaming.enable = true; + internet.enable = true; + office.enable = true; + }; + dev = { + haskell.enable = true; + nix.enable = true; + python.enable = true; + gameDev.enable = true; + }; + services = { + network.enable = true; + nvidia.enable = true; + printing.enable = true; + sound.enable = true; + }; + }; networking = { hostName = "workstation"; @@ -66,7 +80,6 @@ in { }; }; - nixpkgs.overlays = [ (import ../../overlays/blanket.nix) ]; users = { groups.nixremote.gid = 555; users = { diff --git a/lib/default.nix b/lib/default.nix deleted file mode 100644 index 9358660..0000000 --- a/lib/default.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ inputs }: -let - myLib = (import ./default.nix) { inherit inputs; }; - outputs = inputs.self.outputs; -in rec { - pkgsFor = sys: inputs.nixpkgs.legacyPackages.${sys}; - - # ========================== Buildables ========================== # - - mkSystem = config: - inputs.nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs outputs myLib; }; - modules = [ config outputs.nixosModules.default ]; - }; - - mkHome = sys: config: - inputs.home-manager.lib.homeManagerConfiguration { - pkgs = pkgsFor sys; - extraSpecialArgs = { inherit inputs myLib outputs; }; - modules = [ config outputs.homeManagerModules.default ]; - }; - - # =========================== Functions ============================ # - - filesIn = dir: - (map (fileName: dir + "/${fileName}") - (builtins.attrNames (builtins.readDir dir))); - - dirsIn = dir: - inputs.nixpkgs.lib.filterAttrs (name: value: value == "directory") - (builtins.readDir dir); - - fileNameOf = path: (builtins.head (builtins.split "\\." (baseNameOf path))); - - # ========================== Extenders =========================== # - - # Evaluates nixos/home-manager module and extends it's options / config - extendModule = { path, ... }@args: - { pkgs, ... }@margs: - let - eval = if (builtins.isString path) || (builtins.isPath path) then - import path margs - else - path margs; - evalNoImports = builtins.removeAttrs eval [ "imports" "options" ]; - - extra = if (builtins.hasAttr "extraOptions" args) - || (builtins.hasAttr "extraConfig" args) then - [ - ({ ... }: { - options = args.extraOptions or { }; - config = args.extraConfig or { }; - }) - ] - else - [ ]; - in { - imports = (eval.imports or [ ]) ++ extra; - - options = if builtins.hasAttr "optionsExtension" args then - (args.optionsExtension (eval.options or { })) - else - (eval.options or { }); - - config = if builtins.hasAttr "configExtension" args then - (args.configExtension (eval.config or evalNoImports)) - else - (eval.config or evalNoImports); - }; - - # Applies extendModules to all modules - # modules can be defined in the same way - # as regular imports, or taken from "filesIn" - extendModules = extension: modules: - map (f: - let name = fileNameOf f; - in (extendModule ((extension name) // { path = f; }))) modules; - - # ============================ Shell ============================= # - forAllSystems = pkgs: - inputs.nixpkgs.lib.genAttrs [ "x86_64-linux" ] - (system: pkgs inputs.nixpkgs.legacyPackages.${system}); -} diff --git a/modules/apps.nix b/modules/apps.nix index 1ccca13..2701304 100644 --- a/modules/apps.nix +++ b/modules/apps.nix @@ -9,11 +9,15 @@ ./apps/internet.nix ./apps/office.nix ]; - myArt.enable = lib.mkDefault false; - myGameDev.enable = lib.mkDefault false; - # myDictionaries.enable = lib.mkDefault false; - # myFonts.enable = lib.mkDefault false; - myGaming.enable = lib.mkDefault false; - # myInternet.enable = lib.mkDefault false; - # myOffice.enable = lib.mkDefault false; + my = { + dev.gameDev.enable = lib.mkDefault false; + apps = { + art.enable = lib.mkDefault false; + dictionaries.enable = lib.mkDefault false; + fonts.enable = lib.mkDefault false; + gaming.enable = lib.mkDefault false; + internet.enable = lib.mkDefault false; + office.enable = lib.mkDefault false; + }; + }; } diff --git a/modules/apps/art.nix b/modules/apps/art.nix index 8bf3565..e0e6c4d 100644 --- a/modules/apps/art.nix +++ b/modules/apps/art.nix @@ -1,11 +1,15 @@ { config, pkgs, lib, unstable, ... }: - -{ - options = { - myArt.enable = lib.mkEnableOption "enable"; - myGameDev.enable = lib.mkEnableOption "enable"; +let + unstable = import + (builtins.fetchTarball "https://github.com/nixos/nixpkgs/tarball/master") { + config = config.nixpkgs.config; + }; +in { + options.my = { + apps.art.enable = lib.mkEnableOption "enable"; + dev.gameDev.enable = lib.mkEnableOption "enable"; }; - config = lib.mkIf config.myArt.enable { + config = lib.mkIf config.my.apps.art.enable { users.users.jawz.packages = with pkgs; ([ gimp # the coolest bestest art program to never exist @@ -16,7 +20,7 @@ # drawpile # arty party with friends!! pureref # create inspiration/reference boards blender # cgi animation and sculpting - ]) ++ (if config.myGameDev.enable then [ + ]) ++ (if config.my.dev.gameDev.enable then [ godot_4 # game development unstable.gdtoolkit # gdscript language server ] else diff --git a/modules/apps/dictionaries.nix b/modules/apps/dictionaries.nix index d87728e..4972f2a 100644 --- a/modules/apps/dictionaries.nix +++ b/modules/apps/dictionaries.nix @@ -1,11 +1,14 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, unstable, ... }: { - users.users.jawz.packages = with pkgs; ([ - hunspell - hunspellDicts.it_IT - hunspellDicts.es_MX - hunspellDicts.es_ES - hunspellDicts.en_CA-large - ]); + options.my.apps.dictionaries.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.apps.dictionaries.enable { + users.users.jawz.packages = with pkgs; ([ + hunspell + hunspellDicts.it_IT + hunspellDicts.es_MX + hunspellDicts.es_ES + hunspellDicts.en_CA-large + ]); + }; } diff --git a/modules/apps/fonts.nix b/modules/apps/fonts.nix index 78990c9..842a16d 100644 --- a/modules/apps/fonts.nix +++ b/modules/apps/fonts.nix @@ -1,10 +1,13 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, unstable, ... }: { - users.users.jawz.packages = with pkgs; ([ - (nerdfonts.override { - fonts = [ "CascadiaCode" "ComicShannsMono" "Iosevka" ]; - }) - symbola - ]); + options.my.apps.fonts.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.apps.fonts.enable { + users.users.jawz.packages = with pkgs; ([ + (nerdfonts.override { + fonts = [ "CascadiaCode" "ComicShannsMono" "Iosevka" ]; + }) + symbola + ]); + }; } diff --git a/modules/apps/gaming.nix b/modules/apps/gaming.nix index 9a89718..eb7c54d 100644 --- a/modules/apps/gaming.nix +++ b/modules/apps/gaming.nix @@ -1,14 +1,12 @@ { config, pkgs, lib, ... }: { - options = { myGaming.enable = lib.mkEnableOption "enable"; }; - config = lib.mkIf config.myGaming.enable { - programs = { - steam = { - enable = true; - remotePlay.openFirewall = true; - dedicatedServer.openFirewall = true; - }; + options.my.apps.gaming.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.apps.gaming.enable { + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + dedicatedServer.openFirewall = true; }; users.users.jawz.packages = with pkgs; ([ (lutris.override { diff --git a/modules/apps/internet.nix b/modules/apps/internet.nix index 851b161..9873281 100644 --- a/modules/apps/internet.nix +++ b/modules/apps/internet.nix @@ -1,27 +1,30 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, unstable, ... }: { - programs = { - geary.enable = true; - firefox = { - enable = true; - languagePacks = [ "en-CA" "es-MX" "it" ]; + options.my.apps.internet.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.apps.internet.enable { + programs = { + geary.enable = true; + firefox = { + enable = true; + languagePacks = [ "en-CA" "es-MX" "it" ]; + }; }; + services = { psd.enable = true; }; + users.users.jawz.packages = with pkgs; ([ + nextcloud-client # self-hosted google-drive alternative + fragments # beautiful torrent client + protonmail-bridge # bridge for protonmail + tor-browser-bundle-bin # dark web, so dark! + chromium # web browser with spyware included + telegram-desktop # furry chat + nicotine-plus # remember Ares? + vesktop + (pkgs.discord.override { + withOpenASAR = true; + # withVencord = true; + }) + # hugo # website engine + ]); }; - services = { psd.enable = true; }; - users.users.jawz.packages = with pkgs; ([ - nextcloud-client # self-hosted google-drive alternative - fragments # beautiful torrent client - protonmail-bridge # bridge for protonmail - tor-browser-bundle-bin # dark web, so dark! - chromium # web browser with spyware included - telegram-desktop # furry chat - nicotine-plus # remember Ares? - vesktop - (pkgs.discord.override { - withOpenASAR = true; - # withVencord = true; - }) - # hugo # website engine - ]); } diff --git a/modules/apps/office.nix b/modules/apps/office.nix index 3f997b7..3103f2f 100644 --- a/modules/apps/office.nix +++ b/modules/apps/office.nix @@ -1,13 +1,16 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, unstable, ... }: { - users.users.jawz.packages = with pkgs; ([ - libreoffice # office, but based - calibre # ugly af eBook library manager - newsflash # feed reader, syncs with nextcloud - furtherance # I packaged this one tehee track time utility - # foliate # gtk eBook reader - # wike # gtk wikipedia wow! - # denaro # manage your finances - ]); + options.my.apps.office.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.apps.office.enable { + users.users.jawz.packages = with pkgs; ([ + libreoffice # office, but based + calibre # ugly af eBook library manager + newsflash # feed reader, syncs with nextcloud + furtherance # I packaged this one tehee track time utility + # foliate # gtk eBook reader + # wike # gtk wikipedia wow! + # denaro # manage your finances + ]); + }; } diff --git a/modules/bundles/users.nix b/modules/bundles/users.nix deleted file mode 100644 index 2c3b463..0000000 --- a/modules/bundles/users.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ lib, config, inputs, outputs, myLib, pkgs, ... }: -let cfg = config.myNixOS; -in { - options.myNixOS.home-users = lib.mkOption { - type = lib.types.attrsOf (lib.types.submodule { - options = { - userConfig = lib.mkOption { - default = ./../../home-manager/work.nix; - example = "DP-1"; - }; - userSettings = lib.mkOption { - default = { }; - example = "{}"; - }; - }; - }); - default = { }; - }; - - config = { - programs.zsh.enable = true; - - programs.hyprland.enable = cfg.sharedSettings.hyprland.enable; - - services.xserver = lib.mkIf cfg.sharedSettings.hyprland.enable { - displayManager = { defaultSession = "hyprland"; }; - }; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - - extraSpecialArgs = { - inherit inputs; - inherit myLib; - outputs = inputs.self.outputs; - }; - - users = builtins.mapAttrs (name: user: - { ... }: { - imports = - [ (import user.userConfig) outputs.homeManagerModules.default ]; - }) (config.myNixOS.home-users); - }; - - users.users = builtins.mapAttrs (name: user: - { - isNormalUser = true; - initialPassword = "12345"; - description = ""; - shell = pkgs.zsh; - extraGroups = [ "libvirtd" "networkmanager" "wheel" ]; - } // user.userSettings) (config.myNixOS.home-users); - }; -} diff --git a/modules/dev.nix b/modules/dev.nix index 9c7c0f0..7aac528 100644 --- a/modules/dev.nix +++ b/modules/dev.nix @@ -2,7 +2,9 @@ { imports = [ ./dev/haskell.nix ./dev/nix.nix ./dev/python.nix ]; - myHaskell.enable = lib.mkDefault false; - myNix.enable = lib.mkDefault true; - myPython.enable = lib.mkDefault false; + my.dev = { + haskell.enable = lib.mkDefault false; + nix.enable = lib.mkDefault false; + python.enable = lib.mkDefault false; + }; } diff --git a/modules/dev/haskell.nix b/modules/dev/haskell.nix index dc24533..addd712 100644 --- a/modules/dev/haskell.nix +++ b/modules/dev/haskell.nix @@ -1,8 +1,8 @@ { config, pkgs, lib, ... }: { - options = { myHaskell.enable = lib.mkEnableOption "enable"; }; - config = lib.mkIf config.myHaskell.enable { + options.my.dev.haskell.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.dev.haskell.enable { users.users.jawz.packages = with pkgs; ([ ghc # compiler haskell-language-server # lsp diff --git a/modules/dev/nix.nix b/modules/dev/nix.nix index cfd3fa3..2e8119f 100644 --- a/modules/dev/nix.nix +++ b/modules/dev/nix.nix @@ -1,8 +1,8 @@ { config, pkgs, lib, ... }: { - options = { myNix.enable = lib.mkEnableOption "enable"; }; - config = lib.mkIf config.myNix.enable { + options.my.dev.nix.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.dev.nix.enable { users.users.jawz.packages = with pkgs; ([ expect # keep color when nom'ing nix-output-monitor # autistic nix builds diff --git a/modules/dev/python.nix b/modules/dev/python.nix index 6cf8ed9..863150b 100644 --- a/modules/dev/python.nix +++ b/modules/dev/python.nix @@ -1,8 +1,8 @@ { config, pkgs, lib, ... }: { - options = { myPython.enable = lib.mkEnableOption "enable"; }; - config = lib.mkIf config.myPython.enable { + options.my.dev.python.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.dev.python.enable { users.users.jawz.packages = with pkgs; ([ pipenv # python development workflow for humans (python3.withPackages (ps: diff --git a/modules/features/cachix.nix b/modules/features/cachix.nix deleted file mode 100644 index ea8b817..0000000 --- a/modules/features/cachix.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - nix.settings = { - substituters = [ - "https://nix-gaming.cachix.org" - "https://nixpkgs-python.cachix.org" - "https://devenv.cachix.org" - "https://cuda-maintainers.cachix.org" - "https://ai.cachix.org" - ]; - trusted-public-keys = [ - "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" - "nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU=" - "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=" - "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" - "ai.cachix.org-1:N9dzRK+alWwoKXQlnn0H6aUx0lU/mspIoz8hMvGvbbc=" - ]; - }; -} diff --git a/modules/services.nix b/modules/services.nix new file mode 100644 index 0000000..b8312eb --- /dev/null +++ b/modules/services.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ./services/network.nix + ./services/nvidia.nix + ./services/printing.nix + ./services/sound.nix + ]; + my.services = { + network.enable = lib.mkDefault false; + nvidia.enable = lib.mkDefault false; + printing.enable = lib.mkDefault false; + sound.enable = lib.mkDefault false; + }; +} diff --git a/modules/services/example.nix b/modules/services/example.nix deleted file mode 100644 index 273b10f..0000000 --- a/modules/services/example.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ config, pkgs, lib, ... }: -with lib; { - users.users.satisfactory = { - home = "/var/lib/satisfactory"; - createHome = true; - isSystemUser = true; - group = "satisfactory"; - }; - users.groups.satisfactory = { }; - - # boot.kernel.sysctl."net.ipv6.conf.eth0.disable_ipv6" = true; - networking.enableIPv6 = false; - - # nixpkgs.config.allowUnfree = true; - # - networking = { - firewall = { - allowedUDPPorts = [ 15777 15000 7777 27015 ]; - allowedUDPPortRanges = [{ - from = 27031; - to = 27036; - }]; - allowedTCPPorts = [ 27015 27036 ]; - }; - }; - - # -beta experimental \ - systemd.services.satisfactory = { - preStart = '' - ${pkgs.steamcmd}/bin/steamcmd \ - +force_install_dir /var/lib/satisfactory/SatisfactoryServer \ - +login anonymous \ - +app_update 1690800 \ - validate \ - +quit - ''; - script = '' - ${pkgs.steam-run}/bin/steam-run /var/lib/satisfactory/SatisfactoryServer/FactoryServer.sh -DisablePacketRouting - ''; - serviceConfig = { - Nice = "-5"; - Restart = "always"; - User = "satisfactory"; - WorkingDirectory = "/var/lib/satisfactory"; - }; - }; -} diff --git a/modules/services/network.nix b/modules/services/network.nix new file mode 100644 index 0000000..bfd4110 --- /dev/null +++ b/modules/services/network.nix @@ -0,0 +1,18 @@ +{ config, pkgs, lib, ... }: + +{ + options.my.services.network.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.services.network.enable { + networking = { + useDHCP = lib.mkDefault true; + enableIPv6 = false; + networkmanager.enable = true; + extraHosts = '' + 192.168.1.64 workstation + 192.168.1.69 server + 192.168.1.100 miniserver + ''; + firewall = { enable = true; }; + }; + }; +} diff --git a/modules/services/nvidia.nix b/modules/services/nvidia.nix new file mode 100644 index 0000000..2a8b071 --- /dev/null +++ b/modules/services/nvidia.nix @@ -0,0 +1,25 @@ +{ config, pkgs, lib, ... }: + +{ + options.my.services.nvidia.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.services.nvidia.enable { + services.xserver.videoDrivers = [ "nvidia" ]; + hardware = { + opengl = { + enable = true; + driSupport = true; + driSupport32Bit = true; + extraPackages = with pkgs; [ + nvidia-vaapi-driver + vaapiVdpau + libvdpau-va-gl + ]; + }; + nvidia = { + modesetting.enable = true; + powerManagement.enable = true; + powerManagement.finegrained = false; + }; + }; + }; +} diff --git a/modules/services/printing.nix b/modules/services/printing.nix new file mode 100644 index 0000000..1bababd --- /dev/null +++ b/modules/services/printing.nix @@ -0,0 +1,16 @@ +{ config, pkgs, lib, ... }: +let printingDrivers = [ pkgs.hplip pkgs.hplipWithPlugin ]; +in { + options.my.services.printing.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.services.printing.enable { + services.printing = { + enable = true; + drivers = printingDrivers; + }; + hardware.sane = { + enable = true; + extraBackends = printingDrivers; + }; + users.users.jawz.packages = [ pkgs.gnome.simple-scan ]; + }; +} diff --git a/modules/services/sound.nix b/modules/services/sound.nix new file mode 100644 index 0000000..e87cb75 --- /dev/null +++ b/modules/services/sound.nix @@ -0,0 +1,27 @@ +{ config, pkgs, lib, ... }: +# let +# nixGaming = import (builtins.fetchTarball +# "https://github.com/fufexan/nix-gaming/archive/master.tar.gz"); +# in +{ + imports = [ + # nixGaming.nixosModules.pipewireLowLatency + ]; + options.my.services.sound.enable = lib.mkEnableOption "enable"; + config = lib.mkIf config.my.services.sound.enable { + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + sound.enable = false; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # lowLatency = { + # enable = true; + # quantum = 64; + # rate = 48000; + # }; + }; + }; +} diff --git a/services/systemd-user/tasks.nix b/modules/systemd-user/tasks.nix similarity index 100% rename from services/systemd-user/tasks.nix rename to modules/systemd-user/tasks.nix diff --git a/services/network.nix b/services/network.nix deleted file mode 100644 index 2a67c72..0000000 --- a/services/network.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ config, pkgs, lib, ... }: - -{ - networking = { - useDHCP = lib.mkDefault true; - enableIPv6 = false; - networkmanager.enable = true; - extraHosts = '' - 192.168.1.64 workstation - 192.168.1.69 server - 192.168.1.100 miniserver - ''; - firewall = { - enable = true; - }; - }; -} diff --git a/services/nvidia.nix b/services/nvidia.nix deleted file mode 100644 index 06dad29..0000000 --- a/services/nvidia.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, lib, pkgs, ... }: - -{ - services.xserver.videoDrivers = [ "nvidia" ]; - hardware = { - opengl = { - enable = true; - driSupport = true; - driSupport32Bit = true; - extraPackages = with pkgs; [ - nvidia-vaapi-driver - vaapiVdpau - libvdpau-va-gl - ]; - }; - nvidia = { - modesetting.enable = true; - powerManagement.enable = true; - powerManagement.finegrained = false; - }; - }; -} diff --git a/services/printing.nix b/services/printing.nix deleted file mode 100644 index 98b8f1f..0000000 --- a/services/printing.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ config, lib, pkgs, ... }: -let printingDrivers = [ pkgs.hplip pkgs.hplipWithPlugin ]; -in { - services.printing = { - enable = true; - drivers = printingDrivers; - }; - hardware.sane = { - enable = true; - extraBackends = printingDrivers; - }; - users.users.jawz.packages = [ pkgs.gnome.simple-scan ]; -} diff --git a/services/sound.nix b/services/sound.nix deleted file mode 100644 index 6072db1..0000000 --- a/services/sound.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ config, lib, pkgs, ... }: -# let -# nixGaming = import (builtins.fetchTarball -# "https://github.com/fufexan/nix-gaming/archive/master.tar.gz"); -# in -{ - imports = [ - # nixGaming.nixosModules.pipewireLowLatency - ]; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - sound.enable = false; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - # lowLatency = { - # enable = true; - # quantum = 64; - # rate = 48000; - # }; - }; -}