-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Namecoin Core flake #1
base: flake
Are you sure you want to change the base?
Conversation
so I'm kinda dead in the water with the Qt part of this @jonringer . Could we pair at some point? |
Yea, we can. Unfortunately I'm visiting family until the weekend. Sunday or monday? |
the env vars should be conditional on the withGui value, but I couldn't figure it out so they are loaded globally.
I think I'm good actually! This last commit builds Qt successfully. Moving on to cleanup / container / module stuff. |
nix/namecoin-core.nix
Outdated
./configure --enable-cxx --without-bdb --disable-shared --prefix=${db48}/bin --with-boost=${boost} --with-boost-libdir=${boost}/lib --prefix=$out | ||
''; | ||
|
||
QT_PLUGIN_PATH = "${qtbase}/${qtbase.qtPluginPrefix}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't figure out a way to get these evaluated correctly as optionals with withGui
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null values get filtered out
QT_PLUGIN_PATH = "${qtbase}/${qtbase.qtPluginPrefix}"; | |
QT_PLUGIN_PATH = if withGui then "${qtbase}/${qtbase.qtPluginPrefix}" else null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice. I was trying to get those four env vars declared as part of a phase where i could do
optionals withGui [ '' QT_PLUGIN_PATH = ... ;'', '' LRELEASE = ... '' ]
Is that an anti pattern or ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would probably do something like
} // lib.optionalAttrs withGui {
QT_PLUGIN_PATH = "${qtbase}/${qtbase.qtPluginPrefix}";
....
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also probably factor out the nixos module to a separate file
flake.nix
Outdated
@@ -25,6 +29,24 @@ | |||
apps.namecoin-core = utils.lib.mkApp { drv = packages.namecoin-core; }; | |||
hydraJobs = { inherit (legacyPackages) namecoin-core; }; | |||
checks = { inherit (legacyPackages) namecoin-core; }; | |||
nixosModules.namecoin-core = | |||
{ ... }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ ... }: | |
{ lib, config, ... }: |
flake.nix
Outdated
@@ -25,6 +29,24 @@ | |||
apps.namecoin-core = utils.lib.mkApp { drv = packages.namecoin-core; }; | |||
hydraJobs = { inherit (legacyPackages) namecoin-core; }; | |||
checks = { inherit (legacyPackages) namecoin-core; }; | |||
nixosModules.namecoin-core = | |||
{ ... }: | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | |
with lib; | |
let | |
cfg = config.services.namecoin-core; | |
in { | |
options.services.namecoin-core = { | |
enable = lib.mkEnableOption "Namecoin-core"; | |
withGui = lib.mkOption { | |
type = lib.types.bool; | |
default = false; | |
description = "Enable gui"; | |
}; | |
}; | |
config = mkIf cfg.enable { | |
# what you had before |
Thanks 👍 . I'm trying to stay away from adding multiple files, just because I think it'll make it less likely for the upstream project to incorporate the flake. wdyt? |
@nrdsp and I had a really good chat. I think moving forward we should Must:
Optionally:
|
Following-up on @jonringer's comment above, I commited an update of flake conventions. More specifically, attributes |
@jonringer @jurraca |
@jonringer as to testing, should we implement any of the built-in integration tests? |
nix/namecoin-core.nix
Outdated
configureFlags = [ ] | ||
++ optionals (!withGui) [ " --without-gui " ] | ||
++ optionals (!withWallet) [ "--disable-wallet" "--without-bdb" ] | ||
++ optionals (withUpnp) [ "--with-miniupnpc" "--enable-upnp-default" ] | ||
++ optionals (withNatpmp) [ "--with-natpmp" "--enable-natpmp-default" ] | ||
++ optionals (!withHardening) [ "--disable-hardening" ] | ||
++ optionals withGui [ | ||
"--with-gui=qt5" | ||
"--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin" | ||
]; | ||
|
||
configurePhase = '' | ||
./autogen.sh | ||
./configure --enable-cxx --without-bdb --disable-shared --prefix=${db48}/bin --with-boost=${boost} --with-boost-libdir=${boost}/lib --prefix=$out | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odd that we use both configureFlags, and then overwrite the default configure phase and call ./configure
with specific flags. We should probably unify the flags into configureFlags
, and move ./autogen.sh
into preConfigure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving these flags into configureFlags
doesn't seem to have the desired effect. For instance:
configureFlags = [ "--enable-cxx" "--without-bdb" "--disable-shared" "--prefix=${db48}/bin" "--with-boost=${boost}" "--with-boost-libdir=${boost}/lib" "--prefix=$out" ]
++ optionals (!withGui) [ " --without-gui " ]
++ optionals (!withWallet) [ "--disable-wallet" "--without-bdb" ]
++ optionals (withUpnp) [ "--with-miniupnpc" "--enable-upnp-default" ]
++ optionals (withNatpmp) [ "--with-natpmp" "--enable-natpmp-default" ]
++ optionals (!withHardening) [ "--disable-hardening" ]
++ optionals withGui [
"--with-gui=qt5"
"--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin"
];
configurePhase = ''
./configure
'';
The above gives us:
> checking whether to build Namecoin Core GUI... yes (Qt5)
> checking for Berkeley DB C++ headers... no
> configure: error: libdb_cxx headers missing, Namecoin Core requires this library for BDB wallet support (--without-bdb to disable BDB wallet support)
Adding the flag "--without-bdb"
to ++ optionals withGui
doesn't do much either.
Co-authored-by: Jonathan Ringer <[email protected]>
Co-authored-by: Jonathan Ringer <[email protected]>
Hey, I tried consuming this flake nixos module and encountered the following error:
After inspecting the flake with
I have paired with @nrdsp to explore this and we end up finding a solution. This worked fine and now I can do the following: pkgs.lib.nixosSystem {
modules = [ namecoin-core.nixosModules.namecoin-core ]; in my @jonringer Could you have a look at this change and let me know if this is the best option to solve this, please? 🙏 |
Adds a Nix flake for Namecoin-Core.
TODO:
Notes:
I used the bitcoin nix expression to figure out the qt stuff but haven't managed to build it.the core packages built fine until I added some of this qt stuff, but the error is that it can't find core cpp libraries. Stuck on this.