Skip to content

Commit

Permalink
Added home-manager monero node
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus-kirk committed Dec 13, 2024
1 parent d5dc5a0 commit ccd626f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
1 change: 1 addition & 0 deletions configurations/home-manager/work/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ in {
mpv.enable = true;
mvi.enable = true;
xdgMime.enable = true;
monero.enable = true;
git = {
enable = true;
userEmail = "[email protected]";
Expand Down
1 change: 1 addition & 0 deletions modules/home-manager/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
./helix
./homeManagerScripts
./jiten
./monero
./mpv
./mvi
./scripts
Expand Down
2 changes: 1 addition & 1 deletion modules/home-manager/homeManagerScripts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ in {
};

disableNews = mkOption {
type = types.nullOr types.str;
type = types.nullOr types.bool;
default = true;
description = "Disable annoying home-manager news on rebuild.";
};
Expand Down
45 changes: 45 additions & 0 deletions modules/home-manager/monero/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
pkgs,
config,
lib,
...
}:
with lib; let
cfg = config.kirk.monero;

configFile = pkgs.writeText "monero.conf" ''
log-file=/dev/stdout
log-level=0
data-dir=${cfg.dataDir}
${cfg.extraConfig}
'';
in {
options.kirk.monero = {
enable = mkEnableOption "the monero node user-level systemd-service.";

dataDir = mkOption {
type = types.str;
default = "$HOME/.bitmonero";
description = "The directory that the node uses for state.";
};

extraConfig = mkOption {
type = types.str;
default = "";
description = "Extra configuration to pass to the node.";
};
};

config = mkIf cfg.enable {
systemd.user.services.monero = {
Unit.Description = "Monero node daemon";

Service = {
ExecStart = "${pkgs.bash}/bin/bash -c '${pkgs.monero-cli}/bin/monerod --config-file=${configFile} --data-dir=${cfg.dataDir} --non-interactive'";
Restart = "always";
SuccessExitStatus = [ 0 1 ];
};
};
};
}

0 comments on commit ccd626f

Please sign in to comment.