Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sandydoo/nixos
NixOS configuration
https://github.com/sandydoo/nixos
Last synced: 16 days ago
JSON representation
NixOS configuration
- Host: GitHub
- URL: https://github.com/sandydoo/nixos
- Owner: sandydoo
- Created: 2020-11-04T17:15:33.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T13:49:49.000Z (about 1 month ago)
- Last Synced: 2024-10-07T17:23:34.296Z (about 1 month ago)
- Language: Nix
- Size: 487 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NixOS Configs
## NixOS machines
```shell
nixos-rebuild switch --use-remote-sudo
```## Nix Darwin machines
There's a 2-step process to building a Nix Darwin machine from a flake:
```shell
nix build ./#darwinConfigurations.asdfPro.system
``````shell
./result/sw/bin/darwin-rebuild switch --flake ./
```## Setting up VMs on a macOS host
#### How do I change the default NAT subnet for VMs?
```shell
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.vmnet.plist Shared_Net_Address -string 192.168.64.1
```Restart the DHCP server:
```shell
sudo /bin/launchctl kickstart -kp system/com.apple.bootpd
```#### How do I give a VM a static IP address?
Note the MAC address of the VM's network interface. Then, add an entry to `/etc/bootptab`:
```
%%
# hostname hwtype hwaddr ipaddr bootfile
nixos 1 0A:1E:0E:51:29:4C 192.168.64.2
```Restart the DHCP server:
```shell
sudo /bin/launchctl kickstart -kp system/com.apple.bootpd
```#### I'm running out of IP addresses. How do I increase the number of VMs I can run?
Reduce the lease time for DHCP leases. The default is 86400 seconds (24 hours). The following command will reduce it to 600 seconds (10 minutes):
```
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.InternetSharing.default.plist bootpd -dict DHCPLeaseTimeSecs -int 600
```## Maintenance
### Delete older generations
Eventually, the boot drive will fill up with older generations. This is particularly a problem when using a custom kernel version.
To delete the older generations, run the following:```shell
sudo nix-env --profile /nix/var/nix/profiles/system --delete-generations +5
sudo /run/current-system/bin/switch-to-configuration switch
```### Delete Home Manager generations
These are not currently automatically removed.
See https://github.com/nix-community/home-manager/issues/3450.```shell
home-manager expire-generations "-180 days"
```### Run GC
```shell
sudo nix-collect-garbage --delete-older-than 180d
```