Class: ConfCtl::NixBuild

Inherits:
Object
  • Object
show all
Defined in:
lib/confctl/nix_build.rb

Instance Method Summary collapse

Constructor Details

#initialize(args, swpin_paths) ⇒ NixBuild

Returns a new instance of NixBuild.

Parameters:

  • args (Array<String>)
  • swpin_paths (Hash<String>)


5
6
7
8
9
10
11
12
# File 'lib/confctl/nix_build.rb', line 5

def initialize(args, swpin_paths)
  @args = args
  @swpin_paths = swpin_paths
  @build_progress = 0
  @build_total = 0
  @fetch_progress = 0
  @fetch_total = 0
end

Instance Method Details

#run {|type, progress, total, path| ... } ⇒ Object

Yield Parameters:

  • type (:build, :fetch)
  • progress (Integer)
  • total (Integer)
  • path (String)


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/confctl/nix_build.rb', line 18

def run(&block)
  cmd = SystemCommand.new

  line_buf = StdLineBuffer.new do |_out, err|
    parse_line(err, &block) if err && block
  end

  ret = cmd.run(
    'nix-build',
    *args,
    env: { 'NIX_PATH' => build_nix_path(swpin_paths) },
    &line_buf.feed_block
  )

  line_buf.flush
  ret
end