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]
|
[dependencies.iced]
|
||||||
version = "0.14.0"
|
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": {
|
"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": {
|
"flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"systems": "systems"
|
"systems": "systems"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1794427683,
|
"lastModified": 1731533236,
|
||||||
"narHash": "sha256-o7ey9gEilsxaifqJWnBDlYSKbNWYQYtKwDyXeZU2kaU=",
|
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "cd489559845d81f673a12885576016c65cbe9363",
|
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -20,11 +35,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1795234589,
|
"lastModified": 1786862985,
|
||||||
"narHash": "sha256-pAEASBc6wof0S58XcSEdZoQ2iFQDkCnZwH+wFLrkd1Q=",
|
"narHash": "sha256-kSR/jfpR4cE26YRZ8exQkoRbEA30vyWimajwZANYYaE=",
|
||||||
"rev": "2786a2a72088ecf32aea5b3ec52099e6a7cff78f",
|
"rev": "e5bdc4a41d4c072fe1e3787eaa0320a384741d44",
|
||||||
"type": "tarball",
|
"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": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
|
|
@ -33,17 +48,18 @@
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
|
"crane": "crane",
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"systems": {
|
"systems": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1791244623,
|
"lastModified": 1681028828,
|
||||||
"narHash": "sha256-uuanbkFk8a313Zfrxdcz8Us/yQtaxNnKJtX8v0ZPpd8=",
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
"owner": "nix-systems",
|
"owner": "nix-systems",
|
||||||
"repo": "default",
|
"repo": "default",
|
||||||
"rev": "d36eeed142f88b5a636f2e3856a53c61654cf29b",
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
154
flake.nix
154
flake.nix
|
|
@ -2,6 +2,8 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
|
nixpkgs.url = "https://channels.nixos.org/nixos-unstable/nixexprs.tar.zst";
|
||||||
|
|
||||||
|
crane.url = "github:ipetkov/crane";
|
||||||
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -10,95 +12,105 @@
|
||||||
inputs.flake-utils.lib.eachDefaultSystem (
|
inputs.flake-utils.lib.eachDefaultSystem (
|
||||||
system:
|
system:
|
||||||
let
|
let
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
pkgs = import inputs.nixpkgs { inherit system; };
|
||||||
lib = inputs.nixpkgs.lib;
|
lib = pkgs.lib;
|
||||||
|
craneLib = inputs.crane.mkLib pkgs;
|
||||||
|
|
||||||
src = lib.sourceFilesBySuffices ./. [
|
cargoToml = fromTOML (builtins.readFile ./Cargo.toml);
|
||||||
"Cargo.toml"
|
|
||||||
"Cargo.lock"
|
|
||||||
".rs"
|
|
||||||
];
|
|
||||||
|
|
||||||
cargoToml = fromTOML (builtins.readFile "${src}/Cargo.toml");
|
|
||||||
name = cargoToml.package.name;
|
name = cargoToml.package.name;
|
||||||
|
|
||||||
bin =
|
dlDeps =
|
||||||
{
|
with pkgs;
|
||||||
rustPlatform,
|
[
|
||||||
|
# needed for both x11 and wayland
|
||||||
|
libxkbcommon
|
||||||
|
libGL
|
||||||
|
|
||||||
autoPatchelfHook,
|
libx11
|
||||||
|
libxcursor
|
||||||
|
libxi
|
||||||
|
libxcb
|
||||||
|
]
|
||||||
|
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||||
|
vulkan-loader
|
||||||
|
wayland
|
||||||
|
|
||||||
libxkbcommon,
|
dbus.lib
|
||||||
wayland,
|
];
|
||||||
vulkan-loader,
|
|
||||||
|
|
||||||
moreSupport ? false,
|
commonArgs = {
|
||||||
libGL,
|
# all that's needed for artifacts and checks
|
||||||
libx11,
|
nativeBuildInputs = with pkgs; [
|
||||||
libxcursor,
|
# pkg-config
|
||||||
libxi,
|
];
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
];
|
||||||
|
|
||||||
libgcc,
|
strictDeps = true;
|
||||||
}:
|
__structuredAttrs = true;
|
||||||
rustPlatform.buildRustPackage {
|
|
||||||
inherit name src;
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
src = ./.;
|
||||||
autoPatchelfHook
|
};
|
||||||
];
|
|
||||||
buildInputs = [
|
|
||||||
libgcc
|
|
||||||
];
|
|
||||||
runtimeDependencies = [
|
|
||||||
libxkbcommon
|
|
||||||
wayland
|
|
||||||
vulkan-loader
|
|
||||||
]
|
|
||||||
++ lib.optionals moreSupport [
|
|
||||||
libGL
|
|
||||||
libx11
|
|
||||||
libxcursor
|
|
||||||
libxi
|
|
||||||
];
|
|
||||||
|
|
||||||
cargoLock.lockFile = "${src}/Cargo.lock";
|
# Build *just* the cargo dependencies,
|
||||||
|
# to reuse them for build and test derivations.
|
||||||
|
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
|
||||||
|
|
||||||
postFixup =
|
# Build the actual crate itself,
|
||||||
let
|
# reusing the dependency artifacts from above.
|
||||||
desktopItem = pkgs.makeDesktopItem {
|
crate =
|
||||||
inherit name;
|
let
|
||||||
desktopName = name;
|
desktopItem = pkgs.makeDesktopItem {
|
||||||
exec = name;
|
inherit name;
|
||||||
};
|
desktopName = name;
|
||||||
in
|
exec = name;
|
||||||
/* sh */ ''
|
};
|
||||||
|
in
|
||||||
|
craneLib.buildPackage (
|
||||||
|
commonArgs
|
||||||
|
// {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
|
||||||
|
nativeBuildInputs = commonArgs.nativeBuildInputs ++ [
|
||||||
|
pkgs.autoPatchelfHook
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = commonArgs.buildInputs ++ [
|
||||||
|
pkgs.libgcc
|
||||||
|
];
|
||||||
|
|
||||||
|
runtimeDependencies = dlDeps;
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
cp -rs "${desktopItem}"/* "$out"
|
cp -rs "${desktopItem}"/* "$out"
|
||||||
'';
|
'';
|
||||||
|
}
|
||||||
strictDeps = true;
|
);
|
||||||
__structuredAttrs = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
default = pkgs.callPackage bin { };
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages.default = default;
|
packages.default = crate;
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
checks = {
|
||||||
inputsFrom = [ default ];
|
crate-clippy = craneLib.cargoClippy (
|
||||||
|
commonArgs
|
||||||
|
// {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
|
||||||
env.RUSTFLAGS = builtins.concatStringsSep " " [
|
cargoClippyExtraArgs = "-- --deny warnings";
|
||||||
"-Clink-arg=-Wl,-rpath,${lib.makeLibraryPath default.runtimeDependencies}"
|
}
|
||||||
"-Clink-arg=-fuse-ld=mold"
|
);
|
||||||
];
|
};
|
||||||
|
|
||||||
packages = with pkgs; [
|
devShells.default = craneLib.devShell {
|
||||||
clippy
|
env.LD_LIBRARY_PATH = lib.makeLibraryPath dlDeps;
|
||||||
rustfmt
|
|
||||||
rust-analyzer
|
|
||||||
|
|
||||||
mold
|
inputsFrom = [ crate ];
|
||||||
];
|
packages = [ pkgs.rust-analyzer ];
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
__structuredAttrs = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ enum Message {
|
||||||
ChangeQuery(String),
|
ChangeQuery(String),
|
||||||
|
|
||||||
Copy,
|
Copy,
|
||||||
|
Edit,
|
||||||
|
|
||||||
FocusNext,
|
FocusNext,
|
||||||
FocusPrevious,
|
FocusPrevious,
|
||||||
|
|
@ -65,6 +66,8 @@ struct State {
|
||||||
selected_field: db::BasicField,
|
selected_field: db::BasicField,
|
||||||
query: String,
|
query: String,
|
||||||
|
|
||||||
|
editing_entry: Option<keepass::db::EntryId>,
|
||||||
|
|
||||||
status: Cow<'static, str>,
|
status: Cow<'static, str>,
|
||||||
error: 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::FocusNext => return widget::operation::focus_next(),
|
||||||
Message::FocusPrevious => return widget::operation::focus_previous(),
|
Message::FocusPrevious => return widget::operation::focus_previous(),
|
||||||
Message::FocusSearch => return widget::operation::focus("search"),
|
Message::FocusSearch => return widget::operation::focus("search"),
|
||||||
|
|
@ -404,7 +414,7 @@ impl State {
|
||||||
|
|
||||||
Key::Character("y" | "c") if db_loaded => Some(Message::Copy),
|
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),
|
Key::Character("q") => Some(Message::Quit),
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue