forked from maisiliym/skrips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
37 lines (31 loc) · 996 Bytes
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
description = "Skrips";
outputs = { self }: {
SobUyrld = {
modz = [ "pkgs" "pkdjz" ];
lamdy = { runCommand, mksh, sd }:
let
inherit (builtins) readFile readDir mapAttrs;
mkSkrip = name: srcPath:
let
mksheBang = "#!" + mksh + "/bin/mksh";
in
runCommand name { inherit srcPath; } ''
mkdir --parents $out/bin/
for skrip in $srcPath/*
do
export neim=$(basename $skrip)
cp ''$skrip $out/bin/''${neim%.sh}
done
${sd}/bin/sd --string-mode '#!/usr/bin/env mksh' '${mksheBang}' $out/bin/*
chmod 755 $out/bin/*
'';
mkTopDirEntry = name: fileType:
assert (fileType == "directory");
mkSkrip name (self + "/${name}");
topDir = removeAttrs (readDir self) [ "flake.nix" ];
in
mapAttrs mkTopDirEntry topDir;
};
};
}