1
Fork 0

Set up more persistent directories

This commit is contained in:
Matei Adriel 2023-12-12 14:32:06 +01:00
parent d93cb11e2f
commit 50152c3db8
No known key found for this signature in database
17 changed files with 106 additions and 75 deletions

View file

@ -23,7 +23,7 @@ This repo's structure is based on the concept of hosts - individual machines con
## File structure
| Location | Description |
| ---------------------------- | ---------------------------------------------------- |
| ---------------------------- | --------------------------------------------------- |
| [common](./common) | Configuration loaded on both nixos and home-manager |
| [devshells](./devshells) | Nix shells |
| [docs](./docs) | Additional documentation regarding my setup |
@ -34,7 +34,6 @@ This repo's structure is based on the concept of hosts - individual machines con
| [pkgs](./pkgs) | Nix packages |
| [flake.nix](./flake.nix) | Nix flake entrypoint! |
| [secrets.nix](./secrets.nix) | Agenix entrypoint |
| [bootstrap](./bootstrap) | Shell for bootstrapping on non flake-enabled systems |
| [stylua.toml](./stylua.toml) | Lua formatter config for the repo |
## Points of interest

View file

@ -5,6 +5,11 @@
package = pkgs.iosevka;
};
# monospace = {
# name = "Cascadia Code";
# package = pkgs.cascadia-code;
# };
sansSerif = {
name = "CMUSansSerif";
package = pkgs.cm_unicode;

View file

@ -1481,11 +1481,11 @@
]
},
"locked": {
"lastModified": 1700963402,
"narHash": "sha256-JhkanLmYRLekGOysO6JpCWKPlgRoemHPzUrARCGBqYA=",
"lastModified": 1702242899,
"narHash": "sha256-p2FmwhHlIW3V8YzlRu/bWCiKa2a9fSardt9Eh22JlWE=",
"owner": "hyprwm",
"repo": "contrib",
"rev": "65e567a81176d39be7ce6513d1af23954f00cbec",
"rev": "740dbac96354c076a76b7cf6fe70dad150d21659",
"type": "github"
},
"original": {

View file

@ -7,14 +7,5 @@
# Set up my custom imperanence wrapper
satellite.persistence = {
enable = true;
# Actual data/media (eg: projects, images, videos, etc)
at.data.path = "/persist/data";
# App state I want to keep
at.state.path = "/persist/state";
# App state which I should be able to delete at any point
at.cache.path = "/persist/cache";
};
}

View file

@ -18,4 +18,6 @@ in
};
programs.gpg.enable = true;
satellite.persistence.at.state.apps.gpg.directories = [ ".gnupg" ];
}

View file

@ -1,7 +1,7 @@
{
programs.intray = {
enable = true;
data-dir = "/persist/state/home/adrielus/Intray";
cache-dir = "/persist/local/cache/home/adrielus/Intray";
data-dir = "/persist/state/home/adrielus/intray";
cache-dir = "/persist/local/cache/home/adrielus/intray";
};
}

View file

