Compare commits

...

30 commits

Author SHA1 Message Date
d9eeeb5b52 WIP: add notes for missing persistence/backup
All checks were successful
ci/woodpecker/push/check Pipeline was successful
TODO:
* Look at for more inspiration https://github.com/nix-community/impermanence/pull/108
* Do home-manager
* Common files https://github.com/nix-community/impermanence/issues/10
2023-10-26 13:49:02 +00:00
b535717ab4 modules: services: quassel: persist data 2023-10-26 13:49:02 +00:00
c960d91744 modules: services: pirate: persist data 2023-10-26 13:49:02 +00:00
49bb821db7 modules: services: monitoring: persist data 2023-10-26 13:49:01 +00:00
5a84204234 modules: services: nginx: persist SSL certificates 2023-10-26 13:49:01 +00:00
f9e85ad8ff modules: services: transmission: persist data 2023-10-26 13:49:01 +00:00
704c3ba4f6 modules: services: sabnzbd: persist data 2023-10-26 13:49:01 +00:00
73dbe296f3 modules: services: rss-bridge: persist data 2023-10-26 13:49:01 +00:00
b280829953 modules: services: podgrab: persist data 2023-10-26 13:49:01 +00:00
f019c7b26c modules: services: nextcloud: persist data 2023-10-26 13:49:01 +00:00
5f0f7d18d5 modules: services: navidrome: persist data 2023-10-26 13:49:01 +00:00
6cad8a541d modules: services: lohr: persist data 2023-10-26 13:49:01 +00:00
81cd8f085e modules: services: jellyfin: persist data 2023-10-26 13:49:01 +00:00
358574e417 modules: services: indexers: persist data 2023-10-26 13:49:01 +00:00
09520a42ac modules: services: postgresql: persist data 2023-10-26 13:49:01 +00:00
303aff4296 modules: services: postgresql-backup: persist data 2023-10-26 13:49:01 +00:00
d44d7b4c06 modules: services: paperless: persist data 2023-10-26 13:49:01 +00:00
a6d6b6a39e modules: services: matrix: persist data 2023-10-26 13:49:01 +00:00
9a0804a491 modules: services: gitea: persist repositories 2023-10-26 13:49:01 +00:00
6f354de7e2 modules: services: flood: persist data 2023-10-26 13:49:01 +00:00
de7375c356 modules: services: calibre-web: persist library 2023-10-26 13:49:01 +00:00
0933d7e269 modules: services: blog: persist website data 2023-10-26 13:49:01 +00:00
84d8e18d70 modules: hardware: bluetooth: persist connections 2023-10-26 13:49:01 +00:00
3f8fa8375f modules: hardware: netowrking persist connections 2023-10-26 13:49:01 +00:00
3ef8c051e7 modules: services: ssh-server: persist host keys 2023-10-26 13:49:01 +00:00
ed6e7513bb WIP: modules: systems: add persist
This is the module that takes care of configuring impermanence at the
system level.

WIP:
    * address FIXMEs
    * activate home-manager persistence?
        * set `programs.fuse.userAllowOther = true;` ?
    * point `age` to persisted paths [1] ?
    * make sure all services and modules are persisted correctly...

[1]: b1d18d25b8
2023-10-26 13:49:01 +00:00
3cd1789ec9 flake: add 'impermanence' 2023-10-26 13:49:00 +00:00
0f5f848c7e home: firefox: migrate deprecated option
All checks were successful
ci/woodpecker/push/check Pipeline was successful
2023-10-26 13:49:00 +00:00
eebc8c8d84 home: vim: migrate to 'none-ls-nvim'
This is the community-maintained fork of the plug-in.
2023-10-26 13:44:54 +00:00
b6102124a1 overlays: add 'gruvbox-nvim-old-diff'
I dislike the new style of diff [1].

Thankfully somebody wrote a patch to configure it [2] (though not
completely to my liking, so the local patch here is a bit different).
I used it as a basis, but made it always revert, rather than
configurable.

[1]: https://github.com/ellisonleao/gruvbox.nvim/issues/290
[2]: https://github.com/ellisonleao/gruvbox.nvim/pull/291
2023-10-26 13:44:54 +00:00
37 changed files with 289 additions and 7 deletions

