From f28a92db30ac6275eb4779a18af18499ade4af7d Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 24 Apr 2022 14:36:45 +1000 Subject: [PATCH] cleaning up --- .../default.nix => modules/navidrome.nix | 0 pkgs/navidrome.nix | 9 -- pkgs/wallabag.nix | 127 +++++++++++++----- pkgs/wallabag.patch | 31 +++++ profiles/box-zone/common.nix | 120 ----------------- profiles/box-zone/mossnet.nix | 28 ---- profiles/sync/get-music.nix | 4 +- profiles/taskd/default.nix | 64 +-------- 8 files changed, 137 insertions(+), 246 deletions(-) rename profiles/navidrome/default.nix => modules/navidrome.nix (100%) delete mode 100644 pkgs/navidrome.nix create mode 100644 pkgs/wallabag.patch delete mode 100644 profiles/box-zone/common.nix delete mode 100644 profiles/box-zone/mossnet.nix diff --git a/profiles/navidrome/default.nix b/modules/navidrome.nix similarity index 100% rename from profiles/navidrome/default.nix rename to modules/navidrome.nix diff --git a/pkgs/navidrome.nix b/pkgs/navidrome.nix deleted file mode 100644 index 5bcd3789..00000000 --- a/pkgs/navidrome.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ config, lib, pkgs, ... }: -{ - services.navidrome.enable = true; - services.navidrome.settings = { - MusicFolder = "/data/music"; - Port = 4433; - }; - networking.firewall.allowedTCPPorts = [ 4433 ]; -} diff --git a/pkgs/wallabag.nix b/pkgs/wallabag.nix index 243569b4..6adfca0d 100644 --- a/pkgs/wallabag.nix +++ b/pkgs/wallabag.nix @@ -1,31 +1,98 @@ -diff --git a/app/AppKernel.php b/app/AppKernel.php -index 347197e..902b558 100644 ---- a/app/AppKernel.php -+++ b/app/AppKernel.php -@@ -69,19 +69,24 @@ class AppKernel extends Kernel - return __DIR__; +{ pkgs, config, lib, ... }: + +{ + services.postgresql = { + enable = true; + + # Ensure the database, user, and permissions always exist + ensureDatabases = [ "wallabag" ]; + ensureUsers = [ + { name = "wallabag"; + ensurePermissions."DATABASE wallabag" = "ALL PRIVILEGES"; } - -+ public function getProjectDir() -+ { -+ return getenv('WALLABAG_DATA') ?: dirname(__DIR__); -+ } -+ - public function getCacheDir() - { -- return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); -+ return $this->getProjectDir() . '/var/cache/' . $this->getEnvironment(); - } - - public function getLogDir() - { -- return dirname(__DIR__) . '/var/logs'; -+ return $this->getProjectDir() . '/var/logs'; - } - - public function registerContainerConfiguration(LoaderInterface $loader) - { -- $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); -+ $loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml'); - - $loader->load(function ($container) { + ]; + }; + + services.wallabag = { + enable = true; + hostName = "read.mossnet.lan"; + package = pkgs.callPackage ./pkg-wallabag.nix {}; + conf = '' +# This file is a "template" of what your parameters.yml file should look like +parameters: + # Uncomment these settings or manually update your parameters.yml + # to use docker-compose + # + # database_driver: %env.database_driver% + # database_host: %env.database_host% + # database_port: %env.database_port% + # database_name: %env.database_name% + # database_user: %env.database_user% + # database_password: %env.database_password% + + database_driver: pdo_pgsql + database_host: localhost + database_port: ~ + database_name: wallabag + database_user: wallabag + database_password: wallabag + # For SQLite, database_path should be "%kernel.project_dir%/data/db/wallabag.sqlite" + database_path: ~ + database_table_prefix: wallabag_ + database_socket: null + # with PostgreSQL and SQLite, you must set "utf8" + database_charset: utf8 + + domain_name: http://read.mossnet.lan + server_name: "mossnet wallabag instance" + + mailer_transport: smtp + mailer_user: ~ + mailer_password: ~ + mailer_host: 127.0.0.1 + mailer_port: false + mailer_encryption: ~ + mailer_auth_mode: ~ + + locale: en + + # A secret key that's used to generate certain security-related tokens + secret: SAFGOECRIlfal89oe6u0(*^dsaaih961 + + # two factor stuff + twofactor_auth: true + twofactor_sender: no-reply@wallabag.org + + # fosuser stuff + fosuser_registration: true + fosuser_confirmation: true + + # how long the access token should live in seconds for the API + fos_oauth_server_access_token_lifetime: 3600 + # how long the refresh token should life in seconds for the API + fos_oauth_server_refresh_token_lifetime: 1209600 + + from_email: no-reply@wallabag.org + + rss_limit: 50 + + # RabbitMQ processing + rabbitmq_host: localhost + rabbitmq_port: 5672 + rabbitmq_user: guest + rabbitmq_password: guest + rabbitmq_prefetch_count: 10 + + # Redis processing + redis_scheme: tcp + redis_host: localhost + redis_port: 6379 + redis_path: null + redis_password: null + + # sentry logging + sentry_dsn: ~ +''; + }; + # networking.firewall.allowedTCPPorts = [ 8080 ]; +} diff --git a/pkgs/wallabag.patch b/pkgs/wallabag.patch new file mode 100644 index 00000000..243569b4 --- /dev/null +++ b/pkgs/wallabag.patch @@ -0,0 +1,31 @@ +diff --git a/app/AppKernel.php b/app/AppKernel.php +index 347197e..902b558 100644 +--- a/app/AppKernel.php ++++ b/app/AppKernel.php +@@ -69,19 +69,24 @@ class AppKernel extends Kernel + return __DIR__; + } + ++ public function getProjectDir() ++ { ++ return getenv('WALLABAG_DATA') ?: dirname(__DIR__); ++ } ++ + public function getCacheDir() + { +- return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); ++ return $this->getProjectDir() . '/var/cache/' . $this->getEnvironment(); + } + + public function getLogDir() + { +- return dirname(__DIR__) . '/var/logs'; ++ return $this->getProjectDir() . '/var/logs'; + } + + public function registerContainerConfiguration(LoaderInterface $loader) + { +- $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); ++ $loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml'); + + $loader->load(function ($container) { diff --git a/profiles/box-zone/common.nix b/profiles/box-zone/common.nix deleted file mode 100644 index 0790f579..00000000 --- a/profiles/box-zone/common.nix +++ /dev/null @@ -1,120 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ./nvim.nix -# ./unstable.nix - ]; - - - environment.systemPackages = with pkgs; [ - tailscale - htop - fzf - iftop - wget - curl - exa - bat - fd - ag - wpa_supplicant - tcpdump - whois - mtr - file - lsof - atool - inotify-tools - strace - zip - unzip - rsync - tmux - pwgen - glow - jq - gitAndTools.gitFull - #neovim defined in ./nvim.nix - # wofi - # firefox - # fractal - # pinentry_gnome - pinentry_curses - pass - gcc - less - # mpv - # zathura - #qmk_firmware - python3 - gdb - # vcv-rack - #xdotool - #neofetch - #calibre - #openvpn - #gimp - xxd - # tilix - # kitty - taskwarrior - gnupg - openjdk - glslviewer - #filezilla - # signal-desktop - # wire-desktop - # tdesktop - # feedreader - #newsflash -# syncthing - dijo - #ssb-patchwork - #gnomeExtensions.taskwhisperer - #gnome3.networkmanager-openvpn - #python3Packages.youtube-dl - #appimage-run - home-manager - libreoffice - fontconfig - #hugo - #processing - #nextcloud-client - zsh-powerlevel10k - powerline-fonts - supercollider - haskellPackages.tidal - pandoc - # calibre - ]; - - programs.bash.enableCompletion = true; - - programs.gnupg.agent.enable = true; - programs.gnupg.agent.pinentryFlavor = "curses"; - programs.gnupg.agent.enableSSHSupport = true; - # needed for vcv-rack - nixpkgs.config.allowUnfree = true; - - system.copySystemConfiguration = true; - #services.syncthing = { - # enable = true; - # openDefaultPorts = true; - # systemService = true; - # user = "anish"; - # dataDir = "/home/anish/usr/syncthing"; - #}; - - #zsh powerlevel10k - #programs.zsh.enable = true; - #programs.zsh.promptInit = "source ${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; - users.users.anish.shell = pkgs.bash; - - #android - programs.adb.enable = true; - users.users.anish.extraGroups = ["adbusers"]; - - #ssh - services.sshd.enable = true; -} diff --git a/profiles/box-zone/mossnet.nix b/profiles/box-zone/mossnet.nix deleted file mode 100644 index 3cb80308..00000000 --- a/profiles/box-zone/mossnet.nix +++ /dev/null @@ -1,28 +0,0 @@ -{config, pkgs, ...}: - -{ - imports = [ - ./taskd.nix - ./nextcloud.nix - ./networking.nix - ./wireguard.nix - ./shaarli.nix -## ./navidrome.nix -## ./pkg-navidrome.nix - ./mod-wallabag.nix - ./wallabag.nix - ./headphones.nix - ./dns.nix - ./backup.nix - ./monitoring.nix - ./dev.nix - ./gonic.nix - ./module-gonic.nix -# ./rss-bridge.nix -# ./pkg-grasp.nix -# ./mod-grasp.nix - ./cron.nix - ./ftp.nix - ./nfs.nix - ]; -} diff --git a/profiles/sync/get-music.nix b/profiles/sync/get-music.nix index acb3d9d3..721696ec 100644 --- a/profiles/sync/get-music.nix +++ b/profiles/sync/get-music.nix @@ -4,7 +4,9 @@ services.cron = { enable = true; systemCronJobs = [ - "* */24 * * * * anish ~/get-music.sh" + "* */24 * * * * anish /etc/get-music.sh" ]; }; + environment.etc."get-music.sh".text = builtins.readFile "./get-music.sh"; + evironment.systemPackages = [ pkgs.rsync ]; } diff --git a/profiles/taskd/default.nix b/profiles/taskd/default.nix index 55e179aa..64a914f6 100644 --- a/profiles/taskd/default.nix +++ b/profiles/taskd/default.nix @@ -1,61 +1,9 @@ -{ config, pkgs, lib, ... }: +{ config, pkgs, ... }: { - services.tailscale.enable = true; - networking.firewall.allowedUDPPorts = [ 60990 ]; - - # Enable WireGuard - networking.wireguard.interfaces = { - # "wg0" is the network interface name. You can name the interface arbitrarily. - wg0 = { - # Determines the IP address and subnet of the client's end of the tunnel interface. - ips = [ "10.0.69.4/24" ]; - listenPort = 60990; # to match firewall allowedUDPPorts (without this wg uses random port numbers) - - # Path to the private key file. - # - # Note: The private key can also be included inline via the privateKey option, - # but this makes the private key world-readable; thus, using privateKeyFile is - # recommended. - privateKeyFile = "/home/anish/wg/privkey"; - - peers = [ - # For a client configuration, one peer entry for the server will suffice. - { - # Public key of the server (not a file path). - publicKey = "c1J4p63rD3IlszugMZiki7UBV3YmDdqa3DU4UejXzAI="; - - # Forward all the traffic via VPN. - allowedIPs = [ "10.0.69.0/24" ]; - # Or forward only particular subnets - #allowedIPs = [ "10.100.0.1" "91.108.12.0/22" ]; - - # Set this to the server IP and port. - endpoint = "sealight.xyz:60990"; # ToDo: route to endpoint not automatically configured https://wiki.archlinux.org/index.php/WireGuard#Loop_routing https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577 - - # Send keepalives every 25 seconds. Important to keep NAT tables alive. - persistentKeepalive = 25; - } - ]; - }; - }; - -# boot.extraModulePackages = with config.boot.kernelPackages; [ wireguard ]; -# environment.systemPackages = [ pkgs.wireguard ]; -# networking.wireguard.enable = true; -# networking.wireguard.interfaces = { -# wg0 = { -# ips = [ "10.0.69.4/32" ]; -# privateKeyFile = "/home/anish/wg/privkey"; -# listenPort = 60990; -# -# peers = [ -# { # helix - server -# publicKey = "{c1J4p63rD3IlszugMZiki7UBV3YmDdqa3DU4UejXzAI=}"; -# allowedIPs = [ "10.0.69.1/24" ]; -# endpoint = "sealight.xyz:60990"; -# persistentKeepalive = 25; -# } ]; -# }; -# }; + services.taskserver.enable = true; + services.taskserver.fqdn = "task.moss"; + services.taskserver.listenHost = "0.0.0.0"; + services.taskserver.listenPort = 53589; + services.taskserver.organisations.mossnet.users = [ "anish" ]; }