-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflake.nix
More file actions
62 lines (58 loc) · 1.95 KB
/
Copy pathflake.nix
File metadata and controls
62 lines (58 loc) · 1.95 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
{
description = "A command-line tool to generate environment files using KeePass databases as a secure source for sensitive values.";
inputs = {
# Latest stable Nixpkgs
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0";
# A helper library for Rust + Nix
rust-overlay.url = "https://flakehub.com/f/oxalica/rust-overlay/*";
};
outputs = { self, nixpkgs, rust-overlay }:
let
# Systems supported
allSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
"x86_64-darwin" # 64-bit Intel macOS
"aarch64-darwin" # 64-bit ARM macOS
];
# Helper to provide system-specific attributes
forAllSystems = f: nixpkgs.lib.genAttrs allSystems (system: f {
pkgs = import nixpkgs {
inherit system;
overlays = [
# Provides Nixpkgs with a rust-bin attribute for building Rust toolchains
rust-overlay.overlays.default
# Uses the rust-bin attribute to select a Rust toolchain
self.overlays.default
];
};
});
in
{
overlays.default = final: prev: {
# The Rust toolchain used for the package build
rustToolchain = final.rust-bin.stable.latest.default;
};
packages = forAllSystems ({ pkgs }: {
default =
let
rustPlatform = pkgs.makeRustPlatform {
cargo = pkgs.rustToolchain;
rustc = pkgs.rustToolchain;
};
in
rustPlatform.buildRustPackage {
name = "keepass-2-file";
src = ./.;
doCheck = false;
cargoLock = {
lockFile = ./Cargo.lock;
};
postInstall = ''
mkdir -p $out/share/bash-completion/completions
$out/bin/keepass-2-file completion bash > $out/share/bash-completion/completions/keepass-2-file
'';
};
});
};
}