add dev flake

This commit is contained in:
Jonas Heinrich 2024-12-31 21:00:53 +01:00
parent 0a891d836e
commit a8c272a2d6
2 changed files with 91 additions and 0 deletions

26
flake.lock generated Normal file
View file

@ -0,0 +1,26 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1735531152,
"narHash": "sha256-As8I+ebItDKtboWgDXYZSIjGlKeqiLBvjxsQHUmAf1Q=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3ffbbdbac0566a0977da3d2657b89cbcfe9a173b",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-24.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

65
flake.nix Normal file
View file

@ -0,0 +1,65 @@
{
description = "Invoiceplane invoice template development shell";
inputs.nixpkgs.url = "nixpkgs/nixos-24.11";
outputs = { self, nixpkgs, ... }@inputs:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
start =
pkgs.writeShellScriptBin "start" ''
set -e
export QEMU_NET_OPTS="hostfwd=tcp::8080-:80"
${pkgs.nixos-shell}/bin/nixos-shell --flake .
'';
in {
nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs.inputs = inputs;
pkgs = import nixpkgs {
overlays = [
(self: super: {
invoiceplane = super.invoiceplane.overrideAttrs (oldAttrs: rec {
installPhase = oldAttrs.installPhase + ''
rm -r $out/application/views/invoice_templates/pdf
ln -sf /var/lib/invoiceplane/localhost/pdf $out/application/views/invoice_templates/pdf
'';
});
})
];
};
modules = [
({ lib, config, pkgs, ... }: {
services.invoiceplane.sites."localhost" = {
enable = true;
settings.IP_URL = "http://localhost:8080";
};
nixos-shell.mounts.extraMounts = {
"/var/lib/invoiceplane/localhost/pdf" = {
target = /home/onny/projects/invoiceplane-vtdirektmarketing;
cache = "none";
};
};
system.stateVersion = "24.11";
services.getty.autologinUser = "root";
documentation = {
info.enable = false;
man.enable = false;
nixos.enable = false;
};
nix = {
registry.nixpkgs.flake = inputs.nixpkgs;
settings.experimental-features = [ "nix-command" "flakes" ];
};
})
];
};
packages = { inherit start; };
defaultPackage.x86_64-linux = start;
};
}