diff --git a/flake.lock b/flake.lock index 2ebc417..4b70a50 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1711276414, - "narHash": "sha256-tID8RCOmMzws4SBrPkZ5oEIpoDaBtF+U2s0zEH6u8Ms=", + "lastModified": 1734973338, + "narHash": "sha256-E9JOCwppN3WX9oh6kV9w4nkN+6UPGNdzljscdJy5kTs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "11d9b9e97bcb5091c8414bbf9e50eb0d5cd745a9", + "rev": "2b37ecedbb948e7607307c56e35aea5155eb65a7", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 6dd6af1..d81edba 100644 --- a/flake.nix +++ b/flake.nix @@ -4,22 +4,36 @@ flake-utils.url = "github:numtide/flake-utils"; }; - outputs = { self, nixpkgs, flake-utils }: + outputs = + { + self, + nixpkgs, + flake-utils, + }: let - buildInputs = pkgs: with pkgs; [ openssl tpm2-tss ]; - nativeBuildInputs = pkgs: - with pkgs; [ + buildInputs = + pkgs: with pkgs; [ + openssl + tpm2-tss + ]; + nativeBuildInputs = + pkgs: with pkgs; [ llvmPackages.libclang + llvmPackages.clang llvmPackages.libcxxClang clang pkg-config + rustPlatform.bindgenHook ]; - in flake-utils.lib.eachDefaultSystem (system: + in + flake-utils.lib.eachDefaultSystem ( + system: let cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); pkgs = nixpkgs.legacyPackages.${system}; inherit (pkgs) stdenv lib; - in rec { + in + rec { packages.default = pkgs.rustPlatform.buildRustPackage { pname = cargoToml.package.name; version = cargoToml.package.version; @@ -30,68 +44,52 @@ buildInputs = buildInputs pkgs; nativeBuildInputs = nativeBuildInputs pkgs; - LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; - - preBuild = '' - export BINDGEN_EXTRA_CLANG_ARGS="$(< ${stdenv.cc}/nix-support/libc-crt1-cflags) \ - $(< ${stdenv.cc}/nix-support/libc-cflags) \ - $(< ${stdenv.cc}/nix-support/cc-cflags) \ - $(< ${stdenv.cc}/nix-support/libcxx-cxxflags) \ - ${ - lib.optionalString stdenv.cc.isClang - "-idirafter ${stdenv.cc.cc}/lib/clang/${ - lib.getVersion stdenv.cc.cc - }/include" - } \ - ${ - lib.optionalString stdenv.cc.isGNU - "-isystem ${stdenv.cc.cc}/include/c++/${ - lib.getVersion stdenv.cc.cc - } -isystem ${stdenv.cc.cc}/include/c++/${ - lib.getVersion stdenv.cc.cc - }/${stdenv.hostPlatform.config} -idirafter ${stdenv.cc.cc}/lib/gcc/${stdenv.hostPlatform.config}/${ - lib.getVersion stdenv.cc.cc - }/include" - } \ - " - ''; + # LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; }; devShells.default = pkgs.mkShell { - shellHook = "${packages.default.preBuild}"; + # shellHook = "${packages.default.preBuild}"; buildInputs = buildInputs pkgs; nativeBuildInputs = nativeBuildInputs pkgs; }; - }) // { - 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"; + } + ) + // { + 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"; - target = mkOption { - type = types.str; - default = "graphical-session.target"; - example = "hyprland-session.target"; - }; - }; - - 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"; - }; + target = mkOption { + type = types.str; + default = "graphical-session.target"; + example = "hyprland-session.target"; }; }; - gnome-autounlock-keyring = default; - }; + + 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"; + }; + }; + }; + gnome-autounlock-keyring = default; }; + }; }