From 9ec11a8a249b8eb66297e5f1a0ba786e11f62011 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Fri, 27 Sep 2024 14:43:07 +0900 Subject: [PATCH] :heavy_plus_sign: migrate taskwarrior parts to taskwarrior-flake --- flake.lock | 79 +++++++++++++++++++++++++++++++++++- flake.nix | 22 +++++----- homes/palo/taskwarrior.nix | 82 +------------------------------------- nix/packages/default.nix | 18 --------- 4 files changed, 92 insertions(+), 109 deletions(-) diff --git a/flake.lock b/flake.lock index 08133f0..e615612 100644 --- a/flake.lock +++ b/flake.lock @@ -291,6 +291,24 @@ "type": "github" } }, + "flake-parts_5": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_3" + }, + "locked": { + "lastModified": 1726153070, + "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1644229661, @@ -761,6 +779,18 @@ "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" } }, + "nixpkgs-lib_3": { + "locked": { + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1710695816, @@ -998,8 +1028,8 @@ "retiolum": "retiolum", "srvos": "srvos", "stylix": "stylix", - "taskshell": "taskshell", - "treefmt-nix": "treefmt-nix_4" + "taskwarrior": "taskwarrior", + "treefmt-nix": "treefmt-nix_5" } }, "sops-nix": { @@ -1157,6 +1187,7 @@ "inputs": { "flake-utils": "flake-utils_6", "nixpkgs": [ + "taskwarrior", "nixpkgs" ] }, @@ -1174,6 +1205,29 @@ "type": "github" } }, + "taskwarrior": { + "inputs": { + "flake-parts": "flake-parts_5", + "nixpkgs": [ + "nixpkgs" + ], + "taskshell": "taskshell", + "treefmt-nix": "treefmt-nix_4" + }, + "locked": { + "lastModified": 1727415270, + "narHash": "sha256-VrzBytDYF6rextg0qjxtnGEyw88fa1LrWuXfG4k6zE0=", + "owner": "mrvandalo", + "repo": "taskwarrior-flake", + "rev": "6d95efd92e3ae93e4e395f115116e2435fe79e80", + "type": "github" + }, + "original": { + "owner": "mrvandalo", + "repo": "taskwarrior-flake", + "type": "github" + } + }, "tinted-foot": { "flake": false, "locked": { @@ -1286,6 +1340,27 @@ } }, "treefmt-nix_4": { + "inputs": { + "nixpkgs": [ + "taskwarrior", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727252110, + "narHash": "sha256-3O7RWiXpvqBcCl84Mvqa8dXudZ1Bol1ubNdSmQt7nF4=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "1bff2ba6ec22bc90e9ad3f7e94cca0d37870afa3", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "treefmt-nix_5": { "inputs": { "nixpkgs": [ "nixpkgs" diff --git a/flake.nix b/flake.nix index 33d6dc7..4a5301e 100644 --- a/flake.nix +++ b/flake.nix @@ -17,9 +17,9 @@ kmonad.inputs.nixpkgs.follows = "nixpkgs"; # fixme: kmonad crashes every now and than and the keyboard is not usable anymore. kmonad.url = "github:kmonad/kmonad?dir=nix"; # todo: mabye use https://github.com/jtroo/kanata instead landingpage.url = "github:mrVanDalo/landingpage"; - nixos-anywhere.url = "github:nix-community/nixos-anywhere"; nix-topology.inputs.nixpkgs.follows = "nixpkgs"; nix-topology.url = "github:oddlama/nix-topology"; + nixos-anywhere.url = "github:nix-community/nixos-anywhere"; nixos-hardware.url = "github:nixos/nixos-hardware"; nixpkgs-legacy_2211.url = "github:nixos/nixpkgs/nixos-22.11"; nixpkgs-legacy_2311.url = "github:nixos/nixpkgs/nixos-23.11"; @@ -37,8 +37,9 @@ stylix.inputs.home-manager.follows = "home-manager"; stylix.inputs.nixpkgs.follows = "nixpkgs"; stylix.url = "github:danth/stylix"; - taskshell.inputs.nixpkgs.follows = "nixpkgs"; - taskshell.url = "github:mrvandalo/taskshell"; + taskwarrior.inputs.nixpkgs.follows = "nixpkgs"; + taskwarrior.url = "github:mrvandalo/taskwarrior-flake"; + #taskwarrior.url = "git+file:///home/palo/dev/nixos/taskwarrior-flake"; treefmt-nix.inputs.nixpkgs.follows = "nixpkgs"; treefmt-nix.url = "github:numtide/treefmt-nix"; @@ -52,7 +53,6 @@ outputs = inputs@{ - self, clan-core, clan-fact-generators, flake-parts, @@ -60,6 +60,7 @@ home-manager-utils, kmonad, landingpage, + nix-topology, nixos-anywhere, nixos-hardware, nixpkgs, @@ -71,11 +72,11 @@ polygon-art, private-parts, retiolum, + self, srvos, stylix, - taskshell, + taskwarrior, treefmt-nix, - nix-topology, }: let @@ -129,12 +130,14 @@ polygon-art = polygon-art.packages.${system}; landingpage = landingpage.packages.${system}.plain; kmonad = kmonad.packages.${system}.kmonad; - tasksh = taskshell.packages.${system}.tasksh; + inherit (taskwarrior.packages.${system}) + bugwarrior + tasksh + taskwarrior-hooks + ; inherit (self.packages.${system}) otpmenu - taskwarrior-hooks nsxiv - bugwarrior ; }) ]; @@ -359,6 +362,7 @@ home-manager.backupFileExtension = "backup"; home-manager.sharedModules = [ home-manager-utils.hmModule + taskwarrior.hmModules.bugwarrior ]; }; diff --git a/homes/palo/taskwarrior.nix b/homes/palo/taskwarrior.nix index f805be4..07d01b0 100644 --- a/homes/palo/taskwarrior.nix +++ b/homes/palo/taskwarrior.nix @@ -7,97 +7,19 @@ with lib; with types; let - mkMagicMergeOption = - { - description ? "", - example ? { }, - default ? { }, - apply ? id, - ... - }: - mkOption { - inherit - example - description - default - apply - ; - type = - with lib.types; - let - valueType = - nullOr (oneOf [ - bool - int - float - str - (attrsOf valueType) - (listOf valueType) - ]) - // { - description = "bool, int, float or str"; - emptyValue.value = { }; - }; - in - valueType; - }; #taskwarrior-tui = pkgs.legacy_2311.taskwarrior-tui; taskwarrior-tui = pkgs.taskwarrior-tui; - taskwarrior = pkgs.taskwarrior3; in { - # bugwarrior (a bit fiddly) - imports = [ - { - - options.bugwarrior.config = mkMagicMergeOption { - type = attrs; - default = { }; - }; - - config = mkIf config.gui.enable { - home.file.".config/bugwarrior/bugwarrior.toml".source = - (pkgs.formats.toml { }).generate "bugwarriorrc.toml" - ( - { - general.taskrc = pkgs.writeText "taskrc" "data.location=$HOME/.bugwarrior"; - } - // config.bugwarrior.config - ); - home.packages = [ - pkgs.bugwarrior - #export TASKRC=$HOME/.bugwarrior/${pkgs.writeText "bugwarrior.taskrc" "data.location=$HOME/.bugwarrior"} - (pkgs.writers.writeBashBin "bugwarrior-sync" '' - set -eo pipefail - - mkdir -p $HOME/.bugwarrior - touch $HOME/.bugwarrior/taskrc - - export TASKRC=$HOME/.bugwarrior/taskrc - export TASKDATA=$HOME/.bugwarrior - echo "bugwarrior pull" | ${pkgs.boxes}/bin/boxes -d ansi - ${pkgs.bugwarrior}/bin/bugwarrior pull "$@" - echo "task export" | ${pkgs.boxes}/bin/boxes -d ansi - ${pkgs.taskwarrior}/bin/task export > $HOME/.bugwarrior/bugwarrior.json - - unset TASKRC - unset TASKDATA - echo "task import" | ${pkgs.boxes}/bin/boxes -d ansi - ${taskwarrior}/bin/task import rc.hooks=0 $HOME/.bugwarrior/bugwarrior.json - '') - ]; - }; - - } - ]; - config = mkIf config.gui.enable { + bugwarrior.enable = true; + home.packages = [ pkgs.timewarrior diff --git a/nix/packages/default.nix b/nix/packages/default.nix index 608cbd9..11f3314 100644 --- a/nix/packages/default.nix +++ b/nix/packages/default.nix @@ -12,28 +12,10 @@ packages.otpmenu = callPackage ./otpmenu { }; #packages.sononym = callPackage ./sononym { }; #packages.sononym-crawler = callPackage ./sononym-crawler { }; - packages.taskwarrior-hooks = callPackage ./taskwarrior-hooks { }; # overrides # --------- packages.nsxiv = (pkgs.nsxiv.override { conf = builtins.readFile ./nsxiv/config.def.h; }); - packages.bugwarrior = python311Packages.bugwarrior.overrideAttrs (old: { - version = "2024-08-27-r1"; - src = pkgs.fetchFromGitHub { - owner = "ralphbean"; - repo = "bugwarrior"; - rev = "25e99834ef79e0a8c7141943810e0aa5152d6710"; - sha256 = "sha256-JPmFP6i/7Ji5LyrKT9WCngWqMyrM00rEXV8QVLwxx1A="; - }; - propagatedBuildInputs = old.propagatedBuildInputs ++ [ - python311Packages.pydantic_1 - python311Packages.tomli - python311Packages.email-validator - python311Packages.packaging - python311Packages.pbr - ]; - }); - }; }