completely rework rune system

This commit is contained in:
Daylin Morgan 2024-05-06 15:30:10 -05:00
parent ee519f94c9
commit bb87af5136
Signed by: daylin
GPG key ID: 950D13E9719334AD
10 changed files with 72 additions and 40 deletions

View file

@ -13,6 +13,7 @@
"node" # for docker langservers "node" # for docker langservers
"python" "python"
]; ];
rune.motd = enabled;
docker = enabled; docker = enabled;
backups = enabled; backups = enabled;

View file

@ -1,10 +1,5 @@
{ lib, enabled, ... }: { enabled, ... }:
{ {
users.motd = lib.mkRune {
number = "6";
rune = "algiz";
};
services.resolved = enabled; services.resolved = enabled;
services.fail2ban = { services.fail2ban = {

View file

@ -5,6 +5,7 @@
oizys = { oizys = {
desktop = enabled; desktop = enabled;
nix-ld = enabled; nix-ld = enabled;
rune.motd = enabled;
}; };
# Enable the X11 windowing system. # Enable the X11 windowing system.

View file

@ -2,15 +2,9 @@
config, config,
pkgs, pkgs,
enabled, enabled,
mkRune,
... ...
}: }:
{ {
users.motd = mkRune {
number = "2";
rune = "mannaz";
};
# Use the systemd-boot EFI boot loader. # Use the systemd-boot EFI boot loader.
boot.loader = { boot.loader = {
systemd-boot = enabled; systemd-boot = enabled;

View file

@ -1,9 +1,4 @@
{ { pkgs, enabled, ... }:
pkgs,
enabled,
mkRune,
...
}:
{ {
networking.networkmanager = enabled; networking.networkmanager = enabled;
services.printing = enabled; services.printing = enabled;
@ -28,14 +23,6 @@
environment.systemPackages = with pkgs; [ pamixer ]; environment.systemPackages = with pkgs; [ pamixer ];
services.getty = {
greetingLine = mkRune {
rune = "othalan";
runeKind = "ascii";
};
helpLine = "";
};
networking.hostName = "othalan"; networking.hostName = "othalan";
time.timeZone = "US/Central"; time.timeZone = "US/Central";

View file

@ -16,7 +16,6 @@ let
mkDefaultOizysModule mkDefaultOizysModule
mkOizysModule mkOizysModule
enabled enabled
mkRune
; ;
inherit (lib.filesystem) listFilesRecursive; inherit (lib.filesystem) listFilesRecursive;
@ -46,7 +45,6 @@ rec {
mkDefaultOizysModule mkDefaultOizysModule
mkOizysModule mkOizysModule
enabled enabled
mkRune
; ;
}; };
}; };

View file

@ -7,7 +7,6 @@ let
mkOption mkOption
types types
; ;
runes = import ../modules/runes;
in in
rec { rec {
enabled = { enabled = {
@ -38,13 +37,6 @@ rec {
isNixFile = path: hasSuffix ".nix" path; isNixFile = path: hasSuffix ".nix" path;
mkIfIn = name: list: prev.mkIf (builtins.elem name list); mkIfIn = name: list: prev.mkIf (builtins.elem name list);
mkRune =
{
rune,
number ? "6",
runeKind ? "braille",
}:
"[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n";
mkOizysModule = config: attr: content: { mkOizysModule = config: attr: content: {
options.oizys.${attr}.enable = mkEnableOption "enable ${attr} support"; options.oizys.${attr}.enable = mkEnableOption "enable ${attr} support";

View file

@ -5,7 +5,9 @@ in
{ {
imports = with self.nixosModules; [ imports = with self.nixosModules; [
users users
runes
nix nix
cli cli
dev dev
nvim nvim

View file

@ -1,5 +1,68 @@
{ {
othalan = import ./othalan.nix; pkgs,
algiz = import ./algiz.nix; config,
mannaz = import ./mannaz.nix; lib,
...
}:
let
inherit (lib)
types
mkOption
mkIf
mkEnableOption
;
runes = {
othalan = import ./othalan.nix;
algiz = import ./algiz.nix;
mannaz = import ./mannaz.nix;
};
mkRune =
{
rune,
number ? "6",
runeKind ? "braille",
}:
"[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n";
cfg = config.oizys.rune;
in
{
options.oizys = {
rune = {
enable = mkOption {
type = types.bool;
default = true;
};
motd.enable = mkEnableOption "set rune for MOTD";
name = mkOption {
default = config.networking.hostName;
type = types.either (types.enum (builtins.attrNames runes)) types.str;
description = "Name of rune (probabaly matches hostname)";
};
kind = mkOption {
type =
with types;
either (enum [
"ascii"
"braille"
]) str;
default = "ascii";
};
};
};
config =
mkIf cfg.enable {
environment.etc.issue = {
source = pkgs.writeText "issue" (mkRune {
rune = cfg.name;
runeKind = cfg.kind;
});
};
}
// mkIf cfg.motd.enable {
users.motd = mkRune {
number = "2"; # todo: autogenerate based on hostname?
rune = cfg.name;
};
};
} }

View file

@ -1,5 +1,4 @@
{ {
installShellFiles, installShellFiles,
buildGoModule, buildGoModule,
lib, lib,