Skip to content

Commit 467a8b3

Browse files
committed
update: nixos 23.05 setup
1 parent 7636e16 commit 467a8b3

7 files changed

+87
-135
lines changed

.github/workflows/nix-build-using-debian.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/[email protected]
1818
- uses: cachix/install-nix-action@v26
1919
with:
20-
nix_path: nixpkgs=channel:nixos-20.09
20+
nix_path: nixos=channel:nixos-23.05
2121
extra_nix_config: |
2222
extra-platforms = aarch64-linux
2323
- name: Check nix.conf
@@ -78,7 +78,7 @@ jobs:
7878
EOF
7979
- name: Build SD Image
8080
run: |
81-
nix-build '<nixpkgs/nixos>' \
81+
nix-build '<nixos/nixos>' \
8282
-A config.system.build.sdImage \
8383
-I nixos-config=./configuration.custom.sdImage.nix \
8484
--argstr system aarch64-linux \

.github/workflows/nix-build-using-docker.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- uses: actions/[email protected]
1717
- uses: cachix/install-nix-action@v26
1818
with:
19-
nix_path: nixpkgs=channel:nixos-20.09
19+
nix_path: nixos=channel:nixos-23.05
2020
extra_nix_config: |
2121
extra-platforms = aarch64-linux
2222
- name: Check nix.conf
@@ -29,7 +29,7 @@ jobs:
2929
cat /proc/sys/fs/binfmt_misc/qemu-aarch64
3030
- name: Build SD Image
3131
run: |
32-
nix-build '<nixpkgs/nixos>' \
32+
nix-build '<nixos/nixos>' \
3333
-A config.system.build.sdImage \
3434
-I nixos-config=./configuration.default.sdImage.nix \
3535
--argstr system aarch64-linux \
@@ -49,7 +49,7 @@ jobs:
4949
- uses: actions/[email protected]
5050
- uses: cachix/install-nix-action@v26
5151
with:
52-
nix_path: nixpkgs=channel:nixos-20.09
52+
nix_path: nixos=channel:nixos-23.05
5353
extra_nix_config: |
5454
extra-platforms = aarch64-linux
5555
- name: Check nix.conf
@@ -67,7 +67,7 @@ jobs:
6767
EOF
6868
- name: Build SD Image
6969
run: |
70-
nix-build '<nixpkgs/nixos>' \
70+
nix-build '<nixos/nixos>' \
7171
-A config.system.build.sdImage \
7272
-I nixos-config=./configuration.custom.sdImage.nix \
7373
--argstr system aarch64-linux \

.gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ etc-pihole
66
.env
77
docker-compose.override.yml
88
result
9-
sd-image.*
9+
output
10+
.direnv
11+
.DS_Store
12+
sd-image.*
13+
14+
.idea

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ The nix file must import the SD Image packages
9999
{
100100
101101
imports = [
102-
<nixpkgs/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix>
102+
<nixos/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix>
103103
];
104104
105105
# Do not compress the image as we want to use it straight away
@@ -114,7 +114,7 @@ See example in: [configuration.sdImage.nix](configuration.sdImage.nix)
114114
Then build the image:
115115

116116
```
117-
nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I nixos-config=./configuration.sdImage.nix \
117+
nix-build '<nixos/nixos>' -A config.system.build.sdImage -I nixos-config=./configuration.sdImage.nix \
118118
--argstr system aarch64-linux \
119119
--option sandbox false
120120
```
@@ -147,7 +147,7 @@ The build command:
147147

148148
```
149149
# notice that we don't need to specify --argstr system aarch64-linux
150-
nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I nixos-config=./configuration.sdImage.nix \
150+
nix-build '<nixos/nixos>' -A config.system.build.sdImage -I nixos-config=./configuration.sdImage.nix \
151151
--option sandbox false
152152
```
153153

configuration.default.sdImage.nix

+36-7
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
{
33

44
imports = [
5-
<nixpkgs/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix>
5+
<nixos/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix>
66

77
# For nixpkgs cache
8-
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
8+
<nixos/nixos/modules/installer/cd-dvd/channel.nix>
99
];
1010

1111
sdImage.compressImage = true;
@@ -17,24 +17,52 @@
1717
boot.loader.generic-extlinux-compatible.enable = true;
1818

1919
# !!! Set to specific linux kernel version
20-
boot.kernelPackages = pkgs.linuxPackages_5_4;
20+
boot.kernelPackages = pkgs.linuxPackages;
21+
22+
# Disable ZFS on kernel 6
23+
boot.supportedFilesystems = lib.mkForce [
24+
"vfat"
25+
"xfs"
26+
"cifs"
27+
"ntfs"
28+
];
2129

2230
# !!! Needed for the virtual console to work on the RPi 3, as the default of 16M doesn't seem to be enough.
2331
# If X.org behaves weirdly (I only saw the cursor) then try increasing this to 256M.
2432
# On a Raspberry Pi 4 with 4 GB, you should either disable this parameter or increase to at least 64M if you want the USB ports to work.
2533
boot.kernelParams = ["cma=256M"];
2634

35+
# File systems configuration for using the installer's partition layout
36+
fileSystems = {
37+
# Prior to 19.09, the boot partition was hosted on the smaller first partition
38+
# Starting with 19.09, the /boot folder is on the main bigger partition.
39+
# The following is to be used only with older images.
40+
/*
41+
"/boot" = {
42+
device = "/dev/disk/by-label/NIXOS_BOOT";
43+
fsType = "vfat";
44+
};
45+
*/
46+
"/" = {
47+
device = "/dev/disk/by-label/NIXOS_SD";
48+
fsType = "ext4";
49+
};
50+
};
51+
52+
# !!! Adding a swap file is optional, but strongly recommended!
53+
swapDevices = [ { device = "/swapfile"; size = 1024; } ];
54+
2755
# Settings above are the bare minimum
2856
# All settings below are customized depending on your needs
2957

3058
# systemPackages
3159
environment.systemPackages = with pkgs; [
32-
vim curl wget nano bind kubectl helm iptables openvpn
33-
python3 nodejs-12_x docker-compose ];
60+
vim curl wget nano bind kubectl kubernetes-helm iptables openvpn
61+
python3 nodejs docker-compose ];
3462

3563
services.openssh = {
3664
enable = true;
37-
permitRootLogin = "yes";
65+
settings.PermitRootLogin = "yes";
3866
};
3967

4068
programs.zsh = {
@@ -75,8 +103,9 @@
75103
extraGroups = [ "wheel" "docker" ];
76104
};
77105
};
78-
users.extraUsers.root.openssh.authorizedKeys.keys = [
106+
users.users.root.openssh.authorizedKeys.keys = [
79107
# Your ssh key
80108
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDqlXJv/noNPmZMIfjJguRX3O+Z39xeoKhjoIBEyfeqgKGh9JOv7IDBWlNnd3rHVnVPzB9emiiEoAJpkJUnWNBidL6vPYn13r6Zrt/2WLT6TiUFU026ANdqMjIMEZrmlTsfzFT+OzpBqtByYOGGe19qD3x/29nbszPODVF2giwbZNIMo2x7Ww96U4agb2aSAwo/oQa4jQsnOpYRMyJQqCUhvX8LzvE9vFquLlrSyd8khUsEVV/CytmdKwUUSqmlo/Mn7ge/S12rqMwmLvWFMd08Rg9NHvRCeOjgKB4EI6bVwF8D6tNFnbsGVzTHl7Cosnn75U11CXfQ6+8MPq3cekYr lucernae@lombardia-N43SM"
81109
];
110+
system.stateVersion = "23.05";
82111
}

configuration.nix

+30-14
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,15 @@
66
boot.loader.generic-extlinux-compatible.enable = true;
77

88
# !!! Set to specific linux kernel version
9-
boot.kernelPackages = pkgs.linuxPackages_5_4;
9+
boot.kernelPackages = pkgs.linuxPackages;
10+
11+
# Disable ZFS on kernel 6
12+
boot.supportedFilesystems = lib.mkForce [
13+
"vfat"
14+
"xfs"
15+
"cifs"
16+
"ntfs"
17+
];
1018

1119
# !!! Needed for the virtual console to work on the RPi 3, as the default of 16M doesn't seem to be enough.
1220
# If X.org behaves weirdly (I only saw the cursor) then try increasing this to 256M.
@@ -35,20 +43,20 @@
3543

3644
# systemPackages
3745
environment.systemPackages = with pkgs; [
38-
vim curl wget nano bind kubectl helm iptables openvpn
39-
python3 nodejs-12_x docker-compose ];
46+
vim curl wget nano bind kubectl kubernetes-helm iptables openvpn
47+
python3 nodejs docker-compose ];
4048

