all repos — vite @ bc18e19877fdb3475feb5456afaadf29dd873df7

a fast (this time, actually) and minimal static site generator

nix: setup gomod2nix
Anirudh Oppiliappan x@icyphox.sh
Sun, 19 Mar 2023 12:20:58 +0200
commit

bc18e19877fdb3475feb5456afaadf29dd873df7

parent

4ca05429e8f957879142a9b73eaa8b0b60677105

6 files changed, 180 insertions(+), 20 deletions(-)

jump to
M .gitignore.gitignore

@@ -1,3 +1,4 @@

vite .env .direnv +result
A default.nix

@@ -0,0 +1,20 @@

+{ pkgs ? ( + let + inherit (builtins) fetchTree fromJSON readFile; + inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; + in + import (fetchTree nixpkgs.locked) { + overlays = [ + (import "${fetchTree gomod2nix.locked}/overlay.nix") + ]; + } + ) +}: + +pkgs.buildGoApplication { + pname = "vite"; + version = "0.1"; + pwd = ./.; + src = ./.; + modules = ./gomod2nix.toml; +}
M flake.lockflake.lock

@@ -1,22 +1,91 @@

{ "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + }, + "locked": { + "lastModified": 1677459247, + "narHash": "sha256-JbakfAiPYmCCV224yAMq/XO0udN5coWv/oazblMKdoY=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "3cbf3a51fe32e2f57af4c52744e7228bab22983d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1648219316, - "narHash": "sha256-Ctij+dOi0ZZIfX5eMhgwugfvB+WZSrvVNAyAuANOsnQ=", + "lastModified": 1658285632, + "narHash": "sha256-zRS5S/hoeDGUbO+L95wXG9vJNwsSYcl93XiD0HQBXLk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5342fc6fb59d0595d26883c3cadff16ce58e44f3", + "type": "github" + }, + "original": { "owner": "NixOS", + "ref": "master", "repo": "nixpkgs", - "rev": "30d3d79b7d3607d56546dd2a6b49e156ba0ec634", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1678898370, + "narHash": "sha256-xTICr1j+uat5hk9FyuPOFGxpWHdJRibwZC+ATi0RbtE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ac718d02867a84b42522a0ece52d841188208f2c", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" } }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "flake-utils": "flake-utils", + "gomod2nix": "gomod2nix", + "nixpkgs": "nixpkgs_2" + } + }, + "utils": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" } } },
M flake.nixflake.nix

@@ -1,17 +1,23 @@

{ - description = "vite"; + description = "a fast and minimal static site generator"; - outputs = { self, nixpkgs }: { - devShell.x86_64-linux = - let - pkgs = nixpkgs.legacyPackages.x86_64-linux; - in - pkgs.mkShell { - buildInputs = with pkgs; [ - go - gotools - gnumake - ]; - }; - }; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + inputs.gomod2nix.url = "github:nix-community/gomod2nix"; + + outputs = { self, nixpkgs, flake-utils, gomod2nix }: + (flake-utils.lib.eachDefaultSystem + (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = [ gomod2nix.overlays.default ]; + }; + + in + { + packages.default = pkgs.callPackage ./. { }; + devShells.default = import ./shell.nix { inherit pkgs; }; + }) + ); }
A gomod2nix.toml

@@ -0,0 +1,42 @@

+schema = 3 + +[mod] + [mod."git.icyphox.sh/grayfriday"] + version = "v0.0.0-20221126034429-23c704183914" + hash = "sha256-cwTiK30/ZNbp1/R6x/DojxVlgnL0vy3vBiklNJi6wUE=" + [mod."github.com/BurntSushi/toml"] + version = "v0.3.1" + hash = "sha256-Rqak1dE/Aj/+Kx1/pl3Hifgt+Q3OzuZ5fJR+/x3nTbo=" + [mod."github.com/adrg/frontmatter"] + version = "v0.2.0" + hash = "sha256-WJsVcdCpkIkjqUz5fJOFStZYwQlrcFzQ6+mZatZiimo=" + [mod."github.com/alecthomas/chroma"] + version = "v0.10.0" + hash = "sha256-p721vddVTv4iv1O0/dqpdk5xF6x9iLIHcrfh8JEVnqQ=" + [mod."github.com/davecgh/go-spew"] + version = "v1.1.1" + hash = "sha256-nhzSUrE1fCkN0+RL04N4h8jWmRFPPPWbCuDc7Ss0akI=" + [mod."github.com/dlclark/regexp2"] + version = "v1.4.0" + hash = "sha256-Pk/S2x2rX7xnGFLyoHEw09CoNQimvz/msdPRsxLaLsc=" + [mod."github.com/pmezard/go-difflib"] + version = "v1.0.0" + hash = "sha256-/FtmHnaGjdvEIKAJtrUfEhV7EVo5A/eYrtdnUkuxLDA=" + [mod."github.com/stretchr/objx"] + version = "v0.1.0" + hash = "sha256-az0Vd4MG3JXfaYbj0Q6AOmNkrXgmXDeQm8+BBiDXmdA=" + [mod."github.com/stretchr/testify"] + version = "v1.7.0" + hash = "sha256-t1I9uCrn9vSUu/z5IZuNyGShmbOcJ6UGc2f75ZBrHzE=" + [mod."gopkg.in/check.v1"] + version = "v0.0.0-20161208181325-20d25e280405" + hash = "sha256-1w5mgYaZUC52uzDnpXXVqle/9AVkH4WePSrQFOVANUw=" + [mod."gopkg.in/yaml.v2"] + version = "v2.3.0" + hash = "sha256-8tPC5nMGvUFs97W6+JXsxJLjU6EpDmPG9tXo1DyFoNU=" + [mod."gopkg.in/yaml.v3"] + version = "v3.0.0-20210107192922-496545a6307b" + hash = "sha256-j8yDji+vqsitpRZirpb4w/Em8nstgf28wpwkcrOlxBk=" + [mod."icyphox.sh/grayfriday"] + version = "v0.0.0-20221130034322-1ea518786419" + hash = "sha256-+mS2SbGUSAtgo9sOlpldHrH23AiBT+2OosRz44pDqbg="
A shell.nix

@@ -0,0 +1,22 @@

+{ pkgs ? ( + let + inherit (builtins) fetchTree fromJSON readFile; + inherit ((fromJSON (readFile ./flake.lock)).nodes) nixpkgs gomod2nix; + in + import (fetchTree nixpkgs.locked) { + overlays = [ + (import "${fetchTree gomod2nix.locked}/overlay.nix") + ]; + } + ) +}: + +let + goEnv = pkgs.mkGoEnv { pwd = ./.; }; +in +pkgs.mkShell { + packages = [ + goEnv + pkgs.gomod2nix + ]; +}