From d0d73e19d2b61f7854a97759c7dbb0a3bb689ab8 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Sun, 7 Dec 2025 11:23:27 -0600 Subject: [PATCH] building for all systems --- homeManagerModules/restic/flake.nix | 32 +++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/homeManagerModules/restic/flake.nix b/homeManagerModules/restic/flake.nix index 50b776d..1c64115 100644 --- a/homeManagerModules/restic/flake.nix +++ b/homeManagerModules/restic/flake.nix @@ -10,8 +10,10 @@ outputs = { self, nixpkgs, home-manager }: let systems = [ "x86_64-linux" "aarch64-linux" ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + # Define a function to build the resticprofile package for a given system: - resticprofilePkg = { pkgs, lib, ... }: + resticprofilePkg = pkgs: pkgs.buildGoModule rec { pname = "resticprofile"; version = "0.32.0"; @@ -19,12 +21,12 @@ owner = "creativeprojects"; repo = "resticprofile"; rev = "v${version}"; - sha256 = ""; # source tarball hash + sha256 = "sha256-fmYsoGYppNgbtoX18aF5UHBG9ieYorBJ9JZkwrR+UBI="; # source tarball hash }; - vendorHash = ""; # Correct vendor hash + vendorHash = "sha256-/GVWjOvkYe7xMRjANKIKV6FSU0F5VY1ZP/ppgAJyhvw="; # Correct vendor hash goPackagePath = "github.com/creativeprojects/resticprofile"; doCheck = false; # Disable tests due to sandboxed build environment - meta = with lib; { + meta = with pkgs.lib; { description = "Configuration profiles manager and scheduler for restic backup"; homepage = "https://creativeprojects.github.io/resticprofile/"; license = licenses.gpl3Only; @@ -33,14 +35,28 @@ }; in { # Provide the package for all supported systems: - packages = nixpkgs.lib.genAttrs systems (system: - let pkgs = import nixpkgs { inherit system; }; - in { resticprofile = resticprofilePkg { inherit pkgs; lib = pkgs.lib; }; } + packages = forAllSystems (system: + let + pkgs = import nixpkgs { inherit system; }; + in { + resticprofile = resticprofilePkg pkgs; + default = resticprofilePkg pkgs; + } ); # Provide the Home Manager module homeManagerModules = { - resticprofile = ./resticprofile.nix; + resticprofile = { config, lib, pkgs, ... }: + let + # Use the package built by this flake + resticprofilePackage = self.packages.${pkgs.system}.resticprofile; + in { + imports = [ ./resticprofile.nix ]; + config = lib.mkIf config.programs.resticprofile.enable { + programs.resticprofile.package = lib.mkDefault resticprofilePackage; + }; + }; + default = self.homeManagerModules.resticprofile; }; }; }