Remove impermanence home-manager module

Too many bugs to deal with unfortunately.

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2024-07-31 09:56:59 +01:00
parent 8988398bff
commit d54df170cd
20 changed files with 102 additions and 194 deletions

View File

@@ -28,7 +28,10 @@
};
};
fileSystems."/persist".neededForBoot = true;
fileSystems = {
"/persist".neededForBoot = true;
"/cache".neededForBoot = true;
};
environment.persistence."/persist" = {
hideMounts = true;

View File

@@ -3,7 +3,6 @@
}:
{ config, pkgs, ... }:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
@@ -20,11 +19,10 @@ in
users.users.${username}.extraGroups = [ "adbusers" ];
home-manager.users.${username}.home = {
sessionVariables.ANDROID_USER_HOME = "${hmConfig.xdg.dataHome}/android";
persistence."/persist${userConfig.home}".files = [
"${hmConfig.xdg.dataHome}/android/adbkey"
"${hmConfig.xdg.dataHome}/android/adbkey.pub"
];
};
environment.persistence."/persist".users.${username}.files = [
"${hmConfig.xdg.relativeDataHome}/android/adbkey"
"${hmConfig.xdg.relativeDataHome}/android/adbkey.pub"
];
home-manager.users.${username}.home.sessionVariables.ANDROID_USER_HOME = "${hmConfig.xdg.dataHome}/android";
}

View File

@@ -26,9 +26,6 @@
};
};
# This is not set though home-manager because we need to hide the mount
# otherwise docker complains with the following error:
# dockerd-rootless: failed to start daemon: error initializing graphdriver: prerequisites for driver not satisfied (wrong filesystem?): btrfs
environment.persistence."/persist".users.${username}.directories = [ ".local/share/docker" ];
home-manager.users.${username}.home.packages = with pkgs; [ docker-compose ];

View File

@@ -1,31 +0,0 @@
{
username ? throw "username argument is required",
}:
{
config,
inputs,
lib,
...
}:
let
userConfig = config.users.users.${username};
in
{
programs.fuse.userAllowOther = true;
systemd.tmpfiles.rules = ([
"d /persist/home 0755 root root -"
"d /cache/home 0755 root root -"
"d /persist${userConfig.home} 0700 ${username} users -"
"d /cache${userConfig.home} 0700 ${username} users -"
]);
home-manager.users.${username} = {
imports = [ inputs.impermanence.nixosModules.home-manager.impermanence ];
home.persistence = {
"/persist${userConfig.home}".allowOther = true;
"/cache${userConfig.home}".allowOther = true;
};
};
}

View File

@@ -12,14 +12,12 @@ let
sopsKeyPath = ".config/sops-nix/key.txt";
in
{
environment.persistence."/persist".users.${username}.files = [ sopsKeyPath ];
home-manager.users.${username} = {
imports = [ inputs.sops-nix.homeManagerModules.sops ];
sops.age.keyFile = "${userConfig.home}/${sopsKeyPath}";
home = {
persistence."/persist${userConfig.home}".files = [ sopsKeyPath ];
sessionVariables.SOPS_AGE_KEY_FILE = "${userConfig.home}/${sopsKeyPath}";
};
home.sessionVariables.SOPS_AGE_KEY_FILE = "${userConfig.home}/${sopsKeyPath}";
};
}

View File

@@ -1,17 +1,7 @@
{
username ? throw "username argument is required",
}:
{
config,
inputs,
lib,
pkgs,
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{ config, ... }:
{
networking.firewall = {
allowedTCPPorts = [ 22000 ];
@@ -50,25 +40,6 @@ in
};
};
systemd.user.services.syncthing.Unit.After =
let
inherit (pkgs.callPackage "${inputs.impermanence}/lib.nix" { }) mkServiceName parentsOf;
removeHomePrefix =
path: lib.strings.removePrefix "~/" (lib.strings.removePrefix "${userConfig.home}/" path);
syncthingFolders = builtins.map (folder: removeHomePrefix folder.path) (
builtins.attrValues hmConfig.services.syncthing.settings.folders
);
in
lib.lists.flatten (
builtins.map (
persistence:
builtins.map (folder: "${mkServiceName persistence.persistentStoragePath folder}.service") (
builtins.filter (folder: builtins.elem folder persistence.directories) (
lib.lists.unique (lib.lists.flatten (builtins.map parentsOf syncthingFolders))
)
)
) (builtins.attrValues hmConfig.home.persistence)
)
++ [ "sops-nix.service" ];
systemd.user.services.syncthing.Unit.After = [ "sops-nix.service" ];
};
}

View File

@@ -1,17 +1,24 @@
{
username ? throw "username argument is required",
}:
{
config,
lib,
pkgs,
...
}:
{ config, pkgs, ... }:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
environment.persistence."/persist".users.${username}.directories = with hmConfig.xdg.userDirs; [
relativeDesktop
relativeDocuments
relativeDownload
relativeMusic
relativePictures
relativeTemplates
relativeVideos
"VMs"
"git"
];
home-manager.users.${username} = {
imports = [ ./options.nix ];
@@ -33,19 +40,6 @@ in
};
};
home = {
packages = with pkgs; [ xdg-utils ];
persistence."/persist${userConfig.home}".directories = with hmConfig.xdg.userDirs; [
relativeDesktop
relativeDocuments
relativeDownload
relativeMusic
relativePictures
relativeTemplates
relativeVideos
"VMs"
"git"
];
};
home.packages = with pkgs; [ xdg-utils ];
};
}

View File

@@ -3,11 +3,13 @@
}:
{ config, ... }:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
environment.sessionVariables.ZDOTDIR = "$HOME/.config/zsh";
environment = {
sessionVariables.ZDOTDIR = "$HOME/.config/zsh";
persistence."/persist".users.${username}.directories = [ "${hmConfig.xdg.relativeDataHome}/zsh" ];
};
home-manager.users.${username} = {
programs.zsh = {
@@ -23,9 +25,6 @@ in
syntaxHighlighting.enable = true;
};
home = {
file.".zshenv".enable = false;
persistence."/persist${userConfig.home}".directories = [ "${hmConfig.xdg.relativeDataHome}/zsh" ];
};
home.file.".zshenv".enable = false;
};
}

View File

@@ -1,15 +1,7 @@
{
username ? throw "username argument is required",
}:
{
config,
lib,
pkgs,
...
}:
let
userConfig = config.users.users.${username};
in
{ ... }:
{
programs.chromium = {
enable = true;
@@ -26,6 +18,11 @@ in
};
};
environment.persistence = {
"/persist".users.${username}.directories = [ ".config/chromium" ];
"/cache".users.${username}.directories = [ ".cache/chromium" ];
};
home-manager.users.${username} = {
programs.chromium = {
enable = true;
@@ -42,10 +39,5 @@ in
"fpnmgdkabkmnadcjpehmlllkndpkmiak" # Wayback Machine
];
};
home.persistence = {
"/persist${userConfig.home}".directories = [ ".config/chromium" ];
"/cache${userConfig.home}".directories = [ ".cache/chromium" ];
};
};
}

View File

@@ -8,20 +8,18 @@
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
environment.persistence."/cache".users.${username}.directories = [
"${hmConfig.xdg.relativeCacheHome}/cliphist"
];
home-manager.users.${username} = {
home = {
packages = with pkgs; [
wl-clipboard
cliphist
];
persistence."/cache${userConfig.home}".directories = [
"${hmConfig.xdg.relativeCacheHome}/cliphist"
];
};
home.packages = with pkgs; [
wl-clipboard
cliphist
];
systemd.user.services = {
cliphist = {

View File

@@ -7,10 +7,12 @@
pkgs,
...
}:
let
userConfig = config.users.users.${username};
in
{
environment.persistence = {
"/persist".users.${username}.directories = [ ".mozilla" ];
"/cache".users.${username}.directories = [ ".cache/mozilla" ];
};
home-manager.users.${username} = {
programs.firefox = {
enable = true;
@@ -99,10 +101,5 @@ in
home.sessionVariables.DEFAULT_BROWSER = lib.meta.getExe pkgs.firefox;
wayland.windowManager.hyprland.settings.bind = [ "$mod, b, exec, ${lib.meta.getExe pkgs.firefox}" ];
home.persistence = {
"/persist${userConfig.home}".directories = [ ".mozilla" ];
"/cache${userConfig.home}".directories = [ ".cache/mozilla" ];
};
};
}

View File

@@ -8,10 +8,13 @@
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
environment.persistence."/cache".users.${username}.directories = [
"${hmConfig.xdg.relativeCacheHome}/kitty"
];
home-manager.users.${username} = {
programs.kitty = {
enable = true;
@@ -41,9 +44,5 @@ in
)
} &";
};
home.persistence."/cache${userConfig.home}".directories = [
"${hmConfig.xdg.relativeCacheHome}/kitty"
];
};
}

View File

@@ -8,10 +8,13 @@
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
environment.persistence."/cache".users.${username}.directories = [
"${hmConfig.xdg.relativeConfigHome}/obsidian"
];
home-manager.users.${username} = {
imports = [ ./options.nix ];
@@ -712,7 +715,5 @@ in
sops.secrets."google/geocoding" = { };
wayland.windowManager.hyprland.settings.bind = [ "$mod, o, exec, ${pkgs.obsidian}/bin/obsidian" ];
home.persistence."/cache${userConfig.home}".directories = [ ".config/obsidian" ];
};
}

View File

