Skip to content

Commit 203d20a

Browse files
committed
Re-introduce config dir and use it for a symlink
1 parent c9a8df7 commit 203d20a

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

flake.nix

+7-2
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
REMOTE_SUDO_COMMAND = ''{{default "${deployment.sudo.command}" .LP_REMOTE_SUDO_COMMAND}}'';
103103
REMOTE_SUDO_OPTS = ''{{default "${pkgs.lib.concatStrings deployment.sudo.opts}" .LP_REMOTE_SUDO_OPTS}}'';
104104
REBUILD_ACTION = ''{{default "switch" .REBUILD_ACTION}}'';
105+
REMOTE_CONFIG_DIR = deployment.config-dir;
105106
LOCAL_FLAKE_SOURCE = configFlake;
106107
HOSTNAME = hostName;
107108
};
@@ -187,7 +188,7 @@
187188
'' else ''
188189
{{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
189190
"${optionalString useSudo "{{.REMOTE_SUDO_COMMAND}} {{.REMOTE_SUDO_OPTS}}"} nixos-rebuild {{.REBUILD_ACTION}} \
190-
--flake '{{.LOCAL_FLAKE_SOURCE}}#{{.HOSTNAME}}'"
191+
--flake "$(readlink -f {{.REMOTE_CONFIG_DIR}}/flake)#{{.HOSTNAME}}""
191192
'')
192193
];
193194
};
@@ -203,6 +204,10 @@
203204
--to ssh://{{.REMOTE_USER}}@{{.REMOTE_HOST}} \
204205
{{.LOCAL_FLAKE_SOURCE}}
205206
''
207+
''
208+
{{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
209+
"${optionalString useSudo "{{.REMOTE_SUDO_COMMAND}} {{.REMOTE_SUDO_OPTS}}"} ln -sfn {{.LOCAL_FLAKE_SOURCE}} {{.REMOTE_CONFIG_DIR}}/flake"
210+
''
206211
];
207212
};
208213
} // hostConfig.config.lollypops.extraTasks;
@@ -230,7 +235,7 @@
230235
version = "3";
231236
output = "prefixed";
232237

233-
# Don't print excuted commands. Can be overridden by -v
238+
# Don't print executed commands. Can be overridden by -v
234239
silent = true;
235240

236241
# Import the tasks once for each host, setting the HOST

module.nix

+9-3
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ let
5151
in
5252
{
5353

54-
imports = [
55-
(mkRemovedOptionModule ["lollypops" "deployment" "config-dir"] "The flake is now stored in the Nix store directly.")
56-
];
54+
# imports = [
55+
# (mkRemovedOptionModule ["lollypops" "deployment" "config-dir"] "The flake is now stored in the Nix store directly.")
56+
# ];
5757

5858
options.lollypops = {
5959

@@ -93,6 +93,12 @@ in
9393
description = "Evaluate locally instead of on the remote when rebuilding";
9494
};
9595

96+
config-dir = mkOption {
97+
type = types.str;
98+
default = "/var/src/lollypops";
99+
description = "Path to place the configuration on the remote host";
100+
};
101+
96102
group = mkOption {
97103
type = types.str;
98104
default = "default";

0 commit comments

Comments
 (0)