forked from cyberia/capsul-images
aynish-nixos #1
6 changed files with 73 additions and 56 deletions
|
@ -5,7 +5,7 @@ homedir="/home/$user"
|
|||
|
||||
mkdir -p "$homedir/.ssh"
|
||||
chmod 700 "$homedir/.ssh"
|
||||
chown "$user" "$homedir/.ssh"
|
||||
chown -R "$user:$user" "$homedir"
|
||||
|
||||
mount -t iso9660 -o ro /dev/sr0 /mnt
|
||||
|
||||
|
@ -13,38 +13,9 @@ grep '\- ssh' /mnt/user-data | cut -d ' ' -f 8- > "$homedir/.ssh/authorized_key
|
|||
|
||||
chmod 600 "$homedir/.ssh/authorized_keys"
|
||||
|
||||
chown "$user" "$homedir/.ssh/authorized_keys"
|
||||
chown "$user:$user" "$homedir/.ssh/authorized_keys"
|
||||
|
||||
/run/current-system/profile/sbin/resize2fs /dev/vda2
|
||||
|
||||
cat <<EOF > /etc/configuration.nix
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
# we always want git and vim
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
vim
|
||||
];
|
||||
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.version = 2;
|
||||
boot.loader.grub.device = "/dev/vda";
|
||||
system.stateVersion = "22.05";
|
||||
|
||||
users.users.cyberian = {
|
||||
isNormalUser = true;
|
||||
};
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
};
|
||||
EOF
|
||||
|
||||
umount /mnt
|
||||
rm /root/capsul-init
|
||||
sudo nixos-rebuild switch
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# this configuration is intended to give us ssh
|
||||
# access to the build machine
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
|
@ -5,10 +8,10 @@
|
|||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
# we always want git and vim
|
||||
# we always want nano & vi
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
vim
|
||||
vi
|
||||
nano
|
||||
];
|
||||
|
||||
boot.loader.grub.enable = true;
|
||||
|
@ -18,7 +21,6 @@
|
|||
|
||||
users.users.cyberian = {
|
||||
isNormalUser = true;
|
||||
password = "password";
|
||||
};
|
||||
users.users.root.password = "password";
|
||||
|
||||
|
@ -27,16 +29,4 @@
|
|||
permitRootLogin = "yes";
|
||||
passwordAuthentication = true;
|
||||
};
|
||||
|
||||
# Feel free to remove this after first boot
|
||||
# /root/capsul-init gets deleted after first run
|
||||
systemd.services.capsul-init = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
unitConfig = {
|
||||
ConditionPathExists = "/root/capsul-init";
|
||||
};
|
||||
serviceConfig = {
|
||||
ExecStart = "/root/capsul-init";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
43
nixos/22.05/final-configuration.nix
Normal file
43
nixos/22.05/final-configuration.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
# this configuration is meant to be the final
|
||||
# handed over to the user
|
||||
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
# we always want nano & vi
|
||||
environment.systemPackages = with pkgs; [
|
||||
nano
|
||||
vi
|
||||
];
|
||||
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.version = 2;
|
||||
boot.loader.grub.device = "/dev/vda";
|
||||
system.stateVersion = "22.05";
|
||||
|
||||
users.users.cyberian = {
|
||||
isNormalUser = true;
|
||||
};
|
||||
|
||||
services.openssh = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
# Feel free to remove this after first boot
|
||||
# /root/capsul-init gets deleted after first run
|
||||
systemd.services.capsul-init = {
|
||||
enable = true;
|
||||
unitConfig = {
|
||||
ConditionPathExists = "/root/capsul-init";
|
||||
};
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "/root/capsul-init";
|
||||
};
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
}
|
|
@ -46,6 +46,19 @@
|
|||
"mv /tmp/capsul-init /root/capsul-init",
|
||||
"chmod +x /root/capsul-init"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "file",
|
||||
"source": "final-configuration.nix",
|
||||
"destination": "/etc/nixos/configuration.nix"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"inline": [
|
||||
"nixos-rebuild switch",
|
||||
"rm -f /etc/ssh/*key*",
|
||||
"printf '' > /etc/machine-id"
|
||||
]
|
||||
}
|
||||
],
|
||||
"builders": [
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
sudo su
|
||||
parted -s --align=none /dev/vda mktable gpt mkpart primary ext2 0 2MB mkpart primary ext2 2MB 100% set 1 bios_grub on
|
||||
mkfs.ext4 -L root /dev/vda2
|
||||
mount LABEL=root /mnt
|
||||
|
|
1
nixos/OWNERS
Normal file
1
nixos/OWNERS
Normal file
|
@ -0,0 +1 @@
|
|||
@aynish:sealight.xyz
|
Loading…
Reference in a new issue