Nix flakes on the AT protocol
2.4 kB
94 lines
1{
2 description = "Declarative environment for Nix on ATproto project";
3
4 inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs
5
6 outputs =
7 inputs@{ self, nixpkgs, ... }:
8
9 let
10 supportedSystems = [
11 "x86_64-linux" # 64-bit Intel/AMD Linux
12 "aarch64-linux" # 64-bit ARM Linux
13 "aarch64-darwin" # 64-bit ARM macOS
14 ];
15
16 forEachSupportedSystem =
17 f:
18 inputs.nixpkgs.lib.genAttrs supportedSystems (
19 system:
20 f {
21 inherit system;
22 pkgs = import inputs.nixpkgs { inherit system; };
23 }
24 );
25 in
26 {
27 packages = forEachSupportedSystem (
28 { pkgs, system }: {
29 default = pkgs.stdenvNoCC.mkDerivation {
30 pname = "nixat";
31 version = "272K";
32 src = self;
33 nativeBuildInputs = [ pkgs.makeWrapper ];
34
35 meta = with nixpkgs.lib; {
36 description = "A small script for publishing and building Nix flakes on and for the AT protocol";
37 homepage = "https://tangled.org/stau.space/nixat";
38 license = licenses.mit;
39 platform = platforms.all;
40 };
41
42 outputs = [ "out" ];
43
44 configurePhase = ''
45 runHook preConfigure
46 mkdir -p $out/bin
47 runHook postConfigure
48 '';
49
50 buildPhase = ''
51 runHook preBuild
52 cp ${./nixat} $out/bin/nixat
53 chmod +w $out/bin/nixat
54 wrapProgram $out/bin/nixat --prefix PATH : ${
55 pkgs.lib.makeBinPath (
56 with pkgs;
57 [
58 jq
59 git
60 nix
61 atproto-goat
62 ]
63 )
64 }
65 runHook postBuild
66 '';
67
68 propagatedBuildInputs = with pkgs; [
69 jq
70 git
71 ];
72 };
73 }
74 );
75
76 devShells = forEachSupportedSystem (
77 { pkgs, system }: {
78 default = pkgs.mkShellNoCC {
79 packages = with pkgs; [
80 atproto-goat
81 shellcheck
82 jq
83 ];
84
85 env = { };
86
87 shellHook = "";
88 };
89 }
90 );
91
92 formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt);
93 };
94}