From 494442762c4f515b2b8e437a61cf76fd3af3d584 Mon Sep 17 00:00:00 2001 From: Arian van Putten Date: Wed, 12 Jun 2024 11:50:17 +0200 Subject: [PATCH] amazon-ssm-agent: remove overrideEtc parameter This was meant to make amazon-ssm-agent work "out of the box" on non-NixOS systems but the feature never really worked. The problem is that amazon-ssm-agent looks for the files "amazon-ssm-agent.json" and "seelog.xml" but the files in the package are named "amazon-ssm-agent.json.template" and "seelog.xml.template". So even with this overrideEtc = true it would not be able to find the config. E.g. you'd get an error like Error occurred fetching the seelog config file path: open /nix/store/pyfxjr0i0hszcj9b6fqly6344zf9zhcb-amazon-ssm-agent-3.3.484.0/etc/amazon/ssm/seelog.xml: no such file or directory on startup. Removing this parameter from the from the package doesn't break things as it didn't work in the first place. --- nixos/modules/services/misc/amazon-ssm-agent.nix | 8 +------- pkgs/by-name/am/amazon-ssm-agent/package.nix | 4 ---- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/nixos/modules/services/misc/amazon-ssm-agent.nix b/nixos/modules/services/misc/amazon-ssm-agent.nix index 9ab4a7f96d08..0da10621d0a0 100644 --- a/nixos/modules/services/misc/amazon-ssm-agent.nix +++ b/nixos/modules/services/misc/amazon-ssm-agent.nix @@ -28,13 +28,7 @@ in { options.services.amazon-ssm-agent = { enable = mkEnableOption "Amazon SSM agent"; - - package = mkOption { - type = types.path; - description = "The Amazon SSM agent package to use"; - default = pkgs.amazon-ssm-agent.override { overrideEtc = false; }; - defaultText = literalExpression "pkgs.amazon-ssm-agent.override { overrideEtc = false; }"; - }; + package = mkPackageOption pkgs "amazon-ssm-agent" {}; }; config = mkIf cfg.enable { diff --git a/pkgs/by-name/am/amazon-ssm-agent/package.nix b/pkgs/by-name/am/amazon-ssm-agent/package.nix index 5845d5c71aa3..62f66302806f 100644 --- a/pkgs/by-name/am/amazon-ssm-agent/package.nix +++ b/pkgs/by-name/am/amazon-ssm-agent/package.nix @@ -14,7 +14,6 @@ , nixosTests , testers , amazon-ssm-agent -, overrideEtc ? true }: let @@ -96,9 +95,6 @@ buildGoModule rec { --replace "/sbin/shutdown" "shutdown" echo "${version}" > VERSION - '' + lib.optionalString overrideEtc '' - substituteInPlace agent/appconfig/constants_unix.go \ - --replace '"/etc/amazon/ssm/"' '"${placeholder "out"}/etc/amazon/ssm/"' '' + lib.optionalString stdenv.isLinux '' substituteInPlace agent/managedInstances/fingerprint/hardwareInfo_unix.go \ --replace /usr/sbin/dmidecode ${dmidecode}/bin/dmidecode