Hi!

I'm currently trying to package KeePass[0], a password manager written in Mono. I started off with the package definition for gentoo[1] and began writing a guix package definition:

```scheme
(define-public keepass
  (package
   (name "keepass")
   (version "2.57.1")
   (source
    (origin
     (method url-fetch)
     (uri (string-append "mirror://sourceforge/keepass/KeePass%202.x/" version
                         "/KeePass-" version "-Source.zip"))
     (sha256
      (base32 "11i9h0pbvbmz3a6wkp97qhrc8r4l5a2iwxw6vl0zwcp19ka5gdpp"))))
   (build-system gnu-build-system)
   (arguments
    `(#:phases
      (modify-phases %standard-phases
                     (delete 'install)
                     (add-after 'unpack 'set-libgduplus-path
                                (lambda* (#:key inputs #:allow-other-keys)
                                         (setenv "LD_LIBRARY_PATH" (string-append (assoc-ref inputs "libgdiplus") "/lib"))                                          ;; Required for fontconfig to work during the build
                                         (setenv "HOME" "/tmp")))
                     (replace 'unpack
                              (lambda* (#:key source #:allow-other-keys)
                                       (mkdir "source")
                                       (chdir "source")
                                       (invoke "unzip" source)))
                     (replace 'configure
                              (lambda* (#:key inputs #:allow-other-keys)
                                       (substitute* "KeePass.sln"
(("GlobalSection\\(ExtensibilityGlobals\\).*?EndGlobalSection")
                                                     "")
(("GlobalSection\\(ExtensibilityGlobals\\).*?EndGlobalSection" all)
                                                     "")
                                                    (("Format Version 10\\.0")                                                      "Format Version 11.00"))                                        (substitute* "KeePass/KeePass.csproj"                                                     ((" ToolsVersion=\\\"3\\.5\\\"")                                                      " ToolsVersion=\"4.0\"")
(("<SignAssembly>true</SignAssembly>")
"<SignAssembly>false</SignAssembly>")
(("sgen\\\\.exe")
                                                     "")
(("<TargetFrameworkVersion>v4\\.8</TargetFrameworkVersion>")
"<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>"))
                                       (copy-file "Ext/Icons_15_VA/LowResIcons/KeePass_LR.ico" "KeePass/KeePass.ico")                                        (copy-file "Ext/Icons_15_VA/LowResIcons/KeePass_LR.ico" "KeePass/IconsKeePass.ico")                                        (copy-file "Ext/Icons_15_VA/LowResIcons/KeePass_LR_G.ico" "KeePass/IconsKeePass_G.ico")                                        (copy-file "Ext/Icons_15_VA/LowResIcons/KeePass_LR_R.ico" "KeePass/IconsKeePass_R.ico")                                        (copy-file "Ext/Icons_15_VA/LowResIcons/KeePass_LR_Y.ico" "KeePass/IconsKeePass_Y.ico")                                        (substitute* "KeePassLib/KeePassLib.csproj"                                                     ((" ToolsVersion=\\\"3\\.5\\\"")                                                      " ToolsVersion=\"4.0\"")
(("<SignAssembly>true</SignAssembly>")
"<SignAssembly>false</SignAssembly>")
                                                    )
                                       (substitute* "Translation/TrlUtil/TrlUtil.csproj"                                                     ((" ToolsVersion=\\\"3\\.5\\\"")                                                      " ToolsVersion=\"4.0\"")
                                                    )
                                       (copy-file "Ext/Icons_15_VA/LowResIcons/KeePass_LR.ico" "KeePass/Resources/KeePass.ico")
                                       ))
                     (delete 'patch-source)
                     (replace 'build
                              (lambda* (#:key outputs #:allow-other-keys)
                                       (setenv "MONO_REGISTRY_PATH" "/dev/null")
                                       (setenv "LANG" "C")
                                       (setenv "LC_ALL" "C")
                                       (invoke "xbuild" "/target:KeePass" "/property:Configuration=Release"))
                              ))
      #:tests? #f))                   ;no tests
   (native-inputs (list unzip icoutils))
   (inputs (list mono-6.12.0 libgdiplus))
   (home-page "https://keepass.info";)
   (synopsis "A free, open source, light-weight and easy-to-use password manager")    (description "KeePass is a free, open source, light-weight and easy-to-use password manager that helps you manage your passwords in a secure way.  All passwords are stored
in an encrypted database, which is locked with a master key or key file.")
   (license license:gpl2)))
```

I think I'm pretty far already, but the build is still failing (build log [2]).

Unfortunately I have exactly time-since-i-started-working-on-this-package experience with mono and the mono build toolkit. What's weird IMHO is that `xbuild` fails with an error, while at the same time printing that there were no warnings or errors.

At the beginning I started off with version 2.58 of KeePass (the latest) but there have been changes to the build files (according to `history.txt`: "Added solution and project files for Visual Studio 2022"). Additionally it looks like that 2.58 is targeting dotnet 4.8 and the compatibility page[3] of the mono project states that it is compatible up to .NET 4.7. I've also consulted the nixOS package definition[4], which packages version 2.57.1, so I decided to switch to that version for now.

But the build is still failing the same.

The latest mono version packaged within guix is 6.12.0, which is from 24th November 2020, so quite old already. There is a patch release 6.12.0.200 from 11th July 2023, which is significantly younger, but still quite outdated)[5]. The website of the mono-project[6] states, that the project has ended and was taken over by the WINE project[7], where the latest release is 6.14.1 from 29th April 2025, but since the move to the wine project it is maintained by only a single person, so it didn't receive the same level of attention as it did before.

I'm still considering this as a less likely possible source of the issue. It's also the version packaged at nixos[8]. But I would like to prevent the scope to explode too much and the current mono@6.12.0 package looks complicated enough.

Does anyone have any clue on how to solve this?

The install section doesn't seem all too complex, I will just have to figure out how to translate this from gentoo to guix.

Thanks a lot!

nomike

[0] https://keepass.info
[1] https://gitweb.gentoo.org/repo/gentoo.git/tree/app-admin/keepass/keepass-2.57.ebuild
[2] Attachment: keepass.build.log.gz
[3] https://www.mono-project.com/docs/about-mono/compatibility/
[4] https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/by-name/ke/keepass/package.nix
[5] https://www.mono-project.com/docs/about-mono/releases/
[6] https://www.mono-project.com/
[7] https://gitlab.winehq.org/mono/mono
[8] https://search.nixos.org/packages?channel=25.05&show=mono&from=0&size=50&sort=relevance&type=packages&query=mono

Attachment: keepass.build.log.gz
Description: application/gzip

Reply via email to