library extensions

This commit is contained in:
Daylin Morgan 2024-02-27 10:27:41 -06:00
parent 6e3aa008df
commit 280e475edc
Signed by: daylin
GPG key ID: 3CD66E04B8072F3E
12 changed files with 46 additions and 36 deletions

View file

@ -8,10 +8,10 @@
restic restic
]; ];
languages = { oizys.languages = [
nim = true; "nim"
python = true; "python"
}; ];
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
rclone rclone

View file

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

View file

@ -4,7 +4,7 @@
]; ];
oizys.desktop.enable = true; oizys.desktop.enable = true;
cli.enable = true;
# Enable the X11 windowing system. # Enable the X11 windowing system.
services.xserver = { services.xserver = {
enable = true; enable = true;

View file

@ -1,10 +1,10 @@
{ {
config, config,
pkgs, pkgs,
mkRune, lib,
... ...
}: { }: {
users.motd = mkRune { users.motd = lib.mkRune {
number = "2"; number = "2";
rune = "mannaz"; rune = "mannaz";
}; };

View file

@ -23,8 +23,6 @@
}; };
vivaldi.enable = true; vivaldi.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
zk zk
rclone rclone

View file

@ -1,6 +1,6 @@
{ {
pkgs, pkgs,
mkRune, lib,
... ...
}: { }: {
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
@ -27,7 +27,7 @@
pamixer pamixer
]; ];
services.getty.greetingLine = mkRune { services.getty.greetingLine = lib.mkRune {
rune = "othalan"; rune = "othalan";
runeKind = "ascii"; runeKind = "ascii";
}; };

View file

@ -7,11 +7,9 @@
inherit (nixpkgs.lib) hasSuffix nixosSystem genAttrs; inherit (nixpkgs.lib) hasSuffix nixosSystem genAttrs;
inherit (nixpkgs.lib.filesystem) listFilesRecursive; inherit (nixpkgs.lib.filesystem) listFilesRecursive;
#supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
supportedSystems = ["x86_64-linux" ];
runes = import ../modules/runes; runes = import ../modules/runes;
in rec { lib = nixpkgs.lib.extend (final: prev: {
forAllSystems = f: genAttrs supportedSystems (system: f nixpkgs.legacyPackages.${system}); mkIfIn = name: list: prev.mkIf (builtins.elem name list);
mkRune = { mkRune = {
rune, rune,
number ? "6", number ? "6",
@ -19,6 +17,20 @@ in rec {
}: }:
"[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n"; "[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n";
});
#supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
supportedSystems = ["x86_64-linux"];
in rec {
forAllSystems = f: genAttrs supportedSystems (system: f nixpkgs.legacyPackages.${system});
# mkRune = {
# rune,
# number ? "6",
# runeKind ? "braille",
# }:
# "[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n";
isNixFile = path: hasSuffix ".nix" path; isNixFile = path: hasSuffix ".nix" path;
buildOizys = _: buildOizys = _:
forAllSystems ( forAllSystems (
@ -42,7 +54,7 @@ in rec {
isNixFile isNixFile
(listFilesRecursive (../. + "/hosts/${hostname}")); (listFilesRecursive (../. + "/hosts/${hostname}"));
specialArgs = {inherit inputs mkRune self;}; specialArgs = {inherit inputs lib self;};
}; };
mapHosts = dir: mapAttrs (name: _: mkSystem name) (readDir dir); mapHosts = dir: mapAttrs (name: _: mkSystem name) (readDir dir);
buildHosts = _: mapHosts ../hosts; buildHosts = _: mapHosts ../hosts;

View file

@ -4,10 +4,10 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
in { in {
config = mkIf (builtins.elem "misc" cfg) { config = mkIfIn "misc" cfg {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
go go
rustup rustup

View file

@ -4,10 +4,10 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
in { in {
config = mkIf (builtins.elem "nim" cfg) { config = mkIfIn "nim" cfg {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
nim nim

View file

@ -4,10 +4,10 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
in { in {
config = mkIf (builtins.elem "node" cfg) { config = mkIfIn "node" cfg {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
nodejs nodejs
nodePackages.pnpm nodePackages.pnpm

View file

@ -4,10 +4,11 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkIf;
inherit (lib) mkIfIn;
cfg = config.oizys.languages; cfg = config.oizys.languages;
in { in {
config = mkIf (builtins.elem "python" cfg) { config = mkIfIn "python" cfg {
environment.systemPackages = let environment.systemPackages = let
python = pkgs.python3.withPackages (ps: with ps; [pip]); python = pkgs.python3.withPackages (ps: with ps; [pip]);
in in

View file

@ -4,11 +4,10 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkIf; inherit (lib) mkIf mkIfIn;
# cfg = config.oizys.languages; cfg = config.oizys.languages;
langEnabled = name: builtins.elem name config.oizys.languages;
in { in {
config = mkIf (langEnabled "tex") { config = mkIfIn "tex" cfg {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
texlive.combined.scheme-full texlive.combined.scheme-full
]; ];