Skip to content
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

Afterburn module #68702

Closed
wants to merge 2 commits into from
Closed

Afterburn module #68702

wants to merge 2 commits into from

Conversation

arianvp
Copy link
Member

@arianvp arianvp commented Sep 13, 2019

Currently based on #68680
will rebase once that is merged.

This is also WIP. I probably want to add some tests.

Afterburn will allow us to unify the virtual machine setup code for all our cloud provider images.
It allows us to get metadata in a unified way, set ssh keys in a unified way and generate systemd-networkd network configs on the fly.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
Notify maintainers

cc @

@@ -0,0 +1,39 @@
{ stdenv, lib, openssl, pkg-config, fetchCrate, rustPlatform }:

(rustPlatform.buildRustPackage rec {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to avoid the use of buildRustPackage in Nixpkgs. It abuses fixed-output derivations and may stop working in the future (NixOS/nix#2270).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some kind of cargo2nix tool I can use instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is carnix, which has different problems.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TenX has a cargo2nix tool https://github.com/tenx-tech/cargo2nix

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edolstra now that Nix also uses some rust, do you have some new insights in how you would like to see these kind of things one in a reproducible manner?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arianvp This isn't a nixpkgs-maintainer perspective, but FWIW, I've had the best experience with crate2nix, which uses the nixpkgs buildRustCrate and seems to work a lot better than carnix. The other tool I've seen people have good experiences with is naersk (builds on top of cargo, unlike crate2nix). I think crate2nix output should be suitable for upstreaming to nixpkgs.

@arianvp
Copy link
Member Author

arianvp commented Apr 15, 2020

I will close this PR. I don't see a clear way forward how to package this, and no alternatives were given by the reviewers

@arianvp arianvp closed this Apr 15, 2020
@Mic92
Copy link
Member

Mic92 commented Apr 19, 2020

I actually think it does not matter if we have one buildRustPackage more in nixpkgs. We depend on this and a replacement needs to be implemented before we can abandon buildRustPackage. There is a solution coming up that might work for us soon: https://github.com/kolloch/crate2nix See also this thread: nix-community/crate2nix#102

needsFirstBootCheckin = provider: provider == "packet";
in
{
options = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-  options
+  options.services.afterburn

@@ -0,0 +1,48 @@
{ config, pkgs, lib }:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-  { config, pkgs, lib }: 
+  { config, pkgs, lib, ... }:

@lukateras
Copy link
Member

lukateras commented Apr 19, 2020

If you are still interested in having this PR merged, I'd like to help review and merge it. Given that https://github.com/NixOS/nixpkgs/search?q=buildRustPackage has 241 matches, and new buildRustPackage derivations are merged every week, that shouldn't be a blocker for this package, and merely something that would be nice to have resolved across the whole Nixpkgs tree one day.

@lukateras
Copy link
Member

cc @arianvp

@arianvp arianvp reopened this Sep 25, 2020
@arianvp
Copy link
Member Author

arianvp commented Sep 25, 2020

Thanks. I will have a look again.

@flokli
Copy link
Contributor

flokli commented Feb 14, 2021

@arianvp can you rebase this to latest master (which includes the afterburn package)?

arianvp and others added 2 commits March 10, 2021 22:30
This adds the services.afterburn.{enable,provider} options.
(cherry picked from commit 444790a5383e2f4192338eab59144e2e95153984)
@flokli
Copy link
Contributor

flokli commented Mar 10, 2021

I rebased this to master, and started dogfooding the openstack image config with it.

It doesn't work yet, and I'm not sure if/how we're gonna use the upstream-provided systemd units.
I added a lot of comments about how this could work, and a bunch of TODOs of stuff that still needs to be investigated.

Also, there's the --network-units parameter, which could drop ephemeral .network/.netdev files for cloud-provider specific network configuration (like on packet.net).

I'm very much in favour of using something like this over our own, semistable and slightly differing-per-provider metadata server fetcher shellscripts - also, it's less bloated than cloud-init, making it more suitable for minimal images.

@stale
Copy link

stale bot commented Sep 7, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 7, 2021
@arianvp arianvp closed this Sep 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants