dotfiles/nixos/systems/inkbook/filesystems.nix

101 lines
2.4 KiB
Nix
Raw Normal View History

# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
#
# SPDX-License-Identifier: LGPL-3.0-or-later
{lib, ...}: let
inherit
(lib)
singleton
;
in {
disko.rootMountPoint = "/mnt/inkbook";
disko.devices = {
disk.boot = {
type = "disk";
device = "/dev/sdb";
content = {
type = "gpt";
partitions = {
boot = {
device = "/dev/mmcblk0p1";
start = "10M";
size = "1024M";
priority = 0;
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
swap = {
device = "/dev/mmcblk0p2";
size = "1024M";
priority = 1;
content = {
type = "swap";
};
};
root = {
device = "/dev/mmcblk0p3";
size = "100%";
priority = 2;
content = {
type = "filesystem";
format = "f2fs";
mountpoint = "/root-partition";
};
};
};
};
};
nodev."/" = {
fsType = "tmpfs";
mountOptions = ["defaults" "size=128M" "mode=755" "noexec"];
};
};
fileSystems = {
"/root-partition" = {
noCheck = true;
neededForBoot = true;
};
"/nix" = {
device = "/root-partition/nix";
options = ["bind"];
neededForBoot = true;
};
"/home" = {
device = "/root-partition/home";
options = ["bind"];
neededForBoot = true;
};
"/var/lib/nixos" = {
device = "/root-partition/var/lib/nixos";
options = ["bind"];
};
"/var/log" = {
device = "/root-partition/var/log";
options = ["bind"];
};
};
systemd.tmpfiles.rules = [
"d /root-partition/etc/ssh - - - - -"
];
system.activationScripts = {
machine-id = ''
ln -sf /root-partition/etc/machine-id /etc/machine-id
'';
};
environment.etc."ssh/ssh_host_rsa_key".source = "/root-partition/etc/ssh/ssh_host_rsa_key";
environment.etc."ssh/ssh_host_rsa_key.pub".source = "/root-partition/etc/ssh/ssh_host_rsa_key.pub";
environment.etc."ssh/ssh_host_ed25519_key".source = "/root-partition/etc/ssh/ssh_host_ed25519_key";
environment.etc."ssh/ssh_host_ed25519_key.pub".source = "/root-partition/etc/ssh/ssh_host_ed25519_key.pub";
}