solar-dashboard/flake.nix
2024-06-25 07:24:23 +02:00

85 lines
2.1 KiB
Nix

{
description = "Description for the project";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
treefmt-nix.url = "github:numtide/treefmt-nix";
};
outputs =
inputs@{
flake-parts,
treefmt-nix,
self,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ treefmt-nix.flakeModule ];
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
perSystem =
{ pkgs, self', ... }:
{
# Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same
# system.
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs
pnpm
];
};
packages.default = pkgs.stdenv.mkDerivation {
pname = "solar-dashboard";
version = "1.0.0";
src = self';
buildInputs = with pkgs; [
nodejs
pnpm
];
buildPhase = ''
pnpm install
pnpm build
'';
installPhase = ''
mkdir -p $out
cp -r .next public package.json pnpm-lock.yaml $out/
'';
meta = with pkgs.lib; {
description = "A Solar Dashboard built on top of Next.js application";
license = licenses.mit;
maintainers = [ "blackdemonfire" ];
};
};
treefmt = {
projectRootFile = "flake.nix";
programs = {
nixfmt-rfc-style.enable = true;
deadnix.enable = true;
statix.enable = true;
prettier.enable = true;
};
};
};
flake.nixosModules.default =
let
inherit (flake-parts.lib) importApply withSystem;
in
importApply ./nixos-module.nix {
localFlake = self;
inherit withSystem;
};
};
}