@ -1,10 +1,7 @@
{ config, ... }: {
programs.smos = {
enable = true;
notify = {
enable = true;
};
notify.enable = true;
github = {
enable = true;

View file

@ -85,6 +85,7 @@ return {
end
end,
cond = env.vscode.not_active(),
enabled = false,
},
{

View file

@ -1,4 +1,3 @@
# TODO(imperanence): handle persistence of things like harpoon, lazy, etc
{ pkgs, lib, config, inputs, ... }:
let
# {{{ extraPackages
@ -326,7 +325,7 @@ in
# }}}
# }}}
# {{{ visual
# The line between `ui` and `visual is a bit rought. I currenlty mostly judge
# The line between `ui` and `visual` is a bit rought. I currenlty mostly judge
# it by vibe.
# {{{ indent-blankline
satellite.neovim.lazy.indent-blankline = {
@ -665,4 +664,14 @@ in
# }}}
# }}}
# }}}
# {{{ Persistence
satellite.persistence.at.state.apps.neovim.directories = [
".local/state/nvim"
"${config.xdg.dataHome}/nvim"
];
satellite.persistence.at.cache.apps.neovim.directories = [
"${config.xdg.cacheHome}/nvim"
];
# }}}
}

View file

@ -1,4 +1,19 @@
{ config, ... }: {
# {{{ Set up my custom imperanence wrapper
satellite.persistence = {
enable = true;
# Actual data/media (eg: projects, images, videos, etc)
at.data.path = "/persist/data";
at.data.prefixDirectories = false;
# App state I want to keep
at.state.path = "/persist/state";
# App state which I should be able to delete on a whim
at.cache.path = "/persist/local/cache";
};
# }}}
# {{{ XDG dirs
# The lack of "~/Desktop" and "~/Downloads" is intentional!
satellite.persistence.at.data.apps.main.directories = [

View file

@ -16,9 +16,13 @@
# - look into swaylock or whatever people use
# - multiple keyboard layouts
home.sessionVariables = {
NIXOS_OZONES_WL = "1";
};
home.packages =
let
# {{{ OCR
# {{{ OCR script
_ = lib.getExe;
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";

View file

@ -3,19 +3,4 @@
# Arbitrary extra packages
home.packages = [ ];
# Set up my custom imperanence wrapper
satellite.persistence = {
enable = true;
# Actual data/media (eg: projects, images, videos, etc)
at.data.path = "/persist/data";
at.data.prefixDirectories = false;
# App state I want to keep
at.state.path = "/persist/state";
# App state which I should be able to delete at any point
at.cache.path = "/persist/local/cache";
};
}

View file

@ -52,21 +52,6 @@
# Simlink some commonly modified dotfiles outside the store
dev.enable = true;
# Set up my custom imperanence wrapper
persistence = {
enable = true;
# Actual data/media (eg: projects, images, videos, etc)
at.data.path = "/persist/data";
at.data.prefixDirectories = false;
# App state I want to keep
at.state.path = "/persist/state";
# App state which I should be able to delete on a whim
at.cache.path = "/persist/local/cache";
};
monitors = [{
name = "eDP-1";
width = 1920;

View file

@ -9,7 +9,6 @@ let
inputs.agenix.nixosModules.default
inputs.stylix.nixosModules.stylix
inputs.nur.nixosModules.nur
inputs.impermanence.nixosModule
inputs.slambda.nixosModule
# {{{ self management
@ -40,10 +39,6 @@ in
imports = builtins.attrValues outputs.nixosModules ++ imports;
# {{{ ad-hoc options
# Allow non root users to specify the "allowOther" option.
# See [the imperanence readme](https://github.com/nix-community/impermanence#home-manager)
programs.fuse.userAllowOther = true;
# Customize tty colors
stylix.targets.console.enable = true;

View file

@ -1 +1,37 @@
{ }
# This file defines the "non-hardware dependent" part of opt-in persistence
# It imports impermanence, defines the basic persisted dirs, and ensures each
# users' home persist dir exists and has the right permissions
#
# It works even if / is tmpfs, btrfs snapshot, or even not ephemeral at all.
{ lib, inputs, config, ... }: {
imports = [ inputs.impermanence.nixosModules.impermanence ];
environment.persistence."/persist/state".directories = [
"/var/lib/systemd"
"/var/lib/nixos"
"/var/log"
];
# Allow non root users to specify the "allowOther" option.
# See [the imperanence readme](https://github.com/nix-community/impermanence#home-manager)
programs.fuse.userAllowOther = true;
# {{{ Create home directories
systemd.tmpfiles.rules =
let
users = lib.filter (v: v != null) [
(config.users.users.adrielus or null)
(config.users.users.guest or null)
];
mkHomePersistFor = location: lib.forEach users
(user: "Q ${location}${user.home} ${user.homeMode} ${user.name} ${user.group} -");
in
lib.flatten [
(mkHomePersistFor "/persist/data")
(mkHomePersistFor "/persist/state")
(mkHomePersistFor "/persist/local/cache")
];
# }}}
}

View file

@ -1,28 +1,32 @@
let
user = "adrielus";
group = "syncthing";
dataDir = "/persist/data/syncthing";
in
{
services.syncthing = {
inherit user group;
inherit user group dataDir;
enable = true;
openDefaultPorts = true;
configDir = "/persist/state/home/adrielus/Syncthing/.config/syncthing";
dataDir = "/persist/data/syncthing";
configDir = "/persist/state/home/adrielus/syncthing/.config/syncthing";
overrideDevices = true;
overrideFolders = true;
settings = {
# {{{ Device ids
devices = {
enceladus.id = "QWOAERM-V2FNXPI-TB7NFUS-LKW7JTB-IZY4OEZ-FYDPJNP-6IKPW4Y-YREXDQM";
lapetus.id = "VVHM7RC-ZSDOZJI-EGBIJR4-2DOGAXG-OEJZWSH-OYUK5XT-7CDMWSL-3AVM2AZ";
tethys.id = "NGHX5G4-IY3ZXL2-NQMMRQV-2GDQLC6-LIDWSNG-DAJUAQH-KBAP64V-55K2LQ6";
};
# }}}
extraOptions.options.crashReportingEnabled = false;
};
};
# I'm not sure this is needed anymore, I just know I got some ownership errors at some point.
systemd.tmpfiles.rules = [ "d ${dataDir} - ${user} ${group} -" ];
}

View file

@ -18,6 +18,9 @@
# Set default shell
shell = pkgs.fish;
# Picked up by our persistence module
homeMode = "755";
# Add user to the following groups
extraGroups = [
"wheel" # Access to sudo