test
This commit is contained in:
parent
9771707082
commit
c64cb49aa4
4 changed files with 16 additions and 35 deletions
|
@ -5,14 +5,6 @@
|
||||||
* Installing a system from the ISO:
|
* Installing a system from the ISO:
|
||||||
```
|
```
|
||||||
nixos-install <Hostname> [<Username>]
|
nixos-install <Hostname> [<Username>]
|
||||||
|
|
||||||
HOSTNAME='YourHostnameHere'
|
|
||||||
curl https://git.sysctl.io/albert/nix/raw/branch/main/nixos/hosts/${HOSTNAME}/disks.nix >> /tmp/disks.nix
|
|
||||||
echo 'LUKSEncryptionKeyHere' >> /tmp/secret.key
|
|
||||||
nix run github:nix-community/disko -- --mode disko /tmp/disks.nix
|
|
||||||
mkdir -p /mnt/etc/nixos/
|
|
||||||
git clone https://git.sysctl.io/albert/nix /etc/nixos/git
|
|
||||||
nixos-install --flake /etc/nixos/git#${HOSTNAME} -v --show-trace --no-root-password
|
|
||||||
```
|
```
|
||||||
|
|
||||||
![Gruv'd Hyprland](./screenshot.png "Hyprland with a Gruvboxy theme")
|
![Gruv'd Hyprland](./screenshot.png "Hyprland with a Gruvboxy theme")
|
||||||
|
|
|
@ -1,23 +1,9 @@
|
||||||
#!env /bin/bash
|
#!env /bin/bash
|
||||||
# First setup:
|
|
||||||
|
|
||||||
user=albert
|
sudo mkdir /nix/var/nix/profiles/per-user/albert
|
||||||
read -p "Hostname: " hostname;
|
pushd /etc/nixos/git
|
||||||
|
nix develop
|
||||||
# run as root:
|
home-manager switch -b backup --flake .
|
||||||
# eIf on the raspberry pi image:
|
|
||||||
# sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable
|
|
||||||
# sudo nix-channel --update
|
|
||||||
sudo nix-shell -p git --run git clone https://git.sysctl.io/albert/nix /etc/nixos/git
|
|
||||||
sudo git clone https://git.sysctl.io/albert/nix /etc/nixos/git
|
|
||||||
sudo ln -s /etc/nixos/git/flake.nix /etc/nixos/flake.nix
|
|
||||||
sudo chown -R $user:root /etc/nixos/git
|
|
||||||
sudo nixos-rebuild switch --flake '/etc/nixos#$host'
|
|
||||||
sudo mkdir /nix/var/nix/profiles/per-user/$user
|
|
||||||
echo "Host setup complete."
|
|
||||||
|
|
||||||
# as $user:
|
|
||||||
home-manager switch -b backup --flake /etc/nixos/git
|
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
|
|
||||||
# Import and trust the GPG key
|
# Import and trust the GPG key
|
||||||
|
@ -26,21 +12,23 @@ gpg --import $gpgKey
|
||||||
echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key 64F6C4EB46C4543A trust
|
echo -e "5\ny\n" | gpg --command-fd 0 --expert --edit-key 64F6C4EB46C4543A trust
|
||||||
|
|
||||||
# Setup SOPS
|
# Setup SOPS
|
||||||
sudo nix-shell -p ssh-to-pgp --run "ssh-to-pgp -i /etc/ssh/ssh_host_rsa_key -o /etc/nixos/git/keys/hosts/$(hostname).asc"
|
ssh-to-pgp -i /etc/ssh/ssh_host_rsa_key -o /etc/nixos/git/keys/hosts/$(hostname).asc
|
||||||
# Update your .sops.yaml with this key
|
# Update your .sops.yaml with this key
|
||||||
cd /etc/nixos/git
|
|
||||||
nix-shell
|
|
||||||
sops-update secrets/secrets.yaml
|
sops-update secrets/secrets.yaml
|
||||||
|
for i in $(ls secrets/):
|
||||||
|
|
||||||
# Set up ssh keys
|
# Set up ssh keys
|
||||||
ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_rsa -N ""
|
ssh-keygen -t rsa -b 8192 -f ~/.ssh/id_rsa -N ""
|
||||||
echo "" >> /etc/nixos/git/keys/ssh/keys.txt
|
echo "" >> ./keys/ssh/keys.txt
|
||||||
echo "# `whoami`@`hostname`" >> /etc/nixos/git/keys/ssh/keys.txt
|
echo "# `whoami`@`hostname`" >> ./keys/ssh/keys.txt
|
||||||
cat /home/albert/.ssh/id_rsa.pub >> /etc/nixos/git/keys/ssh/keys.txt
|
cat /home/albert/.ssh/id_rsa.pub >> ./keys/ssh/keys.txt
|
||||||
|
|
||||||
# Add all changes to git and and push
|
# Add all changes to git and and push
|
||||||
git add keys/hosts/`hostname`.asc
|
git add keys/hosts/`hostname`.asc
|
||||||
git commit -am "Setup of: `whoami`@`hostname`"
|
git commit -am "Setup: `whoami`@`hostname`"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
echo "Complete. Reboot to complete the config"
|
popd
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo "Complete."
|
|
@ -59,7 +59,7 @@
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Combines mkHost and mkHome for image building - Uses minimal to make a smaller image
|
# Combines mkHost and mkHome for image building
|
||||||
mkMinImage = {
|
mkMinImage = {
|
||||||
hostname ,
|
hostname ,
|
||||||
username ? "albert",
|
username ? "albert",
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
pkgs.vim
|
pkgs.vim
|
||||||
pkgs.alejandra
|
pkgs.alejandra
|
||||||
pkgs.nixfmt
|
pkgs.nixfmt
|
||||||
|
pkgs.ssh-to-pgp
|
||||||
(pkgs.callPackage sops-nix {}).sops-import-keys-hook
|
(pkgs.callPackage sops-nix {}).sops-import-keys-hook
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue