馃尫 the cutsie hackatime helper
1{
2 description = "馃尫 the cutsie hackatime helper";
3
4 inputs = {
5 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6 };
7
8 outputs = { self, nixpkgs }:
9 let
10 allSystems = [
11 "x86_64-linux" # 64-bit Intel/AMD Linux
12 "aarch64-linux" # 64-bit ARM Linux
13 "x86_64-darwin" # 64-bit Intel macOS
14 "aarch64-darwin" # 64-bit ARM macOS
15 ];
16 forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
17 pkgs = import nixpkgs { inherit system; };
18 });
19 in
20 {
21 packages = forAllSystems ({ pkgs }: {
22 default = pkgs.buildGoModule {
23 pname = "akami";
24 version = "0.0.1";
25 subPackages = [ "." ]; # Build from root directory
26 src = ./.;
27 vendorHash = "sha256-9gO00c3D846SJl5dbtfj0qasmONLNxU/7V1TG6QEaxM=";
28 };
29 });
30
31 devShells = forAllSystems ({ pkgs }: {
32 default = pkgs.mkShell {
33 buildInputs = with pkgs; [
34 go
35 gopls
36 gotools
37 go-tools
38 (pkgs.writeShellScriptBin "akami-dev" ''
39 go build -o ./bin/akami ./main.go
40 ./bin/akami "$@" || true
41 '')
42 ];
43
44 shellHook = ''
45 export PATH=$PATH:$PWD/bin
46 mkdir -p $PWD/bin
47 '';
48 };
49 });
50
51 apps = forAllSystems ({ pkgs }: {
52 default = {
53 type = "app";
54 program = "${self.packages.${pkgs.system}.default}/bin/akami";
55 };
56 akami-dev = {
57 type = "app";
58 program = toString (pkgs.writeShellScript "akami-dev" ''
59 go build -o ./bin/akami ./main.go
60 ./bin/akami $* || true
61 '');
62 };
63 });
64 };
65}