forked from Mirrors/nixos-infect
add my user and passwordless sudo right away
This commit is contained in:
parent
5ef3f953d3
commit
98c8157d75
1 changed files with 29 additions and 17 deletions
46
nixos-infect
46
nixos-infect
|
@ -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
|
||||||
{ ... }: {
|
{ ... }:
|
||||||
imports = [
|
let
|
||||||
./hardware-configuration.nix
|
keys = [$(while read -r line; do
|
||||||
$network_import
|
line=$(echo -n "$line" | sed 's/\r//g')
|
||||||
$NIXOS_IMPORT
|
trimmed_line=$(echo -n "$line" | xargs)
|
||||||
];
|
echo -n "''$trimmed_line'' "
|
||||||
|
done <<< "$keys")];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./hardware-configuration.nix
|
||||||
|
$network_import
|
||||||
|
$NIXOS_IMPORT
|
||||||
|
];
|
||||||
|
|
||||||
boot.tmp.cleanOnBoot = true;
|
|
||||||
zramSwap.enable = ${zramswap};
|
boot.tmp.cleanOnBoot = true;
|
||||||
networking.hostName = "$(hostname -s)";
|
zramSwap.enable = ${zramswap};
|
||||||
networking.domain = "$(hostname -d)";
|
networking.hostName = "$(hostname -s)";
|
||||||
services.openssh.enable = true;
|
networking.domain = "$(hostname -d)";
|
||||||
users.users.root.openssh.authorizedKeys.keys = [$(while read -r line; do
|
services.openssh.enable = true;
|
||||||
line=$(echo -n "$line" | sed 's/\r//g')
|
security.sudo.wheelNeedsPassword = false;
|
||||||
trimmed_line=$(echo -n "$line" | xargs)
|
system.stateVersion = "23.11";
|
||||||
echo -n "''$trimmed_line'' "
|
users.users.root.openssh.authorizedKeys.keys = keys;
|
||||||
done <<< "$keys")];
|
users.users.sammy = {
|
||||||
system.stateVersion = "23.11";
|
isNormalUser = true;
|
||||||
|
extraGroups = [ "wheel" ];
|
||||||
|
openssh.authorizedKeys.keys = keys;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue