aboutsummaryrefslogtreecommitdiff
path: root/nix/README.md
blob: b7a00dfc59e8f30ba69fdf8ff43c2dbca60919c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Deploy

## Setup (one time)

Build base image:
```sh
nixos-rebuild build-image --image-variant proxmox --flake .#base
```

Copy base image to a Proxmox node:
```sh
scp result/vzdump-qemu-nixos-26.05.20260401.6201e20.vma.zst root@192.168.0.85:/var/lib/vz/dump/
```

Restore on Proxmox.

Convert to Proxmox Template.

Run TF as usual using clone against the Template.

Generate host-keys, and age key for the host.
```sh
# first time only
./generate-keys.sh torrents--2
```

## Secrets w/ `sops`

Edit the `.sops.yaml` to include the host's age key

Create host's secrets:
```sh
sops secrets/torrents-2.yaml
```

## Push

```sh
./deploy.sh torrents-2 root
```

## References:

https://github.com/nix-community/nixos-generators
https://gist.github.com/joshleecreates/e6892ca21b0e6b7c24d96ca2a24bf23e

# Hosts

## torrents-2

For all my Linux ISOs ofcourse.

## rproxy-2

Entrypoint into my home-lab services.

## git

Set your `sshconfig`:
```sshconfig
# ~/.ssh/config
Host git.kumardamani.net
    Port 2222
```

> Non-SSH access (https) is always read-only, and anonymous.

Manage repos with:
```sh
ssh -t git@git.kumardamani.net

== git repo manager ==
  l) list repos
  c) create repo
  p) publish repo
  h) hide repo
  d) set description
  x) delete repo
  q) quit                                                                                                                                                      
>
```

Without the ssh config entry, use the abs path:
```sh
git clone ssh://git@git.kumardamani.net:2222/srv/git/<name>.git
```

Move an existing local repo onto the server:
```sh
ssh git@git.kumardamani.net create <name>
ssh git@git.kumardamani.net publish <name>
git remote set-url origin git@git.kumardamani.net:<name>
git push --all origin && git push --tags origin
```

Push to both our git and GitLab (for ci/cd repos):
```sh
git config --unset-all remote.origin.pushurl
git remote set-url origin git@git.kumardamani.net:<name>.git
git remote set-url --add --push origin git@git.kumardamani.net:<name>.git
git remote set-url --add --push origin git@gitlab.com:kdam0/<name>.git
git remote -v
```