diff options
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 82 |
1 files changed, 65 insertions, 17 deletions
@@ -1,15 +1,9 @@ { - description = "seth's website"; + description = "Getchoo's website"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - nix-filter.url = "github:numtide/nix-filter"; - - treefmt-nix = { - url = "github:numtide/treefmt-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; outputs = @@ -17,7 +11,6 @@ self, nixpkgs, nix-filter, - treefmt-nix, }: let inherit (nixpkgs) lib; @@ -25,14 +18,26 @@ forAllSystems = lib.genAttrs systems; nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system}); - treefmtFor = forAllSystems ( - system: treefmt-nix.lib.evalModule nixpkgsFor.${system} (self + "/treefmt.nix") - ); in { - checks = forAllSystems (system: { - treefmt = treefmtFor.${system}.config.build.check self; - }); + apps = forAllSystems ( + system: + let + pkgs = nixpkgsFor.${system}; + in + { + serve = { + type = "app"; + program = toString ( + pkgs.runCommand "serve-website" { nativeBuildInputs = [ pkgs.zola ]; } '' + tmpdir=$(mktemp -d) + cd ${self.packages.${system}.website.src} + zola serve --force --output-dir "$tmpdir" + '' + ); + }; + } + ); devShells = forAllSystems ( system: @@ -43,14 +48,18 @@ default = pkgs.mkShellNoCC { packages = [ pkgs.zola - self.formatter.${system} + pkgs.actionlint + pkgs.deadnix + pkgs.nil + pkgs.statix + self.formatter.${system} ]; }; } ); - formatter = forAllSystems (system: treefmtFor.${system}.config.build.wrapper); + formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style); packages = forAllSystems ( system: @@ -58,7 +67,46 @@ pkgs = nixpkgsFor.${system}; in { - website = pkgs.callPackage ./nix/package.nix { inherit nix-filter self; }; + website = pkgs.callPackage ( + { + lib, + stdenvNoCC, + writeShellApplication, + zola, + }: + + stdenvNoCC.mkDerivation { + pname = "getchoo-website"; + version = self.shortRev or self.dirtyShortRev or "unknown"; + + src = nix-filter.lib.filter { + root = self; + include = [ + "config.toml" + "content" + "highlight_themes" + "sass" + "static" + "templates" + ]; + }; + + nativeBuildInputs = [ zola ]; + + postBuild = "zola build --output-dir $out"; + + dontConfigure = true; + dontInstall = true; + dontFixup = true; + + meta = { + homepage = "https://github.com/getchoo/website"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ getchoo ]; + }; + } + ) { }; + default = self.packages.${system}.website; } ); |
