mirror of
https://github.com/CHN-beta/nixos.git
synced 2024-10-23 15:29:10 +08:00
create current rootfs at boot
This commit is contained in:
parent
318e185217
commit
037add7ab3
@ -2,7 +2,6 @@ inputs:
|
|||||||
{
|
{
|
||||||
config =
|
config =
|
||||||
{
|
{
|
||||||
|
|
||||||
# filesystem mount
|
# filesystem mount
|
||||||
fileSystems =
|
fileSystems =
|
||||||
{
|
{
|
||||||
@ -93,7 +92,24 @@ inputs:
|
|||||||
# initrd, luks
|
# initrd, luks
|
||||||
boot.initrd =
|
boot.initrd =
|
||||||
{
|
{
|
||||||
systemd.enable = true;
|
systemd =
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
services.create-current-rootfs =
|
||||||
|
{
|
||||||
|
wantedBy = [ "cryptsetup.target" ];
|
||||||
|
after = [ "cryptsetup.target" ];
|
||||||
|
before = [ "local-fs.target" ];
|
||||||
|
unitConfig.DefaultDependencies = false;
|
||||||
|
serviceConfig.Type = "oneshot";
|
||||||
|
script =
|
||||||
|
''
|
||||||
|
mount /dev/mapper/root /mnt -m
|
||||||
|
btrfs subvolume create /mnt/nix/rootfs/current
|
||||||
|
unmount /mnt
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
# modules in initrd
|
# modules in initrd
|
||||||
# modprobe --show-depends
|
# modprobe --show-depends
|
||||||
availableKernelModules =
|
availableKernelModules =
|
||||||
|
Loading…
Reference in New Issue
Block a user