-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
72 lines (68 loc) · 2.51 KB
/
flake.nix
File metadata and controls
72 lines (68 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
description = "zig-keychain — Portable keychain/secrets abstraction in Zig";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = inputs @ { flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
perSystem = { pkgs, system, ... }:
let
zigVersion = "0.15.2";
zigTargets = {
aarch64-darwin = {
name = "aarch64-macos";
hash = "sha256-PMK6s2fhhc37J1AcSzCxsGU8KNn3PfjckUiOZuzl+ms=";
};
aarch64-linux = {
name = "aarch64-linux";
hash = "sha256-lY7X0eANDqdlkNJ2Zu+/epMigbPXugxrAbD/JkmPZn8=";
};
x86_64-linux = {
name = "x86_64-linux";
hash = "sha256-AqonDxg9onbltZILHaxEpj8aSeVQUOveOuzJ64L5Mjk=";
};
};
zigTarget = zigTargets.${system} or (throw "zig-keychain flake does not provide Zig ${zigVersion} for ${system}");
zig = pkgs.stdenv.mkDerivation {
pname = "zig";
version = zigVersion;
src = pkgs.fetchurl {
url = "https://ziglang.org/download/${zigVersion}/zig-${zigTarget.name}-${zigVersion}.tar.xz";
hash = zigTarget.hash;
};
nativeBuildInputs = [ pkgs.gnutar pkgs.xz ];
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir -p $out/bin $out/lib/zig
tar -xJf $src --strip-components=1 -C $out/lib/zig
ln -s $out/lib/zig/zig $out/bin/zig
'';
};
in
{
devShells.default = pkgs.mkShell {
packages = [
zig
pkgs.just
pkgs.python3Packages.detect-secrets
pkgs.python3Packages.mkdocs-material
pkgs.python3Packages.pymdown-extensions
pkgs.pre-commit
] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.CoreFoundation
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.libsecret
pkgs.glib
pkgs.pkg-config
];
shellHook = ''
echo "zig-keychain dev shell — zig $(zig version 2>/dev/null || echo 'not found')"
'';
};
};
};
}