diff options
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 94 |
1 files changed, 67 insertions, 27 deletions
diff --git a/flake.nix b/flake.nix index 04bef10..900c3cf 100644 --- a/flake.nix +++ b/flake.nix @@ -1,31 +1,71 @@ { - description = "A Nix-flake-based Node.js development environment"; - + description = "My website, alanpearce.eu"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.flockenzeit.url = "github:balsoft/Flockenzeit"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.flake-compat = { + url = "github:edolstra/flake-compat"; + flake = false; + }; + + outputs = { self, nixpkgs, flockenzeit, flake-utils, ... }: + flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + overlays = [ + (final: prev: rec { + nodejs = prev.nodejs-18_x; + bun = (prev.bun.override { inherit nodejs; }); + }) + ]; + nativeBuildInputs = with pkgs; [ + zola + nodePackages.prettier + fd + brotli + gzip + zstd + git + ]; + in + rec { + packages = { + default = pkgs.stdenv.mkDerivation { + name = "alanpearce.eu"; + src = self; + + enableParallelBuilding = true; + makeFlags = [ "PREFIX=$(out)/public" ]; + + inherit nativeBuildInputs; + + dontFixup = true; - outputs = { self, nixpkgs }: - let - overlays = [ - (final: prev: rec { - nodejs = prev.nodejs-18_x; - bun = (prev.bun.override { inherit nodejs; }); - }) - ]; - supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; - forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { - pkgs = import nixpkgs { inherit overlays system; }; - }); - in - { - devShells = forEachSupportedSystem ({ pkgs }: { - default = pkgs.mkShell { - packages = with pkgs; [ - node2nix - nodejs - ] ++ (with pkgs.nodePackages; [ - prettier - ]); - }; - }); - }; + postInstall = '' + cp Caddyfile $out/ + ''; + }; + docker = import ./docker.nix { + inherit self pkgs flockenzeit; + website = packages.default; + }; + }; + devShells = { + default = pkgs.mkShell { + packages = with pkgs; [ + node2nix + nodejs + ] ++ (with pkgs.nodePackages; [ + prettier + ]); + }; + ssg = pkgs.mkShell { + buildInputs = with pkgs; [ + caddy + flyctl + ] ++ nativeBuildInputs; + }; + }; + }); } |