File tree 13 files changed +215
-22
lines changed
13 files changed +215
-22
lines changed Original file line number Diff line number Diff line change 49
49
./machines/pc/configuration.nix
50
50
] ;
51
51
} ;
52
+ hifiberry = inputs . nixpkgs . lib . nixosSystem {
53
+ inherit specialArgs ;
54
+ system = "aarch64-linux" ;
55
+ modules =
56
+ defaultModules
57
+ ++ [
58
+ inputs . nixos-hardware . nixosModules . raspberry-pi-4
59
+ ./machines/hifiberry/configuration.nix
60
+ ] ;
61
+ } ;
52
62
} ;
53
63
54
64
devShells . x86_64-linux . default = let
Original file line number Diff line number Diff line change
1
+ # hifiberry
2
+
3
+ ## New Installation
4
+
5
+ ### SD Image
6
+
7
+ Download and decompress latest aarch64 SD image from [ hydra] ( https://hydra.nixos.org/job/nixos/trunk-combined/nixos.sd_image.aarch64-linux/latest ) :
8
+
9
+ ``` bash
10
+ wget https://hydra.nixos.org/build/283233356/download/1/< name> .img.zst
11
+ unzstd -d < name> .img.zst
12
+ sudo dd if=< name> .img of=/dev/sdX bs=4096 conv=fsync status=progress
13
+ ```
14
+
15
+ ### SSH Host Keys
16
+
17
+ Set a password for nixos in tty.
18
+
19
+ Get public SSH host key, add to agenix and rekey.
20
+
21
+ ``` bash
22
+ ssh nixos@< ip-address> -- cat /etc/ssh/ssh_host_ed25519_key.pub
23
+
24
+ cd secrets
25
+ vim secrets.nix # Add host key
26
+
27
+ agenix -r
28
+ ```
29
+
30
+ ### Deploy configuration
31
+
32
+ ``` bash
33
+ nixos-rebuild switch \
34
+ --flake github:jakobkukla/nixos-config#hifiberry \
35
+ --target-host root@< ip-address>
36
+ ```
37
+
38
+ ### Update Firmware
39
+
40
+ ``` bash
41
+ ssh pi@< ip-address>
42
+
43
+ nix-shell -p raspberrypi-eeprom
44
+ mount /dev/disk/by-label/FIRMWARE /mnt
45
+ BOOTFS=/mnt FIRMWARE_RELEASE_STATUS=stable rpi-eeprom-update -d -a
46
+ ```
47
+
48
+ ## Deploy configuration update remotely
49
+
50
+ The local machine needs a working cross-compilation environment (if applicable).
51
+
52
+ ``` bash
53
+ nixos-rebuild switch \
54
+ --flake github:jakobkukla/nixos-config#hifiberry \
55
+ --target-host root@< ip-address>
56
+ ```
Original file line number Diff line number Diff line change
1
+ { ...} : {
2
+ imports = [
3
+ ./hardware-configuration.nix
4
+ ../base.nix
5
+ ] ;
6
+
7
+ profiles = {
8
+ core . enable = true ;
9
+ chat . enable = false ;
10
+ desktop . enable = false ;
11
+ laptop . enable = false ;
12
+ media . enable = false ;
13
+ gaming . enable = false ;
14
+ work . enable = false ;
15
+ hifiberry . enable = true ;
16
+ } ;
17
+
18
+ modules = {
19
+ user = {
20
+ enable = true ;
21
+ name = "pi" ;
22
+ enableXdgUser = false ;
23
+ } ;
24
+ } ;
25
+
26
+ # Enable HiFiBerry Dac+ overlay
27
+ hardware . hifiberry . dacplus . enable = true ;
28
+
29
+ # Use the extlinux boot loader. (NixOS wants to enable GRUB by default)
30
+ boot . loader . grub . enable = false ;
31
+ # Enables the generation of /boot/extlinux/extlinux.conf
32
+ boot . loader . generic-extlinux-compatible . enable = true ;
33
+
34
+ networking . hostName = "nixos-hifiberry" ;
35
+
36
+ networking . networkmanager . enable = true ;
37
+ networking . networkmanager . wifi . backend = "iwd" ;
38
+
39
+ # FIXME: open librespot and shairport-sync ports in firewall instead
40
+ networking . firewall . enable = false ;
41
+ }
Original file line number Diff line number Diff line change
1
+ # Do not modify this file! It was generated by ‘nixos-generate-config’
2
+ # and may be overwritten by future invocations. Please make changes
3
+ # to /etc/nixos/configuration.nix instead.
4
+ {
5
+ lib ,
6
+ modulesPath ,
7
+ ...
8
+ } : {
9
+ imports = [
10
+ ( modulesPath + "/installer/scan/not-detected.nix" )
11
+ ] ;
12
+
13
+ boot . initrd . availableKernelModules = [ "xhci_pci" ] ;
14
+ boot . initrd . kernelModules = [ ] ;
15
+ boot . kernelModules = [ ] ;
16
+ boot . extraModulePackages = [ ] ;
17
+
18
+ fileSystems . "/" = {
19
+ device = "/dev/disk/by-label/NIXOS_SD" ;
20
+ fsType = "ext4" ;
21
+ options = [ "noatime" ] ;
22
+ } ;
23
+
24
+ swapDevices = [ ] ;
25
+
26
+ # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
27
+ # (the default) this is the recommended approach. When using systemd-networkd it's
28
+ # still possible to use this option, but it's recommended to use it in conjunction
29
+ # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
30
+ networking . useDHCP = lib . mkDefault true ;
31
+ # networking.interfaces.end0.useDHCP = lib.mkDefault true;
32
+ # networking.interfaces.wlan0.useDHCP = lib.mkDefault true;
33
+
34
+ nixpkgs . hostPlatform = lib . mkDefault "aarch64-linux" ;
35
+ }
Original file line number Diff line number Diff line change 7
7
./media.nix
8
8
./gaming.nix
9
9
./work.nix
10
+ ./hifiberry.nix
10
11
] ;
11
12
}
Original file line number Diff line number Diff line change
1
+ {
2
+ lib ,
3
+ config ,
4
+ ...
5
+ } : let
6
+ cfg = config . profiles . hifiberry ;
7
+
8
+ deviceName = "HiFiBerry" ;
9
+ alsaDeviceName = "default:CARD=sndrpihifiberry" ;
10
+ in {
11
+ options . profiles . hifiberry = with lib ; {
12
+ enable = mkEnableOption "HiFiBerry profile" ;
13
+ } ;
14
+
15
+ config = lib . mkIf cfg . enable {
16
+ modules . librespot = {
17
+ enable = true ;
18
+
19
+ settings = {
20
+ name = deviceName ;
21
+ device = alsaDeviceName ;
22
+ bitrate = 320 ;
23
+ enableVolumeNormalisation = true ;
24
+ } ;
25
+ } ;
26
+
27
+ services . shairport-sync = {
28
+ enable = true ;
29
+ arguments = "-a ${ deviceName } --output=alsa -- -d ${ alsaDeviceName } " ;
30
+ } ;
31
+ } ;
32
+ }
Original file line number Diff line number Diff line change
1
+ age-encryption.org/v1
2
+ -> ssh-ed25519 AJb1UQ 42sDcq2BQXsh+N0yhWe5TIJ7Y/9wB+kV91udBdp+diU
3
+ 8sfEDqq/YljfYzSBuau9p5IDg3oX2LkY3EDt0ZBj6VA
4
+ -> ssh-ed25519 gTqh/A A5mt2ozt7Ieep9B4xgFTGcM+xnAKxW+5S7bUtOELfVc
5
+ g3BiwvqCC3XLahI9QzTqIn+DpM79jFFkCAJ0DsqKRG0
6
+ -> ssh-ed25519 8jWW0w LNw54w3wz4TqhSp4UG3mHOor1gG338SLSs3QWmhPZko
7
+ SsIOvHBGMZS7s77JYHRydvMXk/xpfbsYC64BWqur2oA
8
+ -> ssh-ed25519 yQ0bLA uOkcD58pOPt8hmVMEwIJvsP3C0UcU3Qcdhyq9wTF6Ds
9
+ 16x0sEBvVPOHZQnVN6eFdx5ARu4WPXR4/KCaVgQguI0
10
+ -> ssh-ed25519 LG3qfQ Li0DkYicuiADoMo8Gs1/a4958rWXRH6/Q00+pI5DQlE
11
+ Ky+A2UZS654puZEfGidXZZdz/1qz48NROxIzmMXbJBk
12
+ --- wAVn1awNfQas0igYqzDEPnWn9q8/b24Vw47R4myKFBI
13
+ �� ����;gg�������O�GyR�I�ꟾN��n�M,���#�
Original file line number Diff line number Diff line change 1
1
age-encryption.org/v1
2
- -> ssh-ed25519 AJb1UQ GOc3Q378nIWxAe4MchoYE2px6HBujOok/ROGNyvPzD8
3
- FuSuD1IWI0Mbd60HcNqvB9X/AapgLqOpPqMi6QbDHMc
4
- -> ssh-ed25519 gTqh/A g/IzMofnrpmVrRIuw1x2MNvqybWEuWLPpq0uuoIF43w
5
- MrICqJKw03xnS7gqaQsAQH4euTIWW1u33uozJPAJVnQ
6
- -> ssh-ed25519 8jWW0w tW2U17vy7WJuijDEjKsos7sM+CiP6HcubMgHS/o6PFI
7
- dTx4yleVGPCFbhb86E02tv5a6NDTUPjMIK3+Bq0rJ0Q
8
- -> ssh-ed25519 yQ0bLA uS86afmbEfJ/6rfFFk4PP09RO06ACbmn5859F4XAW1s
9
- J1mtccBh3RSCsBE0xuVxfUSinrHJ4p/g/IFJEilMwyw
10
- --- 7fYc/Py81nhqwpgQ9FVMYu8rhBPmdFJ+1UtB6zILDmo
11
- ��À�Rp�lGƻ�aj�V�i-E�� �a܁4�Q�O3����d�A�gT��l?�R�UZ�
12
- M����Tpf5lO85h��H{d��$Tdlq�.��@=��6T��
2
+ -> ssh-ed25519 AJb1UQ gMn/lsx8eFiogkF7wPe0AS+w0v36mmXLb1FrUmiCGQI
3
+ bAh9aY4zQyO95+tMpITzvq0FePuwJjcOGDfg97WyPpk
4
+ -> ssh-ed25519 gTqh/A YDewYZYqyQUCNMJDlyHtXFnsxkorR3I3cqZFM4M5LGg
5
+ /BHD2cSaf/RFV/MUrqGtfX1NicPpaGQaCAfHQE8J7f4
6
+ -> ssh-ed25519 8jWW0w UVRU0akGCT/rQDHRDIKpHVide2EZIY3ANeogCcf2rXs
7
+ v86ox3JpN14irkyb6L7YjWrWxUjBYM+WKvQPXS2f1zQ
8
+ -> ssh-ed25519 yQ0bLA YmuwrxhdGV2XUgHb6q4ak4sBfP2tZTh08CA2bHJulig
9
+ QQaM3cyxziIMJ5H0hn7jhoogjNCkq4Hb9kL32HQRGP0
10
+ -> ssh-ed25519 LG3qfQ kVHO/zJj9GxNOK0xf8eF2e15Ck8NbUT39tKOVuiUJRI
11
+ TihMI3HpOByNGQn/sp2v/sv7J5PVM2/jJplwLHV5/Ek
12
+ --- pY1lJ22Ci3GS/G3cuZVVtLM5XxqbqsbDfD0ypgIpn+o
13
+ ݙ�����h��\ U"I�}K�v'�c�ө�N�۸�ִ��u�9jh�6��#z1p����^J�zM���y7���!v��ʋ~�K�/"�[��ˈ�Vf���3
Original file line number Diff line number Diff line change 5
5
matebook = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ2PyNHnOUfdYWB0oFjuRZQ98/2biKQVy1jt4+vEAmiT root@nixos-matebook" ;
6
6
pc = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFUTEU+53xE6W+LQKsb0/L0Sn4A7c5lQynNF6yCn2I9I root@nixos-pc" ;
7
7
server = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPn5mXfQ1OWg70WbZKMttRGXDWRH7sPXGl67k88xSCIp root@nixos-server" ;
8
- systems = [ matebook pc server ] ;
8
+ hifiberry = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPS0BKlAHc/ev1+oNpPsfp046IPWwijHXf9J9NoLNQ6I root@nixos" ;
9
+ systems = [ matebook pc server hifiberry ] ;
9
10
in {
10
11
"root.age" . publicKeys = users ++ systems ;
11
12
"jakob.age" . publicKeys = users ++ systems ;
13
+ "pi.age" . publicKeys = users ++ systems ;
12
14
"netrc-attic.age" . publicKeys = users ++ systems ;
13
15
"spotify.age" . publicKeys = users ++ systems ;
14
16
"eduroam.age" . publicKeys = users ++ systems ;
Original file line number Diff line number Diff line change 1
1
age-encryption.org/v1
2
- -> ssh-ed25519 AJb1UQ 9vLBZkKCf6KxfL9X1ILtHf/AHonnG7xFMBquFGOeiTk
3
- JKvdFNQFQ2Rpa6B8DutDfUk0fwlYUuAqQ6VtngUN5PM
4
- -> ssh-ed25519 gTqh/A ts17NmY1+dqm3zyM3EKy+2GeRjFYKOa38qdDTp8Z8G4
5
- HNZuAT/kSXkL4cKFZSsCATAfkXqI85/WIwuZF4nH3mg
6
- -> ssh-ed25519 8jWW0w T/xiyMmOGMUOZkR2rku+f6PJLDXMoRRthxvOSZ++Bgc
7
- wbYwl2mYa9sOzwaw7UtoNNs+b9umG26KxePnfx3YwpA
8
- -> ssh-ed25519 yQ0bLA ON4rjO6998E9Q5GflXmqgxPVTk+InBFQv8skSew6two
9
- ij0FQVBqZ1UraRrClxX6sAALYvyZ6jHeDkdz7X7NS9Q
10
- --- pJAVwYCPNvohC0fV96IXzMzyyy+Hk7C+nq6v3mBrQuM
11
- ��͎* �����2�n�?O�$�n��f�K��8<�j��^�K��Ķ��
2
+ -> ssh-ed25519 AJb1UQ 1PgcJo4x1t9DmfcXq0V2y9sATl+pX/QvfLFK9DYr9DU
3
+ lyXfa4xHX5RY5aA0PR/ltyoBJd2AJ74sADfldpGuU0M
4
+ -> ssh-ed25519 gTqh/A 3D6/RWcwKSUb0QvK2OkpTXfKgn1DJaZU9pPcEUSk2TQ
5
+ 0CInvpXAydxtEqJNl+RCFBKVDpgDIzyWuR431EzSZcU
6
+ -> ssh-ed25519 8jWW0w nf8mhqYTss6SOdpLS4G3+AfstwpVycpQT0NmF76Oexc
7
+ Y9kKK7LeuE+idi+K7FKwN8/WMRMMZSo1DY0QGzhLj0g
8
+ -> ssh-ed25519 yQ0bLA VjJmxSnkjC6kVzVXdx0oLtq9Yi9bWF5Z3D2f61lUIFc
9
+ v5Un0IzDgrVSIkSAKweHzRym/10G66SBqy/l9vvNGIY
10
+ -> ssh-ed25519 LG3qfQ UoO5B1s5K6knGz0zNgWbxu2w74m94iYwJmbCgWPu3g8
11
+ 7HOZO7nb2W19olqW1Ep6H6AQAFC9LO3vdGPX8Oh1SKU
12
+ --- GI74G9dKurtVYciRYkLqrJnUHajZvZFXo/mE0ojqxSg
13
+ $�="C^b<���@Yݓ:���pJ��_b��6a��\���ޫ�^a�����B
You can’t perform that action at this time.
0 commit comments