4149
services.openssh = {
4250
enable = true;
43-
permitRootLogin = "yes";
51+
settings.PermitRootLogin = "yes";
4452
};
4553

4654
# Some sample service.
4755
# Use dnsmasq as internal LAN DNS resolver.
4856
services.dnsmasq = {
4957
enable = false;
50-
servers = [ "8.8.8.8" "8.8.4.4" "1.1.1.1" ];
51-
extraConfig = ''
58+
settings.servers = [ "8.8.8.8" "8.8.4.4" "1.1.1.1" ];
59+
settings.extraConfig = ''
5260
address=/fenrir.test/192.168.100.6
5361
address=/recalune.test/192.168.100.7
5462
address=/eth.nixpi.test/192.168.100.3
@@ -91,7 +99,7 @@
9199
useDHCP = false;
92100
ipv4.addresses = [{
93101
# I used static IP over WLAN because I want to use it as local DNS resolver
94-
address = "192.168.100.4";
102+
address = "192.168.1.4";
95103
prefixLength = 24;
96104
}];
97105
};
@@ -108,14 +116,21 @@
108116
wireless.enable = true;
109117
wireless.interfaces = [ "wlan0" ];
110118
# If you want to connect also via WIFI to your router
111-
wireless.networks."WIFI-SSID".psk = "wifipass";
119+
# wireless.networks."SATRIA".psk = "wifipassword";
112120
# You can set default nameservers
113-
nameservers = [ "192.168.100.3" "192.168.100.4" "192.168.100.1" ];
121+
# nameservers = [ "192.168.100.3" "192.168.100.4" "192.168.100.1" ];
114122
# You can set default gateway
115-
defaultGateway = {
116-
address = "192.168.100.1";
117-
interface = "wlan0";
118-
};
123+
# defaultGateway = {
124+
# address = "192.168.1.1";
125+
# interface = "eth0";
126+
# };
127+
};
128+
129+
# forwarding
130+
boot.kernel.sysctl = {
131+
"net.ipv4.conf.all.forwarding" = true;
132+
"net.ipv6.conf.all.forwarding" = true;
133+
"net.ipv4.tcp_ecn" = true;
119134
};
120135

121136
# put your own configuration here, for example ssh keys:
@@ -137,8 +152,9 @@
137152
extraGroups = [ "wheel" "docker" ];
138153
};
139154
};
140-
users.extraUsers.root.openssh.authorizedKeys.keys = [
155+
users.users.root.openssh.authorizedKeys.keys = [
141156
# This is my public key
142157
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDqlXJv/noNPmZMIfjJguRX3O+Z39xeoKhjoIBEyfeqgKGh9JOv7IDBWlNnd3rHVnVPzB9emiiEoAJpkJUnWNBidL6vPYn13r6Zrt/2WLT6TiUFU026ANdqMjIMEZrmlTsfzFT+OzpBqtByYOGGe19qD3x/29nbszPODVF2giwbZNIMo2x7Ww96U4agb2aSAwo/oQa4jQsnOpYRMyJQqCUhvX8LzvE9vFquLlrSyd8khUsEVV/CytmdKwUUSqmlo/Mn7ge/S12rqMwmLvWFMd08Rg9NHvRCeOjgKB4EI6bVwF8D6tNFnbsGVzTHl7Cosnn75U11CXfQ6+8MPq3cekYr lucernae@lombardia-N43SM"
143158
];
159+
system.stateVersion = "23.05";
144160
}

configuration.sdImage.nix

