Compare commits
210
Commits
disko
...
ed2d2731d6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed2d2731d6 | ||
|
|
91ea6863d7 | ||
|
|
341a168dc0 | ||
|
|
4f3a25fa14 | ||
|
|
0c06237cac | ||
|
|
2d6a7329ac | ||
|
|
02e738d0b4 | ||
|
|
9bcb89edac | ||
|
|
20fb312d40 | ||
|
|
12a61ac093 | ||
|
|
d3c6f9b1d1 | ||
|
|
9c07d9e047 | ||
|
|
0decd25b07 | ||
|
|
d505d13d9a | ||
|
|
d517a3c4e9 | ||
|
|
0cda6585df | ||
|
|
1c32aadd7f | ||
|
|
feca19de21 | ||
|
|
9be46dd262 | ||
|
|
6bfbea2195 | ||
|
|
cc4b4e4fd9 | ||
|
|
e8b691da61 | ||
|
|
902dade6eb | ||
|
|
682ebd4c24 | ||
|
|
6b146c3904 | ||
|
|
144a7a7432 | ||
|
|
37dbe868e1 | ||
|
|
3c96fd370f | ||
|
|
d140e8c88c | ||
|
|
8216749e07 | ||
|
|
e10c043789 | ||
|
|
0f4ddb9250 | ||
|
|
9d2e52675e | ||
|
|
6c5c69945a | ||
|
|
9883f3d461 | ||
|
|
6d86bb8368 | ||
|
|
0dbc4792d4 | ||
|
|
753b763b6f | ||
|
|
2a690681cb | ||
|
|
82f4a2e1d4 | ||
|
|
eb18897355 | ||
|
|
00679a2c04 | ||
|
|
8e819e01ea | ||
|
|
cf4c179fc4 | ||
|
|
c991768cc2 | ||
|
|
268879ee01 | ||
|
|
7e9f617965 | ||
|
|
7d6482587a | ||
|
|
cf10e1e963 | ||
|
|
02b2b9cf32 | ||
|
|
dfe6ec5518 | ||
|
|
517d793c88 | ||
|
|
657a65522f | ||
|
|
7bc3ab64dd | ||
|
|
2b5cfe0934 | ||
|
|
cf345521e8 | ||
|
|
f43945d0d2 | ||
|
|
7874412a48 | ||
|
|
e33a6e181e | ||
|
|
928dc4a240 | ||
|
|
63d34640f7 | ||
|
|
921565fe12 | ||
|
|
88792d86db | ||
|
|
49b4ade156 | ||
|
|
34f179465d | ||
|
|
588bea133c | ||
|
|
61ec61e22e | ||
|
|
10a3de42ac | ||
|
|
6f98d674b1 | ||
|
|
4278ceebc1 | ||
|
|
3358dd324e | ||
|
|
c3014ec109 | ||
|
|
08ca6a2846 | ||
|
|
2fbe36d497 | ||
|
|
9929cd297a | ||
|
|
869a219ab7 | ||
|
|
af1a275dd8 | ||
|
|
9d302345ac | ||
|
|
e0b3fe191c | ||
|
|
d3681fcd4f | ||
|
|
5458f74c83 | ||
|
|
13302deaef | ||
|
|
828face9d5 | ||
|
|
e4402eaf19 | ||
|
|
081084648f | ||
|
|
9d629c4656 | ||
|
|
4a65f64a20 | ||
|
|
d3b3e9be1c | ||
|
|
5224a6e4b6 | ||
|
|
dd0778e5f0 | ||
|
|
7247fc94ab | ||
|
|
655803bd1f | ||
|
|
9992039edb | ||
|
|
f31c0f92da | ||
|
|
307aac4ae0 | ||
|
|
160185ef20 | ||
|
|
42619807bc | ||
|
|
86c853de20 | ||
|
|
f52e880b4c | ||
|
|
e157071962 | ||
|
|
d324c957be | ||
|
|
1fa6092498 | ||
|
|
e43a91fe31 | ||
|
|
f06880d6d7 | ||
|
|
fa17ce5b03 | ||
|
|
cf42666c1f | ||
|
|
df49791fb7 | ||
|
|
cf4a324617 | ||
|
|
66b2662030 | ||
|
|
21045c3dd1 | ||
|
|
5f68b9b1e6 | ||
|
|
bb6edfdefd | ||
|
|
afebac0d46 | ||
|
|
06eaf13ec0 | ||
|
|
0b5beaf63d | ||
|
|
03604f9352 | ||
|
|
5047f1ab24 | ||
|
|
22271d33d1 | ||
|
|
c8bf78999a | ||
|
|
0d25c1deff | ||
|
|
3603fe28a7 | ||
|
|
ce7c940f65 | ||
|
|
d8327c3edf | ||
|
|
af9f7e0ee0 | ||
|
|
3285b483e2 | ||
|
|
affa333969 | ||
|
|
3c20190709 | ||
|
|
0305b8d33a | ||
|
|
5ade637e57 | ||
|
|
029ff0c9a3 | ||
|
|
db4bd8cfd9 | ||
|
|
41d25d9695 | ||
|
|
7e2e012f3a | ||
|
|
071e904990 | ||
|
|
b68ca558d8 | ||
|
|
cf760b8b85 | ||
|
|
7d4ee43283 | ||
|
|
4e08366901 | ||
|
|
a0ca155f7c | ||
|
|
110aa4215f | ||
|
|
08a161ff0d | ||
|
|
f4472de631 | ||
|
|
3c154de819 | ||
|
|
709040c072 | ||
|
|
28193823c8 | ||
|
|
dd25c9323d | ||
|
|
5796bee499 | ||
|
|
986afe4b32 | ||
|
|
537e30a347 | ||
|
|
2fec5ead38 | ||
|
|
d4e6283c2f | ||
|
|
32e7d99292 | ||
|
|
d9dab5b9d3 | ||
|
|
cdd94eefb3 | ||
|
|
209dbea02a | ||
|
|
c683809a78 | ||
|
|
739e335c28 | ||
|
|
3c6758b343 | ||
|
|
799b91a509 | ||
|
|
50ff958d35 | ||
|
|
ecc2779ce9 | ||
|
|
10dab81fb5 | ||
|
|
03e96662cc | ||
|
|
d6d54e213e | ||
|
|
f491be0ace | ||
|
|
fef1eff181 | ||
|
|
e869e5d790 | ||
|
|
48caacd9e5 | ||
|
|
ce4401033a | ||
|
|
8b331ad3ae | ||
|
|
417383f89b | ||
|
|
cc75c95ad4 | ||
|
|
a321251b93 | ||
|
|
54677248af | ||
|
|
d8f18016cd | ||
|
|
6522ebc15e | ||
|
|
10216784e8 | ||
|
|
f3abb6d2f3 | ||
|
|
936d654877 | ||
|
|
61d207db04 | ||
|
|
e7b66cb40c | ||
|
|
c9b18219af | ||
|
|
d5c4a78fba | ||
|
|
369d655a38 | ||
|
|
eab130b99d | ||
|
|
5ce6b9bdf2 | ||
|
|
5db52a4f84 | ||
|
|
3524f6b038 | ||
|
|
0cf53a97cf | ||
|
|
46fe5b8056 | ||
|
|
ec3d9e6049 | ||
|
|
fc0476ca5a | ||
|
|
4b7c62d00b | ||
|
|
cfc276184f | ||
|
|
87b50bfb4d | ||
|
|
1bc34518e1 | ||
|
|
f1dcb8c72b | ||
|
|
ec002467fa | ||
|
|
5a228cb375 | ||
|
|
d53e395d42 | ||
|
|
cb39f82a48 | ||
|
|
0efee5bceb | ||
|
|
844118055c | ||
|
|
0ba9de0030 | ||
|
|
a745b35c84 | ||
|
|
6c74dcbc22 | ||
|
|
76e609372f | ||
|
|
cd91944b1e | ||
|
|
bebd2748d1 | ||
|
|
12a4ba0482 |
No files matched your search
@@ -4,8 +4,39 @@ My NixOS configuration.
|
|||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
For disk configuration we use disko, this means that installing the system from the configuration is just a single command:
|
For disk configuration we use disko, but for secrets management we use sops-nix and the particular setup makes the installation process a bit more involved. It is required that the computer from which the installation is being run has access to the `nixos-secrets` repository, otherwise you will need to manually add the required ssh keys to the installation image.
|
||||||
|
```bash
|
||||||
|
# Load into the installer
|
||||||
|
sudo passwd # Set a root password
|
||||||
|
|
||||||
|
# From a machine with network access to the installer
|
||||||
|
# and access to the nixos-secrets repo
|
||||||
|
ssh -A root@(installer-ip)
|
||||||
|
|
||||||
|
# Set up disks
|
||||||
|
nix-shell -p disko
|
||||||
|
disko --mode disko --flake git+https://git.bulthuis.dev/Jan/nixos-config#(system)
|
||||||
|
exit
|
||||||
|
|
||||||
|
# Install NixOS
|
||||||
|
nixos-install --no-channel-copy --no-root-password --flake git+https://git.bulthuis.dev/Jan/nixos-config#(system)
|
||||||
|
|
||||||
|
# Set up host credentials for access to the secrets
|
||||||
|
cd /mnt/persist/system/etc/sops
|
||||||
|
touch sops_ed25519_key
|
||||||
|
chmod 600 sops_ed25519_key
|
||||||
|
nano sops_ed25519_key
|
||||||
```
|
```
|
||||||
sudo nix --experimental-features "nix-command flakes" run "github:nix-community/disko/latest#disko-install" -- --flake git+https://git.bulthuis.dev/Jan/dotfiles#<hostname> --disk main /dev/sda
|
If `nixos-install` is being stopped by the OOM-killer, you can try adding `-j 1` to limit the amount of jobs that will be executed at the same time to 1. It might require running nixos-install multiple times untill it has managed to download all requirements and slowly start building the rest of the system.
|
||||||
```
|
|
||||||
|
## Updating
|
||||||
|
|
||||||
|
To update the system configuration, it is a single command:
|
||||||
|
```bash
|
||||||
|
sudo system-update
|
||||||
|
```
|
||||||
|
Or if this shell script has not been installed for some reason:
|
||||||
|
```bash
|
||||||
|
sudo nixos-rebuild switch --flake git+https://git.bulthuis.dev/Jan/nixos-config
|
||||||
|
```
|
||||||
|
Sometimes it may be necessary to reboot of course.
|
||||||
Generated
+128
-91
@@ -7,11 +7,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1748225455,
|
"lastModified": 1792526520,
|
||||||
"narHash": "sha256-AzlJCKaM4wbEyEpV3I/PUq5mHnib2ryEy32c+qfj6xk=",
|
"narHash": "sha256-3hSJlv8mUVnZPMWK2+CM7a9O+nR6Z4mCh27NfLCmTPc=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "disko",
|
"repo": "disko",
|
||||||
"rev": "a894f2811e1ee8d10c50560551e50d6ab3c392ba",
|
"rev": "cedd626e11b635470fa6f9fdb8ad79b0075dd7f9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -20,40 +20,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-compat": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1733328505,
|
|
||||||
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "edolstra",
|
|
||||||
"repo": "flake-compat",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1731533236,
|
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
@@ -61,11 +27,32 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1748134483,
|
"lastModified": 1794252721,
|
||||||
"narHash": "sha256-5PBK1nV8X39K3qUj8B477Aa2RdbLq3m7wRxUKRtggX4=",
|
"narHash": "sha256-sD1rhEjMghSyWSUG2xEOw+FOVd2wnoWwi/809w8fRkI=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "c1e671036224089937e111e32ea899f59181c383",
|
"rev": "f1db7c474bb49babfe9d8def532939e0c7404327",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"home-manager_2": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"impermanence",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1768598210,
|
||||||
|
"narHash": "sha256-kkgA32s/f4jaa4UG+2f8C225Qvclxnqs76mf8zvTVPg=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "c47b2cc64a629f8e075de52e4742de688f930dc6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -75,12 +62,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"impermanence": {
|
"impermanence": {
|
||||||
|
"inputs": {
|
||||||
|
"home-manager": "home-manager_2",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737831083,
|
"lastModified": 1792739756,
|
||||||
"narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=",
|
"narHash": "sha256-s0TeXWG5Ci75Y/Hzon0Z7NrN/fG773Rc54/z6oPFszQ=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "impermanence",
|
"repo": "impermanence",
|
||||||
"rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170",
|
"rev": "fa627f4c8b8e92f58f58a73d99ee4e1304e64eb2",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -89,60 +80,84 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nix-minecraft": {
|
"nix-vscode-extensions": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"nixpkgs": "nixpkgs_2"
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1747581338,
|
"lastModified": 1794202607,
|
||||||
"narHash": "sha256-/+H9qce+NPsEcAC31s3pbD64nB6GKC3+3ZNLV1+tffk=",
|
"narHash": "sha256-foUWdIx5HTEopoOHXzTy7uhbZYYl1BdjZKPQpkR+pgg=",
|
||||||
"owner": "Jan-Bulthuis",
|
"owner": "nix-community",
|
||||||
"repo": "nix-minecraft",
|
"repo": "nix-vscode-extensions",
|
||||||
"rev": "44b6b40d7a3e0a114567b38a203029a5bc67e838",
|
"rev": "934620178cf8eed2058484c24b5db62dbf4f08b1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "Jan-Bulthuis",
|
"owner": "nix-community",
|
||||||
"repo": "nix-minecraft",
|
"repo": "nix-vscode-extensions",
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nix-modpack": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1747559249,
|
|
||||||
"narHash": "sha256-+ygKEGMVcXNklO4RDYSd5XzydDmQOZWcOcxYZf/PH1U=",
|
|
||||||
"owner": "Jan-Bulthuis",
|
|
||||||
"repo": "nix-modpack",
|
|
||||||
"rev": "a093625c2847afc3ef257513161c7fe318c6be1c",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "Jan-Bulthuis",
|
|
||||||
"repo": "nix-modpack",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1747958103,
|
"lastModified": 1768564909,
|
||||||
"narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=",
|
"narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "fe51d34885f7b5e3e7b59572796e1bcb427eccb1",
|
"rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"ref": "nixpkgs-unstable",
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs-stable": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1793865203,
|
||||||
|
"narHash": "sha256-/cpdPHaySDIyCgZI6EWngiM6jK3YLUNzv1b7lTzy6Bk=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "c56a87d8e41ce69bd2af57eb35dcc117a9dfca33",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-26.05",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1784564315,
|
||||||
|
"narHash": "sha256-7OpsHHIZFUBLbeHNQ0oC40DZRQjsmGWodXge+OqgPgk=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "0c2094806c9e542f31785ef3569ab9e900e3ce9c",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "0c2094806c9e542f31785ef3569ab9e900e3ce9c",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs_3": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1794042290,
|
||||||
|
"narHash": "sha256-ziZn2PvCJE5JEEpqTdxXwJpPB+L3YqoCpTAMCzyaP3U=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "f4a03c008967841f2a0b3cb7c436fc6fc31671f6",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
@@ -152,23 +167,45 @@
|
|||||||
"disko": "disko",
|
"disko": "disko",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"impermanence": "impermanence",
|
"impermanence": "impermanence",
|
||||||
"nix-minecraft": "nix-minecraft",
|
"nix-vscode-extensions": "nix-vscode-extensions",
|
||||||
"nix-modpack": "nix-modpack",
|
"nixpkgs": "nixpkgs_3",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs-stable": "nixpkgs-stable",
|
||||||
|
"secrets": "secrets",
|
||||||
|
"sops-nix": "sops-nix"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"secrets": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1681028828,
|
"lastModified": 1795000895,
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
"narHash": "sha256-DzTRUpiuhSmPJm/MjcUwNLxVbhWxjC1TGLyj41kXnr4=",
|
||||||
"owner": "nix-systems",
|
"ref": "refs/heads/main",
|
||||||
"repo": "default",
|
"rev": "557ab40690eb4320e36c5e57b73bfba1ecb73393",
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
"revCount": 23,
|
||||||
|
"type": "git",
|
||||||
|
"url": "ssh://gitea@git.bulthuis.dev/Jan/nixos-secrets"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "ssh://gitea@git.bulthuis.dev/Jan/nixos-secrets"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sops-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1793995029,
|
||||||
|
"narHash": "sha256-ZlE4BtMjWhfC6rFXLO9Qimn36Ene1INqCgKDDvazjhc=",
|
||||||
|
"owner": "Mic92",
|
||||||
|
"repo": "sops-nix",
|
||||||
|
"rev": "89a234ce2daf6e568a7d4b4fe250afdd23d84e20",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-systems",
|
"owner": "Mic92",
|
||||||
"repo": "default",
|
"repo": "sops-nix",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,19 +3,39 @@
|
|||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
# General inputs
|
# General inputs
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-26.05";
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
home-manager.url = "github:nix-community/home-manager";
|
home-manager.url = "github:nix-community/home-manager";
|
||||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
# Secrets
|
||||||
|
sops-nix.url = "github:Mic92/sops-nix";
|
||||||
|
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
secrets.url = "git+ssh://gitea@git.bulthuis.dev/Jan/nixos-secrets";
|
||||||
|
|
||||||
|
# Disk setup
|
||||||
disko.url = "github:nix-community/disko";
|
disko.url = "github:nix-community/disko";
|
||||||
disko.inputs.nixpkgs.follows = "nixpkgs";
|
disko.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
impermanence.url = "github:nix-community/impermanence";
|
impermanence.url = "github:nix-community/impermanence";
|
||||||
|
|
||||||
|
# VS Code extensions
|
||||||
|
nix-vscode-extensions.url = "github:nix-community/nix-vscode-extensions";
|
||||||
|
|
||||||
|
# MADD
|
||||||
|
# madd.url = "git+https://git.bulthuis.dev/Jan/madd";
|
||||||
|
# madd.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
# For Minecraft VM
|
# For Minecraft VM
|
||||||
nix-minecraft.url = "github:Jan-Bulthuis/nix-minecraft";
|
# nix-minecraft.url = "github:Jan-Bulthuis/nix-minecraft";
|
||||||
nix-minecraft.inputs.nixpkgs.follows = "nixpkgs";
|
# nix-minecraft.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
nix-modpack.url = "github:Jan-Bulthuis/nix-modpack";
|
# nix-modpack.url = "github:Jan-Bulthuis/nix-modpack";
|
||||||
nix-modpack.inputs.nixpkgs.follows = "nixpkgs";
|
# nix-modpack.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs: import ./glue inputs;
|
outputs =
|
||||||
|
inputs:
|
||||||
|
import ./glue {
|
||||||
|
inherit inputs;
|
||||||
|
excludeHomeManagerModules = [ "impermanence" ];
|
||||||
|
};
|
||||||
}
|
}
|
||||||
+45
-4
@@ -1,9 +1,28 @@
|
|||||||
inputs:
|
{
|
||||||
|
inputs,
|
||||||
|
excludeHomeManagerModules ? [ ],
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
flake = inputs.self;
|
flake = inputs.self;
|
||||||
nixpkgs = inputs.nixpkgs;
|
nixpkgs = inputs.nixpkgs;
|
||||||
lib = nixpkgs.lib;
|
lib = nixpkgs.lib;
|
||||||
|
|
||||||
|
nixpkgs-config = {
|
||||||
|
allowUnfree = true;
|
||||||
|
|
||||||
|
permittedInsecurePackages =
|
||||||
|
let
|
||||||
|
insecurePackages = [
|
||||||
|
"electron-39.8.10"
|
||||||
|
"pnpm-10.34.0"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
if builtins.length insecurePackages > 0 then
|
||||||
|
lib.trace "Allowing [${lib.strings.join ", " insecurePackages}] which is/are insecure" insecurePackages
|
||||||
|
else
|
||||||
|
[ ];
|
||||||
|
};
|
||||||
|
|
||||||
importDir =
|
importDir =
|
||||||
path: fn:
|
path: fn:
|
||||||
let
|
let
|
||||||
@@ -49,6 +68,13 @@ let
|
|||||||
pkgs = (
|
pkgs = (
|
||||||
import inputs.nixpkgs {
|
import inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
config = nixpkgs-config;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
stable-pkgs = (
|
||||||
|
import inputs.nixpkgs-stable {
|
||||||
|
inherit system;
|
||||||
|
config = nixpkgs-config;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@@ -102,7 +128,9 @@ let
|
|||||||
homeProfiles = collectModules "${flake}/profiles/home";
|
homeProfiles = collectModules "${flake}/profiles/home";
|
||||||
inputHomeModules = lib.map (flake: flake.outputs.homeManagerModules.default) (
|
inputHomeModules = lib.map (flake: flake.outputs.homeManagerModules.default) (
|
||||||
lib.filter (flake: lib.hasAttrByPath [ "outputs" "homeManagerModules" "default" ] flake) (
|
lib.filter (flake: lib.hasAttrByPath [ "outputs" "homeManagerModules" "default" ] flake) (
|
||||||
lib.attrValues inputs
|
lib.attrValues (
|
||||||
|
lib.attrsets.filterAttrs (name: entry: !(lib.elem name excludeHomeManagerModules)) inputs
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -118,13 +146,22 @@ let
|
|||||||
nixpkgs.overlays = [ overlay ] ++ inputOverlays;
|
nixpkgs.overlays = [ overlay ] ++ inputOverlays;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixpkgsModule =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
nixpkgs.config = nixpkgs-config;
|
||||||
|
};
|
||||||
|
|
||||||
nixosConfigurations = importDir "${flake}/hosts" (
|
nixosConfigurations = importDir "${flake}/hosts" (
|
||||||
attrs:
|
attrs:
|
||||||
lib.mapAttrs (
|
lib.mapAttrs (
|
||||||
name: entry:
|
name: entry:
|
||||||
|
let
|
||||||
|
pkgs-stable = systemArgs."x86_64-linux".stable-pkgs;
|
||||||
|
in
|
||||||
lib.nixosSystem {
|
lib.nixosSystem {
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit inputs;
|
inherit inputs pkgs-stable;
|
||||||
};
|
};
|
||||||
modules =
|
modules =
|
||||||
let
|
let
|
||||||
@@ -143,8 +180,11 @@ let
|
|||||||
usersModule =
|
usersModule =
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{
|
{
|
||||||
|
home-manager.extraSpecialArgs = {
|
||||||
|
inherit inputs pkgs-stable;
|
||||||
|
};
|
||||||
home-manager.sharedModules = homeModules ++ homeProfiles ++ inputHomeModules;
|
home-manager.sharedModules = homeModules ++ homeProfiles ++ inputHomeModules;
|
||||||
home-manager.useUserPackages = false; # TODO: See if this should be changed to true?
|
home-manager.useUserPackages = true;
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.users = homesConfiguration;
|
home-manager.users = homesConfiguration;
|
||||||
users.users = usersConfiguration;
|
users.users = usersConfiguration;
|
||||||
@@ -155,6 +195,7 @@ let
|
|||||||
systemPath
|
systemPath
|
||||||
overlayModule
|
overlayModule
|
||||||
usersModule
|
usersModule
|
||||||
|
nixpkgsModule
|
||||||
]
|
]
|
||||||
++ nixosModules
|
++ nixosModules
|
||||||
++ nixosProfiles
|
++ nixosProfiles
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
{ flake, ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
# State version
|
|
||||||
system.stateVersion = "24.05";
|
|
||||||
|
|
||||||
# Machine hostname
|
|
||||||
networking.hostName = "20212060";
|
|
||||||
|
|
||||||
# Admin users
|
|
||||||
users.users.jan.extraGroups = [
|
|
||||||
"wheel"
|
|
||||||
"wireshark"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Enable virtualisation for VMs
|
|
||||||
virtualisation.libvirtd.enable = true;
|
|
||||||
|
|
||||||
# Enable wireshark
|
|
||||||
programs.wireshark = {
|
|
||||||
enable = true;
|
|
||||||
dumpcap.enable = true;
|
|
||||||
usbmon.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Set up wstunnel client
|
|
||||||
services.wstunnel = {
|
|
||||||
enable = true;
|
|
||||||
clients.wg-tunnel = {
|
|
||||||
connectTo = "wss://tunnel.bulthuis.dev:443";
|
|
||||||
localToRemote = [
|
|
||||||
"udp://51820:10.10.40.100:51820"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
# Module setup
|
|
||||||
modules = {
|
|
||||||
profiles.laptop.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
imports = [
|
|
||||||
./hardware-configuration.nix
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
# Machine platform
|
|
||||||
nixpkgs.hostPlatform = "x86_64-linux";
|
|
||||||
|
|
||||||
# Hardware configuration
|
|
||||||
hardware.enableRedistributableFirmware = true;
|
|
||||||
boot.initrd.availableKernelModules = [
|
|
||||||
"xhci_pci"
|
|
||||||
"nvme"
|
|
||||||
"usb_storage"
|
|
||||||
"sd_mod"
|
|
||||||
"rtsx_pci_sdmmc"
|
|
||||||
];
|
|
||||||
boot.initrd.kernelModules = [ ];
|
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
|
||||||
boot.extraModulePackages = [ ];
|
|
||||||
hardware.cpu.intel.updateMicrocode = true;
|
|
||||||
|
|
||||||
# Filesystems
|
|
||||||
fileSystems."/" = {
|
|
||||||
device = "/dev/disk/by-uuid/3b91eaeb-ea95-4bea-8dc1-f55af7502d23";
|
|
||||||
fsType = "ext4";
|
|
||||||
};
|
|
||||||
|
|
||||||
fileSystems."/boot" = {
|
|
||||||
device = "/dev/disk/by-uuid/46BF-DE2C";
|
|
||||||
fsType = "vfat";
|
|
||||||
options = [
|
|
||||||
"fmask=0077"
|
|
||||||
"dmask=0077"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Swapfile
|
|
||||||
swapDevices = [
|
|
||||||
{
|
|
||||||
device = "/var/lib/swapfile";
|
|
||||||
size = 16 * 1024;
|
|
||||||
}
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
|
|
||||||
{
|
|
||||||
home.stateVersion = "24.11";
|
|
||||||
|
|
||||||
modules.profiles.jan.enable = true;
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -77,7 +77,7 @@
|
|||||||
group = "mixer";
|
group = "mixer";
|
||||||
extraGroups = [ "systemd-journal" ];
|
extraGroups = [ "systemd-journal" ];
|
||||||
openssh.authorizedKeys.keys = [
|
openssh.authorizedKeys.keys = [
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKxoQSxfYqf9ITN8Fhckk8WbY4dwtBAXOhC9jxihJvq jan@bulthuis.dev"
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKxoQSxfYqf9ITN8Fhckk8WbY4dwtBAXOhC9jxihJvq Personal"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
users.groups.mixer = { };
|
users.groups.mixer = { };
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
home.stateVersion = "24.11";
|
|
||||||
|
|
||||||
modules.profiles.base.enable = true;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
# State version
|
||||||
|
system.stateVersion = "25.05";
|
||||||
|
|
||||||
|
# Machine hostname
|
||||||
|
networking.hostName = "vm-infra";
|
||||||
|
|
||||||
|
# Enabled modules
|
||||||
|
modules = {
|
||||||
|
profiles.vm.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Setup JOOL NAT64
|
||||||
|
networking.jool = {
|
||||||
|
enable = true;
|
||||||
|
nat64.default = {
|
||||||
|
global.pool6 = "64:ff9b::/96";
|
||||||
|
pool4 = [
|
||||||
|
{
|
||||||
|
protocol = "TCP";
|
||||||
|
prefix = "10.64.0.1/32";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
protocol = "UDP";
|
||||||
|
prefix = "10.64.0.1/32";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
protocol = "ICMP";
|
||||||
|
prefix = "10.64.0.1/32";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,254 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
# State version
|
||||||
|
system.stateVersion = "25.05";
|
||||||
|
|
||||||
|
# Machine hostname
|
||||||
|
networking.hostName = "vm-k1s";
|
||||||
|
|
||||||
|
# Enabled modules
|
||||||
|
modules = {
|
||||||
|
profiles.vm.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Read in secrets
|
||||||
|
sops.secrets."flux/git-ssh-key" = {
|
||||||
|
sopsFile = "${inputs.secrets}/secrets/k3s-cluster.enc.yaml";
|
||||||
|
};
|
||||||
|
sops.secrets."flux/sops-decrypt-key" = {
|
||||||
|
sopsFile = "${inputs.secrets}/secrets/k3s-cluster.enc.yaml";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Include NFS client module
|
||||||
|
boot.supportedFilesystems = [ "nfs" ];
|
||||||
|
|
||||||
|
# Set up K3S cluster with CoreDNS, FluxCD and Cilium
|
||||||
|
services.k3s = {
|
||||||
|
enable = true;
|
||||||
|
extraFlags = [
|
||||||
|
"--cluster-domain ${inputs.secrets.lab.k3s.clusterDomain}"
|
||||||
|
"--flannel-backend=none"
|
||||||
|
"--disable-network-policy"
|
||||||
|
"--disable-kube-proxy"
|
||||||
|
];
|
||||||
|
disable = [
|
||||||
|
# "coredns" # CoreDNS is required for Flux to be able to bootstrap the cluster (Flux needs to resolve the git repo)
|
||||||
|
"servicelb"
|
||||||
|
"traefik"
|
||||||
|
"local-storage"
|
||||||
|
"metrics-server"
|
||||||
|
"runtimes"
|
||||||
|
];
|
||||||
|
manifests = {
|
||||||
|
git-ssh-key = {
|
||||||
|
source = config.sops.secrets."flux/git-ssh-key".path;
|
||||||
|
};
|
||||||
|
sops-decrypt-key = {
|
||||||
|
source = config.sops.secrets."flux/sops-decrypt-key".path;
|
||||||
|
};
|
||||||
|
# TODO: Move to flux config, once it is possible to easily install flux without CNI
|
||||||
|
gateway-api =
|
||||||
|
let
|
||||||
|
manifest = pkgs.fetchurl {
|
||||||
|
url = "https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.4.1/experimental-install.yaml";
|
||||||
|
hash = "sha256-VTMn4P8yoaK+RGv5OCPIQTz5JTrGptVAfuvR6NJp9p4=";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
source = manifest;
|
||||||
|
};
|
||||||
|
# TODO: Move to flux config, once it is possible to easily install flux without CNI
|
||||||
|
netpol-system-allow-egress.content = {
|
||||||
|
apiVersion = "cilium.io/v2";
|
||||||
|
kind = "CiliumClusterwideNetworkPolicy";
|
||||||
|
metadata.name = "allow-system-egress";
|
||||||
|
spec = {
|
||||||
|
description = "Allow all egress to system services.";
|
||||||
|
endpointSelector = {
|
||||||
|
matchExpressions = [
|
||||||
|
{
|
||||||
|
key = "io.kubernetes.pod.namespace";
|
||||||
|
operator = "NotIn";
|
||||||
|
values = [
|
||||||
|
"bogus-namespace"
|
||||||
|
# "kube-system"
|
||||||
|
# "cilium-system"
|
||||||
|
# "flux-system"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
egress = [
|
||||||
|
{
|
||||||
|
toEntities = [
|
||||||
|
"all"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
ingress = [
|
||||||
|
{
|
||||||
|
fromEntities = [
|
||||||
|
"all"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
netpol-cluster-allow-dns.content = {
|
||||||
|
apiVersion = "cilium.io/v2";
|
||||||
|
kind = "CiliumClusterwideNetworkPolicy";
|
||||||
|
metadata.name = "allow-dns";
|
||||||
|
spec = {
|
||||||
|
description = "Allow DNS";
|
||||||
|
endpointSelector = { };
|
||||||
|
egress = [
|
||||||
|
{
|
||||||
|
toEndpoints = [
|
||||||
|
{
|
||||||
|
matchLabels = {
|
||||||
|
"io.kubernetes.pod.namespace" = "kube-system";
|
||||||
|
"k8s-app" = "kube-dns";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
toPorts = [
|
||||||
|
{
|
||||||
|
ports = [
|
||||||
|
{
|
||||||
|
port = 53;
|
||||||
|
protocol = "ANY";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
rules.dns = [
|
||||||
|
{
|
||||||
|
matchPattern = "*";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
netpol-flux-allow-egress.content = { };
|
||||||
|
};
|
||||||
|
autoDeployCharts = {
|
||||||
|
# TODO: Move to flux config, once it is possible to easily install flux without CNI
|
||||||
|
cilium = {
|
||||||
|
name = "cilium";
|
||||||
|
repo = "oci://quay.io/cilium/charts/cilium";
|
||||||
|
version = "1.18.8";
|
||||||
|
hash = "sha256-z1aDpWttEfQ+Af/l0Lxdafasm75QysRc8h7sPhWXr94=";
|
||||||
|
createNamespace = true;
|
||||||
|
targetNamespace = "cilium-system";
|
||||||
|
values = {
|
||||||
|
operator.replicas = 1;
|
||||||
|
kubeProxyReplacement = true;
|
||||||
|
ipam.operator.clusterPoolIPv4PodCIDRList = [ "10.42.0.0/16" ];
|
||||||
|
cluster = {
|
||||||
|
id = 1;
|
||||||
|
name = "vm-k1s";
|
||||||
|
};
|
||||||
|
k8sServiceHost = "10.10.50.60";
|
||||||
|
k8sServicePort = 6443;
|
||||||
|
policyEnforcementMode = "always";
|
||||||
|
gatewayAPI = {
|
||||||
|
enabled = true;
|
||||||
|
gatewayClass.create = "true";
|
||||||
|
enableAlpn = true;
|
||||||
|
};
|
||||||
|
bgpControlPlane.enabled = true;
|
||||||
|
tls.secretsNamespace.create = false;
|
||||||
|
hubble = {
|
||||||
|
relay.enabled = true;
|
||||||
|
ui.enabled = true;
|
||||||
|
peerService.clusterDomain = inputs.secrets.lab.k3s.clusterDomain;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraFieldDefinitions = {
|
||||||
|
spec.bootstrap = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
flux-operator = {
|
||||||
|
name = "flux-operator";
|
||||||
|
repo = "oci://ghcr.io/controlplaneio-fluxcd/charts/flux-operator";
|
||||||
|
version = "0.38.1";
|
||||||
|
hash = "sha256-nb0mzEWC3IwjPenQ4LSWBN0NNJc2cc68RB+G60xBOEM=";
|
||||||
|
createNamespace = true;
|
||||||
|
targetNamespace = "flux-system";
|
||||||
|
extraDeploy = [
|
||||||
|
{
|
||||||
|
apiVersion = "fluxcd.controlplane.io/v1";
|
||||||
|
kind = "FluxInstance";
|
||||||
|
metadata = {
|
||||||
|
name = "flux";
|
||||||
|
namespace = "flux-system";
|
||||||
|
annotations = {
|
||||||
|
"fluxcd.controlplane.io/reconcile" = "enabled";
|
||||||
|
"fluxcd.controlplane.io/reconcileEvery" = "1h";
|
||||||
|
"fluxcd.controlplane.io/reconcileTimeout" = "5m";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
spec = {
|
||||||
|
distribution = {
|
||||||
|
version = "2.x";
|
||||||
|
registry = "ghcr.io/fluxcd";
|
||||||
|
};
|
||||||
|
components = [
|
||||||
|
"source-controller"
|
||||||
|
"kustomize-controller"
|
||||||
|
"helm-controller"
|
||||||
|
"notification-controller"
|
||||||
|
];
|
||||||
|
cluster = {
|
||||||
|
type = "kubernetes";
|
||||||
|
size = "small";
|
||||||
|
multitenant = false;
|
||||||
|
networkPolicy = true;
|
||||||
|
domain = inputs.secrets.lab.k3s.clusterDomain;
|
||||||
|
};
|
||||||
|
commonMetadata.labels = {
|
||||||
|
"app.kubernetes.io/name" = "flux";
|
||||||
|
};
|
||||||
|
sync = (
|
||||||
|
{
|
||||||
|
pullSecret = "git-ssh-key";
|
||||||
|
}
|
||||||
|
// inputs.secrets.lab.k3s.fluxRepo
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
modules.impermanence.directories = [
|
||||||
|
"/var/lib/rancher/k3s"
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.variables = {
|
||||||
|
KUBECONFIG = "/etc/rancher/k3s/k3s.yaml";
|
||||||
|
CILIUM_NAMESPACE = "cilium-system";
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
fluxcd
|
||||||
|
k9s
|
||||||
|
cilium-cli
|
||||||
|
hubble
|
||||||
|
];
|
||||||
|
|
||||||
|
# Use correct disko profile
|
||||||
|
modules.disko.profile = "k3s";
|
||||||
|
|
||||||
|
# TEMP: Disable firewall for now
|
||||||
|
networking.firewall.enable = false;
|
||||||
|
security.sudo.wheelNeedsPassword = false;
|
||||||
|
}
|
||||||
@@ -25,14 +25,27 @@
|
|||||||
|
|
||||||
# Set up minecraft servers
|
# Set up minecraft servers
|
||||||
users.users.local.extraGroups = [ "minecraft" ];
|
users.users.local.extraGroups = [ "minecraft" ];
|
||||||
|
modules.impermanence.directories = [
|
||||||
|
"/srv/minecraft"
|
||||||
|
];
|
||||||
services.minecraft-servers = {
|
services.minecraft-servers = {
|
||||||
enable = true;
|
enable = true;
|
||||||
eula = true;
|
eula = true;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
servers = {
|
servers = {
|
||||||
modpack = {
|
vanilla = {
|
||||||
enable = true;
|
enable = true;
|
||||||
autoStart = true;
|
autoStart = true;
|
||||||
|
serverProperties = {
|
||||||
|
white-list = true;
|
||||||
|
difficulty = "normal";
|
||||||
|
max-players = 5;
|
||||||
|
};
|
||||||
|
package = inputs.nix-minecraft.legacyPackages.${pkgs.system}.fabricServers.fabric-1_21_7;
|
||||||
|
};
|
||||||
|
modpack = {
|
||||||
|
enable = false;
|
||||||
|
autoStart = true;
|
||||||
serverProperties = { };
|
serverProperties = { };
|
||||||
package = inputs.nix-modpack.packages.${pkgs.system}.mkModpackServer {
|
package = inputs.nix-modpack.packages.${pkgs.system}.mkModpackServer {
|
||||||
packUrl = "https://raw.githubusercontent.com/Jan-Bulthuis/Modpack/refs/heads/master/pack.toml";
|
packUrl = "https://raw.githubusercontent.com/Jan-Bulthuis/Modpack/refs/heads/master/pack.toml";
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
home.stateVersion = "24.11";
|
|
||||||
|
|
||||||
modules.profiles.base.enable = true;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
# State version
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
|
||||||
|
# Machine hostname
|
||||||
|
networking.hostName = "vm-oddjob";
|
||||||
|
|
||||||
|
# Enabled modules
|
||||||
|
modules = {
|
||||||
|
profiles.vm.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Omada Software Controller
|
||||||
|
users.users.omada = {
|
||||||
|
isSystemUser = true;
|
||||||
|
group = "omada";
|
||||||
|
};
|
||||||
|
users.groups.omada = { };
|
||||||
|
virtualisation.podman = {
|
||||||
|
enable = true;
|
||||||
|
dockerCompat = true;
|
||||||
|
defaultNetwork.settings.dns_enabled = true;
|
||||||
|
};
|
||||||
|
virtualisation.oci-containers = {
|
||||||
|
backend = "podman";
|
||||||
|
containers = {
|
||||||
|
omada-controller = {
|
||||||
|
volumes = [
|
||||||
|
"/var/lib/omada:/opt/tplink/EAPController/data"
|
||||||
|
];
|
||||||
|
environment = {
|
||||||
|
TZ = "Europe/Amsterdam";
|
||||||
|
};
|
||||||
|
extraOptions = [
|
||||||
|
"--network=host"
|
||||||
|
"--ulimit"
|
||||||
|
"nofile=4096:8192"
|
||||||
|
];
|
||||||
|
image = "mbentley/omada-controller:5.15";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
modules.impermanence.directories = [
|
||||||
|
"/var/lib/omada"
|
||||||
|
];
|
||||||
|
networking.firewall = {
|
||||||
|
allowedTCPPorts = [
|
||||||
|
8088
|
||||||
|
8043
|
||||||
|
8843
|
||||||
|
];
|
||||||
|
allowedTCPPortRanges = [
|
||||||
|
{
|
||||||
|
from = 29811;
|
||||||
|
to = 29816;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
allowedUDPPorts = [
|
||||||
|
19810
|
||||||
|
27001
|
||||||
|
29810
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Setup NAS backups
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
keyutils
|
||||||
|
];
|
||||||
|
environment.etc."request-key.d/cifs.spnego.conf".text = ''
|
||||||
|
create cifs.spnego * * ${pkgs.cifs-utils}/bin/cifs.upcall -t %k
|
||||||
|
'';
|
||||||
|
environment.etc."request-key.d/cifs.idmap.conf".text = ''
|
||||||
|
create cifs.idmap * * ${pkgs.cifs-utils}/bin/cifs.idmap %k
|
||||||
|
'';
|
||||||
|
sops.secrets."smb-credentials" = {
|
||||||
|
sopsFile = "${inputs.secrets}/secrets/vm-oddjob.enc.yaml";
|
||||||
|
};
|
||||||
|
sops.secrets."backup-script-env" = {
|
||||||
|
sopsFile = "${inputs.secrets}/secrets/vm-oddjob.enc.yaml";
|
||||||
|
};
|
||||||
|
services.cron = {
|
||||||
|
enable = true;
|
||||||
|
systemCronJobs =
|
||||||
|
let
|
||||||
|
script = pkgs.writeShellScript "backup-script" (
|
||||||
|
lib.concatStrings (
|
||||||
|
[
|
||||||
|
''
|
||||||
|
. ${config.sops.secrets."backup-script-env".path}
|
||||||
|
export PBS_REPOSITORY=$PBS_REPOSITORY
|
||||||
|
export PBS_NAMESPACE=$PBS_NAMESPACE
|
||||||
|
export PBS_PASSWORD=$PBS_PASSWORD
|
||||||
|
export PBS_FINGERPRINT=$PBS_FINGERPRINT
|
||||||
|
''
|
||||||
|
]
|
||||||
|
++ lib.map (share: ''
|
||||||
|
systemctl start mnt-${share}.mount
|
||||||
|
${pkgs.util-linux}/bin/prlimit --nofile=1024:1024 ${pkgs.proxmox-backup-client}/bin/proxmox-backup-client backup nfs.pxar:/mnt/${share} --ns $PBS_NAMESPACE --backup-id share-${share} --change-detection-mode=metadata --exclude "#recycle"
|
||||||
|
systemctl stop mnt-${share}.mount
|
||||||
|
'') inputs.secrets.lab.nas.backupShares
|
||||||
|
)
|
||||||
|
);
|
||||||
|
in
|
||||||
|
[
|
||||||
|
"0 0 * * * root ${script}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Mount filesystems
|
||||||
|
systemd.services.krb5-mnt-credentials = {
|
||||||
|
description = "Set up Kerberos credentials for mounting shares";
|
||||||
|
before = map (share: "mnt-${share}.mount") inputs.secrets.lab.nas.backupShares;
|
||||||
|
requiredBy = map (share: "mnt-${share}.mount") inputs.secrets.lab.nas.backupShares;
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
requires = [ "network-online.target" ];
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
script = ''
|
||||||
|
. ${config.sops.secrets."smb-credentials".path}
|
||||||
|
echo $password | ${pkgs.krb5}/bin/kinit $username
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
fileSystems = lib.listToAttrs (
|
||||||
|
lib.map (share: {
|
||||||
|
name = "/mnt/${share}";
|
||||||
|
value = {
|
||||||
|
device = "//${inputs.secrets.lab.nas.host}/${share}";
|
||||||
|
fsType = "cifs";
|
||||||
|
options = [
|
||||||
|
"noauto"
|
||||||
|
"sec=krb5,credentials=${config.sops.secrets."smb-credentials".path}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}) inputs.secrets.lab.nas.backupShares
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
# State version
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
|
||||||
|
# Machine hostname
|
||||||
|
networking.hostName = "vm-test";
|
||||||
|
|
||||||
|
# Enabled modules
|
||||||
|
modules = {
|
||||||
|
profiles.vm.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
{ ... }:
|
|
||||||
|
|
||||||
{
|
|
||||||
home.stateVersion = "24.11";
|
|
||||||
|
|
||||||
modules.profiles.base.enable = true;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
# State version
|
||||||
|
system.stateVersion = "25.05";
|
||||||
|
|
||||||
|
# Machine hostname
|
||||||
|
networking.hostName = "ws-home";
|
||||||
|
|
||||||
|
# Enabled modules
|
||||||
|
modules = {
|
||||||
|
profiles.server.enable = true;
|
||||||
|
disko.profile = "ws-home";
|
||||||
|
domain.enable = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Let the kernel handle router advertisements, so the route to the
|
||||||
|
# Thread network advertised by the OTBR gets installed
|
||||||
|
networking.dhcpcd.IPv6rs = false;
|
||||||
|
boot.kernel.sysctl = {
|
||||||
|
"net.ipv6.conf.default.accept_ra_rt_info_max_plen" = 64;
|
||||||
|
"net.ipv6.conf.eno1.accept_ra" = 1;
|
||||||
|
"net.ipv6.conf.eno1.accept_ra_rt_info_max_plen" = 64;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Matter controller
|
||||||
|
services.matterjs-server = {
|
||||||
|
enable = true;
|
||||||
|
listenAddress = "::1";
|
||||||
|
};
|
||||||
|
modules.impermanence.directories = [
|
||||||
|
"/var/lib/private/matterjs-server"
|
||||||
|
"/var/lib/private/atticd"
|
||||||
|
{
|
||||||
|
directory = "/var/lib/hass";
|
||||||
|
user = "hass";
|
||||||
|
group = "hass";
|
||||||
|
mode = "0700";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d /var/lib/private 0700 root root -"
|
||||||
|
"d /persist/system/var/lib/private 0700 root root -"
|
||||||
|
];
|
||||||
|
networking.firewall.allowedUDPPorts = [
|
||||||
|
5353 # mDNS
|
||||||
|
5540 # Matter
|
||||||
|
];
|
||||||
|
|
||||||
|
# Home Assistant
|
||||||
|
services.home-assistant = {
|
||||||
|
enable = true;
|
||||||
|
extraComponents = [
|
||||||
|
"matter"
|
||||||
|
"mobile_app"
|
||||||
|
"otbr"
|
||||||
|
"thread"
|
||||||
|
];
|
||||||
|
config = {
|
||||||
|
homeassistant = { };
|
||||||
|
mobile_app = { };
|
||||||
|
http = {
|
||||||
|
use_x_forwarded_for = true;
|
||||||
|
# TODO: Narrow down to the address the internal gateway connects from
|
||||||
|
trusted_proxies = [ "10.10.0.0/16" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
networking.firewall.allowedTCPPorts = [
|
||||||
|
8123 # Home Assistant
|
||||||
|
8080 # Attic
|
||||||
|
];
|
||||||
|
|
||||||
|
# Attic binary cache, served as cache.ib.baksteeninc.net behind the reverse proxy
|
||||||
|
sops.secrets."atticd/env".sopsFile = "${inputs.secrets}/secrets/ws-home.enc.yaml";
|
||||||
|
services.atticd = {
|
||||||
|
enable = true;
|
||||||
|
environmentFile = config.sops.secrets."atticd/env".path;
|
||||||
|
settings = {
|
||||||
|
listen = "[::]:8080";
|
||||||
|
api-endpoint = "https://cache.ib.baksteeninc.net/";
|
||||||
|
compression.type = "zstd";
|
||||||
|
garbage-collection = {
|
||||||
|
interval = "12 hours";
|
||||||
|
# Drop paths that have not been accessed for this long
|
||||||
|
default-retention-period = "3 months";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set up hardware
|
||||||
|
imports = [
|
||||||
|
./hardware-configuration.nix
|
||||||
|
./seedbox.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Hardware configuration
|
||||||
|
boot.initrd.availableKernelModules = [
|
||||||
|
"xhci_pci"
|
||||||
|
"ahci"
|
||||||
|
"nvme"
|
||||||
|
"usbhid"
|
||||||
|
];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
boot.zfs.forceImportRoot = false;
|
||||||
|
hardware.cpu.intel.updateMicrocode = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
# Always-on torrent client, confined to a VPN-only network namespace, plus a
|
||||||
|
# read-only, password-protected WebDAV share of its downloads for the local network.
|
||||||
|
#
|
||||||
|
# Everything provider-specific lives in secrets:
|
||||||
|
# seedbox/wireguard wg-quick style config (keys, peer, Address, DNS, MTU)
|
||||||
|
# seedbox/port the incoming port forwarded by the VPN
|
||||||
|
# seedbox/share-password password for the share (user "seedbox")
|
||||||
|
#
|
||||||
|
# Web interface: only on this host's localhost, e.g. `ssh -L 8081:127.0.0.1:8081 ws-home`
|
||||||
|
let
|
||||||
|
netns = "seedbox";
|
||||||
|
wgIf = "wg-seedbox";
|
||||||
|
dataDir = "/var/lib/seedbox";
|
||||||
|
downloadsDir = "${dataDir}/downloads";
|
||||||
|
webuiProxyPort = 8081; # localhost of this host only
|
||||||
|
webuiPort = 8080; # inside the namespace
|
||||||
|
sharePort = 8091;
|
||||||
|
|
||||||
|
secret = name: config.sops.secrets."seedbox/${name}".path;
|
||||||
|
secretFile = "${inputs.secrets}/secrets/ws-home.enc.yaml";
|
||||||
|
|
||||||
|
user = config.services.qbittorrent.user;
|
||||||
|
group = config.services.qbittorrent.group;
|
||||||
|
inNetns = {
|
||||||
|
NetworkNamespacePath = "/run/netns/${netns}";
|
||||||
|
};
|
||||||
|
netnsDeps = {
|
||||||
|
bindsTo = [ "seedbox-netns.service" ];
|
||||||
|
after = [ "seedbox-netns.service" ];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
sops.secrets = {
|
||||||
|
"seedbox/wireguard".sopsFile = secretFile;
|
||||||
|
"seedbox/port" = {
|
||||||
|
sopsFile = secretFile;
|
||||||
|
owner = user;
|
||||||
|
};
|
||||||
|
"seedbox/share-password" = {
|
||||||
|
sopsFile = secretFile;
|
||||||
|
owner = user;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
modules.impermanence.directories = [
|
||||||
|
{
|
||||||
|
directory = dataDir;
|
||||||
|
inherit user group;
|
||||||
|
mode = "0750";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
systemd.tmpfiles.rules = [ "d ${downloadsDir} 0750 ${user} ${group} -" ];
|
||||||
|
|
||||||
|
# Network namespace whose only route out is the WireGuard interface. The interface
|
||||||
|
# is created here and moved into the namespace, so its encrypted traffic uses the
|
||||||
|
# host's network, but nothing inside the namespace can reach anything else.
|
||||||
|
systemd.services.seedbox-netns = {
|
||||||
|
description = "Network namespace for the seedbox";
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
path = with pkgs; [
|
||||||
|
iproute2
|
||||||
|
wireguard-tools
|
||||||
|
gnugrep
|
||||||
|
gnused
|
||||||
|
coreutils
|
||||||
|
];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
RuntimeDirectory = "seedbox";
|
||||||
|
RuntimeDirectoryPreserve = true;
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
set -euo pipefail
|
||||||
|
conf=${secret "wireguard"}
|
||||||
|
field() { grep -iE "^\s*$1\s*=" "$conf" | cut -d= -f2- | tr ',' '\n' | sed 's/ //g'; }
|
||||||
|
|
||||||
|
ip netns del ${netns} 2>/dev/null || true
|
||||||
|
ip link del ${wgIf} 2>/dev/null || true
|
||||||
|
|
||||||
|
ip netns add ${netns}
|
||||||
|
ip -n ${netns} link set lo up
|
||||||
|
|
||||||
|
ip link add ${wgIf} type wireguard
|
||||||
|
wg setconf ${wgIf} <(wg-quick strip "$conf")
|
||||||
|
ip link set ${wgIf} netns ${netns}
|
||||||
|
for addr in $(field Address); do
|
||||||
|
ip -n ${netns} addr add "$addr" dev ${wgIf}
|
||||||
|
done
|
||||||
|
mtu=$(field MTU | head -1)
|
||||||
|
ip -n ${netns} link set ${wgIf} mtu "''${mtu:-1420}" up
|
||||||
|
ip -n ${netns} route add default dev ${wgIf}
|
||||||
|
if field Address | grep -q ':'; then
|
||||||
|
ip -n ${netns} -6 route add default dev ${wgIf}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# DNS only through the tunnel
|
||||||
|
field DNS | grep -v ':' | sed 's/^/nameserver /' > /run/seedbox/resolv.conf
|
||||||
|
echo 'hosts: files dns' > /run/seedbox/nsswitch.conf
|
||||||
|
'';
|
||||||
|
preStop = ''
|
||||||
|
ip netns del ${netns} || true
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
services.qbittorrent = {
|
||||||
|
enable = true;
|
||||||
|
profileDir = dataDir;
|
||||||
|
inherit webuiPort;
|
||||||
|
extraArgs = [ "--confirm-legal-notice" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.qbittorrent = netnsDeps // {
|
||||||
|
serviceConfig = inNetns // {
|
||||||
|
# Resolve names only with the tunnel's DNS. The host's nscd would resolve them
|
||||||
|
# outside the namespace, so it is hidden.
|
||||||
|
BindReadOnlyPaths = [
|
||||||
|
"/run/seedbox/resolv.conf:/etc/resolv.conf"
|
||||||
|
"/run/seedbox/nsswitch.conf:/etc/nsswitch.conf"
|
||||||
|
];
|
||||||
|
InaccessiblePaths = [ "-/run/nscd" ];
|
||||||
|
ReadWritePaths = [ dataDir ];
|
||||||
|
|
||||||
|
# Initial settings, and the incoming port from the secret on every start. Other
|
||||||
|
# settings are left to the web interface.
|
||||||
|
ExecStartPre = pkgs.writeShellScript "seedbox-config" ''
|
||||||
|
set -euo pipefail
|
||||||
|
PATH=${
|
||||||
|
lib.makeBinPath (
|
||||||
|
with pkgs;
|
||||||
|
[
|
||||||
|
coreutils
|
||||||
|
gnused
|
||||||
|
]
|
||||||
|
)
|
||||||
|
}
|
||||||
|
port=$(tr -dc 0-9 < ${secret "port"})
|
||||||
|
cfg=${dataDir}/qBittorrent/config/qBittorrent.conf
|
||||||
|
mkdir -p ${downloadsDir} "$(dirname "$cfg")"
|
||||||
|
if [ ! -f "$cfg" ]; then
|
||||||
|
cat > "$cfg" <<EOF
|
||||||
|
[BitTorrent]
|
||||||
|
Session\DefaultSavePath=${downloadsDir}
|
||||||
|
Session\Interface=${wgIf}
|
||||||
|
Session\InterfaceName=${wgIf}
|
||||||
|
Session\LSDEnabled=false
|
||||||
|
Session\QueueingSystemEnabled=false
|
||||||
|
Session\Port=$port
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
PortForwardingEnabled=false
|
||||||
|
|
||||||
|
[Preferences]
|
||||||
|
WebUI\Address=127.0.0.1
|
||||||
|
WebUI\Port=${toString webuiPort}
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
sed -i -E "s|^Session\\\\Port=.*|Session\\\\Port=$port|" "$cfg"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Web interface on this host's localhost, proxied into the namespace
|
||||||
|
systemd.sockets.seedbox-webui = {
|
||||||
|
wantedBy = [ "sockets.target" ];
|
||||||
|
listenStreams = [ "127.0.0.1:${toString webuiProxyPort}" ];
|
||||||
|
};
|
||||||
|
systemd.services.seedbox-webui = netnsDeps // {
|
||||||
|
requires = [ "qbittorrent.service" ];
|
||||||
|
after = [ "qbittorrent.service" ];
|
||||||
|
serviceConfig = inNetns // {
|
||||||
|
ExecStart = "${pkgs.systemd}/lib/systemd/systemd-socket-proxyd 127.0.0.1:${toString webuiPort}";
|
||||||
|
DynamicUser = true;
|
||||||
|
PrivateTmp = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Read-only share of the downloads on the local network, password protected and
|
||||||
|
# not announced anywhere
|
||||||
|
systemd.services.seedbox-share = {
|
||||||
|
description = "Seedbox downloads share";
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
User = user;
|
||||||
|
Group = group;
|
||||||
|
ProtectSystem = "strict";
|
||||||
|
ProtectHome = true;
|
||||||
|
PrivateTmp = true;
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
ReadOnlyPaths = [ dataDir ];
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
export RCLONE_USER=seedbox
|
||||||
|
RCLONE_PASS=$(cat ${secret "share-password"})
|
||||||
|
export RCLONE_PASS
|
||||||
|
exec ${lib.getExe pkgs.rclone} serve webdav ${downloadsDir} \
|
||||||
|
--addr :${toString sharePort} --read-only --dir-cache-time 15s
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
networking.firewall.interfaces.eno1.allowedTCPPorts = [ sharePort ];
|
||||||
|
}
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
# State version
|
||||||
|
system.stateVersion = "24.05";
|
||||||
|
|
||||||
|
# Machine hostname
|
||||||
|
networking.hostName = "ws-think";
|
||||||
|
|
||||||
|
# Set up users
|
||||||
|
sops.secrets."passwords/jan-hashed" = {
|
||||||
|
sopsFile = "${inputs.secrets}/secrets/ws-think.enc.yaml";
|
||||||
|
neededForUsers = true;
|
||||||
|
};
|
||||||
|
users.mutableUsers = false;
|
||||||
|
users.users.Jan = {
|
||||||
|
hashedPasswordFile = config.sops.secrets."passwords/jan-hashed".path;
|
||||||
|
# Extra admin groups
|
||||||
|
# TODO: Streamline setup of this
|
||||||
|
extraGroups = [
|
||||||
|
"wheel"
|
||||||
|
"wireshark"
|
||||||
|
"podman"
|
||||||
|
"libvirtd"
|
||||||
|
"networkmanager"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Steam Frame wireless adapter
|
||||||
|
modules.steam-frame = {
|
||||||
|
enable = true;
|
||||||
|
regulatoryDomain = "NL";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set up impermanence
|
||||||
|
modules.impermanence = {
|
||||||
|
enable = true;
|
||||||
|
resetScript = ''
|
||||||
|
# Revert to the blank state for the root directory
|
||||||
|
zfs rollback -r tank/root@blank
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set up kerberos
|
||||||
|
security.krb5 = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
libdefaults = {
|
||||||
|
rdns = false;
|
||||||
|
};
|
||||||
|
realms = (inputs.secrets.gewis.krb5Realm);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
services.netbird = {
|
||||||
|
enable = true;
|
||||||
|
# package = pkgs.netbird.overrideAttrs (
|
||||||
|
# final: prev: {
|
||||||
|
# version = "0.66.3";
|
||||||
|
# src = pkgs.fetchFromGitHub {
|
||||||
|
# owner = "netbirdio";
|
||||||
|
# repo = "netbird";
|
||||||
|
# tag = "v${final.version}";
|
||||||
|
# hash = "sha256-Cj9AcdWdHAfdBbqKAkwk3/Vy24XicjTZpmRXLYkyx3k=";
|
||||||
|
# };
|
||||||
|
# vendorHash = "sha256-vyf3zLTMtkmt+AXfCTRSPZ/TaJ8VP/5IzNbJwxQcfPs=";
|
||||||
|
# }
|
||||||
|
# );
|
||||||
|
};
|
||||||
|
|
||||||
|
# SSH X11 forwarding
|
||||||
|
programs.ssh.forwardX11 = true;
|
||||||
|
|
||||||
|
# Enable older samba versions
|
||||||
|
services.samba = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
global = {
|
||||||
|
"invalid users" = [ "root" ];
|
||||||
|
"passwd program" = "/run/wrappers/bin/passwd %u";
|
||||||
|
"security" = "user";
|
||||||
|
"client min protocol" = "NT1";
|
||||||
|
"server min protocol" = "NT1";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# GStreamer
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
gst_all_1.gstreamer
|
||||||
|
gst_all_1.gst-plugins-base
|
||||||
|
gst_all_1.gst-plugins-good
|
||||||
|
gst_all_1.gst-plugins-bad
|
||||||
|
gst_all_1.gst-plugins-ugly
|
||||||
|
gst_all_1.gst-libav
|
||||||
|
gst_all_1.gst-vaapi
|
||||||
|
];
|
||||||
|
environment.variables = {
|
||||||
|
GST_PLUGIN_PATH = "/run/current-system/sw/lib/gstreamer-1.0/";
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Remove once laptop is properly integrated into domain
|
||||||
|
programs.ssh = {
|
||||||
|
package = pkgs.openssh_gssapi;
|
||||||
|
extraConfig = ''
|
||||||
|
GSSAPIAuthentication yes
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable virtualisation for VMs
|
||||||
|
virtualisation.libvirtd.enable = true;
|
||||||
|
programs.virt-manager.enable = true;
|
||||||
|
|
||||||
|
# Enable wireshark
|
||||||
|
programs.wireshark = {
|
||||||
|
enable = true;
|
||||||
|
dumpcap.enable = true;
|
||||||
|
usbmon.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable Nix-LD
|
||||||
|
programs.nix-ld = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set up wstunnel client
|
||||||
|
services.wstunnel = {
|
||||||
|
enable = true;
|
||||||
|
clients.wg-tunnel = {
|
||||||
|
connectTo = "wss://tunnel.bulthuis.dev:443";
|
||||||
|
settings.local-to-remote = [
|
||||||
|
"udp://51819:10.10.40.100:51820"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable flatpak
|
||||||
|
services.flatpak.enable = true;
|
||||||
|
|
||||||
|
# Module setup
|
||||||
|
modules = {
|
||||||
|
profiles.laptop.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set up podman
|
||||||
|
virtualisation.podman = {
|
||||||
|
enable = true;
|
||||||
|
dockerCompat = true;
|
||||||
|
dockerSocket.enable = true;
|
||||||
|
autoPrune.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable Gnome Remote Desktop
|
||||||
|
services.gnome.gnome-remote-desktop.enable = true;
|
||||||
|
systemd.services."gnome-remote-desktop".wantedBy = [ "graphical.target" ];
|
||||||
|
systemd.services."gnome-remote-desktop".preStart =
|
||||||
|
let
|
||||||
|
credDir = "/var/lib/gnome-remote-desktop/.local/share/gnome-remote-desktop";
|
||||||
|
credPath = "${credDir}/credentials.ini";
|
||||||
|
credFile = pkgs.writeText "gnome-remote-desktop-credentials" ''
|
||||||
|
[RDP]
|
||||||
|
credentials={'username': <'remote'>, 'password': <'remote'>}
|
||||||
|
'';
|
||||||
|
script = pkgs.writeScript "gnome-remote-desktop-setup" ''
|
||||||
|
mkdir -p ${credDir}
|
||||||
|
touch ${credPath}
|
||||||
|
chown gnome-remote-desktop:gnome-remote-desktop ${credPath}
|
||||||
|
chmod 600 ${credPath}
|
||||||
|
cat ${credFile} > ${credPath}
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
"${script}";
|
||||||
|
environment.etc."gnome-remote-desktop/grd.conf" = {
|
||||||
|
text = ''
|
||||||
|
[RDP]
|
||||||
|
port=3389
|
||||||
|
tls-key=/run/secrets/gnome-remote-desktop/tls-key
|
||||||
|
tls-cert=/run/secrets/gnome-remote-desktop/tls-crt
|
||||||
|
enabled=true
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
networking.firewall = {
|
||||||
|
allowedTCPPorts = [
|
||||||
|
3389
|
||||||
|
3390
|
||||||
|
];
|
||||||
|
allowedUDPPorts = [
|
||||||
|
3389
|
||||||
|
3390
|
||||||
|
];
|
||||||
|
};
|
||||||
|
sops.secrets."gnome-remote-desktop/tls-key" = {
|
||||||
|
sopsFile = "${inputs.secrets}/secrets/ws-think.enc.yaml";
|
||||||
|
owner = config.users.users.gnome-remote-desktop.name;
|
||||||
|
group = config.users.users.gnome-remote-desktop.group;
|
||||||
|
};
|
||||||
|
sops.secrets."gnome-remote-desktop/tls-crt" = {
|
||||||
|
sopsFile = "${inputs.secrets}/secrets/ws-think.enc.yaml";
|
||||||
|
owner = config.users.users.gnome-remote-desktop.name;
|
||||||
|
group = config.users.users.gnome-remote-desktop.group;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set up hardware
|
||||||
|
imports = [ ./hardware-configuration.nix ];
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
# Machine platform
|
||||||
|
nixpkgs.hostPlatform = "x86_64-linux";
|
||||||
|
|
||||||
|
# Set hostid (required for ZFS)
|
||||||
|
networking.hostId = "deadbeef";
|
||||||
|
|
||||||
|
# Use thermald
|
||||||
|
services.thermald.ignoreCpuidCheck = true;
|
||||||
|
|
||||||
|
# Hardware configuration
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
boot.initrd.availableKernelModules = [
|
||||||
|
"xhci_pci"
|
||||||
|
"nvme"
|
||||||
|
"usb_storage"
|
||||||
|
"sd_mod"
|
||||||
|
"rtsx_pci_sdmmc"
|
||||||
|
];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
boot.zfs.forceImportRoot = false;
|
||||||
|
hardware.cpu.intel.updateMicrocode = true;
|
||||||
|
|
||||||
|
# Filesystems
|
||||||
|
fileSystems = {
|
||||||
|
"/" = {
|
||||||
|
device = "tank/root";
|
||||||
|
fsType = "zfs";
|
||||||
|
options = [ "zfsutil" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
"/nix" = {
|
||||||
|
device = "tank/nix";
|
||||||
|
fsType = "zfs";
|
||||||
|
options = [ "zfsutil" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
"/persist" = {
|
||||||
|
device = "tank/persist";
|
||||||
|
fsType = "zfs";
|
||||||
|
options = [ "zfsutil" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
"/boot" = {
|
||||||
|
device = "/dev/disk/by-uuid/46BF-DE2C";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [
|
||||||
|
"fmask=0077"
|
||||||
|
"dmask=0077"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Swap setup
|
||||||
|
swapDevices = [
|
||||||
|
{
|
||||||
|
device = "/dev/disk/by-uuid/9f6f2a47-e53a-45a0-8cb2-8c1082f54ccb";
|
||||||
|
discardPolicy = "both";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
home.stateVersion = "25.11";
|
||||||
|
|
||||||
|
modules.profiles.jan.enable = true;
|
||||||
|
|
||||||
|
# Open Beat Saber OneClick links on the Steam Frame
|
||||||
|
modules.beatsaber-oneclick = {
|
||||||
|
enable = true;
|
||||||
|
host = "steamos@frame.local";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Larger text while the desktop is streamed to the Steam Frame
|
||||||
|
modules.steam-frame-desktop = {
|
||||||
|
enable = true;
|
||||||
|
streamingTextScale = 1.2;
|
||||||
|
};
|
||||||
|
|
||||||
|
# home.packages = with pkgs; [
|
||||||
|
# opencloud-desktop
|
||||||
|
# code-nautilus
|
||||||
|
# nautilus-open-in-blackbox
|
||||||
|
# ];
|
||||||
|
|
||||||
|
xdg.desktopEntries = {
|
||||||
|
canvas = {
|
||||||
|
name = "Canvas";
|
||||||
|
type = "Application";
|
||||||
|
exec = "${pkgs.chromium}/bin/chromium --app=\"https://canvas.tue.nl\" --user-data-dir=/home/jan/.local/state/Canvas";
|
||||||
|
settings.StartupWMClass = "chrome-canvas.tue.nl__-Default";
|
||||||
|
};
|
||||||
|
overleaf = {
|
||||||
|
name = "Overleaf";
|
||||||
|
type = "Application";
|
||||||
|
exec = "${pkgs.chromium}/bin/chromium --app=\"https://www.overleaf.com\" --user-data-dir=/home/jan/.local/state/Overleaf";
|
||||||
|
settings.StartupWMClass = "chrome-www.overleaf.com__-Default";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Slowly remove
|
||||||
|
modules.impermanence = {
|
||||||
|
directories = [
|
||||||
|
".cache"
|
||||||
|
".config"
|
||||||
|
".cargo"
|
||||||
|
".dbus"
|
||||||
|
".gnupg"
|
||||||
|
".local"
|
||||||
|
".MathWorks"
|
||||||
|
".mozilla"
|
||||||
|
".ssh"
|
||||||
|
".steam"
|
||||||
|
".SteamCloud"
|
||||||
|
".thunderbird"
|
||||||
|
".vscode"
|
||||||
|
".vscode-shared"
|
||||||
|
".var/app"
|
||||||
|
".wine"
|
||||||
|
".Wolfram"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -15,14 +15,14 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# TODO: Enable extensions with dconf
|
# TODO: Enable extensions (declaratively) with dconf
|
||||||
|
|
||||||
home.pointerCursor = {
|
home.pointerCursor = {
|
||||||
|
enable = true;
|
||||||
name = "capitaine-cursors";
|
name = "capitaine-cursors";
|
||||||
size = 24;
|
size = 24;
|
||||||
package = pkgs.capitaine-cursors;
|
package = pkgs.capitaine-cursors;
|
||||||
gtk.enable = true;
|
gtk.enable = true;
|
||||||
x11.enable = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home.packages =
|
home.packages =
|
||||||
@@ -50,32 +50,52 @@ in
|
|||||||
file-roller
|
file-roller
|
||||||
mission-center
|
mission-center
|
||||||
dconf-editor
|
dconf-editor
|
||||||
|
gnome-calendar
|
||||||
|
gnome-backgrounds
|
||||||
|
gnome-bluetooth
|
||||||
|
gnome-color-manager
|
||||||
|
epiphany
|
||||||
|
|
||||||
# For theming gtk3
|
# For theming gtk3
|
||||||
adw-gtk3
|
# adw-gtk3 # TODO: Do this better, same for morewaita, not sure if it even works
|
||||||
|
|
||||||
|
# More icons
|
||||||
|
# morewaita-icon-theme
|
||||||
]
|
]
|
||||||
++ (with pkgs.gnomeExtensions; [
|
++ (with pkgs.gnomeExtensions; [
|
||||||
gsconnect
|
gsconnect
|
||||||
disable-workspace-animation
|
disable-workspace-animation
|
||||||
wallpaper-slideshow
|
wallpaper-slideshow
|
||||||
media-progress
|
media-progress
|
||||||
# luminus-desktop
|
mpris-label
|
||||||
|
pip-on-top
|
||||||
|
rounded-window-corners-reborn
|
||||||
|
caffeine
|
||||||
]);
|
]);
|
||||||
|
|
||||||
# Enable and set the gtk themes
|
# Set up gnome terminal as changing the default terminal is a pain
|
||||||
gtk = {
|
programs.gnome-terminal = {
|
||||||
enable = true;
|
enable = true;
|
||||||
gtk3.extraConfig = {
|
profile."12d2da79-b36c-43d5-8e1f-cf70907b84b3" = {
|
||||||
gtk-theme-name = "adw-gtk3";
|
visibleName = "Default";
|
||||||
};
|
default = true;
|
||||||
gtk4.extraConfig = {
|
|
||||||
gtk-theme-name = "Adwaita";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Enable and set the gtk themes
|
||||||
|
# gtk = {
|
||||||
|
# enable = true;
|
||||||
|
# gtk3.extraConfig = {
|
||||||
|
# gtk-theme-name = "adw-gtk3";
|
||||||
|
# };
|
||||||
|
# gtk4.extraConfig = {
|
||||||
|
# gtk-theme-name = "Adwaita";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
|
||||||
# Set the theme with dconf
|
# Set the theme with dconf
|
||||||
dconf.settings."org/gnome/desktop/interface" = {
|
# dconf.settings."org/gnome/desktop/interface" = {
|
||||||
gtk-theme = "adw-gtk3";
|
# gtk-theme = "adw-gtk3";
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -28,6 +28,18 @@ in
|
|||||||
default = [ ];
|
default = [ ];
|
||||||
description = "Paths to globally ignore";
|
description = "Paths to globally ignore";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
signingKey = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = "Path to the SSH public key used to sign commits and tags.";
|
||||||
|
};
|
||||||
|
|
||||||
|
allowedSigners = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ ];
|
||||||
|
description = "Trusted signers for verifying SSH signatures, as \"<email> <public key>\" lines.";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
@@ -39,15 +51,25 @@ in
|
|||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
extraConfig = {
|
settings = {
|
||||||
pull = {
|
pull = {
|
||||||
rebase = false;
|
rebase = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
userName = cfg.user;
|
settings.user.name = cfg.user;
|
||||||
userEmail = cfg.email;
|
settings.user.email = cfg.email;
|
||||||
ignores = cfg.ignores;
|
ignores = cfg.ignores;
|
||||||
|
|
||||||
|
signing = mkIf (cfg.signingKey != null) {
|
||||||
|
format = "ssh";
|
||||||
|
key = cfg.signingKey;
|
||||||
|
signByDefault = true; # commit.gpgsign and tag.gpgSign
|
||||||
|
};
|
||||||
|
|
||||||
|
settings.gpg.ssh.allowedSignersFile = mkIf (cfg.allowedSigners != [ ]) (
|
||||||
|
toString (pkgs.writeText "git-allowed-signers" (concatLines cfg.allowedSigners))
|
||||||
|
);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.go;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.go = {
|
||||||
|
enable = mkEnableOption "go";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Development packages
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
];
|
||||||
|
|
||||||
|
# VSCode configuration
|
||||||
|
programs.vscode = {
|
||||||
|
profiles.default = {
|
||||||
|
extensions = with pkgs.vscode-extensions; [
|
||||||
|
golang.go
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
userSettings = {
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Neovim configuration
|
||||||
|
# programs.nixvim = {
|
||||||
|
# plugins.rustaceanvim = {
|
||||||
|
# enable = true;
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -18,7 +18,7 @@ in
|
|||||||
# Development packages
|
# Development packages
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
nix-tree
|
nix-tree
|
||||||
nixfmt-rfc-style
|
nixfmt
|
||||||
nixd
|
nixd
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,11 @@ with lib;
|
|||||||
let
|
let
|
||||||
cfg = config.modules.mathematica;
|
cfg = config.modules.mathematica;
|
||||||
|
|
||||||
my-mathematica = pkgs.mathematica.override {
|
my-mathematica = pkgs.mathematica.overrideAttrs (old: {
|
||||||
|
force-rebuild = "1";
|
||||||
# TODO: Just use a generic name for the installer?
|
# TODO: Just use a generic name for the installer?
|
||||||
# source = ./Wolfram_14.2.1_LIN_Bndl.sh;
|
# source = ./Wolfram_14.2.1_LIN_Bndl.sh;
|
||||||
};
|
});
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.modules.mathematica = {
|
options.modules.mathematica = {
|
||||||
@@ -21,6 +22,7 @@ in
|
|||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = [
|
home.packages = [
|
||||||
|
# pkgs.mathematica-cuda
|
||||||
my-mathematica
|
my-mathematica
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ in
|
|||||||
tomoki1207.pdf
|
tomoki1207.pdf
|
||||||
ms-vsliveshare.vsliveshare
|
ms-vsliveshare.vsliveshare
|
||||||
ms-vscode-remote.remote-ssh
|
ms-vscode-remote.remote-ssh
|
||||||
|
myriad-dreamin.tinymist
|
||||||
];
|
];
|
||||||
|
|
||||||
userSettings =
|
userSettings =
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.beatsaber-oneclick;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.beatsaber-oneclick = {
|
||||||
|
enable = mkEnableOption "forwarding Beat Saber OneClick links to a Steam Frame";
|
||||||
|
|
||||||
|
host = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
example = "steamos@frame.local";
|
||||||
|
description = "SSH destination of the Steam Frame. Needs key auth, as there is no terminal to ask for a password.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# The schemes BSManager handles on the Frame. Registering them here makes
|
||||||
|
# browsers on this machine hand the links to the Frame.
|
||||||
|
xdg.desktopEntries.beatsaber-oneclick = {
|
||||||
|
name = "Beat Saber OneClick (Steam Frame)";
|
||||||
|
comment = "Install Beat Saber maps and playlists on the Steam Frame";
|
||||||
|
type = "Application";
|
||||||
|
exec = "${pkgs.beatsaber-oneclick}/bin/beatsaber-oneclick ${escapeShellArg cfg.host} %u";
|
||||||
|
terminal = false;
|
||||||
|
noDisplay = true;
|
||||||
|
mimeType = [
|
||||||
|
"x-scheme-handler/beatsaver"
|
||||||
|
"x-scheme-handler/bsplaylist"
|
||||||
|
"x-scheme-handler/web+bsmap"
|
||||||
|
"x-scheme-handler/modelsaber"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.steam-frame-desktop;
|
||||||
|
|
||||||
|
log = "${config.xdg.dataHome}/Steam/logs/streaming_log.txt";
|
||||||
|
|
||||||
|
setScale = scale: "${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface text-scaling-factor ${toString scale}";
|
||||||
|
|
||||||
|
# Follows Steam's streaming log, which marks when a desktop stream starts and stops
|
||||||
|
# (Remote Play "Connect" on the Frame, or the desktop view in PC VR)
|
||||||
|
watcher = pkgs.writeShellScript "steam-frame-desktop-scale" ''
|
||||||
|
${pkgs.coreutils}/bin/tail -n 0 -F ${escapeShellArg log} 2>/dev/null | while IFS= read -r line; do
|
||||||
|
case "$line" in
|
||||||
|
*">>> Starting desktop stream"*)
|
||||||
|
${setScale cfg.streamingTextScale} ;;
|
||||||
|
# Also reset when Steam restarts, in case it quit mid-stream
|
||||||
|
*">>> Stopped desktop stream"* | *"Client version:"*)
|
||||||
|
${setScale cfg.normalTextScale} ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.steam-frame-desktop = {
|
||||||
|
enable = mkEnableOption "larger text while the desktop is streamed to a Steam Frame";
|
||||||
|
|
||||||
|
streamingTextScale = mkOption {
|
||||||
|
type = types.float;
|
||||||
|
default = 1.44;
|
||||||
|
description = "GNOME text scaling factor while the desktop is being streamed.";
|
||||||
|
};
|
||||||
|
|
||||||
|
normalTextScale = mkOption {
|
||||||
|
type = types.float;
|
||||||
|
default = 1.0;
|
||||||
|
description = "GNOME text scaling factor otherwise.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
systemd.user.services.steam-frame-desktop-scale = {
|
||||||
|
Unit = {
|
||||||
|
Description = "Scale text up while the desktop is streamed to a Steam Frame";
|
||||||
|
PartOf = [ "graphical-session.target" ];
|
||||||
|
After = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
Service = {
|
||||||
|
ExecStart = "${watcher}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
};
|
||||||
|
Install.WantedBy = [ "graphical-session.target" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.bitwarden;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.bitwarden = {
|
||||||
|
enable = mkEnableOption "Bitwarden";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
bitwarden-desktop
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -21,6 +21,7 @@ in
|
|||||||
};
|
};
|
||||||
modules.git.ignores = [
|
modules.git.ignores = [
|
||||||
".direnv"
|
".direnv"
|
||||||
|
".envrc"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -53,5 +53,8 @@ in
|
|||||||
fzf
|
fzf
|
||||||
grc
|
grc
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Impermanence
|
||||||
|
modules.impermanence.files = [ ".local/share/fish/fish_history" ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -24,10 +24,9 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.persistence."/persist/home/${config.home.username}" = {
|
home.persistence."/persist/home" = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hideMounts = true;
|
hideMounts = true;
|
||||||
allowOther = true;
|
|
||||||
directories = cfg.directories;
|
directories = cfg.directories;
|
||||||
files = cfg.files;
|
files = cfg.files;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.secrets;
|
||||||
|
secrets = inputs.secrets;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.secrets = {
|
||||||
|
enable = mkEnableOption "secrets";
|
||||||
|
defaultFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "${secrets}/secrets/common.enc.yaml";
|
||||||
|
description = ''
|
||||||
|
The default file to use for SOPS.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
secrets = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
All secrets that should be made available.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Set up SOPS
|
||||||
|
# TODO: Fix the key not being present in .config/sops before sops-nix runs
|
||||||
|
sops.defaultSopsFile = cfg.defaultFile;
|
||||||
|
sops.age.sshKeyPaths = [
|
||||||
|
"${config.home.homeDirectory}/.config/sops/sops_ed25519_key"
|
||||||
|
# "/persist/home/${config.home.username}/.config/sops/sops_ed25519_key"
|
||||||
|
];
|
||||||
|
sops.secrets = cfg.secrets;
|
||||||
|
modules.impermanence.directories = [ ".config/sops" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -20,5 +20,7 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable { disko.devices = profile.disko.devices; };
|
config = mkIf cfg.enable {
|
||||||
|
disko.devices = profile.disko.devices;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,218 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.domain;
|
||||||
|
domain = inputs.secrets.lab.domain;
|
||||||
|
domainUpper = lib.strings.toUpper domain;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.domain = {
|
||||||
|
enable = mkEnableOption "Domain Integration";
|
||||||
|
join = {
|
||||||
|
userFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "File containing the user used to join the computer.";
|
||||||
|
};
|
||||||
|
passwordFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "File containing the password for the join user.";
|
||||||
|
};
|
||||||
|
domainOUFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The OU to join the computer to.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Set network domain
|
||||||
|
networking.domain = domain;
|
||||||
|
networking.search = [ domain ];
|
||||||
|
|
||||||
|
# Automatically join the domain
|
||||||
|
systemd.services.adcli-join = {
|
||||||
|
description = "Automatically join the domain";
|
||||||
|
wantedBy = [ "default.target" ];
|
||||||
|
before = [ "sssd.service" ];
|
||||||
|
requiredBy = [ "sssd.service" ];
|
||||||
|
after = [
|
||||||
|
"network-online.target"
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
"network-online.target"
|
||||||
|
];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
ADCLI_JOIN_USER=$(cat ${cfg.join.userFile})
|
||||||
|
ADCLI_JOIN_OU=$(cat ${cfg.join.domainOUFile})
|
||||||
|
${pkgs.adcli}/bin/adcli join -D ${domain} \
|
||||||
|
-U $ADCLI_JOIN_USER \
|
||||||
|
-O $ADCLI_JOIN_OU \
|
||||||
|
--dont-expire-password=true \
|
||||||
|
--stdin-password < ${cfg.join.passwordFile}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set up Kerberos
|
||||||
|
security.krb5 = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
libdefaults = {
|
||||||
|
default_realm = domainUpper;
|
||||||
|
};
|
||||||
|
realms.${domainUpper} = {
|
||||||
|
};
|
||||||
|
domain_realm = {
|
||||||
|
"${domain}" = domainUpper;
|
||||||
|
".${domain}" = domainUpper;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set up SSSD
|
||||||
|
services.sssd = {
|
||||||
|
enable = true;
|
||||||
|
config = ''
|
||||||
|
[sssd]
|
||||||
|
domains = ${domain}
|
||||||
|
config_file_version = 2
|
||||||
|
services = nss, pam
|
||||||
|
|
||||||
|
[nss]
|
||||||
|
filter_users = ${concatStringsSep "," (lib.attrNames config.users.users)}
|
||||||
|
filter_groups = ${concatStringsSep "," (lib.attrNames config.users.groups)}
|
||||||
|
|
||||||
|
[domain/${domain}]
|
||||||
|
enumerate = False
|
||||||
|
ad_domain = ${domain}
|
||||||
|
krb5_realm = ${domainUpper}H
|
||||||
|
id_provider = ad
|
||||||
|
auth_provider = ad
|
||||||
|
access_provider = ad
|
||||||
|
chpass_provider = ad
|
||||||
|
use_fully_qualified_names = False
|
||||||
|
ldap_schema = ad
|
||||||
|
ldap_id_mapping = True
|
||||||
|
ad_gpo_access_control = enforcing
|
||||||
|
ad_gpo_implicit_deny = True
|
||||||
|
dyndns_update = True
|
||||||
|
dyndns_update_ptr = False
|
||||||
|
dyndns_refresh_interval = 86400
|
||||||
|
dyndns_ttl = 3600
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
security.pam.services.login.sssdStrictAccess = true;
|
||||||
|
security.pam.services.sshd.sssdStrictAccess = true;
|
||||||
|
security.pam.services.su.sssdStrictAccess = true;
|
||||||
|
|
||||||
|
# Set up Sudo
|
||||||
|
security.sudo =
|
||||||
|
let
|
||||||
|
admin_group = "host_${lib.replaceStrings [ "-" ] [ "_" ] config.networking.hostName}_admin";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
extraConfig = ''
|
||||||
|
%${admin_group} ALL=(ALL) SETENV: ALL
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set up SSH
|
||||||
|
programs.ssh = {
|
||||||
|
package = pkgs.openssh_gssapi;
|
||||||
|
extraConfig = ''
|
||||||
|
GSSAPIAuthentication yes
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
services.openssh = {
|
||||||
|
package = pkgs.openssh_gssapi;
|
||||||
|
settings = {
|
||||||
|
GSSAPIAuthentication = true;
|
||||||
|
GSSAPICleanupCredentials = true;
|
||||||
|
GSSAPIStrictAcceptorCheck = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Set up home directory
|
||||||
|
security.pam.services.login.makeHomeDir = true;
|
||||||
|
security.pam.services.sshd.makeHomeDir = true;
|
||||||
|
security.pam.services.su.makeHomeDir = true;
|
||||||
|
environment.etc.profile.text =
|
||||||
|
let
|
||||||
|
# TODO: Activate configuration based on AD group
|
||||||
|
homeConfiguration = inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
|
inherit pkgs;
|
||||||
|
modules = [
|
||||||
|
(
|
||||||
|
{ lib, ... }:
|
||||||
|
{
|
||||||
|
home.stateVersion = "24.11";
|
||||||
|
home.username = "$USER";
|
||||||
|
home.homeDirectory = "/.$HOME";
|
||||||
|
modules.profiles.base.enable = true;
|
||||||
|
|
||||||
|
# Mount the directories from the network share
|
||||||
|
# home.activation.dirMount =
|
||||||
|
# let
|
||||||
|
# bindScript = dir: ''
|
||||||
|
# mkdir -p /network/$USER/${dir}
|
||||||
|
# mkdir -p $HOME/${dir}
|
||||||
|
# ${pkgs.bindfs}/bin/bindfs /network/$USER/${dir} $HOME/${dir}
|
||||||
|
# '';
|
||||||
|
# in
|
||||||
|
# lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
# if ! ${pkgs.krb5}/bin/klist -s; then
|
||||||
|
# echo "No kerberos ticket found"
|
||||||
|
# ${pkgs.krb5}/bin/kinit
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# if ${pkgs.krb5}/bin/klist -s; then
|
||||||
|
# echo "Kerberos ticket found, mounting home directory"
|
||||||
|
# ${bindScript "Documents"}
|
||||||
|
# ${bindScript "Music"}
|
||||||
|
# ${bindScript "Pictures"}
|
||||||
|
# ${bindScript "Video"}
|
||||||
|
# else
|
||||||
|
# echo "Still no kerberos ticket found, skipping home directory mount"
|
||||||
|
# fi
|
||||||
|
# '';
|
||||||
|
}
|
||||||
|
)
|
||||||
|
] ++ config.home-manager.sharedModules;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
mkAfter ''
|
||||||
|
# Activate Home Manager configuration for domain users
|
||||||
|
if id | egrep -o 'groups=.*' | sed 's/,/\n/g' | cut -d'(' -f2 | sed 's/)//' | egrep -o "^domain users$"; then
|
||||||
|
echo "Setting up environment for domain user"
|
||||||
|
SKIP_SANITY_CHECKS=1 ${homeConfiguration.activationPackage}/activate
|
||||||
|
if test -f "$HOME/.bashrc"; then
|
||||||
|
. $HOME/.bashrc
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Automatically mount home share
|
||||||
|
# Can be accessed at /network/$USER
|
||||||
|
# services.autofs = {
|
||||||
|
# enable = true;
|
||||||
|
# autoMaster =
|
||||||
|
# let
|
||||||
|
# networkMap = pkgs.writeText "auto" ''
|
||||||
|
# * -fstype=cifs,sec=krb5,user=&,uid=$UID,gid=$GID,cruid=$UID ://${inputs.secrets.lab.nas.host}/home
|
||||||
|
# '';
|
||||||
|
# in
|
||||||
|
# ''
|
||||||
|
# /network ${networkMap} --timeout=30
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -20,6 +20,12 @@ in
|
|||||||
console.font = "dina";
|
console.font = "dina";
|
||||||
console.earlySetup = true;
|
console.earlySetup = true;
|
||||||
|
|
||||||
|
fonts.packages = with pkgs; [
|
||||||
|
noto-fonts
|
||||||
|
fira
|
||||||
|
jetbrains-mono
|
||||||
|
];
|
||||||
|
|
||||||
# TODO: Disable default fonts, fonts should be managed per user
|
# TODO: Disable default fonts, fonts should be managed per user
|
||||||
# fonts.enableDefaultPackages = false;
|
# fonts.enableDefaultPackages = false;
|
||||||
# fonts.fontconfig = {
|
# fonts.fontconfig = {
|
||||||
|
|||||||
+10
-24
@@ -17,10 +17,9 @@ in
|
|||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# Enable GDM and Gnome
|
# Enable GDM and Gnome
|
||||||
services.xserver.enable = true;
|
services.displayManager.gdm.enable = true;
|
||||||
services.xserver.displayManager.gdm.enable = true;
|
services.desktopManager.gnome.enable = true;
|
||||||
services.xserver.desktopManager.gnome.enable = true;
|
services.gnome.core-apps.enable = false;
|
||||||
services.gnome.core-utilities.enable = false;
|
|
||||||
services.gnome.games.enable = false;
|
services.gnome.games.enable = false;
|
||||||
services.gnome.core-developer-tools.enable = false;
|
services.gnome.core-developer-tools.enable = false;
|
||||||
environment.gnome.excludePackages = with pkgs; [
|
environment.gnome.excludePackages = with pkgs; [
|
||||||
@@ -29,31 +28,14 @@ in
|
|||||||
gnome-backgrounds
|
gnome-backgrounds
|
||||||
gnome-bluetooth
|
gnome-bluetooth
|
||||||
gnome-color-manager
|
gnome-color-manager
|
||||||
gnome-control-center
|
|
||||||
gnome-shell-extensions
|
gnome-shell-extensions
|
||||||
gnome-tour
|
gnome-tour
|
||||||
gnome-user-docs
|
gnome-user-docs
|
||||||
glib
|
glib
|
||||||
gnome-menus
|
gnome-menus
|
||||||
gtk3.out
|
gtk3.out
|
||||||
xdg-user-dirs
|
|
||||||
xdg-user-dirs-gtk
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# Enable Gnome Remote Desktop
|
|
||||||
services.gnome.gnome-remote-desktop.enable = true;
|
|
||||||
systemd.services."gnome-remote-desktop".wantedBy = [ "graphical.target" ];
|
|
||||||
networking.firewall = {
|
|
||||||
allowedTCPPorts = [
|
|
||||||
3389
|
|
||||||
3390
|
|
||||||
];
|
|
||||||
allowedUDPPorts = [
|
|
||||||
3389
|
|
||||||
3390
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# For GSConnect/KDE Connect
|
# For GSConnect/KDE Connect
|
||||||
# TODO: Move to host config?
|
# TODO: Move to host config?
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
@@ -72,8 +54,12 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Enable dependencies
|
# Enable dependencies
|
||||||
modules = {
|
modules.networkmanager.enable = true;
|
||||||
networkmanager.enable = true;
|
|
||||||
};
|
# Impermanence
|
||||||
|
modules.impermanence.directories = [
|
||||||
|
"/etc/NetworkManager/system-connections"
|
||||||
|
"/var/lib/bluetooth"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -16,7 +16,14 @@ in
|
|||||||
# TODO: Add nvidia settings back in
|
# TODO: Add nvidia settings back in
|
||||||
# TODO: Move to nvidia module
|
# TODO: Move to nvidia module
|
||||||
hardware.nvidia = {
|
hardware.nvidia = {
|
||||||
open = true;
|
open = false;
|
||||||
|
powerManagement.enable = true;
|
||||||
|
prime = {
|
||||||
|
offload.enable = true;
|
||||||
|
offload.enableOffloadCmd = true;
|
||||||
|
intelBusId = "PCI:0@0:2:0";
|
||||||
|
nvidiaBusId = "PCI:1@0:0:0";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ in
|
|||||||
options.modules.impermanence = {
|
options.modules.impermanence = {
|
||||||
enable = mkEnableOption "Impermanence";
|
enable = mkEnableOption "Impermanence";
|
||||||
directories = mkOption {
|
directories = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf (types.either types.str types.attrs);
|
||||||
default = [ ];
|
default = [ ];
|
||||||
description = ''
|
description = ''
|
||||||
Directories that should be stored in persistent storage.
|
Directories that should be stored in persistent storage.
|
||||||
@@ -24,23 +24,58 @@ in
|
|||||||
resetScript = mkOption {
|
resetScript = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
description = ''
|
description = ''
|
||||||
Script to run on boot that resets the root partition.
|
Script to run in order to reset the system to a clean state.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
# Filesystem setup
|
||||||
fileSystems."/persist".neededForBoot = true;
|
fileSystems."/persist".neededForBoot = true;
|
||||||
boot.initrd.postResumeCommands = mkAfter cfg.resetScript;
|
# boot.initrd.postResumeCommands = mkAfter cfg.resetScript;
|
||||||
|
# TODO: Reduce dependency on the root filesystem being ZFS?
|
||||||
|
boot.initrd.systemd.services.impermanence-rollback = {
|
||||||
|
description = "Rollback filesystem to clean state.";
|
||||||
|
wantedBy = [ "initrd.target" ];
|
||||||
|
after = [ "zfs-import.target" ];
|
||||||
|
before = [ "sysroot.mount" ];
|
||||||
|
unitConfig.DefaultDependencies = "no";
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
script = cfg.resetScript;
|
||||||
|
};
|
||||||
|
|
||||||
# For home-manager persistence
|
# For home-manager persistence
|
||||||
programs.fuse.userAllowOther = true;
|
programs.fuse.userAllowOther = true;
|
||||||
|
|
||||||
environment.persistence."/persist/system" = {
|
# For testing purposes with VM
|
||||||
enable = true;
|
virtualisation.vmVariantWithDisko.virtualisation.fileSystems."/persist".neededForBoot = true;
|
||||||
hideMounts = true;
|
|
||||||
directories = cfg.directories;
|
environment.persistence = {
|
||||||
files = cfg.files;
|
"/persist/system" = {
|
||||||
|
enable = true;
|
||||||
|
hideMounts = true;
|
||||||
|
directories = cfg.directories;
|
||||||
|
files = cfg.files;
|
||||||
|
};
|
||||||
|
# "/persist/home" = {
|
||||||
|
# enable = true;
|
||||||
|
# hideMounts = true;
|
||||||
|
# users = (
|
||||||
|
# lib.mapAttrs' (
|
||||||
|
# name: value:
|
||||||
|
# let
|
||||||
|
# user = name;
|
||||||
|
# homeDir = "/home/${user}";
|
||||||
|
# impConfig = value.modules.impermanence;
|
||||||
|
# in
|
||||||
|
# lib.nameValuePair user {
|
||||||
|
# home = homeDir;
|
||||||
|
# directories = impConfig.directories;
|
||||||
|
# files = impConfig.files;
|
||||||
|
# }
|
||||||
|
# ) config.home-manager.users
|
||||||
|
# );
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -11,5 +11,7 @@ in
|
|||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# TODO: Add sudo users to the networkmanager group?
|
# TODO: Add sudo users to the networkmanager group?
|
||||||
networking.networkmanager.enable = true;
|
networking.networkmanager.enable = true;
|
||||||
|
|
||||||
|
networking.firewall.checkReversePath = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
inputs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.secrets;
|
||||||
|
secrets = inputs.secrets;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.secrets = {
|
||||||
|
enable = mkEnableOption "secrets";
|
||||||
|
defaultFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "${secrets}/secrets/common.enc.yaml";
|
||||||
|
description = ''
|
||||||
|
The default file to use for SOPS.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
secrets = mkOption {
|
||||||
|
type = types.attrs;
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
All secrets that should be made available.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Set up SOPS
|
||||||
|
# TODO: Fix the key not being present in /etc/sops before sops-nix runs
|
||||||
|
sops.defaultSopsFile = cfg.defaultFile;
|
||||||
|
sops.age.sshKeyPaths = [
|
||||||
|
"/etc/sops/sops_ed25519_key"
|
||||||
|
"/persist/system/etc/sops/sops_ed25519_key"
|
||||||
|
];
|
||||||
|
sops.secrets = cfg.secrets;
|
||||||
|
modules.impermanence.directories = [ "/etc/sops" ];
|
||||||
|
virtualisation.vmVariantWithDisko.sops.age.sshKeyPaths = [ "/tmp/shared/sops_ed25519_key" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
+19
-2
@@ -9,7 +9,24 @@ in
|
|||||||
enable = mkEnableOption "ssh";
|
enable = mkEnableOption "ssh";
|
||||||
};
|
};
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
services.openssh.enable = true;
|
services.openssh = {
|
||||||
# TODO: Is this default configuration secure?
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
KbdInteractiveAuthentication = false;
|
||||||
|
PermitRootLogin = "no";
|
||||||
|
};
|
||||||
|
hostKeys = mkIf (config.modules.impermanence.enable) [
|
||||||
|
{
|
||||||
|
type = "ed25519";
|
||||||
|
path = "/persist/system/etc/ssh/ssh_host_ed25519_key";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
type = "rsa";
|
||||||
|
bits = 4096;
|
||||||
|
path = "/persist/system/etc/ssh/ssh_host_rsa_key";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.steam-frame;
|
||||||
|
kernel = config.boot.kernelPackages.kernel;
|
||||||
|
|
||||||
|
# Out-of-tree rtw89 driver, as the in-tree rtw89_8852cu driver needs Linux 7.0+,
|
||||||
|
# which ZFS does not support yet
|
||||||
|
rtw89 = pkgs.stdenv.mkDerivation {
|
||||||
|
pname = "rtw89-morrownr";
|
||||||
|
version = "0-unstable-2026-11-09-${kernel.version}";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "morrownr";
|
||||||
|
repo = "rtw89";
|
||||||
|
rev = "f2ce66eda6277e5505d5914a8a08454440518702";
|
||||||
|
hash = "sha256-u2sJ/1tvDM6MloulU7l3w9eLCc2GZqOBebI7/eQbeC8=";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||||
|
makeFlags = kernel.commonMakeFlags ++ [
|
||||||
|
"KDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
||||||
|
];
|
||||||
|
buildFlags = [ "modules" ];
|
||||||
|
|
||||||
|
# Install through Kbuild so the modules are signed (produces the .ko.cer files)
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
local flagsArray=()
|
||||||
|
concatTo flagsArray makeFlags
|
||||||
|
make "''${flagsArray[@]}" -C ${kernel.dev}/lib/modules/${kernel.modDirVersion}/build M=$PWD \
|
||||||
|
modules_install INSTALL_MOD_PATH=$out INSTALL_MOD_DIR=updates/rtw89
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta.platforms = platforms.linux;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.steam-frame = {
|
||||||
|
enable = mkEnableOption "Steam Frame wireless streaming adapter";
|
||||||
|
|
||||||
|
regulatoryDomain = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "Country code to use for Wi-Fi, needed to unlock the 6 GHz band.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Driver for the adapter (Realtek RTL8832CU, 28de:2432)
|
||||||
|
# Firmware comes from linux-firmware (hardware.enableRedistributableFirmware)
|
||||||
|
boot.extraModulePackages = [ rtw89 ];
|
||||||
|
boot.extraModprobeConfig = ''
|
||||||
|
options cfg80211 ieee80211_regdom=${cfg.regulatoryDomain}
|
||||||
|
|
||||||
|
# The adapter tends to stall when it enters power saving
|
||||||
|
options rtw89_core_git disable_ps_mode=y
|
||||||
|
|
||||||
|
# Prevent the in-tree drivers from claiming the adapter
|
||||||
|
blacklist rtw89_core
|
||||||
|
blacklist rtw89_usb
|
||||||
|
blacklist rtw89_8852c
|
||||||
|
blacklist rtw89_8852cu
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Never let the adapter doze. In power save the Frame (the access point) buffers
|
||||||
|
# traffic for the PC until it wakes up, which stalls streams towards the PC
|
||||||
|
# such as spectating. This overrides the global wifi.powersave for this driver only.
|
||||||
|
networking.networkmanager.settings."connection-steam-frame" = {
|
||||||
|
match-device = "driver:rtw89_8852cu_git";
|
||||||
|
"wifi.powersave" = 2;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Udev rules for Valve devices
|
||||||
|
hardware.steam-hardware.enable = true;
|
||||||
|
|
||||||
|
# Streaming ports
|
||||||
|
networking.firewall = {
|
||||||
|
allowedTCPPorts = [ 27036 ];
|
||||||
|
allowedUDPPortRanges = [
|
||||||
|
{
|
||||||
|
from = 10400;
|
||||||
|
to = 10401;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
from = 27031;
|
||||||
|
to = 27036;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = [ pkgs.iw ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
# Forwards a Beat Saber OneClick link to the Steam Frame, where BSManager downloads it,
|
||||||
|
# and keeps a desktop notification up to date until the install is done.
|
||||||
|
# Usage: beatsaber-oneclick <ssh-host> <url>
|
||||||
|
# $remote_script (remote.sh) is set by the package.
|
||||||
|
|
||||||
|
host=${1:?usage: beatsaber-oneclick <ssh-host> <url>}
|
||||||
|
url=${2:?usage: beatsaber-oneclick <ssh-host> <url>}
|
||||||
|
api=https://api.beatsaver.com
|
||||||
|
|
||||||
|
# One notification, updated in place
|
||||||
|
notification_id=
|
||||||
|
notify() {
|
||||||
|
local id
|
||||||
|
if id=$(notify-send --print-id ${notification_id:+--replace-id="$notification_id"} \
|
||||||
|
--app-name="Beat Saber OneClick" --icon=input-gaming "$@"); then
|
||||||
|
notification_id=$id
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Only forward the OneClick schemes, and only plain URL characters, since the URL
|
||||||
|
# ends up in a remote shell command line.
|
||||||
|
if [[ ! $url =~ ^(beatsaver|bsplaylist|web\+bsmap|modelsaber):// ]] ||
|
||||||
|
[[ ! $url =~ ^[A-Za-z0-9+.:/?#\&=%_~@!,\;-]+$ ]]; then
|
||||||
|
notify --urgency=critical "Not a OneClick link" "$url"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
fetch() {
|
||||||
|
curl -sfL --max-time 20 "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Look up what the link installs, to know which map folders to watch for. If that
|
||||||
|
# fails, the link is still sent, just without tracking.
|
||||||
|
ids=()
|
||||||
|
label=$url
|
||||||
|
playlist=
|
||||||
|
case $url in
|
||||||
|
beatsaver://* | web+bsmap://*)
|
||||||
|
ref=${url#*://}
|
||||||
|
ref=${ref%%[/?#]*}
|
||||||
|
if [[ $url == beatsaver://* ]]; then
|
||||||
|
map=$(fetch "$api/maps/id/$ref") || map=
|
||||||
|
else
|
||||||
|
map=$(fetch "$api/maps/hash/$ref") || map=
|
||||||
|
fi
|
||||||
|
if [[ -n $map ]]; then
|
||||||
|
ids=("$(jq -r '.id | ascii_downcase' <<<"$map")")
|
||||||
|
label=$(jq -r '"\(.metadata.songName) – \(.metadata.levelAuthorName)"' <<<"$map")
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
bsplaylist://playlist/*)
|
||||||
|
playlist=1
|
||||||
|
label="Playlist"
|
||||||
|
if bplist=$(fetch "${url#bsplaylist://playlist/}"); then
|
||||||
|
label=$(jq -r '.playlistTitle // "Playlist"' <<<"$bplist")
|
||||||
|
# Entries with a key need no lookup; resolve the rest by hash, 50 at a time
|
||||||
|
mapfile -t ids < <(jq -r '.songs[] | .key // empty | ascii_downcase' <<<"$bplist")
|
||||||
|
mapfile -t hashes < <(jq -r '.songs[] | select(.key == null) | .hash // empty | ascii_downcase' <<<"$bplist")
|
||||||
|
for ((i = 0; i < ${#hashes[@]}; i += 50)); do
|
||||||
|
batch=$(
|
||||||
|
IFS=,
|
||||||
|
echo "${hashes[*]:i:50}"
|
||||||
|
)
|
||||||
|
if found=$(fetch "$api/maps/hash/$batch"); then
|
||||||
|
# A single hash returns the map itself instead of a hash → map object
|
||||||
|
mapfile -t -O "${#ids[@]}" ids < <(jq -r 'if has("id") then .id else (.[] | select(. != null) | .id) end | ascii_downcase' <<<"$found")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
notify "Sending to Steam Frame…" "$label"
|
||||||
|
|
||||||
|
total=${#ids[@]}
|
||||||
|
done_count=0
|
||||||
|
new=0
|
||||||
|
already=0
|
||||||
|
missing=0
|
||||||
|
last_error=
|
||||||
|
stderr_file=$(mktemp)
|
||||||
|
trap 'rm -f "$stderr_file"' EXIT
|
||||||
|
|
||||||
|
exec {events}< <(ssh -T -o BatchMode=yes -o ConnectTimeout=5 "$host" \
|
||||||
|
bash -s -- "$(printf '%q' "$url")" "${ids[@]}" <"$remote_script" 2>"$stderr_file")
|
||||||
|
ssh_pid=$!
|
||||||
|
|
||||||
|
while IFS= read -r -u "$events" event; do
|
||||||
|
case $event in
|
||||||
|
received)
|
||||||
|
notify "Downloading on Steam Frame…" "$label"
|
||||||
|
;;
|
||||||
|
"done "*)
|
||||||
|
done_count=$((done_count + 1))
|
||||||
|
if ((total > 1)); then
|
||||||
|
notify "Downloading on Steam Frame… $done_count/$total" "$label"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"error "*)
|
||||||
|
last_error=${event#error }
|
||||||
|
;;
|
||||||
|
"result "*" new") new=$((new + 1)) ;;
|
||||||
|
"result "*" already") already=$((already + 1)) ;;
|
||||||
|
"result "*" missing") missing=$((missing + 1)) ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if ! wait "$ssh_pid"; then
|
||||||
|
err=$(tr -d '\r' <"$stderr_file" | grep -v 'X11 forwarding' || true)
|
||||||
|
notify --urgency=critical "Couldn't send to Steam Frame" "${err:-ssh failed}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
failure_hint=${last_error:-BSManager didn\'t finish within 2 minutes. Check it on the Frame.}
|
||||||
|
|
||||||
|
if ((total == 0)); then
|
||||||
|
notify "Sent to Steam Frame" "$label"$'\n(Not tracked: couldn\'t look it up on BeatSaver.)'
|
||||||
|
elif [[ -z $playlist ]]; then
|
||||||
|
if ((new > 0)); then
|
||||||
|
notify "Installed on Steam Frame" "$label"
|
||||||
|
elif ((already > 0)); then
|
||||||
|
notify "Already on Steam Frame" "$label"
|
||||||
|
else
|
||||||
|
notify --urgency=critical "Not installed on Steam Frame" "$label"$'\n'"$failure_hint"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
summary="$label: $new new, $already already there"
|
||||||
|
if ((missing > 0)); then
|
||||||
|
notify --urgency=critical "Playlist partly installed on Steam Frame" \
|
||||||
|
"$summary, $missing failed"$'\n'"$failure_hint"
|
||||||
|
else
|
||||||
|
notify "Playlist installed on Steam Frame" "$summary"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
writeShellApplication,
|
||||||
|
openssh,
|
||||||
|
libnotify,
|
||||||
|
curl,
|
||||||
|
jq,
|
||||||
|
}:
|
||||||
|
|
||||||
|
# Forwards Beat Saber OneClick links (BeatSaver, BeatLeader, ScoreSaber, playlists)
|
||||||
|
# to a Steam Frame over SSH and opens them there, so BSManager on the Frame does the
|
||||||
|
# download, and shows the install progress as a notification.
|
||||||
|
# Usage: beatsaber-oneclick <ssh-host> <url>
|
||||||
|
writeShellApplication {
|
||||||
|
name = "beatsaber-oneclick";
|
||||||
|
runtimeInputs = [
|
||||||
|
openssh
|
||||||
|
libnotify
|
||||||
|
curl
|
||||||
|
jq
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
remote_script=${./remote.sh}
|
||||||
|
''
|
||||||
|
+ builtins.readFile ./beatsaber-oneclick.sh;
|
||||||
|
}
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Runs on the Steam Frame (piped over SSH): opens a OneClick link in the graphical
|
||||||
|
# session, so the Frame's own handler (BSManager) downloads and installs it.
|
||||||
|
#
|
||||||
|
# Usage: remote.sh <url> [<beatsaver map id>...]
|
||||||
|
#
|
||||||
|
# With map ids, it then watches BSManager's log and map folders until those maps are
|
||||||
|
# installed, and reports on stdout, one event per line:
|
||||||
|
# received BSManager got the link
|
||||||
|
# downloading <id> BSManager started downloading a map
|
||||||
|
# done <id> the map's folder was (re)written and is complete
|
||||||
|
# error <message> BSManager logged an error (may be unrelated)
|
||||||
|
# result <id> new|already|missing
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
url=$1
|
||||||
|
shift
|
||||||
|
ids=("$@")
|
||||||
|
uid=$(id -u)
|
||||||
|
|
||||||
|
# BSManager's default locations (installation folder not changed)
|
||||||
|
bsm=$HOME/.local/share/BSManager
|
||||||
|
logs=$HOME/.config/bs-manager/logs
|
||||||
|
|
||||||
|
# Give up when nothing has happened for this long (BSManager may need to start first)
|
||||||
|
timeout=120
|
||||||
|
# With maps that were already installed, finish once BSManager is quiet for this long
|
||||||
|
quiet=10
|
||||||
|
|
||||||
|
for id in "${ids[@]}"; do
|
||||||
|
if [[ ! $id =~ ^[0-9a-f]+$ ]]; then
|
||||||
|
echo "Invalid map id: $id" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# An SSH session has no display. Borrow the display variables from a process in
|
||||||
|
# the graphical session, preferring the Steam client.
|
||||||
|
session_env() {
|
||||||
|
local pid env
|
||||||
|
for pid in $(pgrep -u "$uid" -x steam || true) $(pgrep -u "$uid"); do
|
||||||
|
env=$(tr '\0' '\n' <"/proc/$pid/environ" 2>/dev/null) || continue
|
||||||
|
if grep -qE '^(DISPLAY|WAYLAND_DISPLAY)=' <<<"$env"; then
|
||||||
|
printf '%s\n' "$env"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! env=$(session_env); then
|
||||||
|
echo "No graphical session found on the Frame (is it signed in?)" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while IFS= read -r line; do
|
||||||
|
export "${line?}"
|
||||||
|
done < <(grep -E '^(DISPLAY|WAYLAND_DISPLAY|XAUTHORITY|XDG_CURRENT_DESKTOP|XDG_SESSION_TYPE|DBUS_SESSION_BUS_ADDRESS)=' <<<"$env")
|
||||||
|
|
||||||
|
opener=
|
||||||
|
for candidate in gio xdg-open kde-open; do
|
||||||
|
if command -v "$candidate" >/dev/null; then
|
||||||
|
opener=$candidate
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ -z $opener ]]; then
|
||||||
|
echo "No gio, xdg-open or kde-open on the Frame" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
open_cmd=("$opener")
|
||||||
|
[[ $opener == gio ]] && open_cmd+=(open)
|
||||||
|
|
||||||
|
map_dirs=("$bsm"/BSInstances/*/"Beat Saber_Data"/CustomLevels "$bsm"/SharedContent/SharedMaps/CustomLevels)
|
||||||
|
|
||||||
|
# Prints "<newest change time> <total size>" over a map's folders in all instances,
|
||||||
|
# or "none". Change time (not mtime), as extracting may keep the zip's mtimes.
|
||||||
|
map_state() {
|
||||||
|
local d f t s newest=0 size=0 found=
|
||||||
|
for d in "${map_dirs[@]}"; do
|
||||||
|
for f in "$d/$1 ("*; do
|
||||||
|
[[ -d $f ]] || continue
|
||||||
|
found=1
|
||||||
|
t=$(find "$f" -printf '%C@\n' | sort -n | tail -n1)
|
||||||
|
t=${t%.*}
|
||||||
|
((t > newest)) && newest=$t
|
||||||
|
s=$(du -sb "$f" | cut -f1)
|
||||||
|
size=$((size + s))
|
||||||
|
done
|
||||||
|
done
|
||||||
|
if [[ -n $found ]]; then echo "$newest $size"; else echo none; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# BSManager log lines written since we started. Continuation lines (stack traces)
|
||||||
|
# don't start with a timestamp and are left out.
|
||||||
|
log_since_start() {
|
||||||
|
find "$logs" -name '*.log' -newermt "@$start" -print0 2>/dev/null |
|
||||||
|
xargs -0r cat |
|
||||||
|
awk -v s="[$start_log" 'substr($0, 1, 20) >= s'
|
||||||
|
}
|
||||||
|
|
||||||
|
declare -A pre state prev
|
||||||
|
for id in "${ids[@]}"; do
|
||||||
|
pre[$id]=$(map_state "$id")
|
||||||
|
state[$id]=pending
|
||||||
|
prev[$id]=
|
||||||
|
done
|
||||||
|
|
||||||
|
start=$(date +%s)
|
||||||
|
start_log=$(date -d "@$start" '+%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
|
# gio comes first: xdg-open (generic mode) mangles the quoted path in BSManager's Exec line.
|
||||||
|
# Run it in its own scope, detached from this SSH session: if BSManager isn't running
|
||||||
|
# yet, the handler starts it, and it must outlive the connection. Output goes to the
|
||||||
|
# journal: journalctl --user -t beatsaber-oneclick
|
||||||
|
systemd-run --user --scope --collect --quiet \
|
||||||
|
setsid -f systemd-cat -t beatsaber-oneclick "${open_cmd[@]}" "$url" \
|
||||||
|
</dev/null >/dev/null 2>&1
|
||||||
|
|
||||||
|
((${#ids[@]} > 0)) || exit 0
|
||||||
|
|
||||||
|
received=
|
||||||
|
errors_seen=0
|
||||||
|
last_activity=$start
|
||||||
|
while :; do
|
||||||
|
sleep 1
|
||||||
|
now=$(date +%s)
|
||||||
|
lines=$(log_since_start)
|
||||||
|
|
||||||
|
if [[ -z $received ]] && grep -q 'DEEP-LINK RECEIVED' <<<"$lines"; then
|
||||||
|
received=1
|
||||||
|
last_activity=$now
|
||||||
|
echo received
|
||||||
|
fi
|
||||||
|
|
||||||
|
mapfile -t errors < <(grep -F '[error]' <<<"$lines" || true)
|
||||||
|
for err in "${errors[@]:errors_seen}"; do
|
||||||
|
echo "error ${err#*\[error\] }"
|
||||||
|
done
|
||||||
|
errors_seen=${#errors[@]}
|
||||||
|
|
||||||
|
waiting=0
|
||||||
|
all_done=1
|
||||||
|
for id in "${ids[@]}"; do
|
||||||
|
[[ ${state[$id]} == installed ]] && continue
|
||||||
|
all_done=
|
||||||
|
|
||||||
|
if [[ ${state[$id]} == pending ]] && grep -qF " $id https://" <<<"$lines"; then
|
||||||
|
state[$id]=downloading
|
||||||
|
last_activity=$now
|
||||||
|
echo "downloading $id"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Done once the folder changed since we started and stayed the same for a second
|
||||||
|
cur=$(map_state "$id")
|
||||||
|
if [[ $cur != none ]] && ((${cur%% *} >= start)); then
|
||||||
|
if [[ $cur == "${prev[$id]}" ]]; then
|
||||||
|
state[$id]=installed
|
||||||
|
last_activity=$now
|
||||||
|
echo "done $id"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
prev[$id]=$cur
|
||||||
|
last_activity=$now
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Maps that weren't installed yet, or are being downloaded, are worth waiting for
|
||||||
|
if [[ ${state[$id]} == downloading || ${pre[$id]} == none ]]; then
|
||||||
|
waiting=$((waiting + 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
[[ -n $all_done ]] && break
|
||||||
|
[[ -n $received ]] && ((waiting == 0 && now - last_activity >= quiet)) && break
|
||||||
|
((now - last_activity >= timeout)) && break
|
||||||
|
done
|
||||||
|
|
||||||
|
for id in "${ids[@]}"; do
|
||||||
|
if [[ ${state[$id]} == installed ]]; then
|
||||||
|
echo "result $id new"
|
||||||
|
elif [[ ${pre[$id]} != none ]]; then
|
||||||
|
echo "result $id already"
|
||||||
|
else
|
||||||
|
echo "result $id missing"
|
||||||
|
fi
|
||||||
|
done
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
with pkgs;
|
||||||
|
rustPlatform.buildRustPackage {
|
||||||
|
pname = "carla_osc_bridge";
|
||||||
|
version = "master";
|
||||||
|
|
||||||
|
src = fetchFromGitea {
|
||||||
|
domain = "git.bulthuis.dev";
|
||||||
|
owner = "Jan";
|
||||||
|
repo = "carla_osc_bridge";
|
||||||
|
rev = "c037e2d2a1b29b785d8acc10fa0cb761afdb3fcf";
|
||||||
|
hash = "sha256-Wvdfm+4dfygZwkvaUhO9w7DrrUl3ZYvtD7nYrPSD0eA=";
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoHash = "sha256-s1ZKbhHudgPOy7613zbT8TkbM6B7oloLEuTYHoWjX5o=";
|
||||||
|
|
||||||
|
useFetchCargoVendor = true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
# Render node of the GPU the OpenXR runtime uses, for hybrid graphics laptops
|
||||||
|
# (e.g. "/dev/dri/by-path/pci-0000:01:00.0-render"). Only NVIDIA is supported.
|
||||||
|
nvidiaRenderNode ? null,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
# Google Chrome with WebXR over OpenXR. nixpkgs' Chromium sets checkout_openxr = false,
|
||||||
|
# so it is built without the OpenXR backend.
|
||||||
|
let
|
||||||
|
chrome = pkgs.google-chrome;
|
||||||
|
|
||||||
|
flags = [
|
||||||
|
"--enable-features=OpenXR"
|
||||||
|
# The broker reports the wrong pid to SteamVR, which then fails xrCreateInstance
|
||||||
|
"--disable-seccomp-filter-sandbox"
|
||||||
|
"--ozone-platform=wayland"
|
||||||
|
"--use-angle=gl"
|
||||||
|
]
|
||||||
|
++ lib.optionals (nvidiaRenderNode != null) [
|
||||||
|
# The compositor runs on the integrated GPU and can't import NVIDIA buffers,
|
||||||
|
# so the window is composited in software while WebGL and WebXR stay on NVIDIA
|
||||||
|
"--render-node-override=${nvidiaRenderNode}"
|
||||||
|
"--disable-gpu-compositing"
|
||||||
|
];
|
||||||
|
|
||||||
|
desktopItem = pkgs.makeDesktopItem {
|
||||||
|
name = "chrome-xr";
|
||||||
|
exec = "chrome-xr %U";
|
||||||
|
icon = "google-chrome";
|
||||||
|
desktopName = "Chrome XR";
|
||||||
|
genericName = "WebXR Browser";
|
||||||
|
comment = "Google Chrome with WebXR through OpenXR";
|
||||||
|
categories = [
|
||||||
|
"Network"
|
||||||
|
"WebBrowser"
|
||||||
|
];
|
||||||
|
mimeTypes = [
|
||||||
|
"text/html"
|
||||||
|
"x-scheme-handler/http"
|
||||||
|
"x-scheme-handler/https"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "chrome-xr-${chrome.version}";
|
||||||
|
|
||||||
|
paths = [
|
||||||
|
(pkgs.writeShellScriptBin "chrome-xr" ''
|
||||||
|
# SteamVR's vrclient.so needs these, which NixOS doesn't provide globally
|
||||||
|
export LD_LIBRARY_PATH=${
|
||||||
|
lib.makeLibraryPath [
|
||||||
|
pkgs.libuuid
|
||||||
|
pkgs.libglvnd
|
||||||
|
]
|
||||||
|
}''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
|
||||||
|
|
||||||
|
${lib.optionalString (nvidiaRenderNode != null) ''
|
||||||
|
# Render on the NVIDIA GPU, which the OpenXR runtime also uses
|
||||||
|
export __NV_PRIME_RENDER_OFFLOAD=1
|
||||||
|
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
|
||||||
|
export __GLX_VENDOR_LIBRARY_NAME=nvidia
|
||||||
|
export __EGL_VENDOR_LIBRARY_FILENAMES=/run/opengl-driver/share/glvnd/egl_vendor.d/10_nvidia.json
|
||||||
|
export __VK_LAYER_NV_optimus=NVIDIA_only
|
||||||
|
''}
|
||||||
|
|
||||||
|
# Separate profile, as the seccomp sandbox is disabled
|
||||||
|
exec ${chrome}/bin/google-chrome-stable \
|
||||||
|
${lib.escapeShellArgs flags} \
|
||||||
|
--user-data-dir="''${XDG_CONFIG_HOME:-$HOME/.config}/chrome-xr" \
|
||||||
|
"$@"
|
||||||
|
'')
|
||||||
|
desktopItem
|
||||||
|
];
|
||||||
|
|
||||||
|
meta = chrome.meta // {
|
||||||
|
description = "Google Chrome with WebXR through OpenXR";
|
||||||
|
mainProgram = "chrome-xr";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
{
|
||||||
|
jq,
|
||||||
|
lib,
|
||||||
|
moreutils,
|
||||||
|
tinymist,
|
||||||
|
vscode-utils,
|
||||||
|
}:
|
||||||
|
|
||||||
|
vscode-utils.buildVscodeMarketplaceExtension {
|
||||||
|
mktplcRef = {
|
||||||
|
name = "tinymist-vscode-html";
|
||||||
|
publisher = "myriad-dreamin";
|
||||||
|
inherit (tinymist) version;
|
||||||
|
hash = "";
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
jq
|
||||||
|
moreutils
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [ tinymist ];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
cd "$out/$installPrefix"
|
||||||
|
jq '.contributes.configuration.properties."tinymist.serverPath".default = "${lib.getExe tinymist}"' package.json | sponge package.json
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
changelog = "https://marketplace.visualstudio.com/items/myriad-dreamin.tinymist/changelog";
|
||||||
|
description = "VSCode extension for providing an integration solution for Typst";
|
||||||
|
downloadPage = "https://marketplace.visualstudio.com/items?itemName=myriad-dreamin.tinymist";
|
||||||
|
homepage = "https://github.com/myriad-dreamin/tinymist";
|
||||||
|
license = lib.licenses.asl20;
|
||||||
|
maintainers = [ ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
fetchFromGitHub,
|
||||||
|
rustPlatform,
|
||||||
|
helix,
|
||||||
|
helix-unwrapped,
|
||||||
|
tree-sitter,
|
||||||
|
pkgs,
|
||||||
|
}:
|
||||||
|
|
||||||
|
# Helix from git, built with nixpkgs' packaging instead of the upstream flake. The
|
||||||
|
# flake fetches every tree-sitter grammar without a hash at evaluation time. Here
|
||||||
|
# they are pinned in grammars.json, so they are fetched once and kept in the store.
|
||||||
|
#
|
||||||
|
# To update: change rev and hash, set cargoHash to lib.fakeHash, build and copy the
|
||||||
|
# expected hash, then run ./update-grammars.sh.
|
||||||
|
let
|
||||||
|
lockedGrammars = lib.importJSON ./grammars.json;
|
||||||
|
|
||||||
|
unwrapped = helix-unwrapped.overrideAttrs (
|
||||||
|
final: prev: {
|
||||||
|
version = "25.07.1-unstable-${final.src.rev}";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "helix-editor";
|
||||||
|
repo = "helix";
|
||||||
|
rev = "f6f3eb1fe4a73933466f30175843059a4381a985";
|
||||||
|
hash = "sha256-yfNBfV6HWAQU/xZXwrFoedsSYsDmCDIlTHRxAZI6teY=";
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoDeps = rustPlatform.fetchCargoVendor {
|
||||||
|
inherit (final) src pname version;
|
||||||
|
hash = "sha256-oo59HhwOS3EeV/YI+NWirEkdzD9pzMot2lgphZeOxfc=";
|
||||||
|
};
|
||||||
|
|
||||||
|
# The mdbook 0.5 patch from nixpkgs targets the release
|
||||||
|
patches = [ ];
|
||||||
|
|
||||||
|
# Report the commit in `hx --version`
|
||||||
|
env = prev.env // {
|
||||||
|
HELIX_NIX_BUILD_REV = final.src.rev;
|
||||||
|
};
|
||||||
|
|
||||||
|
# The version check expects the release version string
|
||||||
|
doInstallCheck = false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
(helix.override {
|
||||||
|
helix-unwrapped = unwrapped;
|
||||||
|
inherit lockedGrammars;
|
||||||
|
grammarsOverlay = lib.composeManyExtensions [
|
||||||
|
# Keep nixpkgs' fixes for its pinned grammars
|
||||||
|
helix.defaultGrammarsOverlay
|
||||||
|
|
||||||
|
(final: prev: {
|
||||||
|
# The tree-sitter.json fix is already included upstream
|
||||||
|
tree-sitter-tlaplus = prev.tree-sitter-tlaplus.overrideAttrs { patches = [ ]; };
|
||||||
|
})
|
||||||
|
|
||||||
|
# Grammars Helix uses that nixpkgs doesn't package yet
|
||||||
|
(
|
||||||
|
final: prev:
|
||||||
|
lib.mapAttrs' (
|
||||||
|
name: grammar:
|
||||||
|
lib.nameValuePair "tree-sitter-${name}" (
|
||||||
|
lib.makeOverridable tree-sitter.buildGrammar {
|
||||||
|
language = name;
|
||||||
|
version = lib.sources.shortRev grammar.nurl.args.rev;
|
||||||
|
src = pkgs.${grammar.nurl.fetcher} grammar.nurl.args;
|
||||||
|
location = grammar.subpath;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
) (lib.filterAttrs (name: _: !(prev ? "tree-sitter-${name}")) lockedGrammars)
|
||||||
|
)
|
||||||
|
];
|
||||||
|
}).overrideAttrs
|
||||||
|
{ passthru.unwrapped = unwrapped; }
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
"""
|
||||||
|
Lock the tree-sitter grammars of a Helix languages.toml into grammars.json, in the
|
||||||
|
format nixpkgs' helix package takes as `lockedGrammars`.
|
||||||
|
|
||||||
|
Based on nixpkgs' pkgs/by-name/he/helix/generate_grammars.py, but each fetch gets a
|
||||||
|
timeout and falls back to fetching over git. Some forges (e.g. Codeberg) can hang
|
||||||
|
while generating archives.
|
||||||
|
|
||||||
|
Usage: generate-grammars.py <languages.toml> <grammars.json>
|
||||||
|
"""
|
||||||
|
|
||||||
|
import asyncio
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import tomllib
|
||||||
|
|
||||||
|
TIMEOUT = 120
|
||||||
|
|
||||||
|
|
||||||
|
async def nurl(url, rev, *extra):
|
||||||
|
proc = await asyncio.create_subprocess_exec(
|
||||||
|
"nurl", *extra, url, rev, "--json",
|
||||||
|
stdout=asyncio.subprocess.PIPE,
|
||||||
|
stderr=asyncio.subprocess.PIPE,
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
stdout, stderr = await asyncio.wait_for(proc.communicate(), TIMEOUT)
|
||||||
|
except asyncio.TimeoutError:
|
||||||
|
proc.kill()
|
||||||
|
await proc.wait()
|
||||||
|
raise RuntimeError(f"timed out after {TIMEOUT}s")
|
||||||
|
if proc.returncode != 0:
|
||||||
|
raise RuntimeError(stderr.decode().strip())
|
||||||
|
return json.loads(stdout)
|
||||||
|
|
||||||
|
|
||||||
|
async def lock(grammar, semaphore):
|
||||||
|
source = grammar["source"]
|
||||||
|
async with semaphore:
|
||||||
|
try:
|
||||||
|
result = await nurl(source["git"], source["rev"])
|
||||||
|
except RuntimeError as e:
|
||||||
|
print(f" {grammar['name']}: {e}, retrying over git", file=sys.stderr)
|
||||||
|
result = await nurl(source["git"], source["rev"], "-f", "fetchgit")
|
||||||
|
print(f" locked {grammar['name']}", file=sys.stderr)
|
||||||
|
return grammar["name"].replace("_", "-"), {
|
||||||
|
"nurl": result,
|
||||||
|
"subpath": source.get("subpath"),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async def main(languages_toml, output):
|
||||||
|
with open(languages_toml, "rb") as f:
|
||||||
|
grammars = [
|
||||||
|
g
|
||||||
|
for g in tomllib.load(f).get("grammar", [])
|
||||||
|
if "git" in g.get("source", {}) and "rev" in g["source"]
|
||||||
|
]
|
||||||
|
print(f"Locking {len(grammars)} grammars", file=sys.stderr)
|
||||||
|
|
||||||
|
semaphore = asyncio.Semaphore(os.cpu_count() or 4)
|
||||||
|
results = await asyncio.gather(
|
||||||
|
*(lock(g, semaphore) for g in grammars), return_exceptions=True
|
||||||
|
)
|
||||||
|
|
||||||
|
failed = [(g["name"], r) for g, r in zip(grammars, results) if isinstance(r, Exception)]
|
||||||
|
if failed:
|
||||||
|
for name, error in failed:
|
||||||
|
print(f"failed: {name}: {error}", file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
with open(output, "w") as f:
|
||||||
|
json.dump(dict(sorted(results)), f, indent=2)
|
||||||
|
f.write("\n")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
asyncio.run(main(*sys.argv[1:3]))
|
||||||
File diff suppressed because it is too large.
Load diff
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Regenerate grammars.json for the Helix revision pinned in default.nix
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
flake="$(git -C "$dir" rev-parse --show-toplevel)"
|
||||||
|
|
||||||
|
src="$(nix build --no-link --print-out-paths "$flake#helix-git.unwrapped.src")"
|
||||||
|
|
||||||
|
nix shell --inputs-from "$flake" nixpkgs#nurl nixpkgs#nix-prefetch-git nixpkgs#python3 -c \
|
||||||
|
python3 -I "$dir/generate-grammars.py" "$src/languages.toml" "$dir/grammars.json"
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
buildNpmPackage,
|
||||||
|
fetchFromGitHub,
|
||||||
|
makeBinaryWrapper,
|
||||||
|
makeDesktopItem,
|
||||||
|
copyDesktopItems,
|
||||||
|
nodejs_20,
|
||||||
|
electron,
|
||||||
|
python3,
|
||||||
|
nix-update-script,
|
||||||
|
}:
|
||||||
|
|
||||||
|
buildNpmPackage rec {
|
||||||
|
pname = "open-stage-control";
|
||||||
|
version = "1.29.8";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "jean-emmanuel";
|
||||||
|
repo = "open-stage-control";
|
||||||
|
rev = "v${version}";
|
||||||
|
hash = "sha256-518KXvNffLOV2aIWlLJcnPzxEbWxYdjWeiDBC1jlecQ=";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Remove some Electron stuff from package.json
|
||||||
|
postPatch = ''
|
||||||
|
sed -i -e '/"electron"\|"electron-installer-debian"/d' package.json
|
||||||
|
'';
|
||||||
|
|
||||||
|
npmDepsHash = "sha256-U4zwYL5URNW0y0W4WvWAVL0hubiiU+2z9F5mDE9l8UU=";
|
||||||
|
|
||||||
|
nodejs = nodejs_20;
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
copyDesktopItems
|
||||||
|
makeBinaryWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
python3.pkgs.python-rtmidi
|
||||||
|
];
|
||||||
|
|
||||||
|
doInstallCheck = true;
|
||||||
|
|
||||||
|
makeCacheWritable = true;
|
||||||
|
npmFlags = [
|
||||||
|
"--legacy-peer-deps"
|
||||||
|
"--skip-pkg"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Override installPhase so we can copy the only directory that matters (app)
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
# copy built app and node_modules directories
|
||||||
|
mkdir -p $out/lib/node_modules/open-stage-control
|
||||||
|
cp -r app $out/lib/node_modules/open-stage-control/
|
||||||
|
|
||||||
|
# copy icon
|
||||||
|
install -Dm644 resources/images/logo.png $out/share/icons/hicolor/256x256/apps/open-stage-control.png
|
||||||
|
install -Dm644 resources/images/logo.svg $out/share/icons/hicolor/scalable/apps/open-stage-control.svg
|
||||||
|
|
||||||
|
# wrap electron and include python-rtmidi
|
||||||
|
makeWrapper '${electron}/bin/electron' $out/bin/open-stage-control \
|
||||||
|
--inherit-argv0 \
|
||||||
|
--add-flags $out/lib/node_modules/open-stage-control/app \
|
||||||
|
--prefix PYTHONPATH : "$PYTHONPATH" \
|
||||||
|
--prefix PATH : '${lib.makeBinPath [ python3 ]}'
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
installCheckPhase = ''
|
||||||
|
XDG_CONFIG_HOME="$(mktemp -d)" $out/bin/open-stage-control --help
|
||||||
|
'';
|
||||||
|
|
||||||
|
desktopItems = [
|
||||||
|
(makeDesktopItem {
|
||||||
|
name = "open-stage-control";
|
||||||
|
exec = "open-stage-control";
|
||||||
|
icon = "open-stage-control";
|
||||||
|
desktopName = "Open Stage Control";
|
||||||
|
comment = meta.description;
|
||||||
|
categories = [
|
||||||
|
"Network"
|
||||||
|
"Audio"
|
||||||
|
"AudioVideo"
|
||||||
|
"Midi"
|
||||||
|
];
|
||||||
|
startupWMClass = "open-stage-control";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
passthru.updateScript = nix-update-script { };
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Libre and modular OSC / MIDI controller";
|
||||||
|
homepage = "https://openstagecontrol.ammd.net/";
|
||||||
|
license = licenses.gpl3Only;
|
||||||
|
maintainers = [ ];
|
||||||
|
platforms = platforms.linux;
|
||||||
|
mainProgram = "open-stage-control";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
main = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/sda";
|
||||||
|
imageSize = "32G"; # For test VMs
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [ "umask=0077" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zfs = {
|
||||||
|
end = "-4G";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "tank";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
swap = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "swap";
|
||||||
|
discardPolicy = "both";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
longhorn = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/sdb";
|
||||||
|
imageSize = "64G"; # For longhorn storage
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
main = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "ext4";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zpool = {
|
||||||
|
tank = {
|
||||||
|
type = "zpool";
|
||||||
|
rootFsOptions = {
|
||||||
|
compression = "zstd";
|
||||||
|
};
|
||||||
|
mountpoint = null;
|
||||||
|
postCreateHook = "zfs snapshot -r tank@blank && zfs hold -r blank tank@blank";
|
||||||
|
|
||||||
|
datasets = {
|
||||||
|
root = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
nix = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/nix";
|
||||||
|
};
|
||||||
|
persist = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/persist";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
+10
-1
@@ -3,6 +3,8 @@
|
|||||||
disk = {
|
disk = {
|
||||||
main = {
|
main = {
|
||||||
type = "disk";
|
type = "disk";
|
||||||
|
device = "/dev/sda";
|
||||||
|
imageSize = "32G"; # For test VMs
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
@@ -17,12 +19,19 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
zfs = {
|
zfs = {
|
||||||
size = "100%";
|
end = "-4G";
|
||||||
content = {
|
content = {
|
||||||
type = "zfs";
|
type = "zfs";
|
||||||
pool = "tank";
|
pool = "tank";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
swap = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "swap";
|
||||||
|
discardPolicy = "both";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
main = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/sda"; # How do I handle this for laptops
|
||||||
|
imageSize = "64G"; # For test VMs
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [ "umask=0077" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zfs = {
|
||||||
|
end = "-16G";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "tank";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
swap = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "swap";
|
||||||
|
discardPolicy = "both";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zpool = {
|
||||||
|
tank = {
|
||||||
|
type = "zpool";
|
||||||
|
rootFsOptions = {
|
||||||
|
compression = "zstd";
|
||||||
|
};
|
||||||
|
mountpoint = null;
|
||||||
|
postCreateHook = "zfs snapshot -r tank@blank && zfs hold -r blank tank@blank";
|
||||||
|
|
||||||
|
datasets = {
|
||||||
|
root = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
nix = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/nix";
|
||||||
|
};
|
||||||
|
persist = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/persist";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
main = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/nvme0n1";
|
||||||
|
imageSize = "32G"; # For test VMs
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [ "umask=0077" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zfs = {
|
||||||
|
end = "-4G";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "tank";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
swap = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "swap";
|
||||||
|
discardPolicy = "both";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zpool = {
|
||||||
|
tank = {
|
||||||
|
type = "zpool";
|
||||||
|
rootFsOptions = {
|
||||||
|
compression = "zstd";
|
||||||
|
};
|
||||||
|
mountpoint = null;
|
||||||
|
postCreateHook = "zfs snapshot -r tank@blank && zfs hold -r blank tank@blank";
|
||||||
|
|
||||||
|
datasets = {
|
||||||
|
root = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
nix = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/nix";
|
||||||
|
};
|
||||||
|
persist = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/persist";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
disk = {
|
||||||
|
main = {
|
||||||
|
type = "disk";
|
||||||
|
device = "/dev/sda";
|
||||||
|
imageSize = "64G"; # For test VMs
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
size = "512M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
mountOptions = [ "umask=0077" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zfs = {
|
||||||
|
end = "-16G";
|
||||||
|
content = {
|
||||||
|
type = "zfs";
|
||||||
|
pool = "tank";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
swap = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "swap";
|
||||||
|
discardPolicy = "both";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
zpool = {
|
||||||
|
tank = {
|
||||||
|
type = "zpool";
|
||||||
|
rootFsOptions = {
|
||||||
|
compression = "zstd";
|
||||||
|
};
|
||||||
|
mountpoint = null;
|
||||||
|
postCreateHook = "zfs snapshot -r tank@blank && zfs hold -r blank tank@blank";
|
||||||
|
|
||||||
|
datasets = {
|
||||||
|
root = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
nix = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/nix";
|
||||||
|
};
|
||||||
|
persist = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mountpoint = "/persist";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -16,6 +16,7 @@ in
|
|||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
modules = {
|
modules = {
|
||||||
|
impermanence.enable = true;
|
||||||
# btop.enable = true;
|
# btop.enable = true;
|
||||||
direnv.enable = true;
|
direnv.enable = true;
|
||||||
fish.enable = true;
|
fish.enable = true;
|
||||||
|
|||||||
+55
-1
@@ -16,9 +16,63 @@ in
|
|||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
firefox # TODO: Move to dediated module
|
# firefox # TODO: Move to dediated module
|
||||||
];
|
];
|
||||||
|
|
||||||
|
dconf.settings = {
|
||||||
|
"org/gnome/calendar" = {
|
||||||
|
active-view = "week";
|
||||||
|
};
|
||||||
|
"org/gnome/desktop/background" = {
|
||||||
|
picture-uri = "file://${config.home.homeDirectory}/.local/share/backgrounds/background";
|
||||||
|
};
|
||||||
|
"org/gnome/desktop/input-sources" = {
|
||||||
|
sources = [
|
||||||
|
(lib.gvariant.mkTuple [
|
||||||
|
"xkb"
|
||||||
|
"us"
|
||||||
|
])
|
||||||
|
];
|
||||||
|
xkb-options = [ "caps:escape_shifted_capslock" ];
|
||||||
|
};
|
||||||
|
"org/gnome/desktop/interface" = {
|
||||||
|
accent-color = "purple";
|
||||||
|
enable-hot-corners = false;
|
||||||
|
};
|
||||||
|
"org/gnome/desktop/peripherals/touchpad" = {
|
||||||
|
speed = 0.214;
|
||||||
|
two-finger-scrolling-enabled = true;
|
||||||
|
};
|
||||||
|
"org/gnome/mutter" = {
|
||||||
|
workspaces-only-on-primary = true;
|
||||||
|
};
|
||||||
|
"org/gnome/nautilus/icon-view" = {
|
||||||
|
default-zoom-level = "small";
|
||||||
|
};
|
||||||
|
"org/gnome/nautilus/preferences" = {
|
||||||
|
default-folder-viewer = "icon-view";
|
||||||
|
};
|
||||||
|
"org/gnome/settings-daemon/plugins/color" = {
|
||||||
|
night-light-enabled = true;
|
||||||
|
night-light-schedule-automatic = false;
|
||||||
|
night-light-schedule-from = 20.0;
|
||||||
|
night-light-schedule-to = 6.0;
|
||||||
|
night-light-temperature = 2700;
|
||||||
|
};
|
||||||
|
"org/gnome/shell" = {
|
||||||
|
disable-extension-version-validation = true;
|
||||||
|
enabled-extensions = [
|
||||||
|
"disable-workspace-animation@ethnarque"
|
||||||
|
"gsconnect@andyholmes.github.io"
|
||||||
|
"rounded-window-corners@fxgn"
|
||||||
|
"media-progress@krypion17"
|
||||||
|
"mprisLabel@moon-0xff.github.com"
|
||||||
|
"caffeube@patapon.info"
|
||||||
|
];
|
||||||
|
last-selected-power-profile = "power-saver";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
modules = {
|
modules = {
|
||||||
profiles.base.enable = true;
|
profiles.base.enable = true;
|
||||||
|
|
||||||
|
|||||||
+230
-13
@@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
pkgs,
|
pkgs,
|
||||||
|
pkgs-stable,
|
||||||
lib,
|
lib,
|
||||||
config,
|
config,
|
||||||
|
inputs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@@ -16,34 +18,243 @@ in
|
|||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
libreoffice-still
|
firefox
|
||||||
|
# inputs.stable-nixpkgs.legacyPackages.${config.nixpkgs.hostPlatform}.libreoffice
|
||||||
|
libreoffice
|
||||||
remmina
|
remmina
|
||||||
thunderbird
|
thunderbird
|
||||||
signal-desktop
|
signal-desktop
|
||||||
prusa-slicer
|
prusa-slicer
|
||||||
freecad-wayland
|
pkgs-stable.freecad-wayland
|
||||||
inkscape
|
inkscape
|
||||||
ente-auth
|
# ente-auth
|
||||||
bitwarden
|
audacity
|
||||||
carla
|
carla
|
||||||
winbox
|
# pkgs-stable.winbox
|
||||||
whatsapp-for-linux
|
winbox4
|
||||||
|
# whatsapp-for-linux
|
||||||
|
karere
|
||||||
discord
|
discord
|
||||||
steam
|
steam
|
||||||
spotify
|
spotify
|
||||||
# feishin # TODO: Fix or replace as insecure
|
# feishin
|
||||||
eduvpn-client
|
eduvpn-client
|
||||||
river # TODO: Move
|
|
||||||
ryubing
|
ryubing
|
||||||
bottles
|
# bottles
|
||||||
prismlauncher
|
prismlauncher
|
||||||
foliate
|
foliate
|
||||||
wireshark
|
wireshark
|
||||||
|
obsidian
|
||||||
|
# devenv
|
||||||
|
# kicad
|
||||||
|
vlc
|
||||||
|
authenticator
|
||||||
|
hotspot
|
||||||
|
btop
|
||||||
|
winboat
|
||||||
|
hieroglyphic
|
||||||
|
shortwave
|
||||||
|
clairvoyant
|
||||||
|
constrict
|
||||||
|
curtail
|
||||||
|
gnome-decoder
|
||||||
|
dialect
|
||||||
|
impression
|
||||||
|
keypunch
|
||||||
|
gnome-mahjongg
|
||||||
|
textpieces
|
||||||
|
video-trimmer
|
||||||
|
wike
|
||||||
|
davinci-resolve
|
||||||
|
kdePackages.kdenlive
|
||||||
|
kicad
|
||||||
|
|
||||||
|
podman
|
||||||
|
podman-compose
|
||||||
|
|
||||||
|
gnome-network-displays
|
||||||
|
gnome-logs
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.zathura = {
|
||||||
|
enable = true;
|
||||||
|
options = {
|
||||||
|
synctex = true;
|
||||||
|
synctex-editor-command = "${pkgs.texlab}/bin/texlab inverse-search -i %{input} -l %{line}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.helix = {
|
||||||
|
enable = true;
|
||||||
|
defaultEditor = true;
|
||||||
|
# settings = {
|
||||||
|
# theme = {
|
||||||
|
# light = "adwaita-light";
|
||||||
|
# dark = "adwaita-dark";
|
||||||
|
# fallback = "default";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
settings =
|
||||||
|
let
|
||||||
|
move_line_up = [
|
||||||
|
"extend_to_line_bounds"
|
||||||
|
"delete_selection"
|
||||||
|
"move_line_up"
|
||||||
|
"paste_before"
|
||||||
|
];
|
||||||
|
move_line_down = [
|
||||||
|
"extend_to_line_bounds"
|
||||||
|
"delete_selection"
|
||||||
|
"paste_after"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
keys.normal = {
|
||||||
|
"A-up" = move_line_up;
|
||||||
|
"A-down" = move_line_down;
|
||||||
|
"A-k" = move_line_up;
|
||||||
|
"A-j" = move_line_down;
|
||||||
|
};
|
||||||
|
keys.select = {
|
||||||
|
"A-up" = move_line_up;
|
||||||
|
"A-down" = move_line_down;
|
||||||
|
"A-k" = move_line_up;
|
||||||
|
"A-j" = move_line_down;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
bash-language-server # Bash
|
||||||
|
fish-lsp # Fish
|
||||||
|
systemd-lsp # Systemd
|
||||||
|
yaml-language-server # Yaml
|
||||||
|
taplo # Toml
|
||||||
|
nixd # Nix
|
||||||
|
protols # Protobuf
|
||||||
|
dockerfile-language-server # Dockerfile
|
||||||
|
docker-compose-language-service # Docker compose
|
||||||
|
|
||||||
|
clang-tools # C, C++
|
||||||
|
neocmakelsp # Cmake
|
||||||
|
rust-analyzer # Rust
|
||||||
|
lldb # C, C++, Rust
|
||||||
|
zls # Zig
|
||||||
|
|
||||||
|
texlab # Latex
|
||||||
|
tinymist # Typst
|
||||||
|
marksman # Markdown
|
||||||
|
markdown-oxide # Markdown
|
||||||
|
vscode-langservers-extracted # HTML, CSS, JSON, ESLint
|
||||||
|
typescript-language-server # Typescript, Javascript
|
||||||
|
intelephense # PHP
|
||||||
|
vue-language-server # Vue
|
||||||
|
|
||||||
|
ruff # Python
|
||||||
|
basedpyright # Python
|
||||||
|
|
||||||
|
#helix-gpt # Copilot
|
||||||
|
ltex-ls-plus # Spellchecking
|
||||||
|
|
||||||
|
# texlab # Latex, Bibtex
|
||||||
|
# bibtex-tidy # Bibtex
|
||||||
|
# docker-langserver # Dockerfile
|
||||||
|
# docker-compose-langserver # Docker compose
|
||||||
|
# elixir-ls # Elixir
|
||||||
|
# gopls # Go
|
||||||
|
# golangci-lint-langserver # Go
|
||||||
|
# dlv # Go
|
||||||
|
# haskell-language-server # Haskell
|
||||||
|
# julia # Julia
|
||||||
|
# kotlin-language-server # Kotlin
|
||||||
|
# lua-language-server # Lua
|
||||||
|
# slint-lsp # Slint
|
||||||
|
# tinymist # Typst
|
||||||
|
];
|
||||||
|
languages = {
|
||||||
|
language-server = {
|
||||||
|
ltex = {
|
||||||
|
command = "ltex-ls-plus";
|
||||||
|
config.ltex = { };
|
||||||
|
};
|
||||||
|
texlab = {
|
||||||
|
command = "texlab";
|
||||||
|
config.texlab = {
|
||||||
|
build.onSave = true;
|
||||||
|
forwardSearch.executable = "${config.programs.zathura.package}/bin/zathura";
|
||||||
|
forwardSearch.args = [
|
||||||
|
"--synctex-forward"
|
||||||
|
"%l:1:%f"
|
||||||
|
"%p"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
basedpyright = {
|
||||||
|
command = "basedpyright-langserver";
|
||||||
|
args = [ "--stdio" ];
|
||||||
|
};
|
||||||
|
tinymist = {
|
||||||
|
command = "tinymist";
|
||||||
|
config.preview.background = {
|
||||||
|
enabled = true;
|
||||||
|
args = [
|
||||||
|
"--data-plane-host=127.0.0.1:23635"
|
||||||
|
"--invert-colors=never"
|
||||||
|
"--open"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
language = [
|
||||||
|
{
|
||||||
|
name = "latex";
|
||||||
|
# language-servers = [
|
||||||
|
# { name = "texlab"; }
|
||||||
|
# { name = "ltex"; }
|
||||||
|
# ];
|
||||||
|
soft-wrap = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
{
|
||||||
|
name = "python";
|
||||||
|
language-servers = [
|
||||||
|
{
|
||||||
|
name = "basedpyright";
|
||||||
|
except-features = [ "diagnostics" ];
|
||||||
|
}
|
||||||
|
"ruff"
|
||||||
|
];
|
||||||
|
auto-format = true;
|
||||||
|
formatter = {
|
||||||
|
command = "ruff";
|
||||||
|
args = [
|
||||||
|
"format"
|
||||||
|
"-"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.user.tmpfiles.rules = [
|
||||||
|
"d ${config.home.homeDirectory}/Downloads - - - - -"
|
||||||
];
|
];
|
||||||
|
|
||||||
modules = {
|
modules = {
|
||||||
profiles.gnome.enable = true;
|
profiles.gnome.enable = true;
|
||||||
|
|
||||||
|
impermanence = {
|
||||||
|
directories = [
|
||||||
|
"Code"
|
||||||
|
"Documents"
|
||||||
|
"Games"
|
||||||
|
"Models"
|
||||||
|
"Music"
|
||||||
|
"Pictures"
|
||||||
|
"Videos"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Gaming
|
# Gaming
|
||||||
# retroarch.enable = true;
|
# retroarch.enable = true;
|
||||||
# ryujinx.enable = true;
|
# ryujinx.enable = true;
|
||||||
@@ -53,6 +264,10 @@ in
|
|||||||
enable = true;
|
enable = true;
|
||||||
user = "Jan-Bulthuis";
|
user = "Jan-Bulthuis";
|
||||||
email = "git@bulthuis.dev";
|
email = "git@bulthuis.dev";
|
||||||
|
signingKey = "${config.home.homeDirectory}/.ssh/id_ed25519.pub";
|
||||||
|
allowedSigners = [
|
||||||
|
"git@bulthuis.dev ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKxoQSxfYqf9ITN8Fhckk8WbY4dwtBAXOhC9jxihJvq"
|
||||||
|
];
|
||||||
# TODO: Move
|
# TODO: Move
|
||||||
ignores = [
|
ignores = [
|
||||||
".envrc"
|
".envrc"
|
||||||
@@ -61,17 +276,18 @@ in
|
|||||||
"flake.lock"
|
"flake.lock"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
bitwarden.enable = true;
|
||||||
xpra = {
|
xpra = {
|
||||||
enable = true;
|
enable = true;
|
||||||
hosts = [
|
hosts = [
|
||||||
"mixer@10.20.60.251"
|
"mixer@10.20.40.100"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
# docker.enable = true;
|
# docker.enable = true;
|
||||||
# matlab.enable = true;
|
# matlab.enable = true;
|
||||||
mathematica.enable = true;
|
# mathematica.enable = true;
|
||||||
|
|
||||||
# Languages
|
# Languages
|
||||||
haskell.enable = false;
|
haskell.enable = false;
|
||||||
@@ -80,8 +296,9 @@ in
|
|||||||
rust.enable = true;
|
rust.enable = true;
|
||||||
python.enable = true;
|
python.enable = true;
|
||||||
cpp.enable = true;
|
cpp.enable = true;
|
||||||
tex.enable = true;
|
tex.enable = false;
|
||||||
jupyter.enable = false;
|
jupyter.enable = true;
|
||||||
|
go.enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
+23
-11
@@ -1,5 +1,4 @@
|
|||||||
{
|
{
|
||||||
mkModule,
|
|
||||||
pkgs,
|
pkgs,
|
||||||
lib,
|
lib,
|
||||||
config,
|
config,
|
||||||
@@ -20,13 +19,27 @@ in
|
|||||||
bootloader.enable = mkDefault true;
|
bootloader.enable = mkDefault true;
|
||||||
ssh.enable = mkDefault true;
|
ssh.enable = mkDefault true;
|
||||||
|
|
||||||
# Setup sensible default persistent data
|
impermanence = {
|
||||||
impermanence.directories = [
|
files = [
|
||||||
"/var/lib/nixos"
|
"/etc/machine-id"
|
||||||
];
|
"/etc/zfs/zpool.cache" # TODO: Move to zfs module?
|
||||||
impermanence.files = [
|
];
|
||||||
"/etc/shadow"
|
directories = [
|
||||||
];
|
"/var/log/journal"
|
||||||
|
"/var/lib/nixos"
|
||||||
|
"/var/lib/systemd"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: Remove the secrets module and use sops directly?
|
||||||
|
secrets = {
|
||||||
|
enable = true;
|
||||||
|
secrets = {
|
||||||
|
"ssh-keys/deploy-priv" = {
|
||||||
|
path = "/root/.ssh/id_ed25519";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Localization
|
# Localization
|
||||||
@@ -40,9 +53,6 @@ in
|
|||||||
defaultEditor = true;
|
defaultEditor = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Allow unfree packages
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
|
|
||||||
# Enable the usage of flakes
|
# Enable the usage of flakes
|
||||||
nix.settings.experimental-features = [
|
nix.settings.experimental-features = [
|
||||||
"nix-command"
|
"nix-command"
|
||||||
@@ -65,6 +75,8 @@ in
|
|||||||
zip
|
zip
|
||||||
unzip
|
unzip
|
||||||
tmux
|
tmux
|
||||||
|
unixtools.net-tools
|
||||||
|
tcpdump
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.profiles.server;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.modules.profiles.server = {
|
||||||
|
enable = mkEnableOption "Base server profile";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
# Enabled modules
|
||||||
|
modules = {
|
||||||
|
profiles.base.enable = true;
|
||||||
|
disko.enable = true;
|
||||||
|
impermanence = {
|
||||||
|
enable = true;
|
||||||
|
resetScript = ''
|
||||||
|
# Revert to the blank state for the root directory
|
||||||
|
zfs rollback -r tank/root@blank
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
domain = {
|
||||||
|
enable = mkDefault true;
|
||||||
|
join = {
|
||||||
|
userFile = config.sops.secrets."vm-join/user".path;
|
||||||
|
passwordFile = config.sops.secrets."vm-join/password".path;
|
||||||
|
domainOUFile = config.sops.secrets."vm-join/ou".path;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
ssh.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Initialize domain join secrets
|
||||||
|
sops.secrets."vm-join/user" = { };
|
||||||
|
sops.secrets."vm-join/password" = { };
|
||||||
|
sops.secrets."vm-join/ou" = { };
|
||||||
|
|
||||||
|
# Local user
|
||||||
|
sops.secrets."passwords/local-hashed".neededForUsers = true;
|
||||||
|
users.mutableUsers = false;
|
||||||
|
users.users.local = {
|
||||||
|
isNormalUser = true;
|
||||||
|
group = "local";
|
||||||
|
hashedPasswordFile = config.sops.secrets."passwords/local-hashed".path;
|
||||||
|
extraGroups = [ "wheel" ];
|
||||||
|
openssh.authorizedKeys.keys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKKxoQSxfYqf9ITN8Fhckk8WbY4dwtBAXOhC9jxihJvq Admin"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
users.groups.local = { };
|
||||||
|
home-manager.users.local =
|
||||||
|
{ ... }:
|
||||||
|
{
|
||||||
|
home.stateVersion = "24.11";
|
||||||
|
modules.profiles.base.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# System packages
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
# TODO: Make module for utilities/scripts
|
||||||
|
(writeShellScriptBin "system-update" "nixos-rebuild switch --flake git+https://git.bulthuis.dev/Jan/nixos-config")
|
||||||
|
];
|
||||||
|
|
||||||
|
# Machine platform
|
||||||
|
nixpkgs.hostPlatform = mkDefault "x86_64-linux";
|
||||||
|
|
||||||
|
# Set hostid (required for ZFS)
|
||||||
|
networking.hostId = "deadbeef";
|
||||||
|
|
||||||
|
# Hardware configuration
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
+15
-41
@@ -1,6 +1,4 @@
|
|||||||
{
|
{
|
||||||
mkModule,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
lib,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
@@ -18,60 +16,36 @@ in
|
|||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
# Enabled modules
|
# Enabled modules
|
||||||
modules = {
|
modules = {
|
||||||
profiles.base.enable = true;
|
profiles.server.enable = true;
|
||||||
disko = {
|
disko.profile = mkDefault "vm";
|
||||||
enable = true;
|
|
||||||
profile = "vm";
|
|
||||||
};
|
|
||||||
impermanence = {
|
|
||||||
enable = true;
|
|
||||||
resetScript = ''
|
|
||||||
# Revert to the blank state for the root directory
|
|
||||||
zfs rollback -r tank/root@blank
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
ssh.enable = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Admin users
|
# Autologin to root for access from hypervisor
|
||||||
users.users.local = {
|
services.getty.autologinUser = "root";
|
||||||
initialPassword = "local";
|
|
||||||
extraGroups = [ "wheel" ];
|
|
||||||
openssh.authorizedKeys.keys = [
|
|
||||||
"ssh-ed25519 jan@bulthuis.dev"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Enable qemu guest agent
|
# Enable qemu guest agent
|
||||||
services.qemuGuest.enable = true;
|
services.qemuGuest.enable = true;
|
||||||
|
|
||||||
# Machine platform
|
|
||||||
nixpkgs.hostPlatform = "x86_64-linux";
|
|
||||||
|
|
||||||
# Set hostid for ZFS
|
|
||||||
networking.hostId = "deadbeef";
|
|
||||||
|
|
||||||
# Hardware configuration
|
# Hardware configuration
|
||||||
hardware.enableRedistributableFirmware = true;
|
|
||||||
boot.initrd.availableKernelModules = [
|
boot.initrd.availableKernelModules = [
|
||||||
"ata_piix"
|
"ata_piix"
|
||||||
"uhci_hcd"
|
"uhci_hcd"
|
||||||
|
"virtio_net"
|
||||||
"virtio_pci"
|
"virtio_pci"
|
||||||
|
"virtio_mmio"
|
||||||
|
"virtio_blk"
|
||||||
"virtio_scsi"
|
"virtio_scsi"
|
||||||
|
"9p"
|
||||||
|
"9pnet_virtio"
|
||||||
"sd_mod"
|
"sd_mod"
|
||||||
"sr_mod"
|
"sr_mod"
|
||||||
];
|
];
|
||||||
boot.initrd.kernelModules = [ ];
|
boot.kernelModules = [
|
||||||
boot.kernelModules = [ "kvm-intel" ];
|
"kvm-intel"
|
||||||
boot.extraModulePackages = [ ];
|
"virtio_balloon"
|
||||||
hardware.cpu.intel.updateMicrocode = true;
|
"virtio_console"
|
||||||
|
"virtio_rng"
|
||||||
# Swapfile
|
"virtio_gpu"
|
||||||
swapDevices = [
|
|
||||||
{
|
|
||||||
device = "/var/lib/swapfile";
|
|
||||||
size = 6 * 1024;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user