17
flake.lock generated
View file

@ -145,6 +145,22 @@
"type": "github"
}
},
"impermanence": {
"locked": {
"lastModified": 1694622745,
"narHash": "sha256-z397+eDhKx9c2qNafL1xv75lC0Q4nOaFlhaU1TINqb8=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "e9643d08d0d193a2e074a19d4d90c67a874d932e",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "impermanence",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1698134075,
@ -212,6 +228,7 @@
"flake-parts": "flake-parts",
"futils": "futils",
"home-manager": "home-manager",
"impermanence": "impermanence",
"nixpkgs": "nixpkgs",
"nur": "nur",
"pre-commit-hooks": "pre-commit-hooks"

View file

@ -39,6 +39,13 @@
};
};
impermanence = {
type = "github";
owner = "nix-community";
repo = "impermanence";
ref = "master";
};
nixpkgs = {
type = "github";
owner = "NixOS";

View file

@ -33,13 +33,10 @@ in
enable = true;
package = pkgs.firefox.override {
cfg = {
enableTridactylNative = cfg.tridactyl.enable;
};
extraNativeMessagingHosts = with pkgs; ([ ]
nativeMessagingHosts = ([ ]
++ lib.optional cfg.tridactyl.enable pkgs.tridactyl-native
# Watch videos using mpv
++ lib.optional cfg.ff2mpv.enable ambroisie.ff2mpv-go
++ lib.optional cfg.ff2mpv.enable pkgs.ambroisie.ff2mpv-go
);
};

View file

@ -67,7 +67,7 @@ in
nvim-lspconfig # Easy LSP configuration
lsp-format-nvim # Simplified formatting configuration
lsp_lines-nvim # Show diagnostics *over* regions
null-ls-nvim # LSP integration for linters and formatters
none-ls-nvim # LSP integration for linters and formatters
nvim-treesitter.withAllGrammars # Better highlighting
nvim-treesitter-textobjects # More textobjects
nvim-ts-context-commentstring # Comment string in nested language blocks

View file

@ -18,6 +18,13 @@ in
services.blueman.enable = true;
}
# Persist bluetooth files
{
my.system.persist.directories = [
"/var/lib/bluetooth"
];
}
# Support for additional bluetooth codecs
(lib.mkIf cfg.loadExtraCodecs {
hardware.pulseaudio = {

View file

@ -22,6 +22,11 @@ in
config = lib.mkMerge [
(lib.mkIf cfg.wireless.enable {
networking.networkmanager.enable = true;
# Persist NetworkManager files
my.system.persist.directories = [
"/etc/NetworkManager/system-connections"
];
})
];
}

View file

@ -42,5 +42,12 @@ in
# Those are all subdomains, no problem
my.services.nginx.virtualHosts = hostsInfo;
my.system.persist.directories = [
"/var/www/blog"
"/var/www/cv"
"/var/www/dev"
"/var/www/key"
];
};
}

View file

@ -54,6 +54,11 @@ in
];
};
my.system.persist.directories = [
"/var/lib/${config.services.calibre-web.dataDir}"
cfg.libraryPath
];
services.fail2ban.jails = {
calibre-web = ''
enabled = true

View file

@ -46,5 +46,9 @@ in
inherit (cfg) port;
}
];
my.system.persist.directories = [
"/var/lib/${cfg.stateDir}"
];
};
}

View file

@ -135,6 +135,11 @@ in
];
};
my.system.persist.directories = [
config.services.gitea.lfs.contentDir
config.services.gitea.repositoryRoot
];
services.fail2ban.jails = {
gitea = ''
enabled = true

View file

@ -36,5 +36,8 @@ in
forceSSL = true;
useACMEHost = config.networking.domain;
};
# FIXME: backup
# FIXME: persistence
};
}

View file

@ -34,6 +34,10 @@ in
port = jackettPort;
}
];
my.system.persist.directories = [
config.services.jackett.dataDir
];
})
(lib.mkIf cfg.nzbhydra.enable {
@ -47,6 +51,10 @@ in
port = nzbhydraPort;
}
];
my.system.persist.directories = [
config.services.nzbhydra2.dataDir
];
})
(lib.mkIf cfg.prowlarr.enable {
@ -61,6 +69,10 @@ in
}
];
my.system.persist.directories = [
"/var/lib/${config.systemd.services.prowlarr.serviceConfig.StateDirectory}"
];
services.fail2ban.jails = {
prowlarr = ''
enabled = true

View file

@ -35,5 +35,9 @@ in
};
}
];
my.system.persist.directories = [
"/var/lib/${config.systemd.services.jellyfin.serviceConfig.StateDirectory}"
];
};
}

