Move from ZFS to btrfs
This commit is contained in:
@@ -1,11 +1,23 @@
|
||||
((nil
|
||||
. ((eval . (defun dots/install-to-vm (clean-first?)
|
||||
(interactive "P")
|
||||
(let ((dest "/ssh:root@192.168.122.116:/nixos")
|
||||
(root (project-root (project-current))))
|
||||
(progn
|
||||
(when clean-first?
|
||||
(delete-directory dest t))
|
||||
(org-babel-tangle-file (file-name-concat root "README.org"))
|
||||
(copy-file root dest)
|
||||
(message "Finished installing to VM!"))))))))
|
||||
. ((eval
|
||||
. (defun dots/install-to-vm (clean-first?)
|
||||
(interactive "P")
|
||||
(let ((dest-directory "/ssh:root@192.168.122.116:/nixos")
|
||||
(root (project-root (project-current)))
|
||||
(ignored-paths '(".jj" ".git" ".gitignore" ".dir-locals.el")))
|
||||
(progn
|
||||
;; (message "Tangling...")
|
||||
;; (org-babel-tangle-file (file-name-concat root "README.org"))
|
||||
(when clean-first?
|
||||
(delete-directory dest t))
|
||||
(make-directory dest-directory t)
|
||||
(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!"))))))))
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
|
||||
sydnix = {
|
||||
impermanence = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
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
|
||||
# reassigned on reboot.
|
||||
# reassigned on reboot."
|
||||
"/var/lib/nixos"
|
||||
"/etc/ssh"
|
||||
];
|
||||
@@ -30,11 +30,11 @@
|
||||
enable = true;
|
||||
systemd.enable = true;
|
||||
|
||||
systemd.initrdBin = with pkgs; [
|
||||
zfs
|
||||
coreutils
|
||||
babashka
|
||||
];
|
||||
# systemd.initrdBin = with pkgs; [
|
||||
# zfs
|
||||
# coreutils
|
||||
# babashka
|
||||
# ];
|
||||
};
|
||||
|
||||
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
|
||||
# time sudo nixos-install --flake /nixos#nixos-testbed
|
||||
# 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 /persist/dots#nixos-testbed
|
||||
{ lib, ... }:
|
||||
{
|
||||
# imports = [ disko.nixosModules.disko ];
|
||||
boot.zfs.extraPools = [ "rpool" ];
|
||||
boot.zfs.devNodes = "/dev/disk/by-path";
|
||||
boot.initrd.supportedFilesystems = [ "zfs" ];
|
||||
boot.supportedFilesystems = [ "zfs" ];
|
||||
boot.initrd.supportedFilesystems.btrfs = true;
|
||||
boot.supportedFilesystems.btrfs = true;
|
||||
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
|
||||
disko.devices = {
|
||||
disk = {
|
||||
broot = {
|
||||
bootroot = {
|
||||
type = "disk";
|
||||
device = "/dev/vda";
|
||||
device = "/dev/sda";
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
@@ -29,63 +29,42 @@
|
||||
root = {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "zfs";
|
||||
pool = "rpool";
|
||||
type = "btrfs";
|
||||
|
||||
mountpoint = "/partition-root";
|
||||
swap.swapfile.size = "4G";
|
||||
|
||||
# Override existing partitions.
|
||||
extraArgs = [ "-f" ];
|
||||
|
||||
# Subvolumes must set a mountpoint in order to be mounted,
|
||||
# *unless their parent is mounted*.
|
||||
subvolumes = {
|
||||
# Subvolume names do not necessarily correspond to
|
||||
# mountpoints, despite the structural resemblance to a file
|
||||
# path.
|
||||
"/rootfs" = {
|
||||
mountpoint = "/";
|
||||
};
|
||||
"/nix" = {
|
||||
mountpoint = "/nix";
|
||||
};
|
||||
"/persist" = {
|
||||
mountpoint = "/persist";
|
||||
};
|
||||
"/persist/home" = {
|
||||
mountpoint = "/persist/home";
|
||||
};
|
||||
"/swap" = {
|
||||
mountpoint = "/.swapvol";
|
||||
swap.swapfile.size = "4G";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
zpool = {
|
||||
rpool = {
|
||||
type = "zpool";
|
||||
datasets =
|
||||
let dataset = options:
|
||||
let default = {
|
||||
type = "zfs_fs";
|
||||
mountOptions = [ "noauto" ];
|
||||
options = {
|
||||
"com.sun:auto-snapshot" = "false";
|
||||
};
|
||||
};
|
||||
in lib.recursiveUpdate default options;
|
||||
in
|
||||
{
|
||||
"local" = dataset {};
|
||||
"darlings" = dataset {};
|
||||
"local/root" = dataset {
|
||||
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"; };
|
||||
"local/home" = dataset {
|
||||
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"; };
|
||||
"darlings/home" = dataset {
|
||||
mountpoint = "/persist/home";
|
||||
};
|
||||
"reserved" = dataset {
|
||||
options = {
|
||||
canmount = "off";
|
||||
mountpoint = "none";
|
||||
reservation = "5GiB";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user