tool: allow overriding profile name

Closes #18
This commit is contained in:
Julie B. 2021-09-29 20:46:08 +02:00
parent df1bd92229
commit d58d012d4c
3 changed files with 21 additions and 3 deletions

View File

@ -61,6 +61,21 @@ lib.optionalAttrs stdenv.isLinux {
'';
};
install_rename = mkTest {
name = "miniguest-install-rename";
testScript = ''
machine.succeed("""
miniguest install --name=renamed_dummy /tmp/flake1#dummy
""")
assert "foo" in machine.succeed("""
cat /etc/miniguests/renamed_dummy/boot/init
""")
assert "/nix/var/nix/profiles/miniguest-profiles/renamed_dummy\n" == machine.succeed("""
readlink /etc/miniguests/renamed_dummy
""")
'';
};
install_nonexistent = mkTest {
name = "miniguest-install-nonexistent";
testScript = ''

View File

@ -18,11 +18,12 @@
source install_arg.bash
parse_flake_reference "$_arg_flake_reference"
profile_name="${_arg_name:-$guest_name}"
mkdir -p "$guests_dir" || die "" $?
mkdir -p "$profiles_dir" || die "" $?
reset_profile "$guest_name" # FIXME: need an atomic reset-and-install
install_profile "$guest_name" "$flake#nixosConfigurations.$guest_name.config.system.build.miniguest"
reset_profile "$profile_name" # FIXME: need an atomic reset-and-install
install_profile "$profile_name" "$flake#nixosConfigurations.$guest_name.config.system.build.miniguest"
have_control_of_symlink "$guest_name" && ln -sf "$profiles_dir/$guest_name" "$guests_dir"
have_control_of_symlink "$profile_name" && ln -sf "$profiles_dir/$profile_name" "$guests_dir"

View File

@ -15,5 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with Miniguest. If not, see <https://www.gnu.org/licenses/>.
# ARG_HELP(build the guest and install it into a nix profile)
# ARG_POSITIONAL_SINGLE(flake-reference, guest to build)
# ARG_OPTIONAL_SINGLE(name, n, name of the profile)
# ARGBASH_GO