diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..849fe74 --- /dev/null +++ b/flake.nix @@ -0,0 +1,36 @@ +{ + description = "An Invoice Ninja package and a module which can be added to a NixOS configuration"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; + + outputs = + { self, nixpkgs, nix, }: + let + systems = [ "x86_64-linux" ]; + forEachSystem = nixpkgs.lib.genAttrs systems; + + overlayList = [ self.overlays.default ]; + + pkgsBySystem = forEachSystem ( + system: + import nixpkgs { + inherit system; + overlays = overlayList; + } + ); + + in + rec { + + # A Nixpkgs overlay that provides a 'Invoice Ninja' package. + overlays.default = final: prev: { invoice-ninja = final.callPackage ./package.nix { }; }; + + packages = forEachSystem (system: { + invoice-ninja = pkgsBySystem.${system}.invoice-ninja; + default = pkgsBySystem.${system}.invoice-ninja; + }); + + nixosModules = import ./nixos-module { overlays = overlayList; }; + + }; +} diff --git a/nixos-module/default.nix b/nixos-module/default.nix new file mode 100644 index 0000000..6a51a4b --- /dev/null +++ b/nixos-module/default.nix @@ -0,0 +1,11 @@ +{ overlays }: + +{ + invoice-ninja = import ./invoice-ninja.nix + overlayNixpkgsForThisInstance = + { pkgs, ... }: { + nixpkgs = { + inherit overlays; + }; + }; +}; diff --git a/invoice-ninja.nix b/nixos-module/invoice-ninja.nix similarity index 99% rename from invoice-ninja.nix rename to nixos-module/invoice-ninja.nix index 0a3bf10..ffdc2cd 100644 --- a/invoice-ninja.nix +++ b/nixos-module/invoice-ninja.nix @@ -10,7 +10,7 @@ let cfg = config.services.invoice-ninja; user = cfg.user; group = cfg.group; - invoice-ninja = pkgs.callPackage ../../../../pkgs/by-name/in/invoice-ninja/package.nix { + invoice-ninja = pkgs.callPackage ../package.nix { inherit (cfg) dataDir runtimeDir; }; configFormat = pkgs.formats.keyValue { }; diff --git a/default.nix b/package.nix similarity index 100% rename from default.nix rename to package.nix