From 2fbbe7eac3a7827a753aed3aa41171e7059595f8 Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 11 Mar 2024 21:43:20 +0000 Subject: add mantis --- flake.lock | 95 ++++++++------- flake.nix | 24 +++- home.nix | 3 +- hosts/mantis/configuration.nix | 200 ++++++++++++++++++++++++++++++++ hosts/mantis/hardware-configuration.nix | 40 +++++++ hosts/myrtle/configuration.nix | 6 +- programs/bash.nix | 2 +- programs/git.nix | 23 ++++ programs/neovim.nix | 1 + 9 files changed, 335 insertions(+), 59 deletions(-) create mode 100644 hosts/mantis/configuration.nix create mode 100644 hosts/mantis/hardware-configuration.nix diff --git a/flake.lock b/flake.lock index 6e39042..07bf271 100644 --- a/flake.lock +++ b/flake.lock @@ -20,44 +20,62 @@ "url": "https://git.peppe.rs/vim/better-text-objs" } }, - "home-manager": { + "flaresolverr": { "inputs": { + "flaresolverr-src": "flaresolverr-src", "nixpkgs": [ "nixpkgs" - ] + ], + "undetected-chromedriver-src": "undetected-chromedriver-src" }, "locked": { - "lastModified": 1701433070, - "narHash": "sha256-Gf9JStfENaUQ7YWFz3V7x/srIwr4nlnVteqaAxtwpgM=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "4a8545f5e737a6338814a4676dc8e18c7f43fc57", + "lastModified": 1709380050, + "narHash": "sha256-Nwtjc3XZgr9NT8acSGt3IvaVBYRPFWFBo+xVw58eKRw=", + "ref": "refs/heads/master", + "rev": "6798a20e5482b574c8e02e5ff260d72ea6431a29", + "revCount": 1, + "type": "git", + "url": "https://git.peppe.rs/flakes/flaresolverr" + }, + "original": { + "type": "git", + "url": "https://git.peppe.rs/flakes/flaresolverr" + } + }, + "flaresolverr-src": { + "flake": false, + "locked": { + "lastModified": 1709156333, + "narHash": "sha256-pf5sibZ9Vjc98UOVTEUlKrBoXXKiykrt+szXLbNJB3k=", + "owner": "FlareSolverr", + "repo": "FlareSolverr", + "rev": "fd773e59097c1aca4e08edc07c1ed30164f88bd3", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "home-manager", + "owner": "FlareSolverr", + "ref": "v3.3.16", + "repo": "FlareSolverr", "type": "github" } }, - "nix-github-actions": { + "home-manager": { "inputs": { "nixpkgs": [ - "talon", "nixpkgs" ] }, "locked": { - "lastModified": 1693660503, - "narHash": "sha256-B/g2V4v6gjirFmy+I5mwB2bCYc0l3j5scVfwgl6WOl8=", + "lastModified": 1701433070, + "narHash": "sha256-Gf9JStfENaUQ7YWFz3V7x/srIwr4nlnVteqaAxtwpgM=", "owner": "nix-community", - "repo": "nix-github-actions", - "rev": "bd5bdbb52350e145c526108f4ef192eb8e554fa0", + "repo": "home-manager", + "rev": "4a8545f5e737a6338814a4676dc8e18c7f43fc57", "type": "github" }, "original": { "owner": "nix-community", - "repo": "nix-github-actions", + "repo": "home-manager", "type": "github" } }, @@ -78,11 +96,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1701141680, - "narHash": "sha256-qaPcwKI0RR6mxfn4sMrHEjjDl6VCEPUTRZhN+OFB6zg=", + "lastModified": 1707205916, + "narHash": "sha256-fmRJilYGlB7VCt3XsdYxrA0u8e/K84O5xYucerUY0iM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4469e22700c47792f93daa882786d36f9bf8bc2a", + "rev": "8cc79aa39bbc6eaedaf286ae655b224c71e02907", "type": "github" }, "original": { @@ -92,22 +110,6 @@ "type": "github" } }, - "nixpkgs_2": { - "locked": { - "lastModified": 1698318101, - "narHash": "sha256-gUihHt3yPD7bVqg+k/UVHgngyaJ3DMEBchbymBMvK1E=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "63678e9f3d3afecfeafa0acead6239cdb447574c", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "prompt": { "inputs": { "nixpkgs": [ @@ -131,30 +133,27 @@ "root": { "inputs": { "better-text-objs": "better-text-objs", + "flaresolverr": "flaresolverr", "home-manager": "home-manager", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "prompt": "prompt", - "talon": "talon", "vim-colors-plain": "vim-colors-plain" } }, - "talon": { - "inputs": { - "nix-github-actions": "nix-github-actions", - "nixpkgs": "nixpkgs_2" - }, + "undetected-chromedriver-src": { + "flake": false, "locked": { - "lastModified": 1701208467, - "narHash": "sha256-1xt+pieI5N1muLQ3NVuar9yl/YpkWX4/2+LPdhPC31Y=", - "owner": "nix-community", - "repo": "talon-nix", - "rev": "75a4a73b457ccbb44229dc9a5ec97c2ca46da065", + "lastModified": 1708190030, + "narHash": "sha256-Qe+GrsUPnhjJMDgjdUCloapjj0ggFlm/Dr42WLcmb1o=", + "owner": "ultrafunkamsterdam", + "repo": "undetected-chromedriver", + "rev": "0aa5fbe252370b4cb2b95526add445392cad27ba", "type": "github" }, "original": { - "owner": "nix-community", - "repo": "talon-nix", + "owner": "ultrafunkamsterdam", + "repo": "undetected-chromedriver", "type": "github" } }, diff --git a/flake.nix b/flake.nix index f57748d..e5b79b6 100644 --- a/flake.nix +++ b/flake.nix @@ -11,8 +11,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - talon.url = "github:nix-community/talon-nix"; - prompt = { url = "git+https://git.peppe.rs/cli/prompt"; inputs.nixpkgs.follows = "nixpkgs"; @@ -28,6 +26,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + flaresolverr = { + url = "git+https://git.peppe.rs/flakes/flaresolverr"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; outputs = @@ -35,11 +38,10 @@ , nixpkgs , nixos-hardware , home-manager - # , statix , prompt , better-text-objs , vim-colors-plain - , talon + , flaresolverr , ... } @ inputs: { @@ -48,7 +50,7 @@ prompt = prompt.overlay; better-text-objs = better-text-objs.overlay; vim-colors-plain = vim-colors-plain.overlay; - talon = talon.overlays.default; + flaresolverr = flaresolverr.overlays.default; }; nixosConfigurations = { @@ -97,6 +99,18 @@ nixos-hardware.nixosModules.asus-battery ]; }; + + mantis = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ({ config = { nix.registry.nixpkgs.flake = nixpkgs; }; }) + { + imports = [ ./hosts/mantis/configuration.nix ]; + _module.args.self = self; + } + ]; + }; + }; }; diff --git a/home.nix b/home.nix index 6500216..f946df1 100644 --- a/home.nix +++ b/home.nix @@ -36,10 +36,8 @@ cmus tree neomutt - nodePackages.bash-language-server w3m noto-fonts-emoji - urlview fd du-dust jq @@ -52,6 +50,7 @@ httpie thunderbird calibre + gh # gaming mgba diff --git a/hosts/mantis/configuration.nix b/hosts/mantis/configuration.nix new file mode 100644 index 0000000..8b5b489 --- /dev/null +++ b/hosts/mantis/configuration.nix @@ -0,0 +1,200 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page, on +# https://search.nixos.org/options and in the NixOS manual (`nixos-help`). + +{ config, lib, pkgs, self, ... }: + +{ + imports = + [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + nixpkgs.overlays = with self.overlays; [ + flaresolverr + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "mantis"; # Define your hostname. + networking.wireless.iwd.enable = true; # Enables wireless support via wpa_supplicant. + networking.firewall.allowedTCPPorts = [ 80 443 ]; + + time.timeZone = "Europe/London"; + i18n.defaultLocale = "en_US.UTF-8"; + + nixpkgs.config.packageOverrides = pkgs: { + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + }; + + # Enable sound. + sound.enable = true; + hardware.pulseaudio.enable = true; + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver + vaapiIntel + vaapiVdpau + libvdpau-va-gl + intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in) + ]; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.op = { + isNormalUser = true; + extraGroups = [ "wheel" "tty" ]; + packages = with pkgs; [ ]; + home = "/home/op"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILzFK/zY2ZaAftBfFPO+IJAgyD45pe0fXrpF81p8aNIl np@myrtle" + ]; + }; + users.groups."torrent".members = [ + "sonarr" + "radarr" + "bazarr" + "jackett" + "lidarr" + "jellyfin" + "transmission" + ]; + + environment.systemPackages = with pkgs; [ + vim + wget + pkgs.jellyfin + pkgs.jellyfin-web + pkgs.jellyfin-ffmpeg + + pkgs.htop + pkgs.ripgrep + ]; + + services.openssh.enable = true; + services.nginx.enable = true; + services.tailscale.enable = true; + + services.jellyfin = { + enable = true; + openFirewall = true; + group = "torrent"; + }; + services.nginx.virtualHosts."stream.mantis" = { + listen = [{ port = 80; addr = "0.0.0.0"; }]; + locations."/" = { + proxyPass = "http://127.0.0.1:8096"; + proxyWebsockets = true; + }; + }; + + services.transmission = { + enable = true; + openFirewall = true; + openRPCPort = true; + group = "torrent"; + settings = { + download-dir = "/torrents"; + incomplete-dir = "/.incomplete"; + rpc-bind-address = "0.0.0.0"; + rpc-whitelist = "127.0.0.1,10.0.0.1,192.168.*.*,100.64.*.*"; + }; + }; + services.nginx.virtualHosts."torrent.mantis" = { + listen = [{ port = 80; addr = "0.0.0.0"; }]; + locations."/" = { + proxyPass = "http://127.0.0.1:9091"; + }; + }; + + services.sonarr = { + enable = true; + openFirewall = true; + group = "torrent"; + }; + services.nginx.virtualHosts."sonarr.mantis" = { + listen = [{ port = 80; addr = "0.0.0.0"; }]; + locations."/" = { + proxyPass = "http://127.0.0.1:8989"; + }; + }; + + services.radarr = { + enable = true; + openFirewall = true; + group = "torrent"; + }; + services.nginx.virtualHosts."radarr.mantis" = { + listen = [{ port = 80; addr = "0.0.0.0"; }]; + locations."/" = { + proxyPass = "http://127.0.0.1:7878"; + }; + }; + + services.bazarr = { + enable = true; + openFirewall = true; + group = "torrent"; + }; + services.nginx.virtualHosts."bazarr.mantis" = { + listen = [{ port = 80; addr = "0.0.0.0"; }]; + locations."/" = { + proxyPass = "http://127.0.0.1:6767"; + }; + }; + + services.jackett = { + enable = true; + openFirewall = true; + group = "torrent"; + }; + services.nginx.virtualHosts."jackett.mantis" = { + listen = [{ port = 80; addr = "0.0.0.0"; }]; + locations."/" = { + proxyPass = "http://127.0.0.1:9117"; + }; + }; + + services.lidarr = { + enable = true; + openFirewall = true; + group = "torrent"; + }; + services.nginx.virtualHosts."lidarr.mantis" = { + listen = [{ port = 80; addr = "0.0.0.0"; }]; + locations."/" = { + proxyPass = "http://127.0.0.1:8686"; + }; + }; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Copy the NixOS configuration file and link it from the resulting system + # (/run/current-system/configuration.nix). This is useful in case you + # accidentally delete configuration.nix. + # system.copySystemConfiguration = true; + + # This option defines the first version of NixOS you have installed on this particular machine, + # and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions. + # + # Most users should NEVER change this value after the initial install, for any reason, + # even if you've upgraded your system to a new NixOS release. + # + # This value does NOT affect the Nixpkgs version your packages and OS are pulled from, + # so changing it will NOT upgrade your system. + # + # This value being lower than the current NixOS release does NOT mean your system is + # out of date, out of support, or vulnerable. + # + # Do NOT change this value unless you have manually inspected all the changes it would make to your configuration, + # and migrated your data accordingly. + # + # For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion . + system.stateVersion = "23.11"; # Did you read the comment? + +} + diff --git a/hosts/mantis/hardware-configuration.nix b/hosts/mantis/hardware-configuration.nix new file mode 100644 index 0000000..8d7f39a --- /dev/null +++ b/hosts/mantis/hardware-configuration.nix @@ -0,0 +1,40 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/e3eda8a2-b5fe-4458-988c-48579a7cc6c6"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/A170-EC57"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/61cb6a91-b916-40b9-b231-c04378629d90"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp2s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/myrtle/configuration.nix b/hosts/myrtle/configuration.nix index 069425f..dd45d3b 100644 --- a/hosts/myrtle/configuration.nix +++ b/hosts/myrtle/configuration.nix @@ -53,7 +53,6 @@ prompt better-text-objs vim-colors-plain - talon ]; environment = { @@ -141,7 +140,7 @@ services = { xserver = { enable = true; - layout = "us"; + xkb.layout = "us"; videoDrivers = [ "nvidia" ]; displayManager.startx.enable = true; libinput.enable = true; @@ -196,6 +195,7 @@ mountOnMedia = true; }; + tailscale.enable = true; }; systemd.sleep.extraConfig = '' @@ -249,7 +249,7 @@ nix = { package = pkgs.nixUnstable; extraOptions = '' - experimental-features = nix-command flakes + experimental-features = nix-command flakes repl-flake warn-dirty = false keep-outputs = false keep-derivations = false diff --git a/programs/bash.nix b/programs/bash.nix index f6f8de9..e2b825a 100644 --- a/programs/bash.nix +++ b/programs/bash.nix @@ -87,7 +87,7 @@ git worktree list | \ fzf --min-height=15 \ --preview-window=up,10 \ - --preview='git log --color=always -n10 --oneline {2}' \ + --preview='git log --color=always -n10 --decorate --oneline {2}' \ --cycle -1 \ -q "$query" | \ awk '{print $1}' diff --git a/programs/git.nix b/programs/git.nix index bc312de..e4b5e0f 100644 --- a/programs/git.nix +++ b/programs/git.nix @@ -39,11 +39,34 @@ with theme; }; }; }; + # difftastic = { + # enable = true; + # background = "dark"; + # display = "inline"; + # }; + aliases = { + co = "checkout"; + rb = "rebase"; + }; extraConfig = { commit.verbose = true; core = { hooksPath = "/home/np/.hooks"; }; + column = { + ui = "auto dense"; + status = "never"; + }; + branch.sort = "-committerdate"; + worktree.guessRemote = true; + rebase = { + abbreviateCommands = true; + stat = true; + }; + rerere = { + enabled = true; + autoUpdate = true; + }; }; }; } diff --git a/programs/neovim.nix b/programs/neovim.nix index 0430868..08a1ada 100644 --- a/programs/neovim.nix +++ b/programs/neovim.nix @@ -14,6 +14,7 @@ extraPackages = with pkgs; [ # gcc python311Packages.yapf + nodePackages.bash-language-server # hlint # ocamlformat ]; -- cgit v1.2.3