fix nixosModules listing

This commit is contained in:
Chris Kruining 2025-04-24 23:05:48 +02:00
parent b6674e4da4
commit abdf88a717
Signed by: chris
SSH key fingerprint: SHA256:nG82MUfuVdRVyCKKWqhY+pCrbz9nbX6uzUns4RKa1Pg
3 changed files with 16 additions and 5 deletions

View file

@ -46,7 +46,7 @@
outputs = inputs @ { self, nixpkgs, nix-minecraft, flux, ... }:
let
inherit (lib.my) mapModulesRec mapHosts;
inherit (lib.my) readNixosModules mapHosts;
system = "x86_64-linux";
@ -81,7 +81,7 @@
packages."${system}" = lib.my.mapModules ./packages (p: pkgs.callPackage p { inherit inputs; });
nixosModules = mapModulesRec ./modules import;
nixosModules = readNixosModules ./modules import;
nixosConfigurations = mapHosts ./hosts {};
};
}

View file

@ -1,9 +1,10 @@
{ lib, self, ... }:
let
inherit (builtins) attrValues readDir pathExists concatLists;
inherit (builtins) attrValues readDir pathExists concatLists replaceStrings listToAttrs;
inherit (lib.attrsets) mapAttrsToList filterAttrs nameValuePair;
inherit (lib.strings) hasPrefix hasSuffix removeSuffix;
inherit (lib.strings) hasPrefix hasSuffix removeSuffix removePrefix;
inherit (lib.trivial) id;
inherit (lib) flatten;
inherit (self.attrs) mapFilterAttrs;
in rec
{
@ -33,4 +34,14 @@ in rec
paths = files ++ concatLists (map (d: mapModulesRec' d id) dirs);
in
map fn paths;
readNixosModules = dir: fn: filterAttrs (name: value: value != null && !(hasPrefix "_" name)) (listToAttrs (flatten (readDirRecursive fn dir "")));
readDirRecursive = fn: root: dir: mapAttrsToList (name: type:
if type == "directory"
then readDirRecursive fn root "${dir}/${name}"
else if type == "regular" && hasSuffix ".nix" name
then nameValuePair "${replaceStrings ["/"] ["_"] (removePrefix "/" dir)}_${removeSuffix ".nix" name}" (fn "${root}/${dir}/${name}")
else nameValuePair "" null
) (readDir "${root}/${dir}");
}

View file

@ -8,7 +8,7 @@ in mkWindowsAppNoCC rec {
inherit wine;
pname = "studio";
version = "2.25.4_1";
version = "2.25.4";
src = fetchurl {
url = "https://studio.download.bricklink.info/Studio2.0+EarlyAccess/Archive/2.25.4_1/Studio+2.0+EarlyAccess.exe";