1
Fork 0
nixos-system-config/README.md
2025-01-18 15:58:34 +01:00

1.4 KiB

dotnix

Prerequisites

You need to prepare a couple things before installation due to the way secrets are managed.

Prepare secrets repo

  1. Ensure all required dependencies are present.
nix-shell -p sops age git
  1. Initialize your secrets repo. You can do this anywhere on your system except this repository.
mkdir secrets
cd secrets
git init
  1. Create your gitignore. You want this to make sure that you do not accidentally push your private key.
echo "keys.txt" > .gitignore
  1. Generate your private key.
age-keygen -o ./keys.txt
  1. Create your sops configuration file.
cat <<EOF > .sops.yaml
keys:
  - &master $(age-keygen -y ./keys.txt)
creation_rules:
  - path_regex: .*\.(yaml|json|env|ini)$
    key_groups:
    - age:
      - *master
EOF
  1. Create a password file for your user.
mkpasswd | wl-copy # if you're on x11, replace `wl-copy` with `xclip -sel clipboard`
sops <username>.yaml

Where <username> is the user set to be used in flake.nix.

Then edit the file to look like this.

user_password: <The pasted password from mkpasswd>
  1. Commit and push your changes.
git remote add origin git@example.com:example/secrets
git add .
git commit -m "batman"
git push --set-upstream origin master
  1. Update the submodule to use your secrets repository.
cd <Path to the configuration repo>
git submodule set-url -- secrets <ssh uri to your repository>