use empty list as default

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

View file

@ -7,29 +7,11 @@
inherit (nixpkgs.lib) hasSuffix nixosSystem genAttrs; inherit (nixpkgs.lib) hasSuffix nixosSystem genAttrs;
inherit (nixpkgs.lib.filesystem) listFilesRecursive; inherit (nixpkgs.lib.filesystem) listFilesRecursive;
runes = import ../modules/runes; lib = nixpkgs.lib.extend (import ./extended.nix);
lib = nixpkgs.lib.extend (final: prev: {
mkIfIn = name: list: prev.mkIf (builtins.elem name list);
mkRune = {
rune,
number ? "6",
runeKind ? "braille",
}:
"[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n";
});
#supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"]; #supportedSystems = ["x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
supportedSystems = ["x86_64-linux"]; supportedSystems = ["x86_64-linux"];
in rec { in rec {
forAllSystems = f: genAttrs supportedSystems (system: f nixpkgs.legacyPackages.${system}); 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 = _:
@ -57,7 +39,6 @@ in rec {
specialArgs = {inherit inputs lib 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;
findModules = _: listToAttrs (findModulesList ../modules); findModules = _: listToAttrs (findModulesList ../modules);
# https://github.com/balsoft/nixos-config/blob/73cc2c3a8bb62a9c3980a16ae70b2e97af6e1abd/flake.nix#L109-L120 # https://github.com/balsoft/nixos-config/blob/73cc2c3a8bb62a9c3980a16ae70b2e97af6e1abd/flake.nix#L109-L120
@ -84,7 +65,7 @@ in rec {
oizysFlake = _: { oizysFlake = _: {
nixosModules = findModules {}; nixosModules = findModules {};
nixosConfigurations = buildHosts {}; nixosConfigurations = mapHosts ../hosts;
packages = buildOizys {}; packages = buildOizys {};
formatter = forAllSystems (pkgs: pkgs.alejandra); formatter = forAllSystems (pkgs: pkgs.alejandra);
}; };

11
lib/extended.nix Normal file
View file

@ -0,0 +1,11 @@
final: prev: let
runes = import ../modules/runes;
in {
mkIfIn = name: list: prev.mkIf (builtins.elem name list);
mkRune = {
rune,
number ? "6",
runeKind ? "braille",
}:
"[1;3${number}m\n" + runes.${rune}.${runeKind} + "\n";
}

View file

@ -9,11 +9,11 @@
in { in {
imports = [./nim.nix ./tex.nix ./misc.nix ./node.nix ./python.nix]; imports = [./nim.nix ./tex.nix ./misc.nix ./node.nix ./python.nix];
options.oizys.languages = mkOption { options.oizys.languages = mkOption {
type = with types; nullOr (listOf str); type = with types; (listOf str);
description = lib.mdDoc '' description = lib.mdDoc ''
List of programming languages to enable. List of programming languages to enable.
''; '';
default = null; default = [];
example = literalExpression '' example = literalExpression ''
[ [
"python" "python"