Compare commits

...

11 Commits

5 changed files with 146 additions and 34 deletions

52
Makefile Normal file
View File

@@ -0,0 +1,52 @@
####
# Target definitions
####
# Disable echoing of target recipe commands
# Comment this for debugging
.SILENT:
# Run target recipes in one shell invocation
.ONESHELL:
# Since all targets are phony, all targets should be listed here
# One target per line
.PHONY: boot-vm-cli \
boot-vm-gui \
build-vm \
clean \
format-nix-files \
help
# Show the help text
help:
egrep -h '\s##\s' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
format-nix-files: ## Format nix files using the nixpkgs-fmt tool
find . -name "*.nix" -exec nixpkgs-fmt {} \;
clean: ## Clean build artifacts and shutdown running virtual machines
rm result > /dev/null 2>&1
rm nixos.qcow2 > /dev/null 2>&1
pkill qemu
exit 0
build-vm: clean ## Build virtual machine for testing
nix build ".#nixosConfigurations.vm.config.system.build.vm"
boot-vm-cli: ## Run virtual machine in current terminal
QEMU_KERNEL_PARAMS=console=ttyS0 \
QEMU_NET_OPTS=hostfwd=tcp::8080-:80 \
QEMU_OPTS=-nographic \
./result/bin/run-nixos-vm
reset
boot-vm-gui: ## Run virtual machine in QEMU window
QEMU_KERNEL_PARAMS=console=ttyS0 \
QEMU_NET_OPTS=hostfwd=tcp::8080-:80 \
./result/bin/run-nixos-vm
reset

20
flake.lock generated
View File

@@ -78,11 +78,11 @@
"nixpkgs-regression": "nixpkgs-regression" "nixpkgs-regression": "nixpkgs-regression"
}, },
"locked": { "locked": {
"lastModified": 1735677698, "lastModified": 1755114901,
"narHash": "sha256-L0G5igB2xXUQwKhU5aRfRtrhDJfJ3PkOUcvXnQM2+kI=", "narHash": "sha256-8FzXMePkqowfQ6A2f5B7BgDrxj3HCnC+s976iB020JA=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nix", "repo": "nix",
"rev": "4f3960ea260f95a36a204d0d57d60ead66c3b194", "rev": "5d3197bb6c91a799a6672c27de2141331017dde8",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -92,16 +92,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1734359947, "lastModified": 1747179050,
"narHash": "sha256-1Noao/H+N8nFB4Beoy8fgwrcOQLVm9o4zKW1ODaqK9E=", "narHash": "sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "48d12d5e70ee91fe8481378e540433a7303dbf6a", "rev": "adaa24fbf46737f3f1b5497bf64bae750f82942e",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "release-24.11", "ref": "nixos-unstable",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@@ -140,11 +140,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1735531152, "lastModified": 1751274312,
"narHash": "sha256-As8I+ebItDKtboWgDXYZSIjGlKeqiLBvjxsQHUmAf1Q=", "narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3ffbbdbac0566a0977da3d2657b89cbcfe9a173b", "rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -18,11 +18,11 @@
); );
in in
rec { rec {
overlays.default = final: prev: { invoice-ninja-desktop = final.callPackage ./package.nix { }; }; overlays.default = final: prev: { invoiceninja-desktop = final.callPackage ./package.nix { }; };
packages = forEachSystem (system: { packages = forEachSystem (system: {
invoice-ninja-desktop = pkgsBySystem.${system}.invoice-ninja-desktop; invoiceninja-desktop = pkgsBySystem.${system}.invoiceninja-desktop;
default = pkgsBySystem.${system}.invoice-ninja-desktop; default = pkgsBySystem.${system}.invoiceninja-desktop;
}); });
}; };
} }

View File

@@ -1,6 +1,26 @@
{ lib, fetchFromGitHub, flutter319 }: { lib
, makeDesktopItem
, copyDesktopItems
, wrapGAppsHook3
, fetchFromGitHub
, flutter319
}:
let let
desktopFile = makeDesktopItem rec {
name = "Invoice Ninja";
desktopName = name;
exec = "invoiceninja";
icon = "invoiceninja";
startupWMClass = "invoiceninja";
categories = [ "Office" ];
terminal = false;
extraConfig = {
X-MultipleArgs = "false";
};
};
in flutter319.buildFlutterApplication rec {
version = "5.0.172"; version = "5.0.172";
src = fetchFromGitHub { src = fetchFromGitHub {
@@ -10,10 +30,7 @@ let
hash = "sha256-yYGGmF0XiixDi/OuLdlKwN685BUsxcIFzIqXkJi4KMs="; hash = "sha256-yYGGmF0XiixDi/OuLdlKwN685BUsxcIFzIqXkJi4KMs=";
}; };
in flutter319.buildFlutterApplication { pname = "invoiceninja-desktop";
inherit version src;
pname = "invoice-ninja-desktop";
targetFlutterPlatform = "linux"; targetFlutterPlatform = "linux";
@@ -29,10 +46,22 @@ in flutter319.buildFlutterApplication {
super_text_layout = "sha256-SGWTs2zHObYAC8J/LdtdmoDtI/EQZr0fJoYMpGcyGWE="; super_text_layout = "sha256-SGWTs2zHObYAC8J/LdtdmoDtI/EQZr0fJoYMpGcyGWE=";
}; };
nativeBuildInputs = [
copyDesktopItems
wrapGAppsHook3
];
postUnpack = '' postUnpack = ''
mv $sourceRoot/lib/.env.dart.example $sourceRoot/lib/.env.dart mv $sourceRoot/lib/.env.dart.example $sourceRoot/lib/.env.dart
''; '';
postInstall = ''
mkdir -p $out/share/icons
mv $out/app/invoiceninja-desktop/data/flutter_assets/assets/images/icon.png $out/share/icons/invoiceninja.png
'';
desktopItems = [ desktopFile ];
meta = { meta = {
description = "Invoice Ninja desktop client"; description = "Invoice Ninja desktop client";
homepage = "https://github.com/invoiceninja/admin-portal"; homepage = "https://github.com/invoiceninja/admin-portal";

31
vm/default.nix Normal file
View File

@@ -0,0 +1,31 @@
{ modulesPath, pkgs, ... }:
{
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
../nixos-module/invoiceninja.nix
];
system.stateVersion = "24.11";
nixpkgs.config.allowUnfree = true;
users.users.test = {
isNormalUser = true;
extraGroups = [ "wheel" ];
initialPassword = "test";
};
environment.systemPackages = with pkgs; [
invoiceninja-desktop
];
services.xserver.desktopManager.lxqt.enable = true;
programs.chromium.enable = true;
networking.firewall.enable = false;
services.resolved.enable = true;
}