add flake
Anirudh Oppiliappan x@icyphox.sh
Wed, 10 Jul 2024 11:27:30 +0300
4 files changed,
124 insertions(+),
2 deletions(-)
A
flake.lock
@@ -0,0 +1,26 @@
+{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1720169455, + "narHash": "sha256-mY0wDPQ/PS4H4vCPxfXyZxKjeVLDSJMRITQCBPl3iYo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c54175934a00686aa2f266ecbfd1074ee7c0fa93", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +}
A
flake.nix
@@ -0,0 +1,96 @@
+{ + inputs.nixpkgs.url = "github:nixos/nixpkgs"; + + outputs = + { self + , nixpkgs + , + }: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); + in + { + packages = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + honk = self.packages.${system}.honk; + files = pkgs.lib.fileset.toSource { + root = ./.; + fileset = pkgs.lib.fileset.unions [ + ./. + ]; + }; + in + { + honk = pkgs.buildGoModule { + name = "honk"; + rev = "master"; + src = pkgs.lib.fileset.toSource + { + root = ./.; + fileset = pkgs.lib.fileset.unions [ + ./go.mod + ./go.sum + ./views + ./memes + ./schema.sql + ./activity.go + ./admin.go + ./avatar.go + ./backend.go + ./backupdb.go + ./bloat.go + ./cli.go + ./database.go + ./deliverator.go + ./encrypt.go + ./fun.go + ./hfcs.go + ./honk.go + ./import.go + ./main.go + ./masto.go + ./masto_util.go + ./sensors.go + ./skulduggery.go + ./syndicate.go + ./unveil.go + ./upgradedb.go + ./util.go + ./web.go + ]; + }; + CGO_ENABLED = 1; + nativeBuildInputs = [ pkgs.gcc ]; + buildInputs = [ pkgs.sqlite ]; + + vendorHash = "sha256-ahOYBN6lMQz68CN+8a04atsEEUDpQxRES7HWtZgQTmc="; + }; + docker = pkgs.dockerTools.buildLayeredImage { + name = "sini:5000/honk"; + tag = "latest"; + contents = [ files honk pkgs.cacert ]; + config = { + Entrypoint = [ "${honk}/bin/honk" ]; + ExposedPorts = { "5555/tcp" = { }; }; + }; + }; + }); + + defaultPackage = forAllSystems (system: self.packages.${system}.honk); + devShells = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + in + { + default = pkgs.mkShell { + nativeBuildInputs = with pkgs; [ + go + ]; + }; + }); + }; +} +
M
views/about.html
→
views/about.html
@@ -7,7 +7,7 @@ <table class="font08em">
<tbody> <tr><td>version:<td class="text-right">{{ .HonkVersion }} <tr><td>memory:<td class="text-right">{{ printf "%.02f" .Sensors.Memory }}MB -<tr><td>uptime:<td class="text-right">{{ printf "%.02f" .Sensors.Uptime }}s +<tr><td>uptime:<td class="text-right">{{ .Sensors.Uptime }} <tr><td>cputime:<td class="text-right">{{ printf "%.02f" .Sensors.CPU }}s </table> <p>