add my user and passwordless sudo right away

This commit is contained in:
CherryKitten 2024-04-06 22:19:46 +02:00
parent 5ef3f953d3
commit 98c8157d75
Signed by: sammy
GPG key ID: 98D8F75FB0658276

View file

@ -34,24 +34,36 @@ makeConf() {
[[ -n "$doNetConf" ]] && network_import="./networking.nix # generated at runtime by nixos-infect" [[ -n "$doNetConf" ]] && network_import="./networking.nix # generated at runtime by nixos-infect"
cat > /etc/nixos/configuration.nix << EOF cat > /etc/nixos/configuration.nix << EOF
{ ... }: { { ... }:
let
keys = [$(while read -r line; do
line=$(echo -n "$line" | sed 's/\r//g')
trimmed_line=$(echo -n "$line" | xargs)
echo -n "''$trimmed_line'' "
done <<< "$keys")];
in
{
imports = [ imports = [
./hardware-configuration.nix ./hardware-configuration.nix
$network_import $network_import
$NIXOS_IMPORT $NIXOS_IMPORT
]; ];
boot.tmp.cleanOnBoot = true; boot.tmp.cleanOnBoot = true;
zramSwap.enable = ${zramswap}; zramSwap.enable = ${zramswap};
networking.hostName = "$(hostname -s)"; networking.hostName = "$(hostname -s)";
networking.domain = "$(hostname -d)"; networking.domain = "$(hostname -d)";
services.openssh.enable = true; services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = [$(while read -r line; do security.sudo.wheelNeedsPassword = false;
line=$(echo -n "$line" | sed 's/\r//g')
trimmed_line=$(echo -n "$line" | xargs)
echo -n "''$trimmed_line'' "
done <<< "$keys")];
system.stateVersion = "23.11"; system.stateVersion = "23.11";
users.users.root.openssh.authorizedKeys.keys = keys;
users.users.sammy = {
isNormalUser = true;
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = keys;
};
};
} }
EOF EOF