{ description = "my project description"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; flake-utils.url = "github:numtide/flake-utils"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; colmena.url = "github:zhaofengli/colmena"; mmelodies.url = "git+https://fem.mint.lgbt/theotheroracle/andisco.git"; mmelodies.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.colmena.overlay ]; }; # Native VM config. riversong = nixpkgs.lib.nixosSystem { pkgs = import nixpkgs { inherit system; overlays = [ inputs.mmelodies.overlay ]; }; modules = (builtins.attrValues self.nixosModules) ++ [ ./platforms/riversong.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 = riversong.config.system.build.vm; }) // (let # Target device (RPi4 aarch64) nixpkgs. pkgs = import nixpkgs { system = "aarch64-linux"; overlays = [ # https://github.com/NixOS/nixpkgs/issues/154163#issuecomment-1350599022 (final: super: { makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; }); }) inputs.mmelodies.overlay ]; }; # Modules for colmena and sd card image are the same. modules = (builtins.attrValues self.nixosModules) ++ [ ./platforms/melodypond.nix inputs.nixos-hardware.nixosModules.raspberry-pi-4 ]; in { nixosModules = { flakeAliases = { nix.registry = { nixpkgs.flake = nixpkgs; nixconf.flake = self; }; }; default = import ./configuration.nix; }; # Colmena deploy manifest colmena = { meta.nixpkgs = pkgs; melodypond = { deployment.targetUser = "geekygay"; imports = modules; }; }; # SD card image build. melodypond = (nixpkgs.lib.nixosSystem { inherit pkgs modules; }).config.system.build.sdImage; }); }