diff options
| -rw-r--r-- | .envrc | 2 | ||||
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | default.nix | 8 | ||||
| -rw-r--r-- | flake.lock | 7 | ||||
| -rw-r--r-- | flake.nix | 42 | ||||
| -rw-r--r-- | pkgs/default.nix | 11 | ||||
| -rw-r--r-- | pkgs/pywikibot-scripts/default.nix | 40 | ||||
| -rw-r--r-- | pkgs/shell/default.nix | 29 | ||||
| -rw-r--r-- | shell.nix | 6 |
9 files changed, 107 insertions, 39 deletions
@@ -1,2 +1,2 @@ -use flake +use nix PATH_add bin @@ -5,3 +5,4 @@ logs apicache pywikibot-*.lwp throttle.ctrl +result* diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..18a2876 --- /dev/null +++ b/default.nix @@ -0,0 +1,8 @@ +{ pkgs ? import <nixpkgs> args, ... }@args: + +pkgs.callPackage ./pkgs { } +// { + pkgsMusl = pkgs.pkgsMusl.callPackage ./pkgs { }; + + pkgsStatic = pkgs.pkgsStatic.callPackage ./pkgs { }; +} @@ -2,9 +2,7 @@ "nodes": { "flake-utils": { "inputs": { - "systems": [ - "systems" - ] + "systems": "systems" }, "locked": { "lastModified": 1731533236, @@ -39,8 +37,7 @@ "root": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "systems": "systems" + "nixpkgs": "nixpkgs" } }, "systems": { @@ -1,37 +1,13 @@ { - description = "klea's archiveteam flake"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - inputs.systems.url = "github:nix-systems/default"; - inputs.flake-utils = { - url = "github:numtide/flake-utils"; - inputs.systems.follows = "systems"; + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; - outputs = - { nixpkgs, flake-utils, ... }: - flake-utils.lib.eachDefaultSystem ( - system: - let - pkgs = nixpkgs.legacyPackages.${system}; - in - { - devShells = { - default = pkgs.mkShellNoCC { - packages = (with pkgs; [ - (python3.withPackages (p: [ - p.requests - p.lxml - p.pywikibot - ])) - python3Packages.pywikibot - websocat # connect to websocket - jq - libfaketime # used by my fossil script - fossil git # scms - internetarchive # ia cmdline tool - ]); - }; - }; - } - ); + outputs = { self, flake-utils, nixpkgs }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = import nixpkgs { inherit system; }; + in { + legacyPackages = import ./. { inherit pkgs; }; + }); } diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..fc1a96c --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,11 @@ +{ lib, newScope }: + +lib.makeScope newScope (self: { + + /*example = self.callPackage ./example { };*/ + + pywikibot-scripts = self.callPackage ./pywikibot-scripts { }; + + shell = self.callPackage ./shell { pywikibot-scripts = self.pywikibot-scripts; }; + +}) diff --git a/pkgs/pywikibot-scripts/default.nix b/pkgs/pywikibot-scripts/default.nix new file mode 100644 index 0000000..d5ea238 --- /dev/null +++ b/pkgs/pywikibot-scripts/default.nix @@ -0,0 +1,40 @@ +{ + lib, + fetchgit, + python3Packages, +}: + +python3Packages.buildPythonPackage rec { + pname = "pywikibot-scripts"; + version = "10.7.0"; + format = "pyproject"; + + disabled = python3Packages.pythonOlder "3.8"; + + src = fetchgit { + url = "https://gerrit.wikimedia.org/r/pywikibot/core"; + rev = "f1b4b4d0cfbc199c36fb72570425328daa93b067"; + sparseCheckout = [ "pywikibot/scripts" "scripts" ]; + fetchSubmodules = true; + hash = "sha256-MXwrn3WLWmddZRKNryELDRlKmqCqj/6WGDJJbnRAiZs="; + }; + + propagatedBuildInputs = [ + python3Packages.mwparserfromhell + python3Packages.requests + python3Packages.setuptools + ]; + + # Tests attempt to install a tool using pip, which fails due to the sandbox + doCheck = false; + + pythonImportsCheck = [ "pywikibot.scripts" ]; + + meta = { + description = "Python MediaWiki bot framework scripts"; + homepage = "https://www.mediawiki.org/wiki/Manual:Pywikibot"; + changelog = "https://doc.wikimedia.org/pywikibot/master/changelog.html"; + license = lib.licenses.mit; + #maintainers = with lib.maintainers; [ ]; + }; +} diff --git a/pkgs/shell/default.nix b/pkgs/shell/default.nix new file mode 100644 index 0000000..9dfba08 --- /dev/null +++ b/pkgs/shell/default.nix @@ -0,0 +1,29 @@ +{ mkShellNoCC +, python3 +, python3Packages +, websocat +, jq +, libfaketime +, fossil +, git +, internetarchive +, pywikibot-scripts +}: + +mkShellNoCC { + packages = [ + (python3.withPackages (p: [ + p.requests + p.lxml + p.pywikibot + pywikibot-scripts + ])) + python3Packages.pywikibot + pywikibot-scripts + websocat # connect to websocket + jq + libfaketime # used by my fossil script + fossil git # scms + internetarchive # ia cmdline tool + ]; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..8a61b7c --- /dev/null +++ b/shell.nix @@ -0,0 +1,6 @@ +{ + pkgs ? import <nixpkgs> {}, + mypkgs ? import ./pkgs +}: + +(pkgs.callPackage(mypkgs) {}).shell |
