Skip to content

Commit

Permalink
Re-introduce config dir and use it for a symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
pinpox committed Apr 7, 2024
1 parent c9a8df7 commit a72d5d8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 6 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
REMOTE_SUDO_COMMAND = ''{{default "${deployment.sudo.command}" .LP_REMOTE_SUDO_COMMAND}}'';
REMOTE_SUDO_OPTS = ''{{default "${pkgs.lib.concatStrings deployment.sudo.opts}" .LP_REMOTE_SUDO_OPTS}}'';
REBUILD_ACTION = ''{{default "switch" .REBUILD_ACTION}}'';
REMOTE_CONFIG_DIR = deployment.config-dir;
LOCAL_FLAKE_SOURCE = configFlake;
HOSTNAME = hostName;
};
Expand Down Expand Up @@ -187,7 +188,7 @@
'' else ''
{{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
"${optionalString useSudo "{{.REMOTE_SUDO_COMMAND}} {{.REMOTE_SUDO_OPTS}}"} nixos-rebuild {{.REBUILD_ACTION}} \
--flake '{{.LOCAL_FLAKE_SOURCE}}#{{.HOSTNAME}}'"
--flake "$(readlink -f {{.REMOTE_CONFIG_DIR}}/flake)#{{.HOSTNAME}}""
'')
];
};
Expand All @@ -203,6 +204,10 @@
--to ssh://{{.REMOTE_USER}}@{{.REMOTE_HOST}} \
{{.LOCAL_FLAKE_SOURCE}}
''
''
{{.REMOTE_COMMAND}} {{.REMOTE_SSH_OPTS}} {{.REMOTE_USER}}@{{.REMOTE_HOST}} \
"${optionalString useSudo "{{.REMOTE_SUDO_COMMAND}} {{.REMOTE_SUDO_OPTS}}"} ln -sfn {{.LOCAL_FLAKE_SOURCE}} {{.REMOTE_CONFIG_DIR}}/flake"
''
];
};
} // hostConfig.config.lollypops.extraTasks;
Expand Down
12 changes: 9 additions & 3 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ let
in
{

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

options.lollypops = {

Expand Down Expand Up @@ -93,6 +93,12 @@ in
description = "Evaluate locally instead of on the remote when rebuilding";
};

config-dir = mkOption {
type = types.str;
default = "/var/src/lollypops";
description = "Path to place the configuration on the remote host";
};

group = mkOption {
type = types.str;
default = "default";
Expand Down

0 comments on commit a72d5d8

Please sign in to comment.