Skip to content

Commit

Permalink
earthly: init module
Browse files Browse the repository at this point in the history
Earthly is a build configuration framework utilizing buildkit and
Dockerfile-like syntax for simplicity and fast builds.
  • Loading branch information
folliehiyuki committed Jan 3, 2025
1 parent a998762 commit 406fb00
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/lib/maintainers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -628,4 +628,10 @@
github = "ALameLlama";
githubId = 55490546;
};
folliehiyuki = {
name = "Hoang Nguyen";
email = "[email protected]";
github = "folliehiyuki";
githubId = 67634026;
};
}
10 changes: 10 additions & 0 deletions modules/misc/news.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,16 @@ in {
speed, features, or native UIs. Ghostty provides all three.
'';
}

{
time = "2025-01-04T16:53:20+00:00";
message = ''
A new module is available: 'programs.earthly'.
Earthly is a build configuration framework utilizing buildkit and
Dockerfile-like syntax for fast builds and simplicity.
'';
}
];
};
}
1 change: 1 addition & 0 deletions modules/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ let
./programs/dircolors.nix
./programs/direnv.nix
./programs/discocss.nix
./programs/earthly.nix
./programs/eclipse.nix
./programs/emacs.nix
./programs/eww.nix
Expand Down
42 changes: 42 additions & 0 deletions modules/programs/earthly.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{ config, lib, pkgs, ... }:

with lib;

let

cfg = config.programs.earthly;

yamlFormat = pkgs.formats.yaml { };

in {
meta.maintainers = [ maintainers.folliehiyuki ];

options.programs.earthly = {
enable = mkEnableOption "earthly";

package = mkPackageOption pkgs "earthly" { };

settings = mkOption {
type = yamlFormat.type;
default = { };
description = ''
Configuration written to ~/.earthly/config.yml file.
See https://docs.earthly.dev/docs/earthly-config for supported values.
'';
example = literalExpression ''
global = {
disable_analytics = true;
disable_log_sharing = true;
};
'';
};
};

config = mkIf cfg.enable {
home.packages = [ cfg.package ];

home.file.".earthly/config.yml" = mkIf (cfg.settings != { }) {
source = yamlFormat.generate "earthly-config" cfg.settings;
};
};
}
1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ in import nmtSrc {
./modules/programs/darcs
./modules/programs/dircolors
./modules/programs/direnv
./modules/programs/earthly
./modules/programs/emacs
./modules/programs/fastfetch
./modules/programs/feh
Expand Down
1 change: 1 addition & 0 deletions tests/modules/programs/earthly/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ earthly-settings = ./earthly-settings.nix; }
21 changes: 21 additions & 0 deletions tests/modules/programs/earthly/earthly-settings.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
_:

{
programs.earthly = {
enable = true;

settings = {
global.disable_analytics = true;

git."github.com" = {
auth = "ssh";
user = "username";
};
};
};

nmt.script = ''
assertFileExists home-files/.earthly/config.yml
assertFileContent home-files/.earthly/config.yml ${./earthly-settings.yml}
'';
}
6 changes: 6 additions & 0 deletions tests/modules/programs/earthly/earthly-settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
git:
github.com:
auth: ssh
user: username
global:
disable_analytics: true

0 comments on commit 406fb00

Please sign in to comment.