2024-01-12 08:21:49 +01:00
|
|
|
# flakelight -- Framework for simplifying flake setup
|
|
|
|
# Copyright (C) 2023 Archit Gupta <archit@accelbread.com>
|
|
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
# This is a fake pkgs set to enable efficiently extracting a derivation's name
|
|
|
|
|
|
|
|
real:
|
|
|
|
let
|
|
|
|
inherit (real) lib;
|
|
|
|
|
|
|
|
callPackageWith = autoArgs: fn: args:
|
|
|
|
let
|
|
|
|
f = if lib.isFunction fn then fn else import fn;
|
|
|
|
fargs = lib.functionArgs f;
|
2024-01-15 08:52:48 +01:00
|
|
|
mock = lib.mapAttrs (_: _: throw "") (lib.filterAttrs (_: v: !v) fargs);
|
2024-01-12 08:21:49 +01:00
|
|
|
in
|
2024-01-16 20:01:32 +01:00
|
|
|
assert fargs != { };
|
2024-01-12 08:21:49 +01:00
|
|
|
f (mock // builtins.intersectAttrs fargs autoArgs // args);
|
2024-01-15 11:02:48 +01:00
|
|
|
|
2024-01-22 07:22:31 +01:00
|
|
|
mockStdenv = builtins.mapAttrs (_: _: throw "") real.stdenv // {
|
2024-01-15 11:02:48 +01:00
|
|
|
mkDerivation = args:
|
|
|
|
if lib.isFunction args then lib.fix args else args;
|
|
|
|
};
|
2024-01-12 08:21:49 +01:00
|
|
|
in
|
|
|
|
lib.fix (self: {
|
|
|
|
lib = lib // { inherit callPackageWith; };
|
|
|
|
|
|
|
|
callPackage = callPackageWith self;
|
|
|
|
|
2024-01-22 07:22:31 +01:00
|
|
|
stdenv = mockStdenv;
|
|
|
|
stdenvNoCC = mockStdenv;
|
|
|
|
stdenv_32bit = mockStdenv;
|
|
|
|
stdenvNoLibs = mockStdenv;
|
|
|
|
libcxxStdenv = mockStdenv;
|
|
|
|
gccStdenv = mockStdenv;
|
|
|
|
gccStdenvNoLibs = mockStdenv;
|
|
|
|
gccMultiStdenv = mockStdenv;
|
|
|
|
clangStdenv = mockStdenv;
|
|
|
|
clangStdenvNoLibs = mockStdenv;
|
|
|
|
clangMultiStdenv = mockStdenv;
|
|
|
|
ccacheStdenv = mockStdenv;
|
2024-01-12 08:21:49 +01:00
|
|
|
|
2024-01-12 10:52:55 +01:00
|
|
|
runCommandWith = args: _: args;
|
2024-01-12 08:21:49 +01:00
|
|
|
runCommand = name: _: _: { inherit name; };
|
|
|
|
runCommandLocal = name: _: _: { inherit name; };
|
|
|
|
runCommandCC = name: _: _: { inherit name; };
|
2024-01-12 10:52:55 +01:00
|
|
|
writeTextFile = args: args;
|
2024-01-12 08:21:49 +01:00
|
|
|
writeText = name: _: { inherit name; };
|
|
|
|
writeTextDir = path: _: { name = builtins.baseNameOf path; };
|
|
|
|
writeScript = name: _: { inherit name; };
|
|
|
|
writeScriptBin = name: _: { inherit name; };
|
|
|
|
writeShellScript = name: _: { inherit name; };
|
|
|
|
writeShellScriptBin = name: _: { inherit name; };
|
2024-01-12 10:52:55 +01:00
|
|
|
writeShellApplication = args: args;
|
2024-01-12 08:21:49 +01:00
|
|
|
writeCBin = pname: _: { inherit pname; };
|
2024-01-12 10:52:55 +01:00
|
|
|
concatTextFile = args: args;
|
2024-01-12 08:21:49 +01:00
|
|
|
concatText = name: _: { inherit name; };
|
|
|
|
concatScript = name: _: { inherit name; };
|
2024-01-12 10:52:55 +01:00
|
|
|
symlinkJoin = args: args;
|
2024-01-12 08:21:49 +01:00
|
|
|
linkFarm = name: _: { inherit name; };
|
|
|
|
linkFarmFromDrvs = name: _: { inherit name; };
|
|
|
|
})
|