From c0b2603a31b07e939c5663cfd1b1effa47da5d69 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 27 Feb 2024 10:41:27 -0600 Subject: [PATCH] use empty list as default --- lib/default.nix | 25 +++---------------------- lib/extended.nix | 11 +++++++++++ modules/languages/default.nix | 4 ++-- 3 files changed, 16 insertions(+), 24 deletions(-) create mode 100644 lib/extended.nix diff --git a/lib/default.nix b/lib/default.nix index 02bbb6c..84a39d9 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -7,30 +7,12 @@ inherit (nixpkgs.lib) hasSuffix nixosSystem genAttrs; inherit (nixpkgs.lib.filesystem) listFilesRecursive; - runes = import ../modules/runes; - 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"; - - - }); - + lib = nixpkgs.lib.extend (import ./extended.nix); #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 ( @@ -57,7 +39,6 @@ in rec { specialArgs = {inherit inputs lib self;}; }; mapHosts = dir: mapAttrs (name: _: mkSystem name) (readDir dir); - buildHosts = _: mapHosts ../hosts; findModules = _: listToAttrs (findModulesList ../modules); # https://github.com/balsoft/nixos-config/blob/73cc2c3a8bb62a9c3980a16ae70b2e97af6e1abd/flake.nix#L109-L120 @@ -84,7 +65,7 @@ in rec { oizysFlake = _: { nixosModules = findModules {}; - nixosConfigurations = buildHosts {}; + nixosConfigurations = mapHosts ../hosts; packages = buildOizys {}; formatter = forAllSystems (pkgs: pkgs.alejandra); }; diff --git a/lib/extended.nix b/lib/extended.nix new file mode 100644 index 0000000..33b1f51 --- /dev/null +++ b/lib/extended.nix @@ -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"; +} diff --git a/modules/languages/default.nix b/modules/languages/default.nix index 43e95f1..ed1b409 100644 --- a/modules/languages/default.nix +++ b/modules/languages/default.nix @@ -9,11 +9,11 @@ in { imports = [./nim.nix ./tex.nix ./misc.nix ./node.nix ./python.nix]; options.oizys.languages = mkOption { - type = with types; nullOr (listOf str); + type = with types; (listOf str); description = lib.mdDoc '' List of programming languages to enable. ''; - default = null; + default = []; example = literalExpression '' [ "python"