strato-infra/flake.nix

67 lines
1.9 KiB
Nix
Raw Normal View History

2022-05-19 15:03:13 +02:00
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
colmena = {
url = "github:zhaofengli/colmena";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, colmena, nixos-generators, ... }:
let pkgs = nixpkgs.legacyPackages.x86_64-linux;
in {
packages.x86_64-linux.hello = pkgs.hello;
packages.x86_64-linux.default = colmena.packages.x86_64-linux.colmena;
packages.x86_64-linux.register = let
lxc = nixos-generators.nixosGenerate {
pkgs = pkgs;
modules = [ ./machines/base.nix ];
format = "lxc";
};
metadata = nixos-generators.nixosGenerate {
pkgs = pkgs;
modules = [ ./machines/base.nix ];
format = "lxc-metadata";
};
in with import nixpkgs { system = "x86_64-linux"; };
stdenv.mkDerivation {
name = "register-lxc-container";
buildInputs = [ ];
src = self;
buildPhase =
"mkdir -p $out; ln -s ${lxc} $out/lxc; ln -s ${metadata} $out/metadata";
2022-05-19 15:12:01 +02:00
installPhase = ''
ln -s $out/lxc/tarball/nixos-system-x86_64-linux.tar.xz $out/lxc.tar.xz;
ln -s $out/metadata/tarball/nixos-system-x86_64-linux.tar.xz $out/metadata.tar.xz;
'';
2022-05-19 15:03:13 +02:00
};
colmena = {
meta = { nixpkgs = import nixpkgs { system = "x86_64-linux"; }; };
nginx = {
imports = [ ./machines/nginx.nix ];
deployment.targetHost = "10.21.150.250";
};
nginx2 = {
imports = [ ./machines/nginx.nix ];
deployment.targetHost = "10.21.150.95";
};
};
devShells.x86_64-linux.default = pkgs.mkShell {
buildInputs = [ colmena.packages.x86_64-linux.colmena ];
};
};
}