nix-on-droid fixes

This commit is contained in:
Fern Garden 2025-07-16 23:56:48 +08:00
parent 11494614c8
commit 9bf27e1960
2 changed files with 17 additions and 9 deletions

View file

@ -100,11 +100,13 @@ with inputs.nixpkgs.lib; {
}: let
pkgs = import nixpkgs {
system = "aarch64-linux";
config.allowUnfree = true;
config = {
allowUnfree = true;
overlays = [
nix-on-droid.overlays.default
];
};
};
activateNixOnDroid = configuration:
deploy-rs.lib.aarch64-linux.activate.custom
@ -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;
}
];
};

View file

@ -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}"