309 current 2025-02-09 01:23:40 25.05.20241217.d3c42f1 6.6.66 *
This commit is contained in:
@@ -4,45 +4,6 @@
|
|||||||
lib,
|
lib,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
# 1) Recursively collect all scripts into a *list* of { name, value } items
|
|
||||||
# readScriptsRecursively = dir: let
|
|
||||||
# entries = builtins.readDir dir;
|
|
||||||
# names = builtins.attrNames entries;
|
|
||||||
# in
|
|
||||||
# lib.concatMap (
|
|
||||||
# entry: let
|
|
||||||
# fullPath = "${dir}/${entry}";
|
|
||||||
# entryInfo = entries.${entry};
|
|
||||||
# in
|
|
||||||
# if entryInfo.type == "directory"
|
|
||||||
# then
|
|
||||||
# # Recursively gather more {name, value} items
|
|
||||||
# readScriptsRecursively fullPath
|
|
||||||
# else
|
|
||||||
# # For each file, produce one record
|
|
||||||
# [
|
|
||||||
# {
|
|
||||||
# name = entry;
|
|
||||||
# value = fullPath;
|
|
||||||
# }
|
|
||||||
# ]
|
|
||||||
# )
|
|
||||||
# names;
|
|
||||||
# # 2) Convert that list of {name, value} into an attribute set
|
|
||||||
# scripts = lib.attrsets.listToAttrs (readScriptsRecursively ./scripts);
|
|
||||||
# # 3) Map over the attrset to create shell applications
|
|
||||||
# scriptDerivations =
|
|
||||||
# lib.attrsets.mapAttrs
|
|
||||||
# (scriptName: scriptPath:
|
|
||||||
# pkgs.writeShellApplication {
|
|
||||||
# name = scriptName;
|
|
||||||
# runtimeInputs = with pkgs; [
|
|
||||||
# # put your dependencies here
|
|
||||||
# netcat
|
|
||||||
# ];
|
|
||||||
# text = builtins.readFile scriptPath;
|
|
||||||
# })
|
|
||||||
# scripts;
|
|
||||||
in {
|
in {
|
||||||
# home.packages = builtins.attrValues scriptDerivations;
|
# home.packages = builtins.attrValues scriptDerivations;
|
||||||
|
|
||||||
@@ -72,4 +33,28 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
programs.home-manager.enable = true;
|
programs.home-manager.enable = true;
|
||||||
|
|
||||||
|
home.packages = with pkgs;
|
||||||
|
[
|
||||||
|
# any other "normal" packages go here
|
||||||
|
]
|
||||||
|
++ (
|
||||||
|
with lib; let
|
||||||
|
# This function extracts the base file name from a path.
|
||||||
|
basename = path: lib.lists.last (lib.strings.splitString "/" (toString path));
|
||||||
|
|
||||||
|
# Adjust this path to wherever your scripts are.
|
||||||
|
# If your home-manager config is in ~/dotfiles/home.nix,
|
||||||
|
# and your scripts are in ~/dotfiles/bin/bin, you could do:
|
||||||
|
files = lib.filesystem.listFilesRecursive ./scripts;
|
||||||
|
in
|
||||||
|
# For each script found, create a derivation installed in $PATH
|
||||||
|
lib.lists.forEach files (
|
||||||
|
file:
|
||||||
|
pkgs.writeScriptBin
|
||||||
|
(basename file) # the new package's name
|
||||||
|
|
||||||
|
(builtins.readFile file)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
file=$1
|
|
||||||
cat "$1" | nc termbin.com 9999
|
|
||||||
29
home/tb.nix
29
home/tb.nix
@@ -1,16 +1,15 @@
|
|||||||
# scripts.nix
|
{pkgs, ...}: {
|
||||||
# {pkgs, ...}: {
|
home.packages = with pkgs; [
|
||||||
# home.packages = with pkgs; [
|
(writeShellApplication {
|
||||||
# (writeShellApplication {
|
name = "termbin";
|
||||||
# name = "termbin";
|
runtimeInputs = with pkgs; [
|
||||||
# runtimeInputs = with pkgs; [
|
netcat
|
||||||
# netcat
|
];
|
||||||
# ];
|
|
||||||
|
|
||||||
# text = ''
|
text = ''
|
||||||
# file=$1
|
file=$1
|
||||||
# cat "$1" | nc termbin.com 9999
|
cat "$1" | nc termbin.com 9999
|
||||||
# '';
|
'';
|
||||||
# })
|
})
|
||||||
# ];
|
];
|
||||||
# }
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user