diff --git a/modules/lib/maintainers.nix b/modules/lib/maintainers.nix index bcaa6e484..5286334e8 100644 --- a/modules/lib/maintainers.nix +++ b/modules/lib/maintainers.nix @@ -347,6 +347,12 @@ github = "sebtm"; githubId = 17243347; }; + shimunn = { + name = "shimun"; + email = "home-manager.c.shimun@shimun.net"; + github = "shimunn"; + githubId = 41011289; + }; rasmus-kirk = { name = "Rasmus Kirk"; email = "mail@rasmuskirk.com"; diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 34d2aad19..66a57c37c 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -1230,6 +1230,13 @@ in Rio is a hardware-accelerated GPU terminal emulator powered by WebGPU. ''; } + + { + time = "2023-09-24T10:06:47+00:00"; + message = '' + A new module is available: 'programs.bacon'. + ''; + } ]; }; } diff --git a/modules/modules.nix b/modules/modules.nix index 944d3d5bd..a582b8fc1 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -60,6 +60,7 @@ let ./programs/bash.nix ./programs/bashmount.nix ./programs/bat.nix + ./programs/bacon.nix ./programs/beets.nix ./programs/borgmatic.nix ./programs/bottom.nix diff --git a/modules/programs/bacon.nix b/modules/programs/bacon.nix new file mode 100644 index 000000000..263d1f060 --- /dev/null +++ b/modules/programs/bacon.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + + cfg = config.programs.bacon; + + settingsFormat = pkgs.formats.toml { }; +in { + meta.maintainers = [ hm.maintainers.shimunn ]; + + options.programs.bacon = { + enable = mkEnableOption "bacon, a background rust code checker"; + + settings = mkOption { + type = settingsFormat.type; + example = { + jobs.default = { + command = [ "cargo" "build" "--all-features" "--color" "always" ]; + need_stdout = true; + }; + }; + description = '' + Bacon configuration. + For available settings see . + ''; + }; + }; + + config = mkIf cfg.enable { + home.packages = [ pkgs.bacon ]; + + xdg.configFile."bacon/prefs.toml".source = + settingsFormat.generate "prefs.toml" cfg.settings; + }; +} diff --git a/tests/default.nix b/tests/default.nix index 605e1aa42..94921a3a6 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -62,6 +62,7 @@ import nmt { ./modules/programs/aria2 ./modules/programs/atuin ./modules/programs/autojump + ./modules/programs/bacon ./modules/programs/bash ./modules/programs/bat ./modules/programs/bottom diff --git a/tests/modules/programs/bacon/bacon.nix b/tests/modules/programs/bacon/bacon.nix new file mode 100644 index 000000000..15d98127c --- /dev/null +++ b/tests/modules/programs/bacon/bacon.nix @@ -0,0 +1,23 @@ +{ ... }: { + programs.bacon = { + enable = true; + settings = { + jobs = { + ta = { + command = [ "cargo" "test" "--all-features" "--color" "always" ]; + need_stdout = true; + }; + }; + export = { + enabled = true; + path = ".bacon-locations"; + line_format = "{kind} {path}:{line}:{column} {message}"; + }; + }; + }; + test.stubs.bacon = { }; + nmt.script = '' + assertFileExists home-files/.config/bacon/prefs.toml + assertFileContent home-files/.config/bacon/prefs.toml ${./expected.toml} + ''; +} diff --git a/tests/modules/programs/bacon/default.nix b/tests/modules/programs/bacon/default.nix new file mode 100644 index 000000000..5859a2dda --- /dev/null +++ b/tests/modules/programs/bacon/default.nix @@ -0,0 +1 @@ +{ bacon-program = ./bacon.nix; } diff --git a/tests/modules/programs/bacon/expected.toml b/tests/modules/programs/bacon/expected.toml new file mode 100644 index 000000000..912cfd986 --- /dev/null +++ b/tests/modules/programs/bacon/expected.toml @@ -0,0 +1,8 @@ +[export] +enabled = true +line_format = "{kind} {path}:{line}:{column} {message}" +path = ".bacon-locations" + +[jobs.ta] +command = ["cargo", "test", "--all-features", "--color", "always"] +need_stdout = true