Compare commits

...

13 Commits

16 changed files with 268 additions and 75 deletions

View File

@@ -1,20 +1,4 @@
#+title: Sydnix #+title: Sydnix
#+author: Madeleine Sydney Ślaga #+author: Madeleine Sydney Ślaga
Hello! These are my dotfiles for all my software and Nix machines. My TODO lists and READMEs tend to share a file, so I've moved it out of version-control. A link will be here soon enough. these are my disgusting undocumented dotfiles. someday they'll be documented. maybe. }:)
* Overview
** Modules
Nix modules are Sydnix's primary mode of organisation. The modules in this repository are categorised by the scope of their applicability, be it user-specific, machine-specific, Sydnix-specific, or releasable. These sum of these categories resembles a hierarchy wherein modules become less generally-applicable as they build off one another. This all goes to say, in a very roundabout fashion, that we are using the [[https://www.nayuki.io/pe/designing-better-file-organization-around-tags-not-hierarchies][accursed]] hierarchical file-system as god intended:
#+begin_example
«TODO: Annotated diagram explaining the structore of modules/»
#+end_example
User modules may be configurations using a host-specific module, which itself may be a configuration of a Sydnix-specific module.
# Local Variables:
# jinx-local-words: "dotfiles"
# End:

View File

@@ -10,6 +10,7 @@
filesystemType = "btrfs"; filesystemType = "btrfs";
stylix.enable = true; stylix.enable = true;
gc.enable = true;
openssh.enable = true; openssh.enable = true;
sydpkgs.overlay.enable = true; sydpkgs.overlay.enable = true;
@@ -48,6 +49,7 @@
deertopia = { deertopia = {
authelia.enable = true; authelia.enable = true;
gitea.enable = true;
quiver.enable = true; quiver.enable = true;
www.enable = true; www.enable = true;
bepasty.enable = true; bepasty.enable = true;

View File

@@ -25,14 +25,18 @@
openssh.enable = true; openssh.enable = true;
sydpkgs.overlay.enable = true; sydpkgs.overlay.enable = true;
dank-material-shell.enable = true; dank-material-shell.enable = true;
kdeconnect.enable = true;
steam = { steam = {
enable = true; enable = true;
impermanenceUsers = ["crumb" "msyds"]; impermanenceUsers = [
# "crumb"
"msyds"
];
}; };
users.users = [ users.users = [
"crumb" # "crumb"
"msyds" "msyds"
]; ];

View File

@@ -0,0 +1,20 @@
{ config, lib, pkgs, osConfig, ... }:
let cfg = config.sydnix.kdeconnect;
in {
options.sydnix.kdeconnect = {
enable = lib.mkEnableOption "KDE Connect";
};
config = lib.mkIf cfg.enable {
services.kdeconnect = {
enable = true;
indicator = true;
};
warnings = lib.optional (!osConfig.sydnix.kdeconnect.openFirewall) ''
The KDE Connect ports were not opened in the NixOS config. Make
sure someone's allowing these ports!!!
'';
};
}

14
modules/home/terraria.nix Normal file
View File

@@ -0,0 +1,14 @@
{ config, lib, pkgs, ... }:
let cfg = config.sydnix.terraria;
in {
options.sydnix.terraria = {
enable = lib.mkEnableOption "Terraria";
};
config = lib.mkIf cfg.enable {
sydnix.impermanence.directories = [
".local/share/Terraria"
];
};
}

View File

@@ -32,52 +32,55 @@
:load-buffer #'cider-load-buffer) :load-buffer #'cider-load-buffer)
(add-hook 'cider-repl-mode-hook #'syd-lisp-mode) (add-hook 'cider-repl-mode-hook #'syd-lisp-mode)
(syd-push shackle-rules (syd-push shackle-rules
`("*cider-doc*" ,@syd-help-popup-options) `("*cider-doc*" ,@syd-help-popup-options)
'("*cider-test-report*") '("*cider-test-report*")
'("*cider-error*"))) '("*cider-error*")))
(use-package cider-mode (use-package cider-mode
:straight nil ; Part of `cider'. :straight nil ; Part of `cider'.
:hook (clojure-mode-local-vars . cider-mode) :hook (clojure-mode-local-vars . cider-mode)
:custom ((cider-show-error-buffer nil) :custom ((cider-show-error-buffer nil)
;; Download Java source archives for local Javadoc and jump-to-def ;; Download Java source archives for local Javadoc and jump-to-def
;; functionality. ;; functionality.
(cider-download-java-sources t)) (cider-download-java-sources t))
:general :general
;; DEPRECATED: Remove once a `map!' equivalent is implemented.
(:keymaps 'cider-repl-mode-map (:keymaps 'cider-repl-mode-map
:states '(normal insert) :states '(normal insert)
"C-k" #'cider-repl-backward-input "C-k" #'cider-repl-backward-input
"C-j" #'cider-repl-forward-input "C-j" #'cider-repl-forward-input
"C-s" #'consult-history) "C-s" #'consult-history)
;; DEPRECATED: Remove once a `map!' equivalent is implemented.
(:keymaps '(cider-repl-mode-map clojure-mode-map) (:keymaps '(cider-repl-mode-map clojure-mode-map)
:states '(normal visual motion emacs insert) :states '(normal visual motion emacs insert)
:major-modes t :major-modes t
:prefix syd-localleader-key :prefix syd-localleader-key
:non-normal-prefix syd-alt-localleader-key :non-normal-prefix syd-alt-localleader-key
"\"" #'cider-jack-in-cljs "\"" #'cider-jack-in-cljs
"'" #'cider-jack-in-clj "'" #'cider-jack-in-clj
"c" #'cider-connect-clj "c" #'cider-connect-clj
"C" #'cider-connect-cljs "C" #'cider-connect-cljs
"r l" #'cider-load-buffer "r l" #'cider-load-buffer
"r n" #'cider-repl-set-ns "r n" #'cider-repl-set-ns
"r r" #'cider-ns-refresh "r r" #'cider-ns-refresh
"r R" #'cider-restart "r R" #'cider-restart
"r q" #'cider-quit "r q" #'cider-quit
"d d" #'cider-debug-defun-at-point "d d" #'cider-debug-defun-at-point
"M-:" #'cider-read-and-eval "M-:" #'cider-read-and-eval
"h d" #'cider-doc "h d" #'cider-doc
"h c" #'cider-cheatsheet "h c" #'cider-cheatsheet
"h j" #'cider-javadoc "h j" #'cider-javadoc
"h n" #'cider-browse-ns "h n" #'cider-browse-ns
"T n" #'cider-test-run-ns-tests "T n" #'cider-test-run-ns-tests
"T r" #'cider-test-rerun-failed-tests "T r" #'cider-test-rerun-failed-tests
"T R" #'cider-test-rerun-test "T R" #'cider-test-rerun-test
"x" #'cider-scratch) "x" #'cider-scratch
"i" #'cider-inspect-last-result)
(:keymaps 'cider-repl-mode-map (:keymaps 'cider-repl-mode-map
:states 'insert :states 'insert
"S-<return>" #'cider-repl-newline-and-indent) "S-<return>" #'cider-repl-newline-and-indent)
(:keymaps 'cider-inspector-mode-map
:states '(motion insert)
"C-o" #'cider-inspector-pop
"C-i" #'cider-inspector-push)
:config :config
(add-hook 'cider-mode-hook #'eldoc-mode) (add-hook 'cider-mode-hook #'eldoc-mode)
(with-eval-after-load 'consult (with-eval-after-load 'consult
@@ -90,19 +93,19 @@
(syd-add-hook 'cider-repl-preoutput-hook (syd-add-hook 'cider-repl-preoutput-hook
(defun syd-clojure--render-graphviz-h (s) (defun syd-clojure--render-graphviz-h (s)
(if (string-match (rx bol "!!!graph:" (if (string-match (rx bol "!!!graph:"
(group (* anychar) ".svg")) (group (* anychar) ".svg"))
s) s)
(let ((beg (match-beginning 0)) (let ((beg (match-beginning 0))
(end (match-end 0)) (end (match-end 0))
(file (match-string 1 s))) (file (match-string 1 s)))
(message "%d %d %s" beg end file) (message "%d %d %s" beg end file)
(add-display-text-property (add-display-text-property
beg end beg end
'display 'display
`(image :type svg `(image :type svg
:file ,file) :file ,file)
s) s)
s) s)
s)))) s))))
(provide 'syd/clojure) (provide 'syd/clojure)

View File

@@ -127,7 +127,6 @@ if FILE-NAME has no TRAMP prefix."
(cons nil file-name))) (cons nil file-name)))
(use-package eshell (use-package eshell
:ensure nil
:defer t :defer t
:init :init
(defvar syd-eshell-data-dir (defvar syd-eshell-data-dir

View File

@@ -65,9 +65,22 @@ in {
server = { server = {
address = "tcp://:${builtins.toString cfg.httpPort}"; address = "tcp://:${builtins.toString cfg.httpPort}";
# asset_path = "${authelia-state-dir}/assets"; # asset_path = "${authelia-state-dir}/assets";
# Necessary for Nginx integration. No, I do not understand what it endpoints.authz = {
# does. # Necessary for Nginx integration. No, I do not understand what it
endpoints.authz.auth-request.implementation = "AuthRequest"; # does.
auth-request = {
implementation = "AuthRequest";
authn_strategies = [
{
name = "HeaderAuthorization";
schemes = [ "Basic" ];
}
{
name = "CookieSession";
}
];
};
};
}; };
authentication_backend = authentication_backend =
let base-dn = config.services.lldap.settings.ldap_base_dn; let base-dn = config.services.lldap.settings.ldap_base_dn;

View File

@@ -13,8 +13,13 @@ in {
}; };
}; };
imports = [ ./copyparty/vault.nix ];
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
sydnix.deertopia.copyparty.vault.enable = true;
sydnix.impermanence.directories = [ sydnix.impermanence.directories = [
"/var/lib/copyparty"
]; ];
nixpkgs.overlays = [ inputs.copyparty.overlays.default ]; nixpkgs.overlays = [ inputs.copyparty.overlays.default ];

View File

@@ -0,0 +1,46 @@
{ config, lib, pkgs, ... }:
let cfg = config.sydnix.deertopia.copyparty.vault;
in {
options.sydnix.deertopia.copyparty.vault = {
enable = lib.mkEnableOption "personal storage under Copyparty";
};
config = lib.mkIf cfg.enable {
sydnix.impermanence.directories = [ "/vault" ];
# HACK: Ad-hoc permissions, as typical.
users.groups.vault = {};
users.users.copyparty.extraGroups = [ "vault" ];
systemd.tmpfiles.settings."50-vault" =
let e = {
z.group = "vault";
z.mode = "2775";
v.group = "vault";
v.mode = "2775";
};
in {
"/vault" = e;
"/vault/~msyds" = e;
};
services.copyparty.volumes = {
"/~msyds" = {
path = "/vault/~msyds";
access.A = [ "msyds" ];
};
"/~msyds/zotero" = {
path = "/vault/~msyds/zotero";
flags.daw = true;
access.A = [ "msyds" ];
access.rwmd = [ "zotero" ];
};
"/~msyds/public" = {
path = "/vault/~msyds/public";
access.A = [ "msyds" ];
access.r = [ "*" ];
};
};
};
}

View File

@@ -0,0 +1,60 @@
{ config, lib, pkgs, ... }:
let cfg = config.sydnix.deertopia.gitea;
in {
options.sydnix.deertopia.gitea = {
enable = lib.mkEnableOption "Gitea";
};
config = lib.mkIf cfg.enable {
sydnix.impermanence.directories = [
{
directory = config.services.gitea.stateDir;
inherit (config.services.gitea) user group;
}
];
sydnix.deertopia.nginx.vhosts."git" = {
directory = null;
vhost = {
forceSSL = true;
enableACME = true;
locations."/".extraConfig =
let port = builtins.toString config.services.gitea
.settings.server.HTTP_PORT;
in ''
proxy_pass http://127.0.0.1:${port}/;
'';
};
};
users.users.git = {
description = "Gitea Service";
home = config.services.gitea.stateDir;
useDefaultShell = true;
group = config.services.gitea.group;
isSystemUser = true;
};
users.groups.git = { };
# sudo -u git gitea admin auth add-ldap --name gitea --port 3890 --bind-dn 'uid=gitea,ou=people,dc=deertopia,dc=net' --bind-password «password» --user-search-base 'ou=people,dc=deertopia,dc=net' --user-filter '(&(memberof=cn=git,ou=groups,dc=deertopia,dc=net)(|(uid=%[1]s)(mail=%[1]s)))' --username-attribute uid --firstname-attribute givenName --surname-attribute sn --email-attribute mail --avatar-attribute jpegPhoto --security-protocol unencrypted --host 127.0.0.1 --config /var/lib/gitea/custom/conf/app.ini --synchronize-users
services.gitea = {
enable = true;
user = "git";
group = "git";
appName = "GupHub"; # Name per my darling Colestar ♥
settings = {
server = {
ROOT_URL = "https://git.deertopia.net/";
HTTP_PORT = 3000;
DOMAIN = "deertopia.net";
};
service = {
DISABLE_REGISTRATION = true;
};
};
};
};
}

View File

@@ -29,6 +29,8 @@ in {
}; };
}; };
imports = [ ./copyparty/vault.nix ];
config = mkIf cfg.enable { config = mkIf cfg.enable {
users.users.${cfg.user} = { users.users.${cfg.user} = {
isSystemUser = true; isSystemUser = true;

View File

@@ -34,6 +34,7 @@ in {
extraConfig = '' extraConfig = ''
location /~msyds/ { location /~msyds/ {
index index.html; index index.html;
alias /vault/~msyds/public/;
} }
location /~liv/ { location /~liv/ {
index index.html; index index.html;

16
modules/nixos/gc.nix Normal file
View File

@@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
let cfg = config.sydnix.gc;
in {
options.sydnix.gc = {
enable = lib.mkEnableOption "the automatic Nix garbage collector";
};
config = lib.mkIf cfg.enable {
nix.gc = {
automatic = true;
randomizedDelaySec = "14m";
options = "--delete-older-than 30d";
};
};
}

View File

@@ -0,0 +1,21 @@
{ config, lib, pkgs, ... }:
let cfg = config.sydnix.kdeconnect;
in {
options.sydnix.kdeconnect = {
enable = lib.mkEnableOption "KDE Connect";
openFirewall = lib.mkOption {
description = ''Open required ports for KDE Connect'';
type = lib.types.bool;
default = true;
};
};
config = lib.mkIf cfg.enable
(let
port-range = lib.optional cfg.openFirewall { from = 1714; to = 1764; };
in {
networking.firewall.allowedTCPPortRanges = port-range;
networking.firewall.allowedUDPPortRanges = port-range;
});
}

View File

@@ -37,6 +37,9 @@
desktop-environment.enable = true; desktop-environment.enable = true;
clojure.enable = true; clojure.enable = true;
capitaine-cursors.enable = true; capitaine-cursors.enable = true;
terraria.enable = true;
kdeconnect.enable = true;
qalculate.enable = true;
sops = { sops = {
enable = true; enable = true;
keyFile = "/persist/private-keys/age/crumb"; keyFile = "/persist/private-keys/age/crumb";