@@ -8,7 +8,6 @@
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
@@ -20,13 +19,12 @@ in
})
];
environment.persistence."/cache".users.${username}.files = [
"${hmConfig.xdg.relativeConfigHome}/qalculate/qalculate-gtk.history"
];
home-manager.users.${username} = {
home = {
packages = with pkgs; [ qalculate-gtk ];
persistence."/cache${userConfig.home}".files = [
"${hmConfig.xdg.relativeConfigHome}/qalculate/qalculate-gtk.history"
];
};
home.packages = with pkgs; [ qalculate-gtk ];
xdg.configFile."qalculate/qalculate-gtk.cfg".source =
(pkgs.formats.ini { }).generate "qalculate-gtk.cfg"

View File

@@ -8,10 +8,13 @@
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
environment.persistence."/cache".users.${username}.directories = [
"${hmConfig.xdg.relativeCacheHome}/rofi"
];
home-manager.users.${username} = {
programs.rofi = {
enable = true;
@@ -19,10 +22,6 @@ in
font = builtins.head hmConfig.theme.font.monospace.names;
};
home.persistence."/cache${userConfig.home}".directories = [
"${hmConfig.xdg.relativeCacheHome}/rofi"
];
wayland.windowManager.hyprland.settings.bind = [
"$mod, r, exec, ${lib.meta.getExe pkgs.rofi-wayland} -cache-dir ${hmConfig.xdg.cacheHome}/rofi -show drun"
];

View File

@@ -8,7 +8,6 @@
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
@@ -17,6 +16,11 @@ in
allowedUDPPorts = [ 5353 ];
};
environment.persistence = {
"/persist".users.${username}.directories = [ "${hmConfig.xdg.relativeConfigHome}/spotify" ];
"/cache".users.${username}.directories = [ "${hmConfig.xdg.relativeCacheHome}/spotify" ];
};
home-manager.users.${username} = {
imports = [ inputs.spicetify-nix.homeManagerModules.default ];
@@ -57,10 +61,5 @@ in
};
theme.templates."${hmConfig.xdg.configHome}/spotify/colors.css".source = ./colors.css;
home.persistence = {
"/persist${userConfig.home}".directories = [ "${hmConfig.xdg.relativeConfigHome}/spotify" ];
"/cache${userConfig.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/spotify" ];
};
};
}

View File

@@ -8,7 +8,6 @@
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
themeSwww = lib.meta.getExe (
pkgs.writeShellApplication {
@@ -22,11 +21,12 @@ let
);
in
{
environment.persistence."/cache".users.${username}.directories = [
"${hmConfig.xdg.relativeCacheHome}/swww"
];
home-manager.users.${username} = {
home = {
packages = with pkgs; [ swww ];
persistence."/cache${userConfig.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/swww" ];
};
home.packages = with pkgs; [ swww ];
systemd.user.services.swww = {
Unit = {

View File

@@ -9,11 +9,14 @@
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
themeBin = lib.meta.getExe hmConfig.theme.pkg;
in
{
environment.persistence."/persist".users.${username}.directories = [
"${hmConfig.xdg.relativeConfigHome}/theme"
];
home-manager.users.${username} = {
imports = [ ./options.nix ];
@@ -23,9 +26,5 @@ in
"Ctrl_Alt, r, exec, ${themeBin}"
"Ctrl_Alt, t, exec, ${themeBin} toggle"
];
home.persistence."/persist${userConfig.home}".directories = [
"${hmConfig.xdg.relativeConfigHome}/theme"
];
};
}

View File

@@ -3,16 +3,32 @@
}:
{
config,
inputs,
lib,
pkgs,
...
}:
let
userConfig = config.users.users.${username};
hmConfig = config.home-manager.users.${username};
in
{
environment.persistence = {
"/persist".users.${username}.directories = [ ".config/Code" ];
# Bastard: https://github.com/microsoft/vscode/issues/3884
"/cache".users.${username}.directories = [
".config/Code/Cache"
".config/Code/CachedConfigurations"
".config/Code/CachedData"
".config/Code/CachedExtensionVSIXs"
".config/Code/CachedExtensions"
".config/Code/CachedProfilesData"
".config/Code/Code Cache"
".config/Code/DawnCache"
".config/Code/GPUCache"
".config/Code/Service Worker/CacheStorage"
".config/Code/Service Worker/ScriptCache"
];
};
home-manager.users.${username} = {
programs.vscode = {
enable = true;
@@ -81,23 +97,5 @@ in
};
imports = [ ./langs/nix.nix ];
home.persistence = {
"/persist${userConfig.home}".directories = [ ".config/Code" ];
# Bastard: https://github.com/microsoft/vscode/issues/3884
"/cache${userConfig.home}".directories = [
".config/Code/Cache"
".config/Code/CachedConfigurations"
".config/Code/CachedData"
".config/Code/CachedExtensionVSIXs"
".config/Code/CachedExtensions"
".config/Code/CachedProfilesData"
".config/Code/Code Cache"
".config/Code/DawnCache"
".config/Code/GPUCache"
".config/Code/Service Worker/CacheStorage"
".config/Code/Service Worker/ScriptCache"
];
};
};
}

View File

@@ -17,7 +17,6 @@ in
(import ../common/user/configs/console/gpg-agent { inherit username; })
(import ../common/user/configs/console/home-manager { inherit username; })
(import ../common/user/configs/console/imagemagick { inherit username; })
(import ../common/user/configs/console/impermanence { inherit username; })
(import ../common/user/configs/console/neovim { inherit username; })
(import ../common/user/configs/console/nixpkgs { inherit username; })
(import ../common/user/configs/console/pipewire { inherit username; })