From 07d807c4db3a6240ae15761c4ff7e9f2f024c06d Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Tue, 7 Nov 2023 16:47:53 +0100 Subject: [PATCH] fixing bugwarrior --- flake.lock | 8 ++-- nixos/components/README.md | 6 +++ nixos/components/gui/bugwarriorc.toml | 29 -------------- nixos/components/gui/taskwarrior.nix | 52 ++++++++++++++++++++++++-- nixos/machines/cream/configuration.nix | 39 ++++++++++++++++++- 5 files changed, 97 insertions(+), 37 deletions(-) create mode 100644 nixos/components/README.md delete mode 100644 nixos/components/gui/bugwarriorc.toml diff --git a/flake.lock b/flake.lock index c14df5b..d3ba8a7 100644 --- a/flake.lock +++ b/flake.lock @@ -972,11 +972,11 @@ }, "private_assets": { "locked": { - "lastModified": 1682948724, - "narHash": "sha256-hTSiqRTpKuPksq5vsAO0pIuHdYIaL5EGrmN0T6C3oog=", + "lastModified": 1699371582, + "narHash": "sha256-/Axuxxqnmrinj2HwVJWz7imGRdzgxk6HGrr2341o8LE=", "ref": "main", - "rev": "84460fabef41115fa12323c9eaf89abfbe76f22f", - "revCount": 10, + "rev": "3d1c3f6abfebf5750dd7997d06283db9583213dc", + "revCount": 14, "type": "git", "url": "ssh://gitea@git.ingolf-wagner.de/palo/nixos-private-assets.git" }, diff --git a/nixos/components/README.md b/nixos/components/README.md new file mode 100644 index 0000000..d8c8454 --- /dev/null +++ b/nixos/components/README.md @@ -0,0 +1,6 @@ +# components concept + +- components are kinda opinionated. +- should be project agnostic (e.g.: configure bugwarrior via options but leave specifics out). +- `component..enabled` should usually be the default for all it subcomponents (`comonent...enabled`). + - But default should make sense here! diff --git a/nixos/components/gui/bugwarriorc.toml b/nixos/components/gui/bugwarriorc.toml deleted file mode 100644 index f573725..0000000 --- a/nixos/components/gui/bugwarriorc.toml +++ /dev/null @@ -1,29 +0,0 @@ -[general] -targets = terranix, github_private -static_fields = priority -log.level = INFO - -[terranix] -service = github -github.login = mrVanDalo -github.token = @oracle:eval:/nix/store/zhs5nd260m8s9nn8w4y9v8isfvclq9i3-password-store-1.7.4/bin/pass development/github/mrVanDalo/bugwarriorAccessToken -github.username = mrVanDalo -github.default_priority = -github.description_template = {{githubtitle}} {{githuburl}} -github.add_tags = github -github.project_name = terranix -github.involved_issues = True -github.query = org:terranix is:open -github.include_user_issues = False -github.include_user_repos = False - -[github_private] -service = github -github.login = mrVanDalo -github.token = @oracle:eval:/nix/store/zhs5nd260m8s9nn8w4y9v8isfvclq9i3-password-store-1.7.4/bin/pass development/github/mrVanDalo/bugwarriorAccessToken -github.username = mrVanDalo -github.description_template = {{githubtitle}} {{githuburl}} -github.add_tags = github -github.involved_issues = True -github.include_user_issues = True -github.include_user_repos = True diff --git a/nixos/components/gui/taskwarrior.nix b/nixos/components/gui/taskwarrior.nix index 8cf7d31..33ec8c2 100644 --- a/nixos/components/gui/taskwarrior.nix +++ b/nixos/components/gui/taskwarrior.nix @@ -1,11 +1,40 @@ { config, pkgs, lib, ... }: 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; + }; +in + { options.components.gui.taskwarrior.enable = mkOption { - type = lib.types.bool; + type = bool; default = config.components.gui.enable; }; + options.components.gui.taskwarrior.config = mkMagicMergeOption { + type = attrs; + default = { }; + }; + config = mkIf (config.components.gui.taskwarrior.enable) { environment.systemPackages = with pkgs; [ @@ -33,10 +62,27 @@ with lib; ${pkgs.khal}/bin/ikhal '') - python3Packages.bugwarrior + # todo : before deleting this, put it in trilium + (python3Packages.bugwarrior.overrideAttrs (old: { + version = "develop"; + src = pkgs.fetchFromGitHub { + owner = "ralphbean"; + repo = "bugwarrior"; + rev = "eb19a702a698f9c8c3ce2a1fe41f35872d9ae398"; + sha256 = "sha256-Geon+ddE58WJ10L4unotzvmZj1Ye0yjZHVQgrR2YWgE="; + }; + propagatedBuildInputs = old.propagatedBuildInputs ++ [ + python3Packages.pydantic + python3Packages.tomli + python3Packages.email-validator + python3Packages.packaging + ]; + })) ]; - home-manager.users.mainUser.home.file.".config/bugwarrior/bugwarriorrc".source = ./bugwarriorc.toml; + #home-manager.users.mainUser.home.file.".config/bugwarrior/bugwarriorrc".source = ./bugwarriorc.ini; + #home-manager.users.mainUser.home.file.".config/bugwarrior/bugwarriorrc".source = (pkgs.formats.toml { }).generate "bugwarriorrc.toml" config.components.gui.taskwarrior.config; + home-manager.users.mainUser.home.file.".config/bugwarrior/bugwarrior.toml".source = (pkgs.formats.toml { }).generate "bugwarriorrc.toml" config.components.gui.taskwarrior.config; }; diff --git a/nixos/machines/cream/configuration.nix b/nixos/machines/cream/configuration.nix index f00348a..cc335bc 100644 --- a/nixos/machines/cream/configuration.nix +++ b/nixos/machines/cream/configuration.nix @@ -1,4 +1,5 @@ -{ config, pkgs, lib, ... }: { +{ config, pkgs, lib, ... }: +{ imports = [ @@ -37,6 +38,42 @@ components.network.wifi.enable = true; components.terminal.enable = true; + + components.gui.taskwarrior.config = { + general = { + targets = [ "terranix" "github_private" ]; + #targets = [ "terranix" "github_private" "jobrad" ]; + static_fields = "priority"; + log_level = "INFO"; + }; + terranix = { + service = "github"; + login = "mrVanDalo"; + token = "@oracle:eval:${pkgs.pass}/bin/pass development/github/mrVanDalo/bugwarriorAccessToken"; + username = "mrVanDalo"; + default_priority = ""; + description_template = "{{githubtitle}} {{githuburl}}"; + add_tags = "github"; + project_template = "terranix"; + involved_issues = true; + query = "org:terranix is:open"; + include_user_issues = false; + include_user_repos = false; + }; + github_private = { + service = "github"; + login = "mrVanDalo"; + token = "@oracle:eval:${pkgs.pass}/bin/pass development/github/mrVanDalo/bugwarriorAccessToken"; + username = "mrVanDalo"; + description_template = "{{githubtitle}} {{githuburl}}"; + add_tags = "github"; + involved_issues = true; + include_user_issues = true; + include_user_repos = true; + }; + }; + + users.users.mainUser.extraGroups = [ "pipewire" ]; services.nginx.enable = true;