View file

@ -104,5 +104,9 @@ in
inherit (cfg) port;
}
];
my.system.persist.directories = [
"/var/lib/${config.systemd.services.lohr.serviceConfig.StateDirectory}"
];
};
}

View file

@ -257,5 +257,9 @@ in
config.services.matrix-synapse.dataDir
];
};
my.system.persist.directories = [
config.services.matrix-synapse.dataDir
];
};
}

View file

@ -49,5 +49,8 @@ in
inherit (cfg) port;
}
];
# FIXME: backup
# FIXME: persistence
};
}

View file

@ -131,5 +131,10 @@ in
inherit (cfg.grafana) port;
}
];
my.system.persist.directories = [
config.services.grafana.dataDir
"/var/lib/${config.services.prometheus.stateDir}"
];
};
}

View file

@ -53,5 +53,9 @@ in
inherit (cfg) port;
}
];
my.system.persist.directories = [
"/var/lib/${config.systemd.services.navidrome.serviceConfig.StateDirectory}"
];
};
}

View file

@ -82,5 +82,10 @@ in
"${config.services.nextcloud.home}/data/appdata_*/preview"
];
};
my.system.persist.directories = [
config.services.nextcloud.home
config.services.nextcloud.datadir
];
};
}

View file

@ -470,5 +470,9 @@ in
}
];
};
my.system.persist.directories = [
config.users.user.acme.home
];
};
}

View file

@ -164,5 +164,10 @@ in
config.services.paperless.mediaDir
];
};
my.system.persist.directories = [
config.services.paperless-ng.dataDir
config.services.paperless-ng.mediaDir
];
};
}

View file

@ -18,6 +18,11 @@ let
enable = true;
group = "media";
};
# Thankfully those old style services all define users with homes
my.system.persist.directories = [
config.users.user.${service}.home
];
};
mkRedirection = service: {

View file

@ -37,5 +37,10 @@ in
inherit (cfg) port;
}
];
my.system.persist.directories =
builtins.map
(d: "/var/lib/${d}")
config.systemd.services.podgrab.serviceConfig.StateDirectory;
};
}

View file

@ -24,5 +24,9 @@ in
(config.services.postgresqlBackup.location + "/*.prev.sql.gz")
];
};
my.system.persist.directories = [
config.services.postgresqlBackup.location
];
};
}

View file

@ -18,6 +18,13 @@ in
};
})
# Only persist directory if the actual service is enabled
(lib.mkIf config.services.postgresql.enable {
my.system.persist.directories = [
config.services.postgresql.dataDir
];
})
# Taken from the manual
(lib.mkIf cfg.upgradeScript {
containers.temp-pg.config.services.postgresql = {

View file

@ -46,5 +46,9 @@ in
# Because Quassel does not use the socket, I simply trust its connection
authentication = "host quassel quassel localhost trust";
};
my.system.persist.directories = [
config.services.quassel.dataDir
];
};
}

View file

@ -20,5 +20,9 @@ in
forceSSL = true;
useACMEHost = config.networking.domain;
};
my.system.persist.directories = [
config.services.rss-bridge.dataDir
];
};
}

View file

@ -25,6 +25,10 @@ in
}
];
my.system.persist.files = [
config.services.sabnzbd.configFile
];
services.fail2ban.jails = {
sabnzbd = ''
enabled = true

View file

@ -20,6 +20,14 @@ in
};
};
# Persist SSH keys
my.system.persist.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"
];
# Opens the relevant UDP ports.
programs.mosh.enable = true;
};

View file

@ -75,5 +75,8 @@ in
inherit (cfg) port;
}
];
# FIXME: backup
# FIXME: persistence
};
}

View file

@ -91,5 +91,9 @@ in
allowedTCPPorts = [ cfg.peerPort ];
allowedUDPPorts = [ cfg.peerPort ];
};
my.system.persist.directories = [
config.services.transmission.home
];
};
}

