gnome-autounlock-keyring/flake.nix

96 lines
2.5 KiB
Nix
Raw Normal View History

2023-12-18 22:29:13 +01:00
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
2024-12-23 18:31:20 +01:00
outputs =
{
self,
nixpkgs,
flake-utils,
}:
2024-03-24 12:04:24 +01:00
let
2024-12-23 18:31:20 +01:00
buildInputs =
pkgs: with pkgs; [
openssl
tpm2-tss
];
nativeBuildInputs =
pkgs: with pkgs; [
2024-03-24 12:04:24 +01:00
llvmPackages.libclang
2024-12-23 18:31:20 +01:00
llvmPackages.clang
2024-03-24 12:04:24 +01:00
llvmPackages.libcxxClang
clang
pkg-config
2024-12-23 18:31:20 +01:00
rustPlatform.bindgenHook
2024-03-24 12:04:24 +01:00
];
2024-12-23 18:31:20 +01:00
in
flake-utils.lib.eachDefaultSystem (
system:
2023-12-18 22:29:13 +01:00
let
2023-12-19 14:59:04 +01:00
cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml);
2023-12-18 22:29:13 +01:00
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) stdenv lib;
2024-12-23 18:31:20 +01:00
in
rec {
2023-12-19 09:00:07 +01:00
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = cargoToml.package.name;
version = cargoToml.package.version;
src = self;
cargoLock.lockFile = ./Cargo.lock;
doCheck = false;
2024-03-24 12:04:24 +01:00
buildInputs = buildInputs pkgs;
nativeBuildInputs = nativeBuildInputs pkgs;
2024-12-23 18:31:20 +01:00
# LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
2023-12-19 09:00:07 +01:00
};
2023-12-19 10:21:13 +01:00
devShells.default = pkgs.mkShell {
2024-12-23 18:31:20 +01:00
# shellHook = "${packages.default.preBuild}";
2024-03-24 12:04:24 +01:00
buildInputs = buildInputs pkgs;
nativeBuildInputs = nativeBuildInputs pkgs;
2023-12-18 22:29:13 +01:00
};
2024-12-23 18:31:20 +01:00
}
)
// {
nixosModules = rec {
default =
{
config,
lib,
pkgs,
...
}:
with lib;
let
cfg = config.services.gnome-autounlock-keyring;
in
{
options.services.gnome-autounlock-keyring = {
enable = mkEnableOption "gnome-autounlock.keyring";
2024-03-24 12:04:24 +01:00
2024-12-23 18:31:20 +01:00
target = mkOption {
type = types.str;
default = "graphical-session.target";
example = "hyprland-session.target";
2023-12-19 12:27:50 +01:00
};
2024-12-23 18:31:20 +01:00
};
2023-12-19 12:27:50 +01:00
2024-12-23 18:31:20 +01:00
config = mkIf cfg.enable {
systemd.user.services.gnome-autounlock-keyring = {
description = "Automatically unlock gnome keyring using TPM";
wantedBy = [ cfg.target ];
script = ''
${self.packages.${pkgs.system}.default}/bin/gnome-autounlock-keyring unlock
'';
serviceConfig.Type = "oneshot";
2023-12-19 12:27:50 +01:00
};
};
2024-12-23 18:31:20 +01:00
};
gnome-autounlock-keyring = default;
2023-12-19 12:27:50 +01:00
};
2024-12-23 18:31:20 +01:00
};
2023-12-18 22:29:13 +01:00
}