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