krebs += pkgs.writeC lib.toC
This commit is contained in:
parent
f6997378c9
commit
c1aaaca7f7
@ -16,4 +16,10 @@ builtins // lib // rec {
|
|||||||
listset = import ./listset.nix { inherit lib; };
|
listset = import ./listset.nix { inherit lib; };
|
||||||
shell = import ./shell.nix { inherit lib; };
|
shell = import ./shell.nix { inherit lib; };
|
||||||
tree = import ./tree.nix { inherit lib; };
|
tree = import ./tree.nix { inherit lib; };
|
||||||
|
|
||||||
|
toC = x: {
|
||||||
|
list = "{ ${concatStringsSep ", " (map toC x)} }";
|
||||||
|
null = "NULL";
|
||||||
|
string = toJSON x; # close enough
|
||||||
|
}.${typeOf x};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (pkgs) callPackage;
|
inherit (pkgs) callPackage;
|
||||||
@ -14,4 +14,15 @@ pkgs //
|
|||||||
hashPassword = callPackage ./hashPassword.nix {};
|
hashPassword = callPackage ./hashPassword.nix {};
|
||||||
nq = callPackage ./nq.nix {};
|
nq = callPackage ./nq.nix {};
|
||||||
posix-array = callPackage ./posix-array.nix {};
|
posix-array = callPackage ./posix-array.nix {};
|
||||||
|
|
||||||
|
writeC = name: {}: src: pkgs.runCommand name {} ''
|
||||||
|
PATH=${lib.makeSearchPath "bin" (with pkgs; [
|
||||||
|
binutils
|
||||||
|
coreutils
|
||||||
|
gcc
|
||||||
|
])}
|
||||||
|
in=${pkgs.writeText "${name}.c" src}
|
||||||
|
gcc -O -Wall -o $out $in
|
||||||
|
strip --strip-unneeded $out
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
tvpkgs = import ../5pkgs { inherit pkgs; };
|
tvpkgs = import ../5pkgs { inherit lib pkgs; };
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
with import ../5pkgs { inherit pkgs; };
|
with import ../5pkgs { inherit lib pkgs; };
|
||||||
|
|
||||||
{
|
{
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{ pkgs, ... }:
|
{ lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (pkgs) callPackage;
|
inherit (pkgs) callPackage;
|
||||||
kpkgs = import ../../krebs/5pkgs { inherit pkgs; };
|
kpkgs = import ../../krebs/5pkgs { inherit lib pkgs; };
|
||||||
in
|
in
|
||||||
|
|
||||||
kpkgs // {
|
kpkgs // {
|
||||||
|
Loading…
Reference in New Issue
Block a user