View file

@ -119,5 +119,7 @@ in
config.services.vikunja.settings.files.basepath
];
};
# FIXME: persistence
};
}

View file

@ -9,6 +9,7 @@
./language
./nix
./packages
./persist
./podman
./users
];

View file

@ -0,0 +1,68 @@
# Ephemeral root configuration
{ config, inputs, lib, ... }:
let
cfg = config.my.system.persist;
in
{
imports = [
inputs.impermanence.nixosModules.impermanence
];
options.my.system.persist = with lib; {
enable = mkEnableOption "stateless system configuration";
mountPoint = lib.mkOption {
type = types.str;
default = "/persistent";
example = "/etc/nix/persist";
description = ''
Which mount point should be used to persist this system's files and
directories.
'';
};
files = lib.mkOption {
type = with types; listOf str;
default = [ ];
example = [
"/etc/nix/id_rsa"
];
description = ''
Additional files in the root to link to persistent storage.
'';
};
directories = lib.mkOption {
type = with types; listOf str;
default = [ ];
example = [
"/var/lib/libvirt"
];
description = ''
Additional directories in the root to link to persistent storage.
'';
};
};
config = lib.mkIf cfg.enable {
environment.persistence."${cfg.mountPoint}" = {
files = [
"/etc/machine-id"
]
++ cfg.files
;
directories = [
"/etc/nixos"
"/var/log"
"/var/lib/systemd/coredump"
]
++ (lib.optionals config.virtualisation.docker.enable [
"/var/lib/docker"
])
# FIXME: podman
++ cfg.directories
;
};
};
}

View file

@ -0,0 +1,4 @@
self: prev:
{
vimPlugins = prev.vimPlugins.extend (self.callPackage ./generated.nix { });
}

View file

@ -0,0 +1,24 @@
{ vimUtils, fetchFromGitHub }:
_final: _prev: {
gruvbox-nvim = vimUtils.buildVimPlugin {
pname = "gruvbox.nvim";
version = "2023-10-07";
src = fetchFromGitHub {
owner = "ellisonleao";
repo = "gruvbox.nvim";
rev = "477c62493c82684ed510c4f70eaf83802e398898";
sha256 = "0250c24c6n6yri48l288irdawhqs16qna3y74rdkgjd2jvh66vdm";
};
patches = [
# Inspired by https://github.com/ellisonleao/gruvbox.nvim/pull/291
./old-colours.patch
];
meta = {
homepage = "https://github.com/ellisonleao/gruvbox.nvim/";
};
};
}

View file

@ -0,0 +1,28 @@
From 416b3c9c5e783d173ac0fd5310a76c1b144b92c1 Mon Sep 17 00:00:00 2001
From: eeeXun <sdes96303@gmail.com>
Date: Thu, 19 Oct 2023 02:34:12 +0800
Subject: feat: make invert_diff configurable
---
README.md | 3 ++-
lua/gruvbox.lua | 7 ++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/lua/gruvbox.lua b/lua/gruvbox.lua
index ceba0735..a319fc6a 100644
--- a/lua/gruvbox.lua
+++ b/lua/gruvbox.lua
@@ -360,9 +361,9 @@ local function get_groups()
PmenuSel = { fg = colors.bg2, bg = colors.blue, bold = config.bold },
PmenuSbar = { bg = colors.bg2 },
PmenuThumb = { bg = colors.bg4 },
- DiffDelete = { bg = colors.dark_red },
- DiffAdd = { bg = colors.dark_green },
- DiffChange = { bg = colors.dark_aqua },
- DiffText = { bg = colors.yellow, fg = colors.bg0 },
+ DiffDelete = { fg = colors.bg0, bg = colors.red, reverse = config.inverse },
+ DiffAdd = { fg = colors.bg0, bg = colors.green, reverse = config.inverse },
+ DiffChange = { fg = colors.bg0, bg = colors.aqua, reverse = config.inverse },
+ DiffText = { bg = colors.yellow, fg = colors.bg0, reverse = config.inverse },
SpellCap = { link = "GruvboxBlueUnderline" },
SpellBad = { link = "GruvboxRedUnderline" },