-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
47 lines (37 loc) · 1.24 KB
/
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
38
39
40
41
42
43
44
45
46
47
{
description = "analyse-stdenv";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (nixpkgs) lib;
pkgs = nixpkgs.legacyPackages.${system};
inherit (import ./nix/ruby.nix { inherit pkgs; })
ruby rubyEnv;
rubySource = lib.sourceFilesBySuffices ./. [ "rb" ];
in rec {
packages = {
nix-build-deps = pkgs.callPackage ./nix-build-deps {
nix = pkgs.nix_2_3;
};
drv-by-stdenv = pkgs.writeScriptBin "drv-by-stdenv" ''
exec ${rubyEnv.wrappedRuby}/bin/ruby ${rubySource}/drv-by-stdenv.rb "$@"
'';
analyse-stdenv = pkgs.writeScriptBin "analyse-stdenv" ''
export PATH=${lib.makeBinPath [
packages.nix-build-deps
packages.drv-by-stdenv
]}:$PATH
hello=$(nix-instantiate -A hello "$@")
nix-build-deps $hello | drv-by-stdenv $hello
'';
};
defaultPackage = packages.analyse-stdenv;
devShell = rubyEnv.env;
}
);
}