mirror of
https://github.com/nix-community/nixos-generators.git
synced 2024-09-11 12:15:29 +03:00
Create flake.nix
This commit is contained in:
parent
5eb0cbe93b
commit
f8b23a0dd6
17
default.nix
17
default.nix
@ -1,14 +1,3 @@
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
|
||||
with pkgs;
|
||||
stdenv.mkDerivation {
|
||||
name = "nixos-generators";
|
||||
src = lib.cleanSource ./.;
|
||||
meta.description = "Collection of image builders";
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
installFlags = [ "PREFIX=$(out)" ];
|
||||
postFixup = ''
|
||||
wrapProgram $out/bin/nixos-generate \
|
||||
--prefix PATH : ${lib.makeBinPath [ jq coreutils findutils nix ] }
|
||||
'';
|
||||
}
|
||||
(import (builtins.fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
|
||||
src = ./.;
|
||||
}).defaultNix.default
|
||||
|
24
flake.lock
Normal file
24
flake.lock
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1603066386,
|
||||
"narHash": "sha256-BpO5yrRi2oqYaOHwWZBoRlLydOeYm0YhuLG4ISsaSzE=",
|
||||
"path": "/nix/store/6mz8x91y5pbndzfcbiwf3ag8k30k6m00-source",
|
||||
"rev": "5265d49a36bb5a18c85e6817b338b456acc3b8cc",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"id": "nixpkgs",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
40
flake.nix
Normal file
40
flake.nix
Normal file
@ -0,0 +1,40 @@
|
||||
{
|
||||
description = "nixos-generators - one config, multiple formats";
|
||||
|
||||
outputs = { self, nixpkgs }: let
|
||||
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "x86_64-darwin" "i686-linux" "aarch64-linux" ];
|
||||
in {
|
||||
# Packages
|
||||
packages = forAllSystems (system: let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
in {
|
||||
nixos-generators = pkgs.stdenv.mkDerivation {
|
||||
name = "nixos-generators";
|
||||
src = ./.;
|
||||
meta.description = "Collection of image builders";
|
||||
nativeBuildInputs = with pkgs; [ makeWrapper ];
|
||||
installFlags = [ "PREFIX=$(out)" ];
|
||||
postFixup = ''
|
||||
wrapProgram $out/bin/nixos-generate \
|
||||
--prefix PATH : ${pkgs.lib.makeBinPath (with pkgs; [ jq coreutils findutils nix ])}
|
||||
'';
|
||||
};
|
||||
});
|
||||
defaultPackage = forAllSystems (system: self.packages."${system}".nixos-generators);
|
||||
|
||||
devShell = forAllSystems (system: let
|
||||
pkgs = nixpkgs.legacyPackages."${system}";
|
||||
in pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ jq coreutils findutils nix ];
|
||||
});
|
||||
|
||||
# Make it runnable with `nix app`
|
||||
apps = forAllSystems (system: {
|
||||
nixos-generators = {
|
||||
type = "app";
|
||||
program = "${self.packages."${system}".nixos-generators}/bin/nixos-generators";
|
||||
};
|
||||
});
|
||||
defaultApp = forAllSystems (system: self.apps."${system}".nixos-generators);
|
||||
};
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p jq
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
## Configuration
|
||||
|
Loading…
Reference in New Issue
Block a user