Skip to content

Commit

Permalink
caddy: use mainProgram for binary
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Dec 6, 2023
1 parent a7c4dd8 commit 8429584
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions devenv.lock
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1689261696,
"narHash": "sha256-LzfUtFs9MQRvIoQ3MfgSuipBVMXslMPH/vZ+nM40LkA=",
"lastModified": 1701693815,
"narHash": "sha256-7BkrXykVWfkn6+c1EhFA3ko4MLi3gVG0p9G96PNnKTM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "df1eee2aa65052a18121ed4971081576b25d6b5c",
"rev": "09ec6a0881e1a36c29d67497693a67a16f4da573",
"type": "github"
},
"original": {
Expand Down Expand Up @@ -164,11 +164,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1688596063,
"narHash": "sha256-9t7RxBiKWHygsqXtiNATTJt4lim/oSYZV3RG8OjDDng=",
"lastModified": 1700922917,
"narHash": "sha256-ej2fch/T584b5K9sk1UhmZF7W6wEfDHuoUYpFN8dtvM=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "c8d18ba345730019c3faf412c96a045ade171895",
"rev": "e5ee5c5f3844550c01d2131096c7271cec5e9b78",
"type": "github"
},
"original": {
Expand Down
6 changes: 3 additions & 3 deletions src/modules/services/caddy.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ let

formattedConfig = pkgs.runCommand "formattedCaddyFile" { } ''
cp --no-preserve=mode,ownership ${configFile} $out
${cfg.package}/bin/caddy fmt --overwrite $out
${cfg.package}/bin/${cfg.package.meta.mainProgram} fmt --overwrite $out
'';

tlsConfig = {
Expand All @@ -28,7 +28,7 @@ let
};

adaptedConfig = pkgs.runCommand "caddy-config-adapted.json" { } ''
${cfg.package}/bin/caddy adapt \
${cfg.package}/bin/${cfg.package.meta.mainProgram} adapt \
--config ${formattedConfig} --adapter ${cfg.adapter} > $out
'';
tlsJSON = pkgs.writeText "tls.json" (builtins.toJSON tlsConfig);
Expand Down Expand Up @@ -179,6 +179,6 @@ in
};

config = lib.mkIf cfg.enable {
processes.caddy.exec = "XDG_DATA_HOME=${cfg.dataDir}/data XDG_CONFIG_HOME=${cfg.dataDir}/config ${cfg.package}/bin/caddy run ${optionalString cfg.resume "--resume"} --config ${configJSON}";
processes.caddy.exec = "XDG_DATA_HOME=${cfg.dataDir}/data XDG_CONFIG_HOME=${cfg.dataDir}/config ${cfg.package}/bin/${cfg.package.meta.mainProgram} run ${optionalString cfg.resume "--resume"} --config ${configJSON}";
};
}

0 comments on commit 8429584

Please sign in to comment.