Files
jsl-home/homeManagerModules/restic/flake.nix
2025-12-07 11:24:11 -06:00

63 lines
2.4 KiB
Nix

{
description = "Flake packaging resticprofile with a Home Manager module for programs.resticprofile";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable"; # Use latest Nixpkgs for Go package build
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
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:
pkgs.buildGoModule rec {
pname = "resticprofile";
version = "0.32.0";
src = pkgs.fetchFromGitHub {
owner = "creativeprojects";
repo = "resticprofile";
rev = "v${version}";
sha256 = "sha256-fmYsoGYppNgbtoX18aF5UHBG9ieYorBJ9JZkwrR+UBI="; # source tarball hash
};
vendorHash = "sha256-/GVWjOvkYe7xMRjANKIKV6FSU0F5VY1ZP/ppgAJyhvw="; # Correct vendor hash
goPackagePath = "github.com/creativeprojects/resticprofile";
doCheck = false; # Disable tests due to sandboxed build environment
meta = with pkgs.lib; {
description = "Configuration profiles manager and scheduler for restic backup";
homepage = "https://creativeprojects.github.io/resticprofile/";
license = licenses.gpl3Only;
maintainers = [ ]; # (Add yourself or skip)
};
};
in {
# Provide the package for all supported systems:
packages = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; };
in {
resticprofile = resticprofilePkg pkgs;
default = resticprofilePkg pkgs;
}
);
# Provide the Home Manager module
homeManagerModules = {
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;
};
};
}