Updated repo to make it a Nix Flake

This commit is contained in:
Andrew Bryant 2024-12-27 16:18:59 -05:00
parent 038d6fb3bf
commit 209f5d3454
4 changed files with 48 additions and 1 deletions

36
flake.nix Normal file
View File

@ -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; };
};
}

11
nixos-module/default.nix Normal file
View File

@ -0,0 +1,11 @@
{ overlays }:
{
invoice-ninja = import ./invoice-ninja.nix
overlayNixpkgsForThisInstance =
{ pkgs, ... }: {
nixpkgs = {
inherit overlays;
};
};
};

View File

@ -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 { };