236 Commits
Author SHA1 Message Date
mazex 246902f71b p7zip 2024-08-10 16:28:02 +02:00
mazex 2250af78b9 alacritty test 2024-05-02 15:59:59 +02:00
mazex aae9ba00e2 unstable.alacritty doesnt work 2024-05-02 15:57:16 +02:00
mazex 5d8d53c8e0 unstable alacritty 2024-05-02 15:46:07 +02:00
mazex 025c553c40 fix 2024-05-02 15:45:16 +02:00
mazex 63e9e17fbe no unstable 2024-05-02 15:44:27 +02:00
mazex dabb822811 unstable 2024-05-02 15:43:57 +02:00
mazex a5b6c80177 alacritty 2024-05-02 15:38:23 +02:00
mazex b98d0bab4a unstable let 2024-05-02 15:34:13 +02:00
mazex 90feffda6d unstable alacritty 2024-05-02 15:33:49 +02:00
mazex 8a8a74d3f6 flake 2024-05-02 15:29:01 +02:00
mazex 4ee7fa8498 unstable 2024-05-02 15:28:29 +02:00
mazex 0700604672 back to stable 2024-05-02 15:14:35 +02:00
mazex 1aaf95679c nixos 2024-05-02 15:10:25 +02:00
mazex 7f75f57f95 unstable 2024-05-02 15:09:23 +02:00
mazex 0a901c6ab3 lock 2024-05-02 15:02:17 +02:00
mazex f1dd31109d unstable 2024-05-02 14:59:40 +02:00
mazex 5da83fb54e nixpkgs 2024-05-02 14:52:54 +02:00
mazex b6200b14b3 unfree 2024-05-02 14:52:00 +02:00
mazex a75832b79e nixos 2024-05-02 14:50:49 +02:00
mazex ed50656e81 no let unstable 2024-05-02 14:50:05 +02:00
mazex 6288740b59 unstable alacritty 2024-05-02 14:49:36 +02:00
mazex d94d10bddf xterm as desktop manager 2024-05-02 14:38:01 +02:00
mazex 58fc2edc69 test gdm 2024-05-02 14:27:11 +02:00
mazex 06f1d43475 test no comma 2024-05-02 14:10:14 +02:00
mazex 94afb971ce fix 2024-05-02 14:08:43 +02:00
mazex cd2240ad2a xterm 2024-05-02 13:59:29 +02:00
mazex 1e4f9f009f no wayland 2024-05-02 13:56:02 +02:00
mazex 483e56e800 fix 2024-05-02 13:47:44 +02:00
mazex 90045089cb semi colon 2024-05-02 13:47:31 +02:00
mazex 3a749f6ba8 list 2024-05-02 13:47:12 +02:00
mazex 14249595b8 sessoin fix 2024-05-02 13:45:34 +02:00
mazex a0751c0ace fix indent 2024-05-02 13:45:02 +02:00
mazex 878905301d test xterm session 2024-05-02 13:44:39 +02:00
mazex da48931de0 add wayland to sddm 2024-05-02 13:32:46 +02:00
mazex 61a12f02c3 back to sddm 2024-05-01 20:23:38 +02:00
mazex c927106698 no lingering at all 2024-05-01 20:05:10 +02:00
mazex a2677ce776 no lingering fix 2024-05-01 20:04:22 +02:00
mazex c18a4571c0 force again 2024-05-01 20:03:38 +02:00
mazex c4a2381bda mkforce lingering 2024-05-01 20:03:15 +02:00
mazex 477297be69 back to lightdm 2024-05-01 20:00:09 +02:00
mazex 684d7fe998 fonts 2024-05-01 19:12:35 +02:00
mazex e4e48e6acd 11 2024-05-01 19:11:24 +02:00
mazex f06ed87d50 no gparted 2024-04-25 18:27:38 +02:00
mazex 16c9ceec36 gparted 2024-04-25 18:27:29 +02:00
mazex 6a5578251a transmission 3 2024-04-25 18:21:19 +02:00
mazex 7795e6bdb1 transmission 2024-04-25 18:20:33 +02:00
mazex cbe56c570b transmission 2024-04-25 18:19:54 +02:00
mazex 967d618e8b no gparted 2024-04-25 17:54:10 +02:00
mazex 818e03ba05 23.11 2024-04-25 17:53:47 +02:00
mazex a8118fdb0e gparted 2024-04-25 17:52:27 +02:00
mazex 90e015fcde no tunnel 2024-04-25 17:51:04 +02:00
mazex 6505a578c7 polkit 2024-04-25 17:49:32 +02:00
mazex 2da0e3a48a i915 2024-03-17 15:58:12 +01:00
mazex dc4b934757 semicolon 2023-12-20 15:57:54 +01:00
mazex b9b7e7dfa1 dont sleep 2023-12-20 15:57:27 +01:00
mazex 3a3a8c02bb autosuspend false 2023-12-20 15:55:02 +01:00
mazex 516f5706be powermanagement false 2023-12-20 15:49:33 +01:00
mazex 957d79db65 no sleep 2023-12-12 19:15:19 +01:00
mazex b8e9b1de3c no apple fonts too bad 2023-09-24 17:46:34 +02:00
mazex 2bf4d85b98 apple fonts 2023-09-24 17:44:27 +02:00
mazex f49b876826 pro 2023-09-24 17:43:39 +02:00
mazex 040f4c2d06 apple fonts pro 2023-09-24 17:43:08 +02:00
mazex 36bfc87a25 apple font no pkg 2023-09-24 17:42:42 +02:00
mazex ef11e12ff5 apple fonts pkg 2023-09-24 17:42:21 +02:00
mazex 759774dc67 pro 2023-09-24 17:41:43 +02:00
mazex 5c4b3fc080 sf pro 2023-09-24 17:41:13 +02:00
mazex f59e249029 no license unfree 2023-09-24 17:39:56 +02:00
mazex 5deb72584e font 2023-09-24 17:39:05 +02:00
mazex a4f5f932e1 apple fontw 2023-09-24 17:38:03 +02:00
mazex ddc62e1fba apple fonts 2023-09-24 17:36:50 +02:00
mazex c650a1b7de apple fonts 2023-09-24 17:27:40 +02:00
mazex 043bbb7a84 sf pro 2023-09-24 17:26:48 +02:00
mazex a099ebbb86 source code pro 2023-09-24 17:25:27 +02:00
mazex 888bfffd66 cleaned services 2023-09-24 17:08:30 +02:00
mazex 39fe3900ba all fonts 2023-09-24 17:06:36 +02:00
mazex 24fa38ec4f plex 2023-09-24 17:05:30 +02:00
mazex 1492790bfd plex fix 2023-09-24 16:48:49 +02:00
mazex 7419528d5a plex 2023-09-24 16:47:38 +02:00
mazex 6be77da4a7 on unit active sec 2023-09-21 21:03:17 +02:00
mazex 1ce0ed1121 no conflict 2023-09-20 19:33:33 +02:00
mazex b407ad1ce4 pipewire 2023-09-20 19:33:16 +02:00
mazex 416d1807b9 every day 4am pls 2023-09-20 18:46:03 +02:00
mazex 947ff1db85 no oneshot and fuck onsec stuff 2023-09-20 18:42:24 +02:00
mazex b418313a63 oneshot 2023-09-20 18:40:28 +02:00
mazex 96a47301dd oneshot 2023-09-20 18:40:09 +02:00
mazex 62ebd043cc change 2023-09-20 18:35:48 +02:00
mazex 581dd9d670 persistent true 2023-09-20 18:32:33 +02:00
mazex b85a58dffe clean 2023-09-18 19:11:56 +02:00
mazex 7d14403637 systemd timer for tunneltower pls 2023-09-18 19:08:47 +02:00
mazex 99590a5b63 gdm comment 2023-09-17 23:30:45 +02:00
mazex 5106a4096d clean 2023-09-17 23:30:17 +02:00
mazex 62bbeb347a initrd 2023-09-15 21:11:05 +02:00
mazex 92663cdc01 plymouth again 2023-09-15 20:55:54 +02:00
mazex 0d4ceb92a1 peace color 2023-09-15 20:53:45 +02:00
mazex fcbb2c1f27 plasma5 2023-09-15 20:47:26 +02:00
mazex 8103a2f7df kcm 2023-09-15 20:38:25 +02:00
mazex 6796fb0f42 need to learn how to write 2023-09-15 20:37:33 +02:00
mazex b74b8e12b4 apple 2023-09-15 20:33:37 +02:00
mazex 4c40a21644 sha 2023-09-15 20:33:10 +02:00
mazex ac959c2e9c sddm apple 2023-09-15 20:32:36 +02:00
mazex 954bf63674 plasma desktop 2023-09-15 20:22:50 +02:00
mazex 1b8cce166b plasma 2023-09-15 20:21:31 +02:00
mazex 52bbaca62d plasma 2023-09-15 20:21:04 +02:00
mazex db9ab5b500 plasma5 2023-09-15 20:20:50 +02:00
mazex e60db5c3f8 plasma extras and core 2023-09-15 20:17:44 +02:00
mazex e9fb198e82 peace 2023-09-15 20:16:33 +02:00
mazex 9df1c258f0 ok 2023-09-15 20:14:54 +02:00
mazex dc4d7f7a34 master 2023-09-15 20:14:28 +02:00
mazex 3668c836f6 no sha 2023-09-15 20:13:15 +02:00
mazex 376e6e8e3c rename 2023-09-15 20:11:59 +02:00
mazex ed26642a77 sddm peace color 2023-09-15 20:11:32 +02:00
mazex b9585bdfbd fix path 2023-09-15 19:54:54 +02:00
mazex d3824af4a0 no dot 2023-09-15 19:53:33 +02:00
mazex 8a63d8c6ae call package 2023-09-15 19:53:08 +02:00
mazex f0238380a9 sddm theme dialog 2023-09-15 19:37:44 +02:00
mazex 3006a6713d fix path 2023-09-15 19:35:22 +02:00
mazex 257c9aaa56 tokyo-night-sddm 2023-09-15 19:34:40 +02:00
mazex 433ed3a932 withpkgs 2023-09-15 19:34:18 +02:00
mazex 66d6d46cf2 no tokyo 2023-09-15 19:32:42 +02:00
mazex 3070b4bc4b tokyo-night-sddm 2023-09-15 19:31:28 +02:00
mazex 49895e1956 Revert "sddm themes"
This reverts commit 3783c780b5.
2023-09-15 19:29:31 +02:00
mazex 3783c780b5 sddm themes 2023-09-15 19:29:14 +02:00
mazex 2afab79e97 dont enable 2023-09-15 19:28:14 +02:00
mazex 9054c6099c sddm sugar dark 2023-09-15 19:26:40 +02:00
mazex e691131c69 no autologin 2023-09-15 19:24:24 +02:00
mazex a6faa566ce sddm 2023-09-15 19:23:46 +02:00
mazex 046eac3af9 ssdm 2023-09-15 19:23:28 +02:00
mazex a806155e9b lightdm 2023-09-15 19:22:15 +02:00
mazex 5e23748bd2 autologin 2023-09-15 19:21:07 +02:00
mazex 0b2daf31d3 greeter 2023-09-15 19:20:18 +02:00
mazex 91ff519eae gdm 2023-09-15 19:19:22 +02:00
mazex 82488a9490 h 2023-09-15 19:17:45 +02:00
mazex b76b29c668 hyprland as default 2023-09-15 19:17:25 +02:00
mazex 71c621664f amdgpu driver 2023-09-15 19:16:36 +02:00
mazex 3db3c7fe49 greeter 2023-09-15 19:15:43 +02:00
mazex b5fc8e03ea lightdm 2023-09-15 19:14:53 +02:00
mazex b5e4bdd630 fix 2023-09-15 19:14:06 +02:00
mazex 0cef4c75f4 does that work 2023-09-15 19:13:56 +02:00
mazex 32b616da20 try again 2023-09-15 19:12:38 +02:00
mazex 86bd46d0da try to fix 2023-09-15 19:11:49 +02:00
mazex a72af2aa99 no adm maybe 2023-09-15 18:59:51 +02:00
mazex e0c2f97e16 plymouth 2023-09-15 18:55:58 +02:00
mazex 718b139953 fix 2023-09-15 18:51:05 +02:00
mazex 91ac5ffba1 boot.initrd.systemd.enable = true 2023-09-15 18:50:51 +02:00
mazex f93cc60db8 dri 2023-09-15 18:45:17 +02:00
mazex 74efce0686 amd 2023-09-15 18:43:05 +02:00
mazex 657a739647 amdgpu 2023-09-15 18:41:47 +02:00
mazex ed0a7c4035 fix 2023-09-15 18:39:37 +02:00
mazex e816ea45d8 lightdm hyprland 2023-09-15 18:36:51 +02:00
mazex 7015de10fd lightdm 2023-09-15 18:34:18 +02:00
mazex 8f48493bf8 lightdm doesnt work go back to gdm 2023-09-11 08:37:30 +02:00
mazex d3d458a4a6 enable xserver 2023-09-11 08:35:22 +02:00
mazex 30d2cdbf18 services xserver display manager 2023-09-11 08:34:48 +02:00
mazex 2302cbee07 lightdm display manager 2023-09-11 08:34:06 +02:00
mazex f80174f820 then no freejail too bad 2023-09-11 08:03:16 +02:00
mazex cf975eefe8 allow unfree then 2023-09-11 08:02:16 +02:00
mazex 52072180e2 discord and spotify in global 2023-09-11 08:01:30 +02:00
mazex 3e858f3a62 spotify and discord in unfree 2023-09-11 08:00:07 +02:00
mazex 06cbf3c69e firejail here we go with spotify and discord 2023-09-11 07:58:18 +02:00
mazex d1ca41c9c6 firejail here we go 2023-09-11 07:49:35 +02:00
mazex 8834abb11f unfree packages for spotify and discord 2023-09-11 07:22:18 +02:00
mazex 4b37e71c7b new groups 2023-09-11 07:21:02 +02:00
mazex f69764d3b0 fix 2023-09-11 07:19:12 +02:00
mazex 906869e696 added lots of locale 2023-09-11 07:18:43 +02:00
mazex d203a9394a added the 2023-09-11 07:13:33 +02:00
mazex 84b574cc94 locale 2023-09-11 07:13:16 +02:00
mazex 39b1343c21 70 2023-09-04 19:09:00 +02:00
mazex 1b7c48f812 '' 2023-09-04 19:05:48 +02:00
mazex 0c8b386c04 clean tunneltower 2023-09-04 19:01:50 +02:00
mazex aab0054896 no type 2023-09-04 19:00:02 +02:00
mazex c271d086c9 enable linger for marc 2023-09-04 18:57:14 +02:00
mazex 72ede67564 mcfly 2023-09-02 15:09:46 +02:00
mazex f86fa42ec1 Revert "hyprland"
This reverts commit 98e44f40b2.
2023-08-28 01:32:59 +02:00
mazex 88ca30da73 Revert "no url"
This reverts commit 9404cdd55e.
2023-08-28 01:32:41 +02:00
mazex 5bda3eb8a6 free vnc 2023-08-28 01:29:02 +02:00
mazex 9404cdd55e no url 2023-08-21 04:36:24 +02:00
mazex 98e44f40b2 hyprland 2023-08-21 04:34:49 +02:00
mazex 9da30ef535 enable xserver 2023-08-21 04:26:24 +02:00
mazex 44de68db6b gnome gdm 2023-08-21 04:22:10 +02:00
mazex 71ead633de gdm 2023-08-21 04:20:02 +02:00
mazex f9db5b6a28 gdm 2023-08-21 04:18:15 +02:00
mazex 6f13522f52 no alacritty 2023-08-21 04:00:53 +02:00
mazex aba9b0789e alacritty 2023-08-21 04:00:36 +02:00
mazex c3545e93db backward 2023-08-21 03:55:10 +02:00
mazex bfcd43ff13 wayland window manager 2023-08-21 03:54:52 +02:00
mazex abcb04846a seat group 2023-08-21 03:51:48 +02:00
mazex 3885a679ef ly 2023-08-21 03:51:01 +02:00
mazex 7f382c30df seatd 2023-08-21 03:47:29 +02:00
mazex ab2fe7d036 killall 2023-08-21 03:45:16 +02:00
mazex 2dec9664e6 hyprland enable 2023-08-21 03:43:12 +02:00
mazex e267a91a51 no mg 2023-08-21 03:29:44 +02:00
mazex 99f6130b5e enable flakes 2023-08-13 20:15:22 +02:00
mazex 94bb015b81 autossh 2023-08-13 18:36:39 +02:00
mazex 6c3ee63e22 autossh pls 2023-08-13 18:20:14 +02:00
mazex 37dd78c236 fix 2023-08-13 18:17:59 +02:00
mazex 634821da31 no k3s 2023-07-17 19:31:03 +02:00
mazex 054c944dbc once is enough 2023-07-07 04:09:59 +02:00
mazex c3c135bd7c fix enrionment system packages 2023-07-07 04:09:38 +02:00
mazex 2aec10d69f fix let in 2023-07-07 04:06:23 +02:00
mazex a114e9ddb9 kubernetes pls 2023-07-07 04:05:11 +02:00
mazex dda312c598 htop 2023-07-07 04:02:33 +02:00
mazex 422bd28822 marc in docker group 2023-07-06 14:41:16 +02:00
mazex 773f4cb407 kubectl 2023-07-05 12:14:14 +02:00
mazex e64e3adcd1 Revert "disable home manager"
This reverts commit 054d8889c9.
2023-07-04 12:50:49 +02:00
mazex 054d8889c9 disable home manager 2023-07-04 12:47:42 +02:00
mazex 343eb10b05 home manager 2023-07-04 04:28:14 +02:00
mazex 1c5feaa451 gnupg 2023-07-04 04:18:09 +02:00
mazex 245f279a2e marc same as root 2023-07-04 04:08:34 +02:00
mazex 4c66642ba6 bat 2023-07-04 04:03:21 +02:00
mazex 00879f3e15 zsh enable 2023-07-04 00:56:30 +02:00
mazex f4e673b746 gnumake 2023-07-04 00:52:14 +02:00
mazex bc817489de coreutils 2023-07-04 00:50:57 +02:00
mazex 1f1bd39c95 make 2023-07-04 00:49:16 +02:00
mazex 7d4677e733 neovim and stow 2023-07-04 00:48:40 +02:00
mazex f30e2c3251 pulseaudio 2023-06-25 04:25:35 +02:00
mazex e68d52d626 tower 2023-06-25 04:22:58 +02:00
mazex ebfadf1ee3 bluetooth 2023-06-25 04:17:29 +02:00
mazex 4b00071d59 tower 2023-06-24 15:36:57 +02:00
mazex 5e3e6bccb2 timezone 2023-06-24 15:36:33 +02:00
mazex f2624feaef custom hostname 2023-06-24 15:34:47 +02:00
mazex 7babdb2592 fix flag 2023-06-24 15:32:07 +02:00
mazex 560844cd49 kubernetes zfs support 2023-06-24 15:31:02 +02:00
mazex 917cb9fede openssh.authorizedKeys 2023-06-24 15:21:08 +02:00
mazex 03a91d16ca fix system packages 2023-06-24 15:16:46 +02:00
mazex 036ba8fdbf kubernetes 2023-06-24 15:15:29 +02:00
mazex 4a82b5fa6c passwordssh 2023-06-24 15:04:59 +02:00
mazex 4d625910d3 removed useless line 2023-06-24 15:03:56 +02:00
mazex a03749f995 docker 2023-06-24 15:02:09 +02:00
mazex ac29dcaa09 marc fix 2023-06-24 06:49:04 +02:00
mazex 7d4bb67c3b marc 2023-06-24 06:48:26 +02:00
mazex 16be42651c iwd 2023-06-24 06:29:54 +02:00
mazex ad1d13112d fix part
Signed-off-by: Marc Partensky <marc@marcpartensky.com>
2023-06-24 04:02:07 +00:00
mazex 9a4eb4554d flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/3a70dd92993182f8e514700ccf5b1ae9fc8a3b8d' (2023-05-31)
  → 'github:nixos/nixpkgs/ecb441f22067ba1d6312f4932a7c64efa8d19a7b' (2023-06-22)
