Add flake
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| .direnv/* | ||||
							
								
								
									
										27
									
								
								flake.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								flake.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| { | ||||
|   "nodes": { | ||||
|     "nixpkgs": { | ||||
|       "locked": { | ||||
|         "lastModified": 1732837521, | ||||
|         "narHash": "sha256-jNRNr49UiuIwaarqijgdTR2qLPifxsVhlJrKzQ8XUIE=", | ||||
|         "owner": "NixOS", | ||||
|         "repo": "nixpkgs", | ||||
|         "rev": "970e93b9f82e2a0f3675757eb0bfc73297cc6370", | ||||
|         "type": "github" | ||||
|       }, | ||||
|       "original": { | ||||
|         "owner": "NixOS", | ||||
|         "ref": "nixos-unstable", | ||||
|         "repo": "nixpkgs", | ||||
|         "type": "github" | ||||
|       } | ||||
|     }, | ||||
|     "root": { | ||||
|       "inputs": { | ||||
|         "nixpkgs": "nixpkgs" | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   "root": "root", | ||||
|   "version": 7 | ||||
| } | ||||
							
								
								
									
										67
									
								
								flake.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								flake.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| { | ||||
|   description = "Alertmanager to dbus notify bridge"; | ||||
|  | ||||
|   inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||||
|  | ||||
|   outputs = | ||||
|     { self, nixpkgs }: | ||||
|     let | ||||
|       allSystems = [ | ||||
|         "x86_64-linux" | ||||
|         "aarch64-linux" | ||||
|         "x86_64-darwin" | ||||
|         "aarch64-darwin" | ||||
|       ]; | ||||
|       forAllSystems = | ||||
|         f: | ||||
|         nixpkgs.lib.genAttrs allSystems ( | ||||
|           system: | ||||
|           f { | ||||
|             pkgs = import nixpkgs { inherit system; }; | ||||
|           } | ||||
|         ); | ||||
|     in | ||||
|     { | ||||
|       overlays.default = final: prev: { | ||||
|         alerttonotify = self.packages.${prev.system}.default; | ||||
|       }; | ||||
|  | ||||
|       packages = forAllSystems ( | ||||
|         { pkgs }: | ||||
|         { | ||||
|           default = | ||||
|             let | ||||
|               src = pkgs.lib.sourceFilesBySuffices ./. [ | ||||
|                 "go.mod" | ||||
|                 "go.sum" | ||||
|                 ".go" | ||||
|               ]; | ||||
|               version = pkgs.lib.strings.removePrefix "v" ( | ||||
|                 builtins.elemAt (pkgs.lib.strings.split "\"" ( | ||||
|                   pkgs.lib.lists.findFirst (x: pkgs.lib.strings.hasInfix "Version" x) null ( | ||||
|                     pkgs.lib.strings.splitString "\n" (builtins.readFile ./main.go) | ||||
|                   ) | ||||
|                 )) 2 | ||||
|               ); | ||||
|             in | ||||
|             pkgs.buildGoModule { | ||||
|               version = version; | ||||
|               pname = "alerttonotify"; | ||||
|               src = src; | ||||
|               vendorHash = pkgs.lib.fakeHash; | ||||
|             }; | ||||
|         } | ||||
|       ); | ||||
|       devShells = forAllSystems ( | ||||
|         { pkgs }: | ||||
|         { | ||||
|           default = pkgs.mkShell { | ||||
|             packages = with pkgs; [ | ||||
|               go | ||||
|               golangci-lint | ||||
|             ]; | ||||
|           }; | ||||
|         } | ||||
|       ); | ||||
|     }; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user