diff --git a/README.md b/README.md index 438cd6a..9a94476 100644 --- a/README.md +++ b/README.md @@ -22,20 +22,19 @@ 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 | -| [home](./home) | Home manager configurations | -| [hosts/nixos](./hosts/nixos) | Nixos configurations | -| [modules](./modules) | Custom generic/nixos/home-manager modules | -| [overlays](./overlays) | Nix overlays | -| [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 | +| Location | Description | +| ---------------------------- | --------------------------------------------------- | +| [common](./common) | Configuration loaded on both nixos and home-manager | +| [devshells](./devshells) | Nix shells | +| [docs](./docs) | Additional documentation regarding my setup | +| [home](./home) | Home manager configurations | +| [hosts/nixos](./hosts/nixos) | Nixos configurations | +| [modules](./modules) | Custom generic/nixos/home-manager modules | +| [overlays](./overlays) | Nix overlays | +| [pkgs](./pkgs) | Nix packages | +| [flake.nix](./flake.nix) | Nix flake entrypoint! | +| [secrets.nix](./secrets.nix) | Agenix entrypoint | +| [stylua.toml](./stylua.toml) | Lua formatter config for the repo | ## Points of interest diff --git a/common/fonts.nix b/common/fonts.nix index 4a42cbd..0154354 100644 --- a/common/fonts.nix +++ b/common/fonts.nix @@ -5,6 +5,11 @@ package = pkgs.iosevka; }; + # monospace = { + # name = "Cascadia Code"; + # package = pkgs.cascadia-code; + # }; + sansSerif = { name = "CMUSansSerif"; package = pkgs.cm_unicode; diff --git a/flake.lock b/flake.lock index 142f063..8b6cce5 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/home/euporie.nix b/home/euporie.nix index 528c573..ba4ea0c 100644 --- a/home/euporie.nix +++ b/home/euporie.nix @@ -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"; }; } diff --git a/home/features/cli/gpg.nix b/home/features/cli/gpg.nix index 35706a1..5e0c4a9 100644 --- a/home/features/cli/gpg.nix +++ b/home/features/cli/gpg.nix @@ -18,4 +18,6 @@ in }; programs.gpg.enable = true; + + satellite.persistence.at.state.apps.gpg.directories = [ ".gnupg" ]; } diff --git a/home/features/cli/productivity/intray.nix b/home/features/cli/productivity/intray.nix index edc8fed..dc4ff39 100644 --- a/home/features/cli/productivity/intray.nix +++ b/home/features/cli/productivity/intray.nix @@ -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"; }; } diff --git a/home/features/cli/productivity/smos/default.nix b/home/features/cli/productivity/smos/default.nix index 01a8e9d..71d180c 100644 --- a/home/features/cli/productivity/smos/default.nix +++ b/home/features/cli/productivity/smos/default.nix @@ -1,10 +1,7 @@ { config, ... }: { programs.smos = { enable = true; - - notify = { - enable = true; - }; + notify.enable = true; github = { enable = true; diff --git a/home/features/neovim/config/lua/my/plugins/init.lua b/home/features/neovim/config/lua/my/plugins/init.lua index 39e6191..cc70451 100644 --- a/home/features/neovim/config/lua/my/plugins/init.lua +++ b/home/features/neovim/config/lua/my/plugins/init.lua @@ -85,6 +85,7 @@ return { end end, cond = env.vscode.not_active(), + enabled = false, }, { diff --git a/home/features/neovim/default.nix b/home/features/neovim/default.nix index d6c18af..f6d73d7 100644 --- a/home/features/neovim/default.nix +++ b/home/features/neovim/default.nix @@ -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" + ]; + # }}} } diff --git a/home/features/persistence.nix b/home/features/persistence.nix index 340405e..3799e47 100644 --- a/home/features/persistence.nix +++ b/home/features/persistence.nix @@ -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 = [ diff --git a/home/features/wayland/global.nix b/home/features/wayland/global.nix index 318e68d..a10cb22 100644 --- a/home/features/wayland/global.nix +++ b/home/features/wayland/global.nix @@ -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"; diff --git a/home/lapetus.nix b/home/lapetus.nix index 29aadc1..1591f2f 100644 --- a/home/lapetus.nix +++ b/home/lapetus.nix @@ -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"; - }; } diff --git a/home/tethys.nix b/home/tethys.nix index 891c546..7e4a9ed 100644 --- a/home/tethys.nix +++ b/home/tethys.nix @@ -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; diff --git a/hosts/nixos/common/global/default.nix b/hosts/nixos/common/global/default.nix index 550131a..05e67ad 100644 --- a/hosts/nixos/common/global/default.nix +++ b/hosts/nixos/common/global/default.nix @@ -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; diff --git a/hosts/nixos/common/global/persistence.nix b/hosts/nixos/common/global/persistence.nix index ffcd441..038e6d2 100644 --- a/hosts/nixos/common/global/persistence.nix +++ b/hosts/nixos/common/global/persistence.nix @@ -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") + ]; + # }}} +} + diff --git a/hosts/nixos/common/optional/services/syncthing.nix b/hosts/nixos/common/optional/services/syncthing.nix index 39d4c89..4be9fc8 100644 --- a/hosts/nixos/common/optional/services/syncthing.nix +++ b/hosts/nixos/common/optional/services/syncthing.nix @@ -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} -" ]; } diff --git a/hosts/nixos/common/users/adrielus.nix b/hosts/nixos/common/users/adrielus.nix index 5f2fb6e..7bf9135 100644 --- a/hosts/nixos/common/users/adrielus.nix +++ b/hosts/nixos/common/users/adrielus.nix @@ -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