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
];
languages = {
nim = true;
python = true;
};
oizys.languages = [
"nim"
"python"
];
environment.systemPackages = with pkgs; [
rclone

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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