diff --git a/nix/default.nix b/nix/default.nix deleted file mode 100644 index b07d863..0000000 --- a/nix/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ pkgs ? ( - let - inherit (builtins) fetchTree fromJSON readFile; - inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; - in - import (fetchTree nixpkgs.locked) { - overlays = [ - (import "${fetchTree gomod2nix.locked}/overlay.nix") - ]; - } -) -, buildGoApplication ? pkgs.buildGoApplication -}: - -buildGoApplication { - pname = "discord-tweeter"; - version = "0.1"; - pwd = ./.; - src = ../.; - modules = ./gomod2nix.toml; -} diff --git a/nix/flake.lock b/nix/flake.lock deleted file mode 100644 index a0e83ed..0000000 --- a/nix/flake.lock +++ /dev/null @@ -1,85 +0,0 @@ -{ - "nodes": { - "flake-utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "gomod2nix": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1742209644, - "narHash": "sha256-jMy1XqXqD0/tJprEbUmKilTkvbDY/C0ZGSsJJH4TNCE=", - "owner": "nix-community", - "repo": "gomod2nix", - "rev": "8f3534eb8f6c5c3fce799376dc3b91bae6b11884", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "gomod2nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1742288794, - "narHash": "sha256-Txwa5uO+qpQXrNG4eumPSD+hHzzYi/CdaM80M9XRLCo=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "b6eaf97c6960d97350c584de1b6dcff03c9daf42", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "flake-utils": "flake-utils", - "gomod2nix": "gomod2nix", - "nixpkgs": "nixpkgs" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/nix/flake.nix b/nix/flake.nix deleted file mode 100644 index 80ad039..0000000 --- a/nix/flake.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - description = "NixOS flake for discord-tweeter"; - - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - inputs.flake-utils.url = "github:numtide/flake-utils"; - inputs.gomod2nix.url = "github:nix-community/gomod2nix"; - inputs.gomod2nix.inputs.nixpkgs.follows = "nixpkgs"; - inputs.gomod2nix.inputs.flake-utils.follows = "flake-utils"; - - outputs = { self, nixpkgs, flake-utils, gomod2nix }: - (flake-utils.lib.eachDefaultSystem - (system: - let - pkgs = nixpkgs.legacyPackages.${system}; - - callPackage = pkgs.darwin.apple_sdk_11_0.callPackage or pkgs.callPackage; - in - { - nixosModules.default = callPackage ./services.nix { inherit self; }; - packages.default = callPackage ./. { inherit (gomod2nix.legacyPackages.${system}) buildGoApplication; }; - devShells.default = callPackage ./shell.nix { inherit (gomod2nix.legacyPackages.${system}) mkGoEnv gomod2nix; }; - }) - ); -} diff --git a/nix/gomod2nix.toml b/nix/gomod2nix.toml deleted file mode 100644 index 5edd8c3..0000000 --- a/nix/gomod2nix.toml +++ /dev/null @@ -1,21 +0,0 @@ -schema = 3 - -[mod] - [mod."github.com/AlexEidt/Vidio"] - version = "v1.5.1" - hash = "sha256-WdnCYjxbFqDmh/IVaVCCc1TzvklKdJtDMdIgn6m6NTM=" - [mod."github.com/BurntSushi/toml"] - version = "v1.5.0" - hash = "sha256-wX8bEVo7swuuAlm0awTIiV1KNCAXnm7Epzwl+wzyqhw=" - [mod."github.com/imperatrona/twitter-scraper"] - version = "v0.0.16" - hash = "sha256-nbv9fI6/3OxnC8NaLO82UfcwbJMz1jxvfNjZPOrILzM=" - [mod."github.com/jmoiron/sqlx"] - version = "v1.4.0" - hash = "sha256-0H132+A983nBr2zEyCKsJoBCZlC9pG+ylEcGysxKL4M=" - [mod."github.com/mattn/go-sqlite3"] - version = "v1.14.24" - hash = "sha256-taGKFZFQlR5++5b2oZ1dYS3RERKv6yh1gniNWhb4egg=" - [mod."golang.org/x/net"] - version = "v0.37.0" - hash = "sha256-sZKbJISVdBwyuYRQgrraTKxeIORWlzK5hScceQ2dE58=" diff --git a/nix/services.nix b/nix/services.nix deleted file mode 100644 index 6658611..0000000 --- a/nix/services.nix +++ /dev/null @@ -1,51 +0,0 @@ -{config, lib, pkgs, ...}: - -with lib; - -let - cfg = config.services.discord-tweeter; - - format = pkgs.formats.toml { }; - configFile = format.generate "config.toml" cfg.settings; -in -{ - options.services.discord-tweeter = { - enable = mkEnableOption (lib.mdDoc "discord-tweeter"); - - settings = mkOption { - type = format.type; - default = { - username = ""; - password = ""; - proxyaddr = ""; - webhook = ""; - DbPath = "/var/lib/discord-tweeter/"; - CookiePath = "/var/lib/discord-tweeter/"; - channels = [ ]; - filter = [ 0b11111 ]; - UseWebServer = true; - HostURL = ""; - WebPort = 8080; - UserAgents = [ "discordbot" "curl" "httpie" "lwp-request" "wget" "python-requests" "openbsd ftp" "powershell" ]; - NitterBase = "https://xcancel.com"; - }; - description = lib.mdDoc '' - ''; - }; - }; - - config = mkIf cfg.enable { - systemd.services.discord-tweeter = { - description = "Send tweets to Discord by scraping Twitter (now X)"; - after = [ "network.target" ]; - wantedBy = [ "multi-user.target" ]; - - serviceConfig = { - DynamicUser = true; - ExecStart = "${self.packages.${pkgs.system}.default}/bin/discord-tweeter ${configFile}"; - Restart = "on-failure"; - }; - }; - }; -} - diff --git a/nix/shell.nix b/nix/shell.nix deleted file mode 100644 index 8d806a2..0000000 --- a/nix/shell.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ pkgs ? ( - let - inherit (builtins) fetchTree fromJSON readFile; - inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; - in - import (fetchTree nixpkgs.locked) { - overlays = [ - (import "${fetchTree gomod2nix.locked}/overlay.nix") - ]; - } - ) -, mkGoEnv ? pkgs.mkGoEnv -, gomod2nix ? pkgs.gomod2nix -}: - -let - goEnv = mkGoEnv { pwd = ../.; }; -in -pkgs.mkShell { - packages = [ - goEnv - gomod2nix - ]; -}