-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
59 lines (51 loc) · 1.63 KB
/
flake.nix
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
{
outputs = { flake-utils, nixpkgs, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
setup-internal = pkgs.writeShellApplication {
name = "setup-internal";
text = let files = "{age,encrypted_keys,parse,tui,wordlist}"; in ''
rm -fv internal/${files}.go
cp -v ${pkgs.age.src}/cmd/age/${files}.go internal
sed -Ei 's|package main|package internal|' internal/*.go
'';
};
in
rec {
packages.default = pkgs.buildGoModule rec {
pname = "sillysecrets";
version = "1.4.0";
src = ./.;
vendorHash = "sha256-BdPKXOwWPGQGCvdXVKC7kax86UtUmLjD9wco8Gay2pE=";
preBuild = pkgs.lib.getExe setup-internal;
CGO_ENABLED = "0";
ldflags = [ "-s" "-w" ];
nativeBuildInputs = with pkgs; [
installShellFiles
makeBinaryWrapper
];
postInstall = ''
mv $out/bin/{${pname},sesi}
wrapProgram $out/bin/sesi \
--prefix PATH : ${pkgs.moreutils}/bin
for i in bash fish zsh; do
$out/bin/sesi completion $i > sesi.$i
installShellCompletion sesi.$i
done
'';
meta.mainProgram = "sesi";
};
devShells.default = pkgs.mkShell {
inputsFrom = [ packages.default ];
packages = with pkgs; [
age
age-plugin-fido2-hmac
cobra-cli
delve
setup-internal
ssh-to-age
];
};
});
}