Home

blog @7ad5d166cf2aa10d4c649b808037fe0d557a82d1 - refs - log -
-
https://git.jolheiser.com/blog.git
My nonexistent blog
blog / flake.nix
- 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
{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs";
    templ = {
      url = "github:a-h/templ";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    self,
    nixpkgs,
    templ,
  } @ inputs: let
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages.${system};
    templ = inputs.templ.packages.${system}.templ;
  in {
    packages.${system}.default = pkgs.buildGoModule {
      pname = "blog.jolheiser.com";
      version = "blog";
      src = ./.;
      vendorHash = nixpkgs.lib.fileContents ./go.mod.sri;
      nativeBuildInputs = [templ];
      excludedPackages = ".";
      postBuild = ''
        export BLOG_REF=${self.rev or "main"}
        go generate
        mv out $out
      '';
    };
    devShells.default = pkgs.mkShell {
      nativeBuildInputs = with pkgs; [
        go
        templ
        vscode-langservers-extracted
      ];
    };
  };
}