From c96a8b6b93efcbbb7ab01a81a7ba155be3bdfd2a Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 6 Mar 2023 13:20:05 +0900 Subject: [PATCH] Try to use impermanence --- flake.lock | 16 +++++++++++ flake.nix | 4 +++ hosts/fuhen/hardware-configuration.nix | 6 ++++ modules/nixos/games/default.nix | 1 + modules/nixos/nix/default.nix | 39 ++++++++++++++++++++++++-- modules/nixos/wayland/default.nix | 2 +- 6 files changed, 65 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 52965d9..9fe2a4f 100644 --- a/flake.lock +++ b/flake.lock @@ -129,6 +129,21 @@ "type": "github" } }, + "impermanence": { + "locked": { + "lastModified": 1675359654, + "narHash": "sha256-FPxzuvJkcO49g4zkWLSeuZkln54bLoTtrggZDJBH90I=", + "owner": "nix-community", + "repo": "impermanence", + "rev": "6138eb8e737bffabd4c8fc78ae015d4fd6a7e2fd", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "impermanence", + "type": "github" + } + }, "jq": { "flake": false, "locked": { @@ -290,6 +305,7 @@ "inputs": { "home-manager": "home-manager", "hyprland": "hyprland", + "impermanence": "impermanence", "jq": "jq", "neovim-nightly": "neovim-nightly", "nix-colors": "nix-colors", diff --git a/flake.nix b/flake.nix index 684fb27..cd99df1 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,10 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + impermanence = { + url = "github:nix-community/impermanence"; + inputs.nixpkgs.follows = "nixpkgs"; + }; hyprland = { url = "github:hyprwm/Hyprland/v0.22.0beta"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/hosts/fuhen/hardware-configuration.nix b/hosts/fuhen/hardware-configuration.nix index f2dae96..e1fd876 100644 --- a/hosts/fuhen/hardware-configuration.nix +++ b/hosts/fuhen/hardware-configuration.nix @@ -15,6 +15,12 @@ boot.extraModulePackages = []; fileSystems."/" = { + device = "none"; + fsType = "tmpfs"; + options = [ "size=4G" "mode=755" ]; + }; + + fileSystems."/nix" = { device = "/dev/disk/by-uuid/e8f1fdc5-c5fc-4468-b92a-63b7b4093345"; fsType = "ext4"; }; diff --git a/modules/nixos/games/default.nix b/modules/nixos/games/default.nix index 55057a1..cb2e258 100644 --- a/modules/nixos/games/default.nix +++ b/modules/nixos/games/default.nix @@ -5,6 +5,7 @@ in { config = lib.mkIf cfg.enable { services.flatpak.enable = true; + hardware.steam-hardware.enable = true; hardware.opengl.driSupport32Bit = true; environment.systemPackages = with pkgs; [ wineWowPackages.stable diff --git a/modules/nixos/nix/default.nix b/modules/nixos/nix/default.nix index 0fbf3e8..9864aa9 100644 --- a/modules/nixos/nix/default.nix +++ b/modules/nixos/nix/default.nix @@ -1,25 +1,60 @@ { lib, config, + impermanence, ... }: let cfg = config.nixconf; in { + imports = [ impermanence.nixosModules.impermanence ]; options.nixconf = {enable = lib.mkEnableOption "nix";}; config = lib.mkIf cfg.enable { + nix = { - settings.auto-optimise-store = true; + settings = { + auto-optimise-store = true; + warn-dirty = false; + experimental-features = ["nix-command" "flakes"]; + }; gc = { automatic = true; dates = "weekly"; options = "--delete-older-than 14d"; }; extraOptions = '' - experimental-features = nix-command flakes keep-outputs = true keep-derivations = true ''; }; nixpkgs.config.allowUnfree = true; + + environment.persistence."/nix/persist" = { + hideMounts = true; + directories = [ + "/var/log" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + "/var/lib/docker" + "/etc/NetworkManager/system-connections" + ]; + files = [ + "/etc/machine-id" + ]; + users.zoriya = { + directories = [ + "downloads" + "stuff" + "projects" + { directory = ".gnupg"; mode = "0700"; } + { directory = ".ssh"; mode = "0700"; } + ".local/share/direnv" + ".local/share/flatpak" + ".local/share/atuin" + ".config/google-chrome" + ]; + files = [ ]; + }; + }; }; } diff --git a/modules/nixos/wayland/default.nix b/modules/nixos/wayland/default.nix index 1b7decc..9bfaf93 100644 --- a/modules/nixos/wayland/default.nix +++ b/modules/nixos/wayland/default.nix @@ -22,7 +22,7 @@ in { alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; - #wireplumber.enable = true; + wireplumber.enable = true; }; # Autostart hyprland and display lockscreen as greeter