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
"python"
];
rune.motd = enabled;
docker = enabled;
backups = enabled;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,7 +7,6 @@ let
mkOption
types
;
runes = import ../modules/runes;
in
rec {
enabled = {
@ -38,13 +37,6 @@ rec {
isNixFile = path: hasSuffix ".nix" path;
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: {
options.oizys.${attr}.enable = mkEnableOption "enable ${attr} support";

View file

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

View file

@ -1,5 +1,68 @@
{
pkgs,
config,
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,
buildGoModule,
lib,