rustboro: added initial impermanence settings

This commit is contained in:
Aly Raffauf 2024-04-02 02:08:25 -04:00
parent df4410ae77
commit a0f67b3a10
5 changed files with 72 additions and 4 deletions

View file

@ -200,6 +200,21 @@
"type": "github" "type": "github"
} }
}, },
"impermanence": {
"locked": {
"lastModified": 1708968331,
"narHash": "sha256-VUXLaPusCBvwM3zhGbRIJVeYluh2uWuqtj4WirQ1L9Y=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "a33ef102a02ce77d3e39c25197664b7a636f9c30",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"nixos-hardware": { "nixos-hardware": {
"locked": { "locked": {
"lastModified": 1711352745, "lastModified": 1711352745,
@ -285,6 +300,7 @@
"home-manager": "home-manager", "home-manager": "home-manager",
"home-manager-unstable": "home-manager-unstable", "home-manager-unstable": "home-manager-unstable",
"hyprland": "hyprland", "hyprland": "hyprland",
"impermanence": "impermanence",
"nixos-hardware": "nixos-hardware", "nixos-hardware": "nixos-hardware",
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"nixpkgs-unstable": "nixpkgs-unstable" "nixpkgs-unstable": "nixpkgs-unstable"

View file

@ -23,6 +23,8 @@
disko-unstable.url = "github:nix-community/disko"; disko-unstable.url = "github:nix-community/disko";
disko-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable"; disko-unstable.inputs.nixpkgs.follows = "nixpkgs-unstable";
impermanence.url = "github:nix-community/impermanence";
# Latest Hyprland # Latest Hyprland
hyprland.url = "github:hyprwm/Hyprland"; hyprland.url = "github:hyprwm/Hyprland";
@ -40,7 +42,7 @@
}; };
outputs = inputs@{ nixpkgs, nixpkgs-unstable, home-manager outputs = inputs@{ nixpkgs, nixpkgs-unstable, home-manager
, home-manager-unstable, nixos-hardware, disko, disko-unstable, ... }: { , home-manager-unstable, nixos-hardware, impermanence, disko, disko-unstable, ... }: {
homeConfigurations.aly = homeConfigurations.aly =
home-manager-unstable.lib.homeManagerConfiguration { home-manager-unstable.lib.homeManagerConfiguration {
@ -92,6 +94,7 @@
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
disko-unstable.nixosModules.disko disko-unstable.nixosModules.disko
impermanence.nixosModules.impermanence
nixos-hardware.nixosModules.lenovo-thinkpad-t440p nixos-hardware.nixosModules.lenovo-thinkpad-t440p
home-manager-unstable.nixosModules.home-manager home-manager-unstable.nixosModules.home-manager
./hosts/rustboro ./hosts/rustboro

View file

@ -1,6 +1,6 @@
# Lenovo Thinkpad T440p with a Core i5 4210M, 16GB RAM, 512GB SSD. # Lenovo Thinkpad T440p with a Core i5 4210M, 16GB RAM, 512GB SSD.
{ config, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = [ imports = [
@ -13,6 +13,41 @@
# Bootloader. # Bootloader.
loader.systemd-boot.enable = true; loader.systemd-boot.enable = true;
loader.efi.canTouchEfiVariables = true; loader.efi.canTouchEfiVariables = true;
# initrd.postDeviceCommands = lib.mkAfter ''
# mkdir /btrfs_tmp
# mount /dev/sda2 /btrfs_tmp
# if [[ -e /btrfs_tmp/rootfs ]]; then
# mkdir -p /btrfs_tmp/old_roots
# timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/rootfs)" "+%Y-%m-%-d_%H:%M:%S")
# mv /btrfs_tmp/rootfs "/btrfs_tmp/old_roots/$timestamp"
# fi
# delete_subvolume_recursively() {
# IFS=$'\n'
# for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do
# delete_subvolume_recursively "/btrfs_tmp/$i"
# done
# btrfs subvolume delete "$1"
# }
# for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +10); do
# delete_subvolume_recursively "$i"
# done
# btrfs subvolume create /btrfs_tmp/rootfs
# umount /btrfs_tmp
# '';
initrd.postDeviceCommands = lib.mkAfter ''
mkdir /btrfs_tmp
mount /dev/sda2 /btrfs_tmp
if [[ -e /btrfs_tmp/rootfs ]]; then
btrfs subvolume delete /btrfs_tmp/rootfs
fi
btrfs subvolume create /btrfs_tmp/rootfs
umount /btrfs_tmp
'';
}; };
networking.hostName = "rustboro"; # Define your hostname. networking.hostName = "rustboro"; # Define your hostname.
@ -40,5 +75,15 @@
users.users.aly.hashedPassword = users.users.aly.hashedPassword =
"$y$j9T$VdtiEyMOegHpcUwgmCVFD0$K8Ne6.zk//VJNq2zxVQ0xE0Wg3LohvAQd3Xm9aXdM15"; "$y$j9T$VdtiEyMOegHpcUwgmCVFD0$K8Ne6.zk//VJNq2zxVQ0xE0Wg3LohvAQd3Xm9aXdM15";
environment.persistence."/persist" = {
hideMounts = true;
directories = [
"/etc/NetworkManager/system-connections"
];
files = [
"/etc/machine-id"
];
};
system.stateVersion = "23.11"; # Did you read the comment? system.stateVersion = "23.11"; # Did you read the comment?
} }

View file

@ -11,7 +11,7 @@
priority = 1; priority = 1;
name = "ESP"; name = "ESP";
start = "1M"; start = "1M";
end = "128M"; end = "512M";
type = "EF00"; type = "EF00";
content = { content = {
type = "filesystem"; type = "filesystem";
@ -31,7 +31,7 @@
"rootfs" = { mountpoint = "/"; }; "rootfs" = { mountpoint = "/"; };
# For use with future impermanence setups # For use with future impermanence setups
"persistent" = { "persistent" = {
mountpoint = "/persistent"; mountpoint = "/persist";
mountOptions = [ "compress=zstd" ]; mountOptions = [ "compress=zstd" ];
}; };
# Subvolume name is the same as the mountpoint # Subvolume name is the same as the mountpoint

View file

@ -19,6 +19,10 @@
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/persist" = {
neededForBoot = true;
};
networking.useDHCP = lib.mkDefault true; networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";