Trying to structure this to be a flake input.
This commit is contained in:
parent
9b4bd81df3
commit
2e6fbe5856
3 changed files with 89 additions and 0 deletions
38
flake.nix
Normal file
38
flake.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
description = "Metanix infra logic flake";
|
||||
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
data = import ./meta.nix;
|
||||
metanix = import ./lib/metanix.nix { inherit data; lib = pkgs.lib; };
|
||||
in
|
||||
{
|
||||
# You get a devShell so you can :repl in peace
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
buildInputs = [ pkgs.nix pkgs.git ];
|
||||
};
|
||||
|
||||
# Simple command to dump the system index to stdout
|
||||
apps.${system}.print-index = {
|
||||
type = "app";
|
||||
program = pkgs.writeShellScript "print-index" ''
|
||||
nix eval --impure --expr '
|
||||
let
|
||||
data = import ./meta.nix;
|
||||
lib = import ${nixpkgs}/lib;
|
||||
metanix = import ./lib/metanix.nix { inherit data lib; };
|
||||
in
|
||||
builtins.toJSON metanix.buildSystemIndex
|
||||
'
|
||||
'';
|
||||
};
|
||||
|
||||
# Or expose it as a Nix eval-friendly output
|
||||
packages.${system}.default = pkgs.writeText "system-index.json"
|
||||
(builtins.toJSON metanix.buildSystemIndex);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue