flake.nix (view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
{
description = "site";
inputs.nixpkgs.url = "github:nixos/nixpkgs";
inputs.vite.url = "github:icyphox/go-vite";
outputs =
{ self
, nixpkgs
, vite
,
}:
let
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in
{
devShells = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
{
default = pkgs.mkShell {
buildInputs = [
vite.packages.${system}.vite
pkgs.gotools
pkgs.gnumake
pkgs.entr
pkgs.awscli2
];
};
}
);
apps = forAllSystems (
system:
let
pkgs = nixpkgsFor.${system};
in
{
default = {
type = "app";
program = "${pkgs.writeShellScriptBin "vite-build" ''
#!/usr/bin/env bash
${vite.packages.${system}.vite}/bin/vite build
''}/bin/vite-build";
cwd = ./.;
};
deploy = {
type = "app";
program = "${pkgs.writeShellScriptBin "s3-sync" ''
#!/usr/bin/env bash
${vite.packages.${system}.vite}/bin/vite build
${pkgs.awscli2}/bin/aws s3 sync build s3://site/ --size-only
''}/bin/s3-sync";
};
}
);
};
}
|