diff --git a/helpers.nix b/helpers.nix index 5752db1..d953517 100644 --- a/helpers.nix +++ b/helpers.nix @@ -100,10 +100,12 @@ with inputs.nixpkgs.lib; { }: let pkgs = import nixpkgs { system = "aarch64-linux"; - config.allowUnfree = true; - overlays = [ - nix-on-droid.overlays.default - ]; + config = { + allowUnfree = true; + overlays = [ + nix-on-droid.overlays.default + ]; + }; }; activateNixOnDroid = configuration: @@ -114,12 +116,10 @@ with inputs.nixpkgs.lib; { nixOnDroidConfigurations.${hostname} = nix-on-droid.lib.nixOnDroidConfiguration { inherit pkgs; + extraSpecialArgs = {inherit uid gid;}; + modules = [ ./suites/nix-on-droid - { - user.uid = uid; - user.gid = gid; - } ]; }; diff --git a/suites/nix-on-droid/default.nix b/suites/nix-on-droid/default.nix index 69c7ff6..ad6103a 100644 --- a/suites/nix-on-droid/default.nix +++ b/suites/nix-on-droid/default.nix @@ -2,6 +2,8 @@ config, pkgs, lib, + uid, + gid, ... }: with lib; let @@ -17,6 +19,12 @@ with lib; let ${pkgs.openssh}/bin/sshd -f "${sshdDirectory}/sshd_config" -D ''; in { + # Set UID & GID + user = { + uid = uid; + gid = gid; + }; + # NixOS version. system.stateVersion = "24.05"; @@ -28,7 +36,7 @@ in { # SSHD script. build.activation.sshd = '' $DRY_RUN_CMD mkdir $VERBOSE_ARG --parents "${config.user.home}/.ssh" - $DRY_RUN_CMD cat ${authorizedKeys} > "${config.user.home}/.ssh/authorized_keys" + $DRY_RUN_CMD echo ${authorizedKeys} > "${config.user.home}/.ssh/authorized_keys" if [[ ! -d "${sshdDirectory}" ]]; then $DRY_RUN_CMD rm $VERBOSE_ARG --recursive --force "${sshdTmpDirectory}"