Skip to content

Commit

Permalink
Merge pull request nix-community#16 from Mic92/master
Browse files Browse the repository at this point in the history
make nixos-generators installable
  • Loading branch information
Lassulus authored Jan 22, 2019
2 parents dfb253f + 3fe1d1d commit c7c260c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PREFIX ?= /usr/local
SHARE ?= $(PREFIX)/share/nixos-generator

all:

install:
mkdir -p $(PREFIX)/bin $(SHARE)
sed \
-e "s|libexec_dir=\".*\"|libexec_dir=\"$(SHARE)\"|" \
-e "s|#!/usr/bin/env.*|#!/usr/bin/env bash|" \
nixos-generate > $(PREFIX)/bin/nixos-generate
chmod 755 $(PREFIX)/bin/nixos-generate
cp -r formats config.nix eval-format.nix $(SHARE)
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ or
it echoes the path to a iso image, which you then can flash onto an usb-stick
or mount & boot in a virtual machine.

# Installation

nixos-generators can be installed from source into the user profile like this:

```console
$ nix-env -f https://github.com/nix-community/nixos-generators/archive/master.tar.gz -i
```

## Supported formats

format | description
Expand Down
13 changes: 13 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ pkgs ? import <nixpkgs> {} }:

with pkgs;
stdenv.mkDerivation {
name = "nixos-generators";
src = ./.;
nativeBuildInputs = [ makeWrapper ];
installFlags = [ "PREFIX=$(out)" ];
postFixup = ''
wrapProgram $out/bin/nixos-generate \
--prefix PATH : ${lib.makeBinPath [ jq coreutils findutils nix ] }
'';
}

0 comments on commit c7c260c

Please sign in to comment.