2023-06-24 04:01:36 +00:00
mazex b197a375ce initial installation
Signed-off-by: Marc Partensky <marc@marcpartensky.com>
2023-06-24 04:00:42 +00:00
mazex f1ccf0c7bf initial commit
Signed-off-by: Marc Partensky <marc@marcpartensky.com>
2023-06-24 03:55:39 +00:00
22 changed files with 759 additions and 557 deletions
-10
View File
@@ -1,10 +0,0 @@
FROM alpine
RUN apk update
RUN apk add mkpasswd zfs
COPY LICENSE configuration.nix flake.lock flake.nix install.sh ./
COPY hosts ./
COPY modules ./
ENTRYPOINT [ "./install.sh" ]
+21 -15
View File
@@ -1,18 +1,24 @@
* Install NixOS with ZFS as root filesystem
This repo contains a minimal set of configuration for installing
NixOS, using ZFS as root filesystem.
* Minimal NixOS Root on ZFS configuration
This repo contains a minimal set of configuration needed for
installing NixOS on a computer with ZFS as root filesystem.
ZFS is a modern filesystem with many features such as snapshot,
self-healing and pooled storage, see [[https://openzfs.org/wiki/Main_Page#Introduction_to_OpenZFS][Introduction]] for details.
#+begin_src text
.gitignore
LICENSE
configuration.nix <- configuration shared by all hosts
flake.lock
flake.nix
hosts/exampleHost/default.nix <- per-host configuration
hosts/exampleHost/sshUnlock.txt
modules/boot/default.nix
modules/default.nix
modules/fileSystems/default.nix
modules/networking/default.nix
modules/users/default.nix
#+end_src
For using this repo on your computer, see [[https://openzfs.github.io/openzfs-docs/Getting%20Started/NixOS/Root%20on%20ZFS.html][Documentation]].
Just enough to get you started.
Upon initial installation, only the bootloader, mountpoints and root
password are configured.
- Refer to =man configuration.nix= for available options;
- Search for available packages with [[https://search.nixos.org/packages][Package Search]];
- Search for options with [[https://search.nixos.org/options][Option Search]].
[[https://codeberg.org/m0p/dotfiles][My personal dotfiles repo]] contains an example of desktop configuration
based on sway, tmux and Emacs.
See [[https://github.com/ne9z/personal-dotfiles][my personal dotfiles repo]] for an example of how to configure
servers and desktop computers in the same git repository, based on
this template repo you are viewing now.
+395 -59
View File
@@ -1,37 +1,180 @@
# configuration in this file is shared by all hosts
{
my-config, zfs-root, inputs, pkgs, lib, ...
}:
let
kubeMasterIP = "10.1.1.2";
kubeMasterHostname = "api.kube";
kubeMasterAPIServerPort = 6443;
# tokyo-night-sddm = pkgs.libsForQt5.callPackage ./themes/tokyo-night-sddm.nix { };
sddm-peace-color = pkgs.libsForQt5.callPackage ./themes/sddm-peace-color.nix { };
# sddm-apple = pkgs.libsForQt5.callPackage ./themes/sddm-apple.nix { };
unstable = import <nixpkgs-unstable> { config.allowUnfree = true; };
in
{
# load module config to top-level configuration
inherit my-config zfs-root;
# Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = if (inputs.self ? rev) then
inputs.self.rev
else
throw "refuse to build: git tree is dirty";
system.stateVersion = "23.11";
# system.activationScripts = {
# enableLingering = ''
# # remove all existing lingering users
# rm -r /var/lib/systemd/linger
# mkdir /var/lib/systemd/linger
# # enable for the subset of declared users
# touch /var/lib/systemd/linger/marc
# '';
# };
# config.systemd.user.services.nixos-activation.unitConfig.ConditionUser = mkForce
# [
# "!@system"
# "!marc"
# ];
boot.zfs.forceImportRoot = lib.mkDefault false;
# boot.loader.systemd-boot.enable = true;
boot.initrd.systemd.enable = true;
# boot.loader.efi.canTouchEfiVariables = true;
boot.plymouth.enable = true;
boot.plymouth.theme = "breeze";
virtualisation.docker.enable = true;
{ pkgs, pkgs-unstable, inputs, ... }:
let inherit (inputs) self;
in {
# Enable NetworkManager for wireless networking,
# You can configure networking with "nmtui" command.
networking.useDHCP = true;
networking.networkmanager.enable = false;
# networking.useDHCP = true;
networking.hostName = "tower";
networking.networkmanager.enable = true;
networking.wireless.iwd.enable = true;
networking.networkmanager.wifi.backend = "iwd";
users.users = {
root = {
initialHashedPassword = "rootHash_placeholder";
openssh.authorizedKeys.keys = [ "sshKey_placeholder" ];
services = {
# plex = {
# enable = true;
# dataDir = "/var/lib/plex";
# openFirewall = true;
# user = "plex";
# group = "plex";
# };
# hardware.pulseaudio.enable = true;
# services.transmission.settings = {
# download-dir = "${config.services.transmission.home}/Downloads";
# };
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
jack.enable = true;
pulse.enable = true;
socketActivation = true;
};
# Enable the X11 windowing system.
xserver = {
enable = true;
layout = "us";
videoDrivers = [ "amdgpu" ];
# windowManager.i3.enable = true;
desktopManager.plasma5.enable = true;
desktopManager.xterm.enable = true;
displayManager = {
defaultSession = "hyprland";
# autoLogin = {
# enable = true;
# user = "marc";
# };
sddm = {
enable = false;
# wayland.enable = true;
# theme = "sddm-apple";
theme = "sddm-peace-color";
};
lightdm = {
enable = false;
# greeter.enable = true; fonts
};
gdm.enable = true;
session = [
# {
# manage = "desktop";
# name = "xterm";
# start = ''
# ${pkgs.xterm}/bin/xterm -ls &
# waitPID=$!
# '';
# }
{
manage = "desktop";
name = "firefox";
start = ''
${pkgs.firefox}/bin/firefox &
waitPID=$!
'';
}
];
};
};
openssh = {
enable = lib.mkDefault true;
settings = { PasswordAuthentication = lib.mkDefault true; };
};
};
## enable GNOME desktop.
## You need to configure a normal, non-root user.
# services.xserver = {
# enable = true;
# desktopManager.gnome.enable = true;
# displayManager.gdm.enable = true;
# };
hardware.bluetooth.enable = true;
## enable ZFS auto snapshot on datasets
## You need to set the auto snapshot property to "true"
## on datasets for this to work, such as
# zfs set com.sun:auto-snapshot=true rpool/nixos/home
services.zfs = {
autoSnapshot = {
enable = false;
flags = "-k -p --utc";
monthly = 48;
# amd support with vulkan
hardware.opengl.driSupport = true;
hardware.opengl.extraPackages = with pkgs; [
rocm-opencl-icd
rocm-opencl-runtime
amdvlk
];
fonts.packages = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
liberation_ttf
fira-code
fira-code-symbols
mplus-outline-fonts.githubRelease
dina-font
proggyfonts
source-code-pro
];
# services.xserver.enable = true;
# services.xserver.displayManager.gdm.enable = true;
programs.hyprland.enable = true;
programs.dconf.enable = true; # apply gtk themes in wayland apps
users.users = {
root = {
isNormalUser = false;
shell = pkgs.zsh;
initialHashedPassword = "$6$0QAYnBqAJtqB12p3$2lb7rAS2sYw49GUJt0L0bAEpZJSv4HZARQjlbYPhexSmeRB71IRMBzXjf3b4rX6fuDxOuDLydP/Kni9uraS5j/";
openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDiUE73uIEgijfmSsDwBvZmecQnqjBUPRKlMDmevsThc1YJNWEHl57NNIUcx6XSCDPKu5azayImLqIBt8wT5xlqtNX20uCnikDfXZ8gFbGlMRTGZKutQZIRmUrUS5mz97S4dVVK+n5WU+OwOfEg/XKXPh4WbTVDpfTTg7RopRAXkma56HV2TJM0ndPRN8VLmBmtnwdQwEpJ0tRRY+KOHmTojsH65eaZ89+BHbto+Kg+lk6x8IH5VDCRQNHgTEccOpOGYBSHRpoZi1a5h3yajf/eGAQ9Cd38DOsfMtm84oFlii7oXPyxwXoM+uH1SDnvLXyheIrV/XLUurSbEb4aJni6Zu79Z9l8xHhUNmVNSZqWOWUvPbAHlDKUzsbxgk9Zs9OTvSDaRzGhViYl4e1Qc993yerGSW1HHIvYUKM7o5nSQqskSOvOI+ahL5fIbgdyVx4FeuURZIyZSxCz4jIJTK15/6pkT/miHKv+vmQhsoLCqgyXY4SG1p9ruzKkzBe03ZQVW5WeFDLYRjZ+Z4Q2IL2K3BmLgp8tInkPJizQ7v5UGSiajJmPxY0j+CqdH9ZlIBdf8GS+run/N4hpMC1/ayUZRbCY5jg4c8bev8dKEZYJKPs/Hq2zLRZe4YtxcKuiGhgIwQOzo/QrCvSM4pVDgo+d2DjEzIdapqE8hF6BHWDg/w== marc.partensky@gmail.com" ];
};
marc = {
isNormalUser = true;
home = "/home/marc";
description = "Marc Partensky";
extraGroups = ["wheel" "networkmanager" "docker" "seat" "kvm" "video"];
# openssh.authorizedKeys.keys =
shell = pkgs.zsh;
initialHashedPassword = "$6$0QAYnBqAJtqB12p3$2lb7rAS2sYw49GUJt0L0bAEpZJSv4HZARQjlbYPhexSmeRB71IRMBzXjf3b4rX6fuDxOuDLydP/Kni9uraS5j/";
openssh.authorizedKeys.keys = [ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDiUE73uIEgijfmSsDwBvZmecQnqjBUPRKlMDmevsThc1YJNWEHl57NNIUcx6XSCDPKu5azayImLqIBt8wT5xlqtNX20uCnikDfXZ8gFbGlMRTGZKutQZIRmUrUS5mz97S4dVVK+n5WU+OwOfEg/XKXPh4WbTVDpfTTg7RopRAXkma56HV2TJM0ndPRN8VLmBmtnwdQwEpJ0tRRY+KOHmTojsH65eaZ89+BHbto+Kg+lk6x8IH5VDCRQNHgTEccOpOGYBSHRpoZi1a5h3yajf/eGAQ9Cd38DOsfMtm84oFlii7oXPyxwXoM+uH1SDnvLXyheIrV/XLUurSbEb4aJni6Zu79Z9l8xHhUNmVNSZqWOWUvPbAHlDKUzsbxgk9Zs9OTvSDaRzGhViYl4e1Qc993yerGSW1HHIvYUKM7o5nSQqskSOvOI+ahL5fIbgdyVx4FeuURZIyZSxCz4jIJTK15/6pkT/miHKv+vmQhsoLCqgyXY4SG1p9ruzKkzBe03ZQVW5WeFDLYRjZ+Z4Q2IL2K3BmLgp8tInkPJizQ7v5UGSiajJmPxY0j+CqdH9ZlIBdf8GS+run/N4hpMC1/ayUZRbCY5jg4c8bev8dKEZYJKPs/Hq2zLRZe4YtxcKuiGhgIwQOzo/QrCvSM4pVDgo+d2DjEzIdapqE8hF6BHWDg/w== marc.partensky@gmail.com" ];
};
};
@@ -41,50 +184,243 @@ in {
vimAlias = true;
};
services.openssh = {
enable = true;
settings = { PasswordAuthentication = false; };
imports = [
"${inputs.nixpkgs}/nixos/modules/installer/scan/not-detected.nix"
# "${inputs.nixpkgs}/nixos/modules/profiles/qemu-guest.nix"
];
nixpkgs = {
config = {
allowUnfree = true;
packageOverrides = pkgs: {
unstable = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz") {};
};
};
};
boot.zfs.forceImportRoot = false;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# kubernetes https://nixos.wiki/wiki/K3s
networking.firewall.allowedTCPPorts = [ 6443 5900 ];
# services.k3s = {
# enable = true;
# role = "server";
# # TODO describe how to enable zfs snapshotter in containerd
# extraFlags = toString [
# "--container-runtime-endpoint unix:///run/containerd/containerd.sock"
# ];
# };
boot.initrd.systemd.enable = true;
# kubernetes zfs support
# virtualisation.containerd = {
# enable = true;
# settings =
# let
# fullCNIPlugins = pkgs.buildEnv {
# name = "full-cni";
# paths = with pkgs;[
# cni-plugins
# cni-plugin-flannel
# ];
# };
# in {
# plugins."io.containerd.grpc.v1.cri".cni = {
# bin_dir = "${fullCNIPlugins}/bin";
# conf_dir = "/var/lib/rancher/k3s/agent/etc/cni/net.d/";
# };
# };
# };
# kubernetes support
# resolve master hostname
# networking.extraHosts = "${kubeMasterIP} ${kubeMasterHostname}";
# services.kubernetes = {
# roles = ["master" "node"];
# masterAddress = kubeMasterHostname;
# apiserverAddress = "https://${kubeMasterHostname}:${toString kubeMasterAPIServerPort}";
# easyCerts = true;
# apiserver = {
# securePort = kubeMasterAPIServerPort;
# advertiseAddress = kubeMasterIP;
# };
# # use coredns
# addons.dns.enable = true;
# # needed if you use swap
# kubelet.extraOpts = "--fail-swap-on=false";
# };
nix.settings.experimental-features = lib.mkDefault [ "nix-command" "flakes" ];
programs.git.enable = true;
programs.zsh.enable = true;
security = {
doas.enable = true;
sudo.enable = false;
doas.enable = lib.mkDefault true;
sudo.enable = lib.mkDefault false;
};
environment.systemPackages = builtins.attrValues {
inherit (pkgs)
mg # emacs-like editor
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
# systemd.services.tunneltower = {
# enable = true;
# description = "Connect to my tower remotely";
# unitConfig = {
# # Type = "simple";
# };
# serviceConfig = {
# ExecStart = ''
# ${pkgs.autossh}/bin/autossh -M 0 \
# -o ServerAliveInterval=30 \
# -o ServerAliveCountMax=3 \
# -o PubkeyAuthentication=yes \
# -o PasswordAuthentication=no \
# -NR localhost:42070:localhost:22 \
# -p 42069 \
# -i ~/.ssh/id_rsa \
# marc@207.180.235.56
# '';
# };
# wantedBy = [ "multi-user.target" ];
# };
boot.kernelParams = [
"i915.enable_psr=0"
];
powerManagement.enable = false;
systemd.targets.sleep.enable = false;
systemd.targets.suspend.enable = false;
systemd.targets.hibernate.enable = false;
systemd.targets.hybrid-sleep.enable = false;
services.xserver.displayManager.gdm.autoSuspend = false;
environment.etc."systemd/sleep.conf".text = ''
[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowSuspendThenHibernate=no
AllowHybridSleep=no
#SuspendMode=
#SuspendState=mem standby freeze
#HibernateMode=platform shutdown
#HibernateState=disk
#HybridSleepMode=suspend platform shutdown
#HybridSleepState=disk
#HibernateDelaySec=180min
'';
systemd.timers.tunneltower = {
wantedBy = [ "timers.target" ];
timerConfig = {
# OnBootSec = "1d";
# OnUnitActiveSec = "1d";
Unit = "tunneltower";
Persistent = true;
# OnCalendar = "*-*-* 5:00:00";
OnBootSec="15min";
OnUnitActiveSec="1d";
};
};
#
# environment.systemPackages = builtins.attrValues {
# inherit (pkgs)
# k3s
# autossh
# jq # other programs
# neovim
# stow
# coreutils
# gnumake
# bat
# gnupg
# nome-manager
# htop
# kompose
# kubectl
# kubernetes
# killall
# seatd
# mcfly
# sddm
# # tokyo-night-sddm
# ;
# };
environment.systemPackages = with pkgs;
[
k3s
autossh
jq # other programs
;
# By default, the system will only use packages from the
# stable channel. i.e.
# inherit (pkg) my-favorite-stable-package;
# You can selectively install packages
# from the unstable channel. Such as
# inherit (pkgs-unstable) my-favorite-unstable-package;
# You can also add more
# channels to pin package version.
neovim
stow
coreutils
gnumake
bat
gnupg
home-manager
htop
kompose
kubectl
kubernetes
killall
seatd
mcfly
sddm
sddm-peace-color
# sddm-apple
sddm-kcm
transmission-gtk
xterm
alacritty
p7zip
# unstable.alacritty
# plasma-desktop
# plasma-workspace
# plasma-workspace-wallpapers
# tokyo-night-sddm
# sddm-theme-dialog
# (callPackage ./themes/sddm-theme-dialog.nix {}).sddm-theme-dialog
];
i18n.defaultLocale = "fr_FR.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "fr_FR.UTF-8";
LC_IDENTIFICATION = "fr_FR.UTF-8";
LC_MEASUREMENT = "fr_FR.UTF-8";
LC_MONETARY = "fr_FR.UTF-8";
LC_NAME = "fr_FR.UTF-8";
LC_NUMERIC = "fr_FR.UTF-8";
LC_PAPER = "fr_FR.UTF-8";
LC_TELEPHONE = "fr_FR.UTF-8";
LC_TIME = "fr_FR.UTF-8";
};
# Safety mechanism: refuse to build unless everything is
# tracked by git
system.configurationRevision = if (self ? rev) then
self.rev
else
throw "refuse to build: git tree is dirty";
system.stateVersion = "23.05";
# let nix commands follow system nixpkgs revision
nix.registry.nixpkgs.flake = inputs.nixpkgs;
# you can then test any package in a nix shell, such as
# $ nix shell nixpkgs#neovim
environment.sessionVariables = {
# POLKIT_AUTH_AGENT = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
# GSETTINGS_SCHEMA_DIR = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}/glib-2.0/schemas";
# LIBVA_DRIVER_NAME = "nvidia";
# XDG_SESSION_TYPE = "wayland";
# GBM_BACKEND = "nvidia-drm";
# __GLX_VENDOR_LIBRARY_NAME = "nvidia";
# WLR_NO_HARDWARE_CURSORS = "1";
# NIXOS_OZONE_WL = "1";
# MOZ_ENABLE_WAYLAND = "1";
# SDL_VIDEODRIVER = "wayland";
# _JAVA_AWT_WM_NONREPARENTING = "1";
# CLUTTER_BACKEND = "wayland";
# WLR_RENDERER = "vulkan";
# XDG_CURRENT_DESKTOP = "Hyprland";
# XDG_SESSION_DESKTOP = "Hyprland";
# GTK_USE_PORTAL = "1";
# NIXOS_XDG_OPEN_USE_PORTAL = "1";
};
}
-5
View File
@@ -1,5 +0,0 @@
version: "3.9"
services:
nixos-zfs-installer:
image: marcpartensky/nixos-zfs-installer
build: .
Generated
+7 -44
View File
@@ -1,61 +1,24 @@
{
"nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1695108154,
"narHash": "sha256-gSg7UTVtls2yO9lKtP0yb66XBHT1Fx5qZSZbGMpSn2c=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "07682fff75d41f18327a871088d20af2710d4744",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-23.05",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1696983906,
"narHash": "sha256-L7GyeErguS7Pg4h8nK0wGlcUTbfUMDu+HMf1UcyP72k=",
"owner": "NixOS",
"lastModified": 1714253743,
"narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "bd1cde45c77891214131cbbea5b1203e485a9d51",
"rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-23.05",
"type": "indirect"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1697349934,
"narHash": "sha256-mSOXTIvCMA31nD/XEYmeSOebrXl0lFKirM14LK845e4=",
"owner": "NixOS",
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"rev": "f320b0d46ee33f521f50d7c6885605714210e5c9",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "master",
"type": "indirect"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable"
"nixpkgs": "nixpkgs"
}
}
},
+15 -49
View File
@@ -1,61 +1,27 @@
{
description = "Barebones NixOS on ZFS config";
# inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
## after reboot, you can track rolling release by using
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.05";
nixpkgs-unstable.url = "nixpkgs/master";
home-manager = {
url = "github:nix-community/home-manager/release-23.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, home-manager }@inputs:
outputs = { self, nixpkgs }@inputs:
let
mkHost = hostName: system:
nixpkgs.lib.nixosSystem {
pkgs = import nixpkgs {
inherit system;
# settings to nixpkgs goes to here
# nixpkgs.pkgs.zathura.useMupdf = true;
# nixpkgs.config.allowUnfree = false;
};
specialArgs = {
# By default, the system will only use packages from the
# stable channel. You can selectively install packages
# from the unstable channel. You can also add more
# channels to pin package version.
pkgs-unstable = import nixpkgs-unstable {
inherit system;
# settings to nixpkgs-unstable goes to here
};
# make all inputs availabe in other nix files
inherit inputs;
};
lib = nixpkgs.lib;
mkHost = { my-config, zfs-root, pkgs, system, ... }:
lib.nixosSystem {
inherit system;
modules = [
# Root on ZFS related configuration
./modules
# Configuration shared by all hosts
./configuration.nix
# Configuration per host
./hosts/${hostName}
# home-manager
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
(import ./configuration.nix {
inherit my-config zfs-root inputs pkgs lib;
})
];
};
in {
nixosConfigurations = {
laptop = mkHost "laptop" "x86_64-linux";
tower = let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in mkHost (import ./hosts/tower { inherit system pkgs; });
};
};
}
-39
View File
@@ -1,39 +0,0 @@
How to set hostname for a host.
You need to change the host name in three different places.
Place 1.
./flake.nix
Change
exampleHost = mkHost "exampleHost" "x86_64-linux";
to
myHost = mkHost "myHost" "x86_64-linux";
Place 2.
Move directory
./hosts/exampleHost
to
./hosts/myHost
Place 3.
./hosts/exampleHost/default.nix
Change
networking.hostName = "exampleHost";
to
networking.hostName = "myHost";
End.
-24
View File
@@ -1,24 +0,0 @@
{ config, pkgs, lib, inputs, modulesPath, ... }: {
zfs-root = {
boot = {
devNodes = "/dev/disk/by-id/";
bootDevices = [ "bootDevices_placeholder" ];
immutable.enable = false;
removableEfi = true;
luks.enable = True;
};
};
boot.initrd.availableKernelModules = [ "kernelModules_placeholder" ];
boot.kernelParams = [ ];
networking.hostId = "nixos";
# read changeHostName.txt file.
networking.hostName = "laptop";
time.timeZone = "Europe/Paris";
# import preconfigured profiles
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
# (modulesPath + "/profiles/hardened.nix")
# (modulesPath + "/profiles/qemu-guest.nix")
];
}
+45
View File
@@ -0,0 +1,45 @@
How to set hostname for a host.
This repo is structured in a way that allows managing multiple hosts
in a single repo. As a consequence of this, hostname appears in
several different places and should be updated together if needed.
The entry point of this repo is ``flake.nix'' file, which takes a
revision of the nixpkgs as input then gives an attribute set (attrset)
as output:
{
nixosConfigurations = {
exampleHost = { ... };
host2 = { ... };
host3 = { ... };
...
};
}
The hostname specified here inside nixosConfigurations attrset is used
when ``nix command'' is invoked, as in
nixos-install --flake ./#exampleHost
The hostname also appears in the filesystem path of the per-host
configuration file:
hosts/exampleHost/default.nix
hosts/host2/default.nix
...
Finally, the hostname is specified in the zfs-boot.networking.hostName
option inside per-host configuration file at
hosts/exampleHost/default.nix:
zfs-boot.networking.hostName = "exampleHost";
If the value of this option is identical to the name of
nixosConfigurations.<hostname> attrset, all subsequent invocations of
``nix command'' will default to this hostname, i.e. the command:
nixos-rebuild boot
will automatically append ``#hostName'' when evaluating the flake.
+37
View File
@@ -0,0 +1,37 @@
# #
##
## per-host configuration for exampleHost
##
##
{ system, pkgs, ... }: {
inherit pkgs system;
zfs-root = {
boot = {
devNodes = "/dev/";
bootDevices = [ "nvme0n1" ];
immutable = false;
availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "usb_storage" "sd_mod" ];
removableEfi = true;
kernelParams = [ ];
sshUnlock = {
# read sshUnlock.txt file.
enable = false;
authorizedKeys = [ ];
};
};
networking = {
# read changeHostName.txt file.
hostName = "tower";
timeZone = "Europe/Paris";
hostId = "97a4a6a0";
};
};
# To add more options to per-host configuration, you can create a
# custom configuration module, then add it here.
my-config = {
# Enable custom gnome desktop on exampleHost
template.desktop.gnome.enable = false;
};
}
-272
View File
@@ -1,272 +0,0 @@
#!/bin/env bash
log() { echo -e "\n\033[1m${@}\033[0m"; }
log Checking root
mustberoot() {
log You must be root
exit 1
}
whoami | grep root || mustberoot
log Checking connectivity
curl -s google.com > /dev/null || exit 1
log Loading zfs module first
modprobe zfs || exit 1
echo ""
lsblk
echo ""
# read -p "disk: " DISK
DISK=`lsblk | grep disk | grep -v SWAP | awk '{print $1}' | fzf`
DISK=`echo /dev/$DISK`
log $disk
read -p "swapsize GiB: " SWAPSIZEGIB
read -p "reserve GiB: " RESERVEGIB
read -sp "password: " POOLPASS
EMAIL="marc@marcpartensky.com"
NAME="Marc Partensky"
RESERVE=$((RESERVEGIB * 1024))
SWAPSIZE=$((SWAPSIZEGIB * 1024))
MNT=$(mktemp -d)
log Destroying zfs pool rpool and bpool just in case
swapoff -a
zpool import -fa
for i in ${DISK}; do
zpool labelclear -f $i
done
zpool destroy -f bpool
zpool destroy -f rpool
zpool export -a
log Unmounting filesystems just in case
# ---
umount -Rl "${MNT}"
log Enabling Nix Flakes functionality
# ---
mkdir -p ~/.config/nix
echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
log Installing programs needed for system installation
# ---
if ! command -v git; then nix-env -f '<nixpkgs>' -iA git; fi
if ! command -v jq; then nix-env -f '<nixpkgs>' -iA jq; fi
if ! command -v partprobe; then nix-env -f '<nixpkgs>' -iA parted; fi
log Partition the disks
# ---
partition_disk () {
local disk=$1
blkdiscard -f $disk || true
parted --script --align=optimal $disk -- \
mklabel gpt \
mkpart swap 1MiB $((SWAPSIZE + 1))MiB \
mkpart rpool $((SWAPSIZE + 1))MiB -$((RESERVE + 100))MiB \
mkpart bpool -$((RESERVE + 100))MiB -$((RESERVE + 3))MiB \
mkpart EFI -$((RESERVE + 3))MiB -$((RESERVE + 2))MiB \
mkpart BIOS -$((RESERVE + 2))MiB -$((RESERVE + 1))MiB \
set 4 esp on \
set 5 bios_grub on \
set 5 legacy_boot on
partprobe $disk
udevadm settle
}
for i in $DISK; do
partition_disk $i || exit 1
done
log disk $DISK
log Creating boot pool
# ---
# shellcheck disable=SC2046
createbpool="zpool create \
-o compatibility=grub2 \
-o ashift=12 \
-o autotrim=on \
-O acltype=posixacl \
-O canmount=off \
-O compression=lz4 \
-O devices=off \
-O normalization=formD \
-O relatime=on \
-O xattr=sa \
-m /boot \
-R $MNT \
bpool \
`for i in $DISK; do
printf '%s ' ${i}3
done`"
echo $createbpool
eval $createbpool
log Creating root pool
# ---
# shellcheck disable=SC2046
echo $POOLPASS | zpool create \
-o ashift=12 \
-o autotrim=on \
-R $MNT \
-O acltype=posixacl \
-O canmount=off \
-O compression=zstd \
-O dnodesize=auto \
-O normalization=formD \
-O relatime=on \
-O xattr=sa \
-o feature@encryption=enabled \
-O encryption=on \
-O keyformat=passphrase \
-m / \
rpool \
$(for i in $DISK; do
printf '%s ' "${i}p2";
done)
log Creating encrypted root system container
# ---
echo $POOLPASS | zfs create \
-o canmount=off \
-o mountpoint=none \
-o encryption=on \
-o keylocation=prompt \
-o keyformat=passphrase \
rpool/nixos
log Creating system datasets, managing mountpoints with mountpoint=legacy
# ---
zfs create -o mountpoint=legacy rpool/nixos/root
mount -t zfs rpool/nixos/root "${MNT}"/
zfs create -o mountpoint=legacy rpool/nixos/home
mkdir "${MNT}"/home
mount -t zfs rpool/nixos/home "${MNT}"/home
zfs create -o mountpoint=legacy rpool/nixos/var
zfs create -o mountpoint=legacy rpool/nixos/var/lib
zfs create -o mountpoint=legacy rpool/nixos/var/log
zfs create -o mountpoint=none bpool/nixos
zfs create -o mountpoint=legacy bpool/nixos/root
mkdir "${MNT}"/boot
mount -t zfs bpool/nixos/root "${MNT}"/boot
mkdir -p "${MNT}"/var/log
mkdir -p "${MNT}"/var/lib
mount -t zfs rpool/nixos/var/lib "${MNT}"/var/lib
mount -t zfs rpool/nixos/var/log "${MNT}"/var/log
zfs create -o mountpoint=legacy rpool/nixos/empty
zfs snapshot rpool/nixos/empty@start
log Formatting and mounting ESP
# ---
for i in ${DISK}; do
mkfs.vfat -n EFI "${i}"4
mkdir -p "${MNT}"/boot/efis/"${i##*/}"4
mount -t vfat -o iocharset=iso8859-1 "${i}"4 "${MNT}"/boot/efis/"${i##*/}"4
done
log Cloning template flake configuration
# ---
mkdir -p "${MNT}"/etc
git clone --depth 1 --branch custom \
https://github.com/marcpartensky/nixos-zfs-installer.git "${MNT}"/etc/nixos
rm -rf "${MNT}"/etc/nixos/.git
git -C "${MNT}"/etc/nixos/ init -b master
git -C "${MNT}"/etc/nixos/ add "${MNT}"/etc/nixos/
git -C "${MNT}"/etc/nixos config user.email $EMAIL
git -C "${MNT}"/etc/nixos config user.name $NAME
git -C "${MNT}"/etc/nixos commit -nasm 'initial commit'
log Customizing configuration to your hardware
# ---
for i in ${DISK}; do
sed -i \
"s|/dev/disk/by-id/|${i%/*}/|" \
"${MNT}"/etc/nixos/hosts/nixos/default.nix
break
done
diskNames=""
for i in ${DISK}; do
diskNames="${diskNames} \"${i##*/}\""
done
sed -i "s|\"bootDevices_placeholder\"|${diskNames}|g" \
"${MNT}"/etc/nixos/hosts/nixos/default.nix
sed -i "s|\"abcd1234\"|\"$(head -c4 /dev/urandom | od -A none -t x4| sed 's| ||g' || true)\"|g" \
"${MNT}"/etc/nixos/hosts/nixos/default.nix
sed -i "s|\"x86_64-linux\"|\"$(uname -m || true)-linux\"|g" \
"${MNT}"/etc/nixos/flake.nix
cp "$(command -v nixos-generate-config || true)" ./nixos-generate-config
chmod a+rwx ./nixos-generate-config
# shellcheck disable=SC2016
echo 'print STDOUT $initrdAvailableKernelModules' >> ./nixos-generate-config
kernelModules="$(./nixos-generate-config --show-hardware-config --no-filesystems | tail -n1 || true)"
sed -i "s|\"kernelModules_placeholder\"|${kernelModules}|g" \
"${MNT}"/etc/nixos/hosts/nixos/default.nix
log Setting root password
# ---
rootPwd=$(mkpasswd2 -m SHA-512)
sed -i \
"s|rootHash_placeholder|${rootPwd}|" \
"${MNT}"/etc/nixos/configuration.nix
log Commiting changes to local repo
# ---
git -C "${MNT}"/etc/nixos commit -asm 'initial installation'
log Updating flake lock file to track latest system version
# ---
nix flake update --commit-lock-file \
"git+file://${MNT}/etc/nixos"
log Installing system and apply configuration
# ---
nixos-install \
--root "${MNT}" \
--no-root-passwd \
--flake "git+file://${MNT}/etc/nixos#nixos"
log Setuping encrypted swap. This is useful if the available memory is small
# ---
for i in ${DISK}; do
cryptsetup open --type plain --key-file /dev/random "${i}"1 "${i##*/}"1
mkswap /dev/mapper/"${i##*/}"1
swapon /dev/mapper/"${i##*/}"1
done
log Unmounting filesystems
# ---
umount -Rl "${MNT}"
zpool export -a
log The installation is done, enjoy
+59 -35
View File
@@ -11,11 +11,6 @@ in {
type = types.bool;
default = true;
};
luks.enable = mkOption {
description = "Use luks encryption";
type = types.bool;
default = false;
};
devNodes = mkOption {
description = "Specify where to discover ZFS pools";
type = types.str;
@@ -29,7 +24,15 @@ in {
description = "Specify boot devices";
type = types.nonEmptyListOf types.str;
};
immutable.enable = mkOption {
availableKernelModules = mkOption {
type = types.nonEmptyListOf types.str;
default = [ "uas" "nvme" "ahci" ];
};
kernelParams = mkOption {
type = types.listOf types.str;
default = [ ];
};
immutable = mkOption {
description = "Enable root on ZFS immutable root support";
type = types.bool;
default = false;
@@ -41,61 +44,56 @@ in {
};
partitionScheme = mkOption {
default = {
swap = "1";
rootPool = "2";
bootPool = "3";
efiBoot = "4";
biosBoot = "5";
biosBoot = "p5";
efiBoot = "p1";
swap = "p4";
bootPool = "p2";
rootPool = "p3";
};
description = "Describe on disk partitions";
type = types.attrsOf types.str;
};
sshUnlock = {
enable = mkOption {
type = types.bool;
default = false;
};
authorizedKeys = mkOption {
type = types.listOf types.str;
default = [ ];
};
};
};
config = mkIf (cfg.enable) (mkMerge [
{
zfs-root.fileSystems.datasets = {
# rpool/path/to/dataset = "/path/to/mountpoint"
"rpool/nixos/home" = mkDefault "/home";
"rpool/nixos/var/lib" = mkDefault "/var/lib";
"rpool/nixos/var/log" = mkDefault "/var/log";
"bpool/nixos/root" = "/boot";
};
}
(mkIf cfg.luks.enable {
boot.initrd.luks.devices = mkMerge (map (diskName: {
"luks-rpool-${diskName}${cfg.partitionScheme.rootPool}" = {
device = (cfg.devNodes + diskName + cfg.partitionScheme.rootPool);
allowDiscards = true;
bypassWorkqueues = true;
};
}) cfg.bootDevices);
})
(mkIf (!cfg.immutable.enable) {
(mkIf (!cfg.immutable) {
zfs-root.fileSystems.datasets = { "rpool/nixos/root" = "/"; };
})
(mkIf cfg.immutable.enable {
(mkIf cfg.immutable {
zfs-root.fileSystems = {
datasets = {
# rpool/path/to/dataset = "/path/to/mountpoint"
"rpool/nixos/empty" = "/";
"rpool/nixos/root" = "/oldroot";
};
bindmounts = {
# /bindmount/source = /bindmount/target
"/oldroot/nix" = "/nix";
"/oldroot/etc/nixos" = "/etc/nixos";
};
};
boot.initrd.systemd.services.immutable-zfs-root = {
description = "Rollback root filesystem to an empty snapshot";
unitConfig.DefaultDependencies = false;
wantedBy = [ "zfs.target" ];
after = [ "zfs-import-rpool.service" ];
before = [ "sysroot.mount" ];
path = [ pkgs.zfs ];
serviceConfig.Type = "oneshot";
script = "zfs rollback -r rpool/nixos/empty@start";
};
boot.initrd.postDeviceCommands = ''
if ! grep -q zfs_no_rollback /proc/cmdline; then
zpool import -N rpool
zfs rollback -r rpool/nixos/empty@start
zpool export -a
fi
'';
})
{
zfs-root.fileSystems = {
@@ -106,6 +104,10 @@ in {
(map (diskName: diskName + cfg.partitionScheme.swap) cfg.bootDevices);
};
boot = {
kernelPackages =
mkDefault config.boot.zfs.package.latestCompatibleLinuxPackages;
initrd.availableKernelModules = cfg.availableKernelModules;
kernelParams = cfg.kernelParams;
supportedFilesystems = [ "zfs" ];
zfs = {
devNodes = cfg.devNodes;
@@ -134,5 +136,27 @@ in {
};
};
}
(mkIf cfg.sshUnlock.enable {
boot.initrd = {
network = {
enable = true;
ssh = {
enable = true;
hostKeys = [
"/var/lib/ssh_unlock_zfs_ed25519_key"
"/var/lib/ssh_unlock_zfs_rsa_key"
];
authorizedKeys = cfg.sshUnlock.authorizedKeys;
};
postCommands = ''
tee -a /root/.profile >/dev/null <<EOF
if zfs load-key rpool/nixos; then
pkill zfs
fi
exit
EOF'';
};
};
})
]);
}
+3 -1
View File
@@ -1 +1,3 @@
{ config, lib, pkgs, ... }: { imports = [ ./boot ./fileSystems ]; }
{ config, lib, pkgs, ... }: {
imports = [ ./boot ./fileSystems ./networking ./my-config ];
}
+2 -2
View File
@@ -41,7 +41,7 @@ in {
};
}) cfg.bindmounts ++ map (esp: {
"/boot/efis/${esp}" = {
device = "${config.zfs-root.boot.devNodes}${esp}";
device = "${config.zfs-root.boot.devNodes}/${esp}";
fsType = "vfat";
options = [
"x-systemd.idle-timeout=1min"
@@ -54,7 +54,7 @@ in {
};
}) cfg.efiSystemPartitions);
config.swapDevices = mkDefault (map (swap: {
device = "${config.zfs-root.boot.devNodes}${swap}";
device = "${config.zfs-root.boot.devNodes}/${swap}";
discardPolicy = mkDefault "both";
randomEncryption = {
enable = true;
+41
View File
@@ -0,0 +1,41 @@
{ config, lib, pkgs, ... }:
let inherit (lib) types mkIf mkDefault mkOption;
in {
options.my-config = {
template.desktop.gnome.enable = mkOption {
description = "Enable my customized GNOME desktop";
type = types.bool;
default = false;
};
};
# if my-config.template.desktop.gnome.enable is set to true
# set the following options
config = mkIf config.my-config.template.desktop.gnome.enable {
services.xserver = {
enable = true;
desktopManager.gnome.enable = true;
displayManager.gdm.enable = true;
};
# GNOME must be used with a non-root user,
# add a non-root user
users.users.alice = {
# Generate hashed password with "mkpasswd -m sha-512" command,
# "!" disables login.
# "mkpasswd" without "-m sha-512" will not work
initialHashedPassword = "!";
description = "Full Name";
# Users in "wheel" group are allowed to use "doas" command
# to obtain root permissions.
extraGroups = [ "wheel" ];
packages = builtins.attrValues {
inherit (pkgs)
mg # emacs-like editor
jq # other programs
;
};
isNormalUser = true;
};
};
}
+1 -1
View File
@@ -7,7 +7,7 @@ in {
hostName = mkOption {
description = "The name of the machine. Used by nix flake.";
type = types.str;
default = "nixos";
default = "exampleHost";
};
timeZone = mkOption {
type = types.str;
-1
View File
@@ -1 +0,0 @@
print STDOUT $initrdAvailableKernelModules
+38
View File
@@ -0,0 +1,38 @@
{ lib
, qtbase
, qtsvg
, qtgraphicaleffects
, qtquickcontrols2
, wrapQtAppsHook
, stdenvNoCC
, fetchFromGitHub
}:
stdenvNoCC.mkDerivation
rec {
pname = "sddm-apple";
version = "1..0";
dontBuild = true;
src = fetchFromGitHub {
owner = "vfosterm";
repo = "nixos-sddm-theme-noBlur";
rev = "master";
sha256 = "sha256-Hxifk68xVfnL9EWBicHctzJqyowkCBhAZgSLd7ZZXvg=";
};
nativeBuildInputs = [
wrapQtAppsHook
];
propagatedUserEnvPkgs = [
qtbase
qtsvg
qtgraphicaleffects
qtquickcontrols2
];
installPhase = ''
mkdir -p $out/share/sddm/themes
cp -aR $src $out/share/sddm/themes/sddm-apple
'';
}
+38
View File
@@ -0,0 +1,38 @@
{ lib
, qtbase
, qtsvg
, qtgraphicaleffects
, qtquickcontrols2
, wrapQtAppsHook
, stdenvNoCC
, fetchFromGitHub
}:
stdenvNoCC.mkDerivation
rec {
pname = "sddm-peace-color";
version = "1..0";
dontBuild = true;
src = fetchFromGitHub {
owner = "marcpartensky";
repo = "sddm-peace-color";
rev = "master";
sha256 = "sha256-JRCa8JYkQqkBKQ8YYNNjPrUPY3WwiEkq0W3pBmlhbEs=";
};
nativeBuildInputs = [
wrapQtAppsHook
];
propagatedUserEnvPkgs = [
qtbase
qtsvg
qtgraphicaleffects
qtquickcontrols2
];
installPhase = ''
mkdir -p $out/share/sddm/themes
cp -aR $src $out/share/sddm/themes/sddm-peace-color
'';
}
+19
View File
@@ -0,0 +1,19 @@
{ stdenv, fetchFromGitHub }:
{
sddm-theme-dialog = stdenv.mkDerivation rec {
pname = "sddm-theme-dialog";
version = "53f81e3";
dontBuild = true;
installPhase = ''
mkdir -p $out/share/sddm/themes
cp -aR $src $out/share/sddm/themes/sddm-theme-dialog
'';
src = fetchFromGitHub {
owner = "joshuakraemer";
repo = "sddm-theme-dialog";
rev = "53f81e322f715d3f8e3f41c38eb3774b1be4c19b";
sha256 = "qoLSRnQOvH3rAH+G1eRrcf9ZB6WlSRIZjYZBOTkew/0=";
};
};
}
+38
View File
@@ -0,0 +1,38 @@
{ lib
, qtbase
, qtsvg
, qtgraphicaleffects
, qtquickcontrols2
, wrapQtAppsHook
, stdenvNoCC
, fetchFromGitHub
}:
stdenvNoCC.mkDerivation
rec {
pname = "tokyo-night-sddm";
version = "1..0";
dontBuild = true;
src = fetchFromGitHub {
owner = "rototrash";
repo = "tokyo-night-sddm";
rev = "320c8e74ade1e94f640708eee0b9a75a395697c6";
sha256 = "sha256-JRVVzyefqR2L3UrEK2iWyhUKfPMUNUnfRZmwdz05wL0=";
};
nativeBuildInputs = [
wrapQtAppsHook
];
propagatedUserEnvPkgs = [
qtbase
qtsvg
qtgraphicaleffects
qtquickcontrols2
];
installPhase = ''
mkdir -p $out/share/sddm/themes
cp -aR $src $out/share/sddm/themes/tokyo-night-sddm
'';
}