diff --git a/etcnixos/hardware_desktop.nix b/etcnixos/hardware_desktop.nix deleted file mode 100644 index c1e2481..0000000 --- a/etcnixos/hardware_desktop.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ - config, - lib, - pkgs, - modulesPath, - ... -}: -{ - fileSystems."/" = { - device = "/dev/disk/by-uuid/ff51be5a-b87b-4e6a-9c1d-796ceeaca153"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/3D37-E610"; - fsType = "vfat"; - options = [ - "fmask=0022" - "dmask=0022" - ]; - }; - - fileSystems."/media/games" = { - device = "/dev/disk/by-uuid/1878136e-765d-4784-b204-3536ab4fdac8"; - fsType = "f2fs"; - options = [ "nofail" ]; - }; - -} diff --git a/etcnixos/impermanence-disk-config.nix b/etcnixos/impermanence-disk-config.nix new file mode 100644 index 0000000..4c091c1 --- /dev/null +++ b/etcnixos/impermanence-disk-config.nix @@ -0,0 +1,52 @@ +{ + disko.devices = { + disk = { + main = { + type = "disk"; + content = { + type = "gpt"; + partitions = { + ESP = { + type = "EF00"; + size = "500M"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + persistent = { + size = "100%"; + content = { + type = "filesystem"; + format = "f2fs"; + mountpoint = "/persistent"; + }; + }; + nix = { + size = "200G"; + content = { + type = "filesystem"; + format = "f2fs"; + mountpoint = "/nix"; + }; + }; + }; + }; + }; + }; + nodev = { + "/" = { + fsType = "tmpfs"; + mountOptions = [ + "defaults" + "size=2G" + "mode=755" + ]; + }; + }; + }; + + fileSystems."/persistent".neededForBoot = true; + fileSystems."/nix".neededForBoot = true; +} diff --git a/etcnixos/impermanence.nix b/etcnixos/impermanence.nix new file mode 100644 index 0000000..2f8600d --- /dev/null +++ b/etcnixos/impermanence.nix @@ -0,0 +1,35 @@ +{ + config, + lib, + username, + ... +}: +{ + environment.persistence."/persistent" = { + hideMounts = true; + directories = [ + "/var/log" + "/var/lib/systemd/coredump" + "/var/lib/nixos" + "/var/lib/systemd/timers" + ]; + + files = [ + "/etc/ssh/ssh_host_ed25519_key" + "/etc/ssh/ssh_host_ed25519_key.pub" + "/etc/ssh/ssh_host_rsa_key" + "/etc/ssh/ssh_host_rsa_key.pub" + "/etc/machine-id" + ]; + + users.${username} = { + directories = [ + "." + ]; + }; + }; + + systemd.tmpfiles.rules = [ + "d /etc 755 root" + ]; +} diff --git a/etcnixos/system-yarn.nix b/etcnixos/system-yarn.nix index b0035f6..bc499e8 100644 --- a/etcnixos/system-yarn.nix +++ b/etcnixos/system-yarn.nix @@ -8,14 +8,23 @@ }: { imports = [ + ./impermanence-disk-config.nix ./common.nix - ./hardware_desktop.nix + ./impermanence.nix ./no-rgb.nix ./vr.nix inputs.nixos-hardware.nixosModules.common-cpu-amd-pstate inputs.nixos-hardware.nixosModules.common-cpu-amd-zenpower + inputs.impermanence.nixosModules.impermanence + inputs.disko.nixosModules.disko ]; + + fileSystems."/media/games" = { + device = "/dev/disk/by-uuid/1878136e-765d-4784-b204-3536ab4fdac8"; + fsType = "f2fs"; + options = [ "nofail" ]; + }; networking.hostId = "abf570f9"; services.openssh = { diff --git a/flake.lock b/flake.lock index 97940cb..d86b64d 100644 --- a/flake.lock +++ b/flake.lock @@ -154,6 +154,21 @@ "type": "github" } }, + "impermanence": { + "locked": { + "lastModified": 1737831083, + "narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, "lanzaboote": { "inputs": { "crane": "crane", @@ -344,6 +359,7 @@ "disko": "disko", "emacs-overlay": "emacs-overlay", "home-manager": "home-manager", + "impermanence": "impermanence", "lanzaboote": "lanzaboote", "niri": "niri", "nix-doom-emacs-unstraightened": "nix-doom-emacs-unstraightened", diff --git a/flake.nix b/flake.nix index a5db65c..743f7c5 100644 --- a/flake.nix +++ b/flake.nix @@ -52,6 +52,11 @@ inputs.nixpkgs.follows = "nixpkgs"; inputs.emacs-overlay.follows = "emacs-overlay"; }; + + impermanence = { + url = "github:nix-community/impermanence"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs =