Move from ZFS to btrfs
This commit is contained in:
@@ -1,11 +1,23 @@
|
|||||||
((nil
|
((nil
|
||||||
. ((eval . (defun dots/install-to-vm (clean-first?)
|
. ((eval
|
||||||
|
. (defun dots/install-to-vm (clean-first?)
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(let ((dest "/ssh:root@192.168.122.116:/nixos")
|
(let ((dest-directory "/ssh:root@192.168.122.116:/nixos")
|
||||||
(root (project-root (project-current))))
|
(root (project-root (project-current)))
|
||||||
|
(ignored-paths '(".jj" ".git" ".gitignore" ".dir-locals.el")))
|
||||||
(progn
|
(progn
|
||||||
|
;; (message "Tangling...")
|
||||||
|
;; (org-babel-tangle-file (file-name-concat root "README.org"))
|
||||||
(when clean-first?
|
(when clean-first?
|
||||||
(delete-directory dest t))
|
(delete-directory dest t))
|
||||||
(org-babel-tangle-file (file-name-concat root "README.org"))
|
(make-directory dest-directory t)
|
||||||
(copy-file root dest)
|
(let ((files-to-install
|
||||||
|
(--> (directory-files root)
|
||||||
|
(-filter (lambda (x) (not (memq x ignored-paths))) it))))
|
||||||
|
(dolist (file-src files-to-install)
|
||||||
|
(let ((file-dest-directory
|
||||||
|
(file-name-concat dest-directory
|
||||||
|
(file-name-directory file-src))))
|
||||||
|
(make-directory file-dest-directory t)
|
||||||
|
(copy-file file file-dest-directory))))
|
||||||
(message "Finished installing to VM!"))))))))
|
(message "Finished installing to VM!"))))))))
|
||||||
|
|||||||
@@ -7,11 +7,11 @@
|
|||||||
|
|
||||||
sydnix = {
|
sydnix = {
|
||||||
impermanence = {
|
impermanence = {
|
||||||
enable = true;
|
enable = false;
|
||||||
directories = [
|
directories = [
|
||||||
# Warning: Neither /var/lib/nixos nor any of its parents are persisted.
|
# "Warning: Neither /var/lib/nixos nor any of its parents are persisted.
|
||||||
# This means all users/groups without specified uids/gids will have them
|
# This means all users/groups without specified uids/gids will have them
|
||||||
# reassigned on reboot.
|
# reassigned on reboot."
|
||||||
"/var/lib/nixos"
|
"/var/lib/nixos"
|
||||||
"/etc/ssh"
|
"/etc/ssh"
|
||||||
];
|
];
|
||||||
@@ -30,11 +30,11 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
systemd.enable = true;
|
systemd.enable = true;
|
||||||
|
|
||||||
systemd.initrdBin = with pkgs; [
|
# systemd.initrdBin = with pkgs; [
|
||||||
zfs
|
# zfs
|
||||||
coreutils
|
# coreutils
|
||||||
babashka
|
# babashka
|
||||||
];
|
# ];
|
||||||
};
|
};
|
||||||
|
|
||||||
loader = {
|
loader = {
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode disko /nixos/hosts/nixos-testbed/disko-config.nix
|
# sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode disko /persist/dots/hosts/nixos-testbed/disko-config.nix
|
||||||
# time sudo nixos-install --flake /nixos#nixos-testbed
|
# time sudo nixos-install --flake /persist/dots#nixos-testbed
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
{
|
{
|
||||||
# imports = [ disko.nixosModules.disko ];
|
# imports = [ disko.nixosModules.disko ];
|
||||||
boot.zfs.extraPools = [ "rpool" ];
|
boot.initrd.supportedFilesystems.btrfs = true;
|
||||||
boot.zfs.devNodes = "/dev/disk/by-path";
|
boot.supportedFilesystems.btrfs = true;
|
||||||
boot.initrd.supportedFilesystems = [ "zfs" ];
|
|
||||||
boot.supportedFilesystems = [ "zfs" ];
|
fileSystems."/persist".neededForBoot = true;
|
||||||
|
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
disk = {
|
disk = {
|
||||||
broot = {
|
bootroot = {
|
||||||
type = "disk";
|
type = "disk";
|
||||||
device = "/dev/vda";
|
device = "/dev/sda";
|
||||||
content = {
|
content = {
|
||||||
type = "gpt";
|
type = "gpt";
|
||||||
partitions = {
|
partitions = {
|
||||||
@@ -29,63 +29,42 @@
|
|||||||
root = {
|
root = {
|
||||||
size = "100%";
|
size = "100%";
|
||||||
content = {
|
content = {
|
||||||
type = "zfs";
|
type = "btrfs";
|
||||||
pool = "rpool";
|
|
||||||
};
|
mountpoint = "/partition-root";
|
||||||
};
|
swap.swapfile.size = "4G";
|
||||||
};
|
|
||||||
};
|
# Override existing partitions.
|
||||||
};
|
extraArgs = [ "-f" ];
|
||||||
};
|
|
||||||
zpool = {
|
# Subvolumes must set a mountpoint in order to be mounted,
|
||||||
rpool = {
|
# *unless their parent is mounted*.
|
||||||
type = "zpool";
|
subvolumes = {
|
||||||
datasets =
|
# Subvolume names do not necessarily correspond to
|
||||||
let dataset = options:
|
# mountpoints, despite the structural resemblance to a file
|
||||||
let default = {
|
# path.
|
||||||
type = "zfs_fs";
|
"/rootfs" = {
|
||||||
mountOptions = [ "noauto" ];
|
|
||||||
options = {
|
|
||||||
"com.sun:auto-snapshot" = "false";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in lib.recursiveUpdate default options;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
"local" = dataset {};
|
|
||||||
"darlings" = dataset {};
|
|
||||||
"local/root" = dataset {
|
|
||||||
mountpoint = "/";
|
mountpoint = "/";
|
||||||
postCreateHook = ''
|
|
||||||
zfs list -t snapshot -H -o name \
|
|
||||||
| grep -E '^rpool/local/root@blank$' \
|
|
||||||
|| zfs snapshot rpool/local/root@blank
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
"local/nix" = dataset { mountpoint = "/nix"; };
|
"/nix" = {
|
||||||
"local/home" = dataset {
|
mountpoint = "/nix";
|
||||||
mountpoint = "/home";
|
|
||||||
postCreateHook = ''
|
|
||||||
zfs list -t snapshot -H -o name \
|
|
||||||
| grep -E '^rpool/local/home@blank$' \
|
|
||||||
|| zfs snapshot rpool/local/home@blank
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
"darlings/persist" = dataset { mountpoint = "/persist"; };
|
"/persist" = {
|
||||||
"darlings/home" = dataset {
|
mountpoint = "/persist";
|
||||||
|
};
|
||||||
|
"/persist/home" = {
|
||||||
mountpoint = "/persist/home";
|
mountpoint = "/persist/home";
|
||||||
};
|
};
|
||||||
"reserved" = dataset {
|
"/swap" = {
|
||||||
options = {
|
mountpoint = "/.swapvol";
|
||||||
canmount = "off";
|
swap.swapfile.size = "4G";
|
||||||
mountpoint = "none";
|
};
|
||||||
reservation = "5GiB";
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSystems."/persist".neededForBoot = true;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user