+6-104
Original file line numberDiff line numberDiff line change
@@ -2,114 +2,16 @@
22
{
33

44
imports = [
5-
<nixpkgs/nixos/modules/installer/cd-dvd/sd-image-aarch64.nix>
5+
<nixos/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix>
66

77
# For nixpkgs cache
8-
<nixpkgs/nixos/modules/installer/cd-dvd/channel.nix>
8+
<nixos/nixos/modules/installer/cd-dvd/channel.nix>
9+
10+
# main configuration
11+
./configuration.nix
912
];
1013

1114
sdImage.compressImage = false;
12-
13-
14-
# NixOS wants to enable GRUB by default
15-
boot.loader.grub.enable = false;
16-
# Enables the generation of /boot/extlinux/extlinux.conf
17-
boot.loader.generic-extlinux-compatible.enable = true;
18-
19-
# !!! Set to specific linux kernel version
20-
boot.kernelPackages = pkgs.linuxPackages_5_4;
21-
22-
# !!! Needed for the virtual console to work on the RPi 3, as the default of 16M doesn't seem to be enough.
23-
# If X.org behaves weirdly (I only saw the cursor) then try increasing this to 256M.
24-
# On a Raspberry Pi 4 with 4 GB, you should either disable this parameter or increase to at least 64M if you want the USB ports to work.
25-
boot.kernelParams = ["cma=256M"];
26-
27-
# Settings above are the bare minimum
28-
# All settings below are customized depending on your needs
29-
30-
# systemPackages
31-
environment.systemPackages = with pkgs; [
32-
vim curl wget nano bind kubectl helm iptables openvpn
33-
python3 nodejs-12_x docker-compose ];
34-
35-
services.openssh = {
36-
enable = true;
37-
permitRootLogin = "yes";
38-
};
39-
40-
programs.zsh = {
41-
enable = true;
42-
ohMyZsh = {
43-
enable = true;
44-
theme = "bira";
45-
};
46-
};
4715

48-
49-
virtualisation.docker.enable = true;
50-
51-
networking.firewall.enable = false;
52-
53-
# WiFi
54-
hardware = {
55-
enableRedistributableFirmware = true;
56-
firmware = [ pkgs.wireless-regdb ];
57-
};
58-
59-
# Networking
60-
networking = {
61-
# useDHCP = true;
62-
interfaces.wlan0 = {
63-
useDHCP = false;
64-
ipv4.addresses = [{
65-
# I used static IP over WLAN because I want to use it as local DNS resolver
66-
address = "192.168.100.4";
67-
prefixLength = 24;
68-
}];
69-
};
70-
interfaces.eth0 = {
71-
useDHCP = true;
72-
# I used DHCP because sometimes I disconnect the LAN cable
73-
#ipv4.addresses = [{
74-
# address = "192.168.100.3";
75-
# prefixLength = 24;
76-
#}];
77-
};
78-
79-
# Enabling WIFI
80-
wireless.enable = true;
81-
wireless.interfaces = [ "wlan0" ];
82-
# If you want to connect also via WIFI to your router
83-
wireless.networks."WIFI-SSID".psk = "wifipass";
84-
# You can set default nameservers
85-
nameservers = [ "192.168.100.3" "192.168.100.4" "192.168.100.1" ];
86-
# You can set default gateway
87-
defaultGateway = {
88-
address = "192.168.100.1";
89-
interface = "wlan0";
90-
};
91-
};
92-
93-
# put your own configuration here, for example ssh keys:
94-
users.defaultUserShell = pkgs.zsh;
95-
users.mutableUsers = true;
96-
users.groups = {
97-
nixos = {
98-
gid = 1000;
99-
name = "nixos";
100-
};
101-
};
102-
users.users = {
103-
nixos = {
104-
uid = 1000;
105-
home = "/home/nixos";
106-
name = "nixos";
107-
group = "nixos";
108-
shell = pkgs.zsh;
109-
extraGroups = [ "wheel" "docker" ];
110-
};
111-
};
112-
users.extraUsers.root.openssh.authorizedKeys.keys = [
113-
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDqlXJv/noNPmZMIfjJguRX3O+Z39xeoKhjoIBEyfeqgKGh9JOv7IDBWlNnd3rHVnVPzB9emiiEoAJpkJUnWNBidL6vPYn13r6Zrt/2WLT6TiUFU026ANdqMjIMEZrmlTsfzFT+OzpBqtByYOGGe19qD3x/29nbszPODVF2giwbZNIMo2x7Ww96U4agb2aSAwo/oQa4jQsnOpYRMyJQqCUhvX8LzvE9vFquLlrSyd8khUsEVV/CytmdKwUUSqmlo/Mn7ge/S12rqMwmLvWFMd08Rg9NHvRCeOjgKB4EI6bVwF8D6tNFnbsGVzTHl7Cosnn75U11CXfQ6+8MPq3cekYr lucernae@lombardia-N43SM"
114-
];
16+
system.copySystemConfiguration = true;
11517
}

0 commit comments

Comments
 (0)