melodypond/flake.nix

62 lines
1.6 KiB
Nix
Raw Normal View History

2023-04-04 17:51:16 +00:00
{
description = "my project description";
inputs = {
2023-07-25 07:32:19 +00:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
2023-04-04 17:51:16 +00:00
flake-utils.url = "github:numtide/flake-utils";
2023-07-25 07:32:19 +00:00
colmena.url = "github:zhaofengli/colmena";
2023-04-04 17:51:16 +00:00
};
outputs = inputs@{self, nixpkgs, flake-utils, ...}:
flake-utils.lib.eachDefaultSystem (system:
2023-08-03 20:26:44 +00:00
let
# nixpkgs for native system.
2023-04-04 17:51:16 +00:00
pkgs = import nixpkgs {
inherit system;
2023-08-03 20:00:12 +00:00
overlays = [
inputs.colmena.overlay
];
2023-04-04 17:51:16 +00:00
};
2023-08-03 20:26:44 +00:00
# Native VM config.
2023-08-03 20:00:12 +00:00
clementine = nixpkgs.lib.nixosSystem {
inherit pkgs;
modules = [
./citrus.nix
2023-08-03 23:25:15 +00:00
"${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix"
2023-08-03 20:00:12 +00:00
./platforms/clementine.nix
];
};
2023-08-03 20:26:44 +00:00
in rec {
# Install colmena in dev shell for deployment.
2023-07-25 07:32:19 +00:00
devShell = pkgs.mkShell {
packages = with pkgs; [ colmena ];
};
2023-08-03 20:26:44 +00:00
# Run testing VM using `nix run`
2023-08-03 20:00:12 +00:00
packages.default = clementine.config.system.build.vm;
2023-07-27 19:24:32 +00:00
}) // (let
2023-08-03 20:26:44 +00:00
# Target device (RPi3 aarch64) nixpkgs.
2023-07-27 19:24:32 +00:00
pkgs = import nixpkgs {
system = "aarch64-linux";
};
2023-08-03 20:26:44 +00:00
# Modules for colmena and sd card image are the same.
2023-08-03 20:00:12 +00:00
modules = [
./citrus.nix
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix"
./platforms/orange.nix
];
in {
2023-08-03 20:26:44 +00:00
# Colmena deploy manifest
2023-07-25 07:32:19 +00:00
colmena = {
2023-08-03 20:00:12 +00:00
meta.nixpkgs = pkgs;
2023-07-25 07:32:19 +00:00
orange = {
deployment.targetUser = "geekygay";
2023-08-03 20:00:12 +00:00
imports = modules;
2023-07-25 07:32:19 +00:00
};
};
2023-08-03 20:26:44 +00:00
# SD card image build.
2023-08-03 20:00:12 +00:00
orange = (nixpkgs.lib.nixosSystem {
inherit pkgs modules;
}).config.system.build.sdImage;
2023-07-27 19:24:32 +00:00
});
2023-04-04 17:51:16 +00:00
}