doc: server git pull without PATH, keep flakes bootstrap config in repo
- nixos-server.nix: comment for pull when sudo git not found - readme: add 'Pull when git is not in PATH' and full-path fallback - add server-configuration-with-flakes.nix for one-time scp to enable flakes Made-with: Cursor
This commit is contained in:
parent
bfe7ae5622
commit
2265cdcaff
3 changed files with 28 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
# One-time on server: clone repo to /etc/dotfiles (root needs git access).
|
# One-time on server: clone repo to /etc/dotfiles (root needs git access).
|
||||||
# If private repo: use SSH (ssh:// or git@) and add root's key to GitHub, or use HTTPS + token.
|
# If private repo: use SSH (ssh:// or git@) and add root's key to GitHub, or use HTTPS + token.
|
||||||
# Then: sudo nixos-rebuild switch --flake /etc/dotfiles/nixos#nixos-server
|
# Then: sudo nixos-rebuild switch --flake /etc/dotfiles/nixos#nixos-server
|
||||||
|
# If sudo git is not found: sudo nix run nixpkgs#git -- -C /etc/dotfiles pull origin main
|
||||||
# Timer runs every 15 min: git fetch, pull if origin/main changed, rebuild.
|
# Timer runs every 15 min: git fetch, pull if origin/main changed, rebuild.
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,3 +40,9 @@ Use `git@github.com:DannyDannyDanny/dotfiles.git` if the repo is private (clone
|
||||||
SSH keys for danny (not in repo): from your machine `scp ~/.ssh/*.pub danny@server:/tmp/`, then on server `mkdir -p ~/.ssh; cat /tmp/*.pub >> ~/.ssh/authorized_keys`.
|
SSH keys for danny (not in repo): from your machine `scp ~/.ssh/*.pub danny@server:/tmp/`, then on server `mkdir -p ~/.ssh; cat /tmp/*.pub >> ~/.ssh/authorized_keys`.
|
||||||
|
|
||||||
After that, a timer pulls and rebuilds every 15 min when `main` changes. Config lives in `hosts/nixos-server.nix` and `hosts/nixos-server-hardware.nix`.
|
After that, a timer pulls and rebuilds every 15 min when `main` changes. Config lives in `hosts/nixos-server.nix` and `hosts/nixos-server-hardware.nix`.
|
||||||
|
|
||||||
|
**Pull when git is not in PATH** (e.g. before first rebuild or when `sudo git` says "command not found"):
|
||||||
|
```bash
|
||||||
|
sudo nix run nixpkgs#git -- -C /etc/dotfiles pull origin main
|
||||||
|
```
|
||||||
|
Then run `sudo nixos-rebuild switch --flake /etc/dotfiles/nixos#nixos-server` as usual. After that, git is in the system profile; for manual pulls you can use `sudo /run/current-system/sw/bin/git -C /etc/dotfiles pull origin main` if `sudo git` still isn’t in PATH.
|
||||||
|
|
|
||||||
21
nixos/server-configuration-with-flakes.nix
Normal file
21
nixos/server-configuration-with-flakes.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# One-time: copy to server /etc/nixos/configuration.nix then nixos-rebuild switch (enables flakes for daemon).
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ ./hardware-configuration.nix ];
|
||||||
|
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
|
networking.hostName = "nixos-server";
|
||||||
|
time.timeZone = "Europe/Copenhagen";
|
||||||
|
|
||||||
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
|
||||||
|
users.users.danny = {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [ "wheel" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
services.openssh.enable = true;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue