orange/flake.nix

64 lines
1.9 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";
};
outputs = inputs@{self, nixpkgs, flake-utils, ...}:
flake-utils.lib.eachDefaultSystem (system:
let
# nixpkgs for native system.
pkgs = import nixpkgs {
inherit system;
overlays = [
inputs.colmena.overlay
];
};
# Native VM config.
clementine = nixpkgs.lib.nixosSystem {
inherit pkgs;
modules = [
{ nix.registry.nixconf.flake = self; }
./citrus.nix
"${nixpkgs}/nixos/modules/virtualisation/qemu-vm.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";
};
# Modules for colmena and sd card image are the same.
modules = [
{ nix.registry.nixconf.flake = self; }
./citrus.nix
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
./platforms/orange.nix
];
in {
# Colmena deploy manifest
colmena = {
meta.nixpkgs = pkgs;
orange = {
deployment.targetUser = "geekygay";
imports = modules;
};
};
# SD card image build.
orange = (nixpkgs.lib.nixosSystem {
inherit pkgs modules;
}).config.system.build.sdImage;
});
}