aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-09-28 01:53:30 -0700
committerFuwn <[email protected]>2024-09-28 02:00:42 -0700
commit3709b31dbbdbe51d0e315559adcb56c907883266 (patch)
tree656a3c362debbc98ee4d6640db7bbfce2376a6cb
parente147fccb2e85196e0bc7daf3a9e696b49a48ea3c (diff)
downloadgigi-3709b31dbbdbe51d0e315559adcb56c907883266.tar.xz
gigi-3709b31dbbdbe51d0e315559adcb56c907883266.zip
chore(nix): configure flake
-rw-r--r--.gitignore4
-rw-r--r--flake.lock143
-rw-r--r--flake.nix103
-rw-r--r--go.mod3
4 files changed, 253 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 50e9ba7..eb9fcf3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,7 @@ gigi
# Ninja
.ninja_*
+
+# Nix
+.pre-commit-config.yaml
+result
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..c725d28
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,143 @@
+{
+ "nodes": {
+ "flake-compat": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1696426674,
+ "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
+ "type": "github"
+ },
+ "original": {
+ "owner": "edolstra",
+ "repo": "flake-compat",
+ "type": "github"
+ }
+ },
+ "flake-utils": {
+ "inputs": {
+ "systems": [
+ "systems"
+ ]
+ },
+ "locked": {
+ "lastModified": 1726560853,
+ "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "gitignore": {
+ "inputs": {
+ "nixpkgs": [
+ "pre-commit-hooks",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1709087332,
+ "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
+ "owner": "hercules-ci",
+ "repo": "gitignore.nix",
+ "rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
+ "type": "github"
+ },
+ "original": {
+ "owner": "hercules-ci",
+ "repo": "gitignore.nix",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1727509811,
+ "narHash": "sha256-VMo9WWz6s0Ecn44z954cNBE1/USEZ2ui/FkEhKNnCzY=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "028b7d27a3bb8ca6a9096ede2f5c82e13876035b",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "nixpkgs-stable": {
+ "locked": {
+ "lastModified": 1720386169,
+ "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-24.05",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "pre-commit-hooks": {
+ "inputs": {
+ "flake-compat": [
+ "flake-compat"
+ ],
+ "gitignore": "gitignore",
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "nixpkgs-stable": "nixpkgs-stable"
+ },
+ "locked": {
+ "lastModified": 1726745158,
+ "narHash": "sha256-D5AegvGoEjt4rkKedmxlSEmC+nNLMBPWFxvmYnVLhjk=",
+ "owner": "cachix",
+ "repo": "git-hooks.nix",
+ "rev": "4e743a6920eab45e8ba0fbe49dc459f1423a4b74",
+ "type": "github"
+ },
+ "original": {
+ "owner": "cachix",
+ "repo": "git-hooks.nix",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-compat": "flake-compat",
+ "flake-utils": "flake-utils",
+ "nixpkgs": "nixpkgs",
+ "pre-commit-hooks": "pre-commit-hooks",
+ "systems": "systems"
+ }
+ },
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..9c0e65b
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,103 @@
+{
+ description = "An honest Finger protocol server";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs";
+ systems.url = "github:nix-systems/default";
+
+ flake-compat = {
+ url = "github:edolstra/flake-compat";
+ flake = false;
+ };
+
+ flake-utils = {
+ url = "github:numtide/flake-utils";
+ inputs.systems.follows = "systems";
+ };
+
+ pre-commit-hooks = {
+ url = "github:cachix/git-hooks.nix";
+
+ inputs = {
+ flake-compat.follows = "flake-compat";
+ nixpkgs.follows = "nixpkgs";
+ };
+ };
+ };
+
+ outputs =
+ {
+ self,
+ nixpkgs,
+ flake-utils,
+ pre-commit-hooks,
+ ...
+ }:
+ flake-utils.lib.eachDefaultSystem (
+ system:
+ let
+ pkgs = import nixpkgs { inherit system; };
+
+ meta = with pkgs.lib; {
+ description = "An honest Finger protocol server";
+ homepage = "https://github.com/Fuwn/gigi";
+ license = licenses.gpl3;
+ maintainers = [ maintainers.Fuwn ];
+ mainPackage = "gigi";
+ platforms = platforms.linux;
+ };
+
+ gigi = pkgs.buildGo122Module {
+ inherit meta;
+
+ pname = "gigi";
+ version = "0.2.0";
+ src = pkgs.lib.cleanSource ./.;
+ vendorHash = null;
+
+ ldflags = [
+ "-s"
+ "-w"
+ ];
+ };
+ in
+ {
+ packages = {
+ default = gigi;
+ gigi = self.packages.${system}.default;
+ };
+
+ apps = {
+ default = {
+ inherit meta;
+
+ type = "app";
+ program = "${self.packages.${system}.default}/bin/gigi";
+ };
+
+ gigi = self.apps.${system}.default;
+ };
+
+ formatter = nixpkgs.legacyPackages."${system}".nixfmt-rfc-style;
+
+ checks.pre-commit-check = pre-commit-hooks.lib.${system}.run {
+ src = ./.;
+
+ hooks = {
+ deadnix.enable = true;
+ flake-checker.enable = true;
+ nixfmt-rfc-style.enable = true;
+ statix.enable = true;
+ };
+ };
+
+ devShells.default = nixpkgs.legacyPackages.${system}.mkShell {
+ inherit (self.checks.${system}.pre-commit-check) shellHook;
+
+ buildInputs = self.checks.${system}.pre-commit-check.enabledPackages ++ [
+ pkgs.go_1_22
+ ];
+ };
+ }
+ );
+}
diff --git a/go.mod b/go.mod
new file mode 100644
index 0000000..d9ae005
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,3 @@
+module github.com/Fuwn/gigi
+
+go 1.22.7