306 current 2025-01-25 22:09:05 25.05.20241217.d3c42f1 6.6.66 *
This commit is contained in:
@@ -4,46 +4,50 @@
|
|||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
# readScriptsRecursively = dir: let
|
readScriptsRecursively = dir: let
|
||||||
# entries = builtins.readDir dir; # This gives an attrset of filenames -> { "type": "regular"|"directory", ...}
|
entries = builtins.readDir dir; # This gives an attrset of filenames -> { "type": "regular"|"directory", ...}
|
||||||
# names = builtins.attrNames entries;
|
names = builtins.attrNames entries;
|
||||||
# in
|
in
|
||||||
# # We convert all items to a list of name/value pairs; then flatten them
|
# We convert all items to a list of name/value pairs; then flatten them
|
||||||
# lib.attrsets.listToAttrs (lib.concatMap (
|
lib.attrsets.listToAttrs (lib.concatMap (
|
||||||
# entry: let
|
entry: let
|
||||||
# fullPath = "${dir}/${entry}";
|
fullPath = "${dir}/${entry}";
|
||||||
# entryInfo = entries.${entry}; # e.g., {type="regular"|"directory",size=...}
|
entryInfo = entries.${entry}; # e.g., {type="regular"|"directory",size=...}
|
||||||
# in
|
in
|
||||||
# if entryInfo.type == "directory"
|
if entryInfo.type == "directory"
|
||||||
# then
|
then
|
||||||
# # Recursively read sub-directory
|
# Recursively read sub-directory
|
||||||
# builtins.attrValues (readScriptsRecursively fullPath)
|
builtins.attrValues (readScriptsRecursively fullPath)
|
||||||
# else
|
else
|
||||||
# # For a file, produce an attribute set item
|
# For a file, produce an attribute set item
|
||||||
# [
|
[
|
||||||
# {
|
{
|
||||||
# name = entry;
|
name = entry;
|
||||||
# value = fullPath;
|
value = fullPath;
|
||||||
# }
|
}
|
||||||
# ]
|
]
|
||||||
# )
|
)
|
||||||
# names);
|
names);
|
||||||
# scripts = readScriptsRecursively ./scripts;
|
|
||||||
# scriptDerivations =
|
scripts = readScriptsRecursively ./scripts;
|
||||||
# lib.attrsets.mapAttrs (
|
|
||||||
# scriptName: scriptPath:
|
scriptDerivations =
|
||||||
# pkgs.writeShellApplication {
|
lib.attrsets.mapAttrs (
|
||||||
# name = scriptName;
|
scriptName: scriptPath:
|
||||||
# # Pick whatever runtime dependencies you need
|
pkgs.writeShellApplication {
|
||||||
# runtimeInputs = with pkgs; [
|
name = scriptName;
|
||||||
# # Example: netcat, bashInteractive, curl, etc.
|
|
||||||
# netcat
|
# Pick whatever runtime dependencies you need
|
||||||
# ];
|
runtimeInputs = with pkgs; [
|
||||||
# # The text of the shell script is read directly from the file
|
# Example: netcat, bashInteractive, curl, etc.
|
||||||
# text = builtins.readFile scriptPath;
|
netcat
|
||||||
# }
|
];
|
||||||
# )
|
|
||||||
# scripts;
|
# The text of the shell script is read directly from the file
|
||||||
|
text = builtins.readFile scriptPath;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
scripts;
|
||||||
in {
|
in {
|
||||||
home.username = "synchronous";
|
home.username = "synchronous";
|
||||||
home.homeDirectory = "/home/synchronous";
|
home.homeDirectory = "/home/synchronous";
|
||||||
|
|||||||
Reference in New Issue
Block a user