diff --git a/flake.lock b/flake.lock index 1080ce4..eccc824 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,44 @@ { "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1717050755, + "narHash": "sha256-C9IEHABulv2zEDFA+Bf0E1nmfN4y6MIUe5eM2RCrDC0=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "31b6d2e40b36456e792cd6cf50d5a8ddd2fa59a1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1704161960, @@ -18,11 +57,27 @@ }, "root": { "inputs": { + "gomod2nix": "gomod2nix", "nixpkgs": "nixpkgs", "tailwind-ctp": "tailwind-ctp", "tailwind-ctp-lsp": "tailwind-ctp-lsp" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tailwind-ctp": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index b4cf20f..e93f15e 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,10 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + gomod2nix = { + url = "github:nix-community/gomod2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; tailwind-ctp = { url = "git+https://git.jolheiser.com/tailwind-ctp"; inputs.nixpkgs.follows = "nixpkgs"; @@ -16,6 +20,7 @@ outputs = { self, nixpkgs, + gomod2nix, tailwind-ctp, tailwind-ctp-lsp, } @ inputs: let @@ -23,15 +28,23 @@ pkgs = nixpkgs.legacyPackages.${system}; tailwind-ctp = inputs.tailwind-ctp.packages.${system}.default; tailwind-ctp-lsp = inputs.tailwind-ctp-lsp.packages.${system}.default; - ugit = pkgs.buildGoModule rec { - pname = "ugitd"; - version = self.rev or "dev"; + ugit = gomod2nix.legacyPackages.${system}.buildGoApplication rec { + name = "ugitd"; src = pkgs.nix-gitignore.gitignoreSource [] (builtins.path { - name = pname; + inherit name; path = ./.; }); + pwd = ./.; subPackages = ["cmd/ugitd"]; - vendorHash = nixpkgs.lib.fileContents ./go.mod.sri; + CGO_ENABLED = 0; + flags = [ + "-trimpath" + ]; + ldflags = [ + "-s" + "-w" + "-extldflags -static" + ]; meta = with pkgs.lib; { description = "Minimal git server"; homepage = "https://git.jolheiser.com/ugit"; @@ -45,6 +58,7 @@ nativeBuildInputs = with pkgs; [ go gopls + gomod2nix.legacyPackages.${system}.gomod2nix templ tailwind-ctp tailwind-ctp-lsp diff --git a/gomod2nix.toml b/gomod2nix.toml new file mode 100644 index 0000000..59ee644 --- /dev/null +++ b/gomod2nix.toml @@ -0,0 +1,180 @@ +schema = 3 + +[mod] + [mod."dario.cat/mergo"] + version = "v1.0.0" + hash = "sha256-jlpc8dDj+DmiOU4gEawBu8poJJj9My0s9Mvuk9oS8ww=" + [mod."github.com/Microsoft/go-winio"] + version = "v0.6.1" + hash = "sha256-BL0BVaHtmPKQts/711W59AbHXjGKqFS4ZTal0RYnR9I=" + [mod."github.com/ProtonMail/go-crypto"] + version = "v1.0.0" + hash = "sha256-Gflazvyv+457FpUTtPafJ+SdolYSalpsU0tragTxNi8=" + [mod."github.com/a-h/templ"] + version = "v0.2.543" + hash = "sha256-1BvIj9UPZJp8SOXMPIGdHyZLIvjORHg2UY3pRZJM01s=" + [mod."github.com/alecthomas/chroma/v2"] + version = "v2.12.0" + hash = "sha256-w3gKGPwsoayknuU4ifPaF0JOMNqnKjIEutbIkR9c2Ag=" + [mod."github.com/anmitsu/go-shlex"] + version = "v0.0.0-20200514113438-38f4b401e2be" + hash = "sha256-L3Ak4X2z7WXq7vMKuiHCOJ29nlpajUQ08Sfb9T0yP54=" + [mod."github.com/aymanbagabas/go-osc52/v2"] + version = "v2.0.1" + hash = "sha256-6Bp0jBZ6npvsYcKZGHHIUSVSTAMEyieweAX2YAKDjjg=" + [mod."github.com/charmbracelet/bubbletea"] + version = "v0.25.0" + hash = "sha256-A0WjFRFAUhwO3m7uvCOeefPPIM8ReU+xTtIRxG0aH+Y=" + [mod."github.com/charmbracelet/keygen"] + version = "v0.5.0" + hash = "sha256-JFD2SdFL7tq3oVhnBEgiBTrJvjqdUtIuodAJuSFcJoA=" + [mod."github.com/charmbracelet/lipgloss"] + version = "v0.9.1" + hash = "sha256-AHbabOymgDRIXsMBgJHS25/GgBWT54oGbd15EBWKeZc=" + [mod."github.com/charmbracelet/log"] + version = "v0.3.1" + hash = "sha256-Er60POPID2eNrRZnBHxoI4yHn0mIKnXYftGKSslbXx0=" + [mod."github.com/charmbracelet/ssh"] + version = "v0.0.0-20240201134204-3f297de25560" + hash = "sha256-r4h4bym47rs3C2us+sCgVfwAl4TCbm3bDCTsXKYREz8=" + [mod."github.com/charmbracelet/wish"] + version = "v1.3.0" + hash = "sha256-3Uq1PDu5DMoWgJykFx/roGk20x8jdb7o5JFPpmEtX/c=" + [mod."github.com/charmbracelet/x/errors"] + version = "v0.0.0-20240130180102-bafe6fbaee60" + hash = "sha256-GO8hf0lhVtl00C+xoTzvBtPU2cO0PymSLc2szBRUNtE=" + [mod."github.com/charmbracelet/x/exp/term"] + version = "v0.0.0-20240130180102-bafe6fbaee60" + hash = "sha256-hEj/Gj1U1ahk5EFVZVAL52yrdBNO47yXykpiehJICbc=" + [mod."github.com/cloudflare/circl"] + version = "v1.3.7" + hash = "sha256-AkOpcZ+evLxLJStvvr01+TLeWDqcLxY3e/AhGggzh40=" + [mod."github.com/containerd/console"] + version = "v1.0.4-0.20230706203907-8f6c4e4faef5" + hash = "sha256-mxRERsgS6TmI5I0UYblhzl2FZlbtkJhUkfF1x6mZINw=" + [mod."github.com/creack/pty"] + version = "v1.1.21" + hash = "sha256-pjGw6wQlrVhN65XaIxZueNJqnXThGu00u24rKOLzxS0=" + [mod."github.com/cyphar/filepath-securejoin"] + version = "v0.2.4" + hash = "sha256-heCD0xMxlwnHCHcRBgTjVexHOLyWI2zRW3E8NFKoLzk=" + [mod."github.com/dlclark/regexp2"] + version = "v1.10.0" + hash = "sha256-Jxzj/O/Q9tIWBOOgCkCibhrgJBzzfVIxYDsabt7O8ow=" + [mod."github.com/dustin/go-humanize"] + version = "v1.0.1" + hash = "sha256-yuvxYYngpfVkUg9yAmG99IUVmADTQA0tMbBXe0Fq0Mc=" + [mod."github.com/emirpasic/gods"] + version = "v1.18.1" + hash = "sha256-hGDKddjLj+5dn2woHtXKUdd49/3xdsqnhx7VEdCu1m4=" + [mod."github.com/go-chi/chi/v5"] + version = "v5.0.11" + hash = "sha256-95LKg/OVzhik2HUz6cirHH3eAT4qbHSg52bSvkc+XOY=" + [mod."github.com/go-git/gcfg"] + version = "v1.5.1-0.20230307220236-3a3c6141e376" + hash = "sha256-f4k0gSYuo0/q3WOoTxl2eFaj7WZpdz29ih6CKc8Ude8=" + [mod."github.com/go-git/go-billy/v5"] + version = "v5.5.0" + hash = "sha256-4XUoD2bOCMCdu83egb/y8kY/Fm0s1rWgPMtiahh38OQ=" + [mod."github.com/go-git/go-git/v5"] + version = "v5.11.0" + hash = "sha256-2yUM/FlV+nYxacVynJCnDZeMub4Iu8JL2WBHmlnwOkE=" + [mod."github.com/go-logfmt/logfmt"] + version = "v0.6.0" + hash = "sha256-RtIG2qARd5sT10WQ7F3LR8YJhS8exs+KiuUiVf75bWg=" + [mod."github.com/golang/groupcache"] + version = "v0.0.0-20210331224755-41bb18bfe9da" + hash = "sha256-7Gs7CS9gEYZkbu5P4hqPGBpeGZWC64VDwraSKFF+VR0=" + [mod."github.com/jbenet/go-context"] + version = "v0.0.0-20150711004518-d14ea06fba99" + hash = "sha256-VANNCWNNpARH/ILQV9sCQsBWgyL2iFT+4AHZREpxIWE=" + [mod."github.com/kevinburke/ssh_config"] + version = "v1.2.0" + hash = "sha256-Ta7ZOmyX8gG5tzWbY2oES70EJPfI90U7CIJS9EAce0s=" + [mod."github.com/lucasb-eyer/go-colorful"] + version = "v1.2.0" + hash = "sha256-Gg9dDJFCTaHrKHRR1SrJgZ8fWieJkybljybkI9x0gyE=" + [mod."github.com/mattn/go-isatty"] + version = "v0.0.20" + hash = "sha256-qhw9hWtU5wnyFyuMbKx+7RB8ckQaFQ8D+8GKPkN3HHQ=" + [mod."github.com/mattn/go-localereader"] + version = "v0.0.1" + hash = "sha256-JlWckeGaWG+bXK8l8WEdZqmSiTwCA8b1qbmBKa/Fj3E=" + [mod."github.com/mattn/go-runewidth"] + version = "v0.0.15" + hash = "sha256-WP39EU2UrQbByYfnwrkBDoKN7xzXsBssDq3pNryBGm0=" + [mod."github.com/muesli/ansi"] + version = "v0.0.0-20230316100256-276c6243b2f6" + hash = "sha256-qRKn0Bh2yvP0QxeEMeZe11Vz0BPFIkVcleKsPeybKMs=" + [mod."github.com/muesli/cancelreader"] + version = "v0.2.2" + hash = "sha256-uEPpzwRJBJsQWBw6M71FDfgJuR7n55d/7IV8MO+rpwQ=" + [mod."github.com/muesli/reflow"] + version = "v0.3.0" + hash = "sha256-Pou2ybE9SFSZG6YfZLVV1Eyfm+X4FuVpDPLxhpn47Cc=" + [mod."github.com/muesli/termenv"] + version = "v0.15.2" + hash = "sha256-Eum/SpyytcNIchANPkG4bYGBgcezLgej7j/+6IhqoMU=" + [mod."github.com/peterbourgon/ff/v3"] + version = "v3.4.0" + hash = "sha256-rmRl4GSmc2atnMbw6hTs6jwxW5lO4ivYuF2VN3jacZM=" + [mod."github.com/pjbgf/sha1cd"] + version = "v0.3.0" + hash = "sha256-kX9BdLh2dxtGNaDvc24NORO+C0AZ7JzbrXrtecCdB7w=" + [mod."github.com/rivo/uniseg"] + version = "v0.4.6" + hash = "sha256-zGfzO8FWj03POzo47SzrK1B4yLMKJ7iic6ium76ZLzI=" + [mod."github.com/sergi/go-diff"] + version = "v1.3.1" + hash = "sha256-XLA/BLIPuUU76yikXqIeRSXr7T7A3Uz6I27+mDxGj7w=" + [mod."github.com/skeema/knownhosts"] + version = "v1.2.1" + hash = "sha256-u0jB6ahTdGa+SvcIvPNRLnbSHvgmW9X/ThRq0nWQrJs=" + [mod."github.com/u-root/u-root"] + version = "v0.12.0" + hash = "sha256-B9Qoq1S0l0W6twET54uxiWjh2ulxN/zMLAeWJX4cXW0=" + [mod."github.com/xanzy/ssh-agent"] + version = "v0.3.3" + hash = "sha256-l3pGB6IdzcPA/HLk93sSN6NM2pKPy+bVOoacR5RC2+c=" + [mod."github.com/yuin/goldmark"] + version = "v1.6.0" + hash = "sha256-0PeGjGxxM7lUSx2dn8yPUBpilPQzEN9nkgf3s+5zGTY=" + [mod."github.com/yuin/goldmark-emoji"] + version = "v1.0.2" + hash = "sha256-RvzhNXlF98fu9SD/Rve9JMtR4bcRh7rN56Twhh/kmt4=" + [mod."github.com/yuin/goldmark-highlighting/v2"] + version = "v2.0.0-20230729083705-37449abec8cc" + hash = "sha256-HpiwU7jIeDUAg2zOpTIiviQir8dpRPuXYh2nqFFccpg=" + [mod."golang.org/x/crypto"] + version = "v0.18.0" + hash = "sha256-BuMVUxOIyfLo8MOhqYt+uQ8NDN6P2KdblKyfPxINzQ4=" + [mod."golang.org/x/exp"] + version = "v0.0.0-20240119083558-1b970713d09a" + hash = "sha256-JQ3JLywTjgboNhs12blhOkS3ty7m8sUa/zaWv1k/X28=" + [mod."golang.org/x/mod"] + version = "v0.14.0" + hash = "sha256-sx3hWp5l99DBfIrn821ohfoBwvaITSHMWbzPvX0btLM=" + [mod."golang.org/x/net"] + version = "v0.20.0" + hash = "sha256-PCttIsWSBQd6fDXL49jepszUAMLnAGAKR//5EDO3XDk=" + [mod."golang.org/x/sync"] + version = "v0.6.0" + hash = "sha256-LLims/wjDZtIqlYCVHREewcUOX4hwRwplEuZKPOJ/HI=" + [mod."golang.org/x/sys"] + version = "v0.16.0" + hash = "sha256-ZkGclbp2S7NQYhbuGji6XokCn2Qi1BJy8dwyAOTV8sY=" + [mod."golang.org/x/term"] + version = "v0.16.0" + hash = "sha256-9qlHcsCI1sa7ZI4Q+fJbOp3mG5Y+uV16e+pGmG+MQe0=" + [mod."golang.org/x/text"] + version = "v0.14.0" + hash = "sha256-yh3B0tom1RfzQBf1RNmfdNWF1PtiqxV41jW1GVS6JAg=" + [mod."golang.org/x/tools"] + version = "v0.17.0" + hash = "sha256-CxuHfKKtUkn3VjA7D9WQjzvV1EUbyI/xMNhb5CxO6IQ=" + [mod."gopkg.in/warnings.v0"] + version = "v0.1.2" + hash = "sha256-ATVL9yEmgYbkJ1DkltDGRn/auGAjqGOfjQyBYyUo8s8=" + [mod."gopkg.in/yaml.v2"] + version = "v2.4.0" + hash = "sha256-uVEGglIedjOIGZzHW4YwN1VoRSTK8o0eGZqzd+TNdd0="