melodypond/flake.nix
2023-08-03 16:26:44 -04:00

65 lines
1.7 KiB
Nix

{
description = "my project description";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
colmena.url = "github:zhaofengli/colmena";
graphfix.url = "sourcehut:~mtxyz/graphfix";
graphfix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{self, nixpkgs, flake-utils, ...}:
flake-utils.lib.eachDefaultSystem (system:
let
# nixpkgs for native system.
pkgs = import nixpkgs {
inherit system;
overlays = [
inputs.graphfix.overlay
inputs.colmena.overlay
];
};
# Native VM config.
clementine = nixpkgs.lib.nixosSystem {
inherit pkgs;
modules = [
./citrus.nix
./platforms/clementine.nix
];
};
in rec {
# Install colmena in dev shell for deployment.
devShell = pkgs.mkShell {
packages = with pkgs; [ colmena ];
};
# Run testing VM using `nix run`
packages.default = clementine.config.system.build.vm;
}) // (let
# Target device (RPi3 aarch64) nixpkgs.
pkgs = import nixpkgs {
system = "aarch64-linux";
overlays = [ inputs.graphfix.overlay ];
};
# Modules for colmena and sd card image are the same.
modules = [
./citrus.nix
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
./platforms/orange.nix
];
in {
# Colmena deploy manifest
colmena = {
meta.nixpkgs = pkgs;
orange = {
imports = modules;
};
};
# SD card image build.
orange = (nixpkgs.lib.nixosSystem {
inherit pkgs modules;
}).config.system.build.sdImage;
});
}