Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
a38b0ca3dc |
5 changed files with 503 additions and 470 deletions
745
Cargo.lock
generated
745
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
16
Cargo.toml
16
Cargo.toml
|
|
@ -13,19 +13,3 @@ rfd = "0.17.2"
|
|||
|
||||
[dependencies.iced]
|
||||
version = "0.14.0"
|
||||
|
||||
[profile.debug]
|
||||
debug = true
|
||||
strip = "none"
|
||||
debug-assertions = true
|
||||
overflow-checks = true
|
||||
|
||||
[profile.dev]
|
||||
debug = false
|
||||
debug-assertions = false
|
||||
overflow-checks = false
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
lto = "fat"
|
||||
strip = "symbols"
|
||||
|
|
|
|||
36
flake.lock
generated
36
flake.lock
generated
|
|
@ -1,15 +1,30 @@
|
|||
{
|
||||
"nodes": {
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1785782307,
|
||||
"narHash": "sha256-MPaRdVkf6zZP5fCPxYCi8Dr4pZzgmXzg8T9nVEbp3Mw=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "2c71e194474d13de031d729b729c968ddbe3507f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1794427683,
|
||||
"narHash": "sha256-o7ey9gEilsxaifqJWnBDlYSKbNWYQYtKwDyXeZU2kaU=",
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "cd489559845d81f673a12885576016c65cbe9363",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -20,11 +35,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1795234589,
|
||||
"narHash": "sha256-pAEASBc6wof0S58XcSEdZoQ2iFQDkCnZwH+wFLrkd1Q=",
|
||||
"rev": "2786a2a72088ecf32aea5b3ec52099e6a7cff78f",
|
||||
"lastModified": 1786862985,
|
||||
"narHash": "sha256-kSR/jfpR4cE26YRZ8exQkoRbEA30vyWimajwZANYYaE=",
|
||||
"rev": "e5bdc4a41d4c072fe1e3787eaa0320a384741d44",
|
||||
"type": "tarball",
|
||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1125864.2786a2a72088/nixexprs.tar.zst?lastModified=1795234589&rev=2786a2a72088ecf32aea5b3ec52099e6a7cff78f"
|
||||
"url": "https://releases.nixos.org/nixos/unstable/nixos-26.11pre1055335.e5bdc4a41d4c/nixexprs.tar.zst?lastModified=1786862985&rev=e5bdc4a41d4c072fe1e3787eaa0320a384741d44"
|
||||
},
|
||||
"original": {
|
||||
"type": "tarball",
|
||||
|
|
@ -33,17 +48,18 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1791244623,
|
||||
"narHash": "sha256-uuanbkFk8a313Zfrxdcz8Us/yQtaxNnKJtX8v0ZPpd8=",
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "d36eeed142f88b5a636f2e3856a53c61654cf29b",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
144
flake.nix
144
flake.nix
|
|
@ -2,6 +2,8 @@
|
|||
inputs = {
|
||||
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
|
||||
|
||||
crane.url = "github:ipetkov/crane";
|
||||
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
|
|
@ -10,60 +12,53 @@
|
|||
inputs.flake-utils.lib.eachDefaultSystem (
|
||||
system:
|
||||
let
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
lib = inputs.nixpkgs.lib;
|
||||
pkgs = import inputs.nixpkgs { inherit system; };
|
||||
lib = pkgs.lib;
|
||||
craneLib = inputs.crane.mkLib pkgs;
|
||||
|
||||
src = lib.sourceFilesBySuffices ./. [
|
||||
"Cargo.toml"
|
||||
"Cargo.lock"
|
||||
".rs"
|
||||
];
|
||||
|
||||
cargoToml = fromTOML (builtins.readFile "${src}/Cargo.toml");
|
||||
cargoToml = fromTOML (builtins.readFile ./Cargo.toml);
|
||||
name = cargoToml.package.name;
|
||||
|
||||
bin =
|
||||
{
|
||||
rustPlatform,
|
||||
|
||||
autoPatchelfHook,
|
||||
|
||||
libxkbcommon,
|
||||
wayland,
|
||||
vulkan-loader,
|
||||
|
||||
moreSupport ? false,
|
||||
libGL,
|
||||
libx11,
|
||||
libxcursor,
|
||||
libxi,
|
||||
|
||||
libgcc,
|
||||
}:
|
||||
rustPlatform.buildRustPackage {
|
||||
inherit name src;
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoPatchelfHook
|
||||
];
|
||||
buildInputs = [
|
||||
libgcc
|
||||
];
|
||||
runtimeDependencies = [
|
||||
dlDeps =
|
||||
with pkgs;
|
||||
[
|
||||
# needed for both x11 and wayland
|
||||
libxkbcommon
|
||||
wayland
|
||||
vulkan-loader
|
||||
]
|
||||
++ lib.optionals moreSupport [
|
||||
libGL
|
||||
|
||||
libx11
|
||||
libxcursor
|
||||
libxi
|
||||
libxcb
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
vulkan-loader
|
||||
wayland
|
||||
|
||||
dbus.lib
|
||||
];
|
||||
|
||||
cargoLock.lockFile = "${src}/Cargo.lock";
|
||||
commonArgs = {
|
||||
# all that's needed for artifacts and checks
|
||||
nativeBuildInputs = with pkgs; [
|
||||
# pkg-config
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
];
|
||||
|
||||
postFixup =
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
|
||||
src = ./.;
|
||||
};
|
||||
|
||||
# Build *just* the cargo dependencies,
|
||||
# to reuse them for build and test derivations.
|
||||
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||
|
||||
# Build the actual crate itself,
|
||||
# reusing the dependency artifacts from above.
|
||||
crate =
|
||||
let
|
||||
desktopItem = pkgs.makeDesktopItem {
|
||||
inherit name;
|
||||
|
|
@ -71,35 +66,52 @@
|
|||
exec = name;
|
||||
};
|
||||
in
|
||||
/* sh */ ''
|
||||
craneLib.buildPackage (
|
||||
commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
|
||||
nativeBuildInputs = commonArgs.nativeBuildInputs ++ [
|
||||
pkgs.autoPatchelfHook
|
||||
];
|
||||
|
||||
buildInputs = commonArgs.buildInputs ++ [
|
||||
pkgs.libgcc
|
||||
];
|
||||
|
||||
runtimeDependencies = dlDeps;
|
||||
|
||||
doCheck = false;
|
||||
|
||||
postFixup = ''
|
||||
cp -rs "${desktopItem}"/* "$out"
|
||||
'';
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
packages.default = crate;
|
||||
|
||||
checks = {
|
||||
crate-clippy = craneLib.cargoClippy (
|
||||
commonArgs
|
||||
// {
|
||||
inherit cargoArtifacts;
|
||||
|
||||
cargoClippyExtraArgs = "-- --deny warnings";
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
devShells.default = craneLib.devShell {
|
||||
env.LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps;
|
||||
|
||||
inputsFrom = [ crate ];
|
||||
packages = [ pkgs.rust-analyzer ];
|
||||
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
};
|
||||
|
||||
default = pkgs.callPackage bin { };
|
||||
in
|
||||
{
|
||||
packages.default = default;
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
inputsFrom = [ default ];
|
||||
|
||||
env.RUSTFLAGS = builtins.concatStringsSep " " [
|
||||
"-Clink-arg=-Wl,-rpath,${lib.makeLibraryPath default.runtimeDependencies}"
|
||||
"-Clink-arg=-fuse-ld=mold"
|
||||
];
|
||||
|
||||
packages = with pkgs; [
|
||||
clippy
|
||||
rustfmt
|
||||
rust-analyzer
|
||||
|
||||
mold
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ enum Message {
|
|||
ChangeQuery(String),
|
||||
|
||||
Copy,
|
||||
Edit,
|
||||
|
||||
FocusNext,
|
||||
FocusPrevious,
|
||||
|
|
@ -65,6 +66,8 @@ struct State {
|
|||
selected_field: db::BasicField,
|
||||
query: String,
|
||||
|
||||
editing_entry: Option<keepass::db::EntryId>,
|
||||
|
||||
status: Cow<'static, str>,
|
||||
error: Cow<'static, str>,
|
||||
}
|
||||
|
|
@ -182,6 +185,13 @@ impl State {
|
|||
}
|
||||
}
|
||||
|
||||
Message::Edit => {
|
||||
self.editing_entry = self
|
||||
.db_view
|
||||
.get(self.selected_entry)
|
||||
.map(|entry| entry.id());
|
||||
}
|
||||
|
||||
Message::FocusNext => return widget::operation::focus_next(),
|
||||
Message::FocusPrevious => return widget::operation::focus_previous(),
|
||||
Message::FocusSearch => return widget::operation::focus("search"),
|
||||
|
|
@ -404,7 +414,7 @@ impl State {
|
|||
|
||||
Key::Character("y" | "c") if db_loaded => Some(Message::Copy),
|
||||
|
||||
Key::Named(key::Named::Escape) => Some(Message::ChangeQuery(String::new())),
|
||||
Key::Character("e") if db_loaded => Some(Message::Edit),
|
||||
|
||||
Key::Character("q") => Some(Message::Quit),
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue