Comments (10)
@coretemp you don't have to believe. Here is a module you can plugin and check yourself
{ lib, nodes, pkgs, ...}: {
networking.hosts."${nodes.some-machine.config.networking.privateIPv4}" = [ "alias-machine" ];
}
This is excerpt from my NixOps config
from nixops-aws.
NixOps adds one more top-level argument nodes
to each module args list, which you can inspect
{ config, pkgs, lib, nodes, ... }:
{
... nodes.mynode.config.networking.privateIPv4 ...
}
from nixops-aws.
@danbst I will believe that it works when I see a test in the nixops repository doing exactly what I described, because I have tried these things and it does not work.
I do use nodes
as an argument in some places already, but this described a very specific interaction, which is likely a bug.
from nixops-aws.
@coretemp I guess it depends on which EC2 resource are you assigning this option to. If it's a NixOS machine configuration, I think it will likely work. Otherwise, for non machine resources (security groups etc ) I don't think the config is evaluated when the resource evaluation is done, so the IP address is undefined at that time. Do you have some concrete examples of the use case you're trying ?
from nixops-aws.
@AmineChikhaoui Yes, this is about non-machine resources.
# this is the network configuration (as per NixOps manual)
{arguments}:
let
machine1 = <snip>;
machine2 = <snip>;
in
{
<other resources>;
resources.ec2SecurityGroups.mysecuritygroup = {
inherit accessKeyId region;
description = "a";
rules = [
{ protocol = "tcp"; fromPort = 0; toPort = 65535;
sourceIp = "${nodes.machine2.config.networking.privateIPv4}/32";
}
];
};
}
from nixops-aws.
@coretemp yeah unfortunately I don't think there is a way to do that at the moment.
from nixops-aws.
If there is nothing in the manual allowing this behavior (I don't think there is), it should be labeled as a bug.
from nixops-aws.
All rudeness aside, I've been investigating on that a bit.
The problem comes from here: https://github.com/NixOS/nixops/blob/master/nix/eval-machine-info.nix#L82
Instead of forwarding the nodes attrset (see https://github.com/NixOS/nixops/blob/master/nix/eval-machine-info.nix#L35 ), info.machines
is forwarded.
I guess we could add a nodes.nodes attribute forwarding the actual nodes attrset in order to not break any backward compatibility.
@rbvermaa Is there a particular reason to forward info.machines
here?
from nixops-aws.
Anyone has any idea how this can be accomplished?
from nixops-aws.
Actually, I was able to proceed with a workaround consisting in whitelisting the whole VPC CIDR Block and it worked just fine for me in case anyone else is interested.
from nixops-aws.
Related Issues (20)
- Port to python3
- Failure to provision hosts on spot market HOT 1
- Root volume is considered as 'detached' using nixpkgs 20.03 HOT 6
- Record on route53 is not being created. HOT 17
- Route53RecordSet pointing at an elasticIP address fails to be created
- AWS c6g.large instance type is not supported
- Where are the docs? HOT 2
- [feature] Manage RDS passwords
- Add support for gp3 disk type HOT 2
- Stop/Start an RDS DB instance HOT 2
- invalid EC2 region ‘eu-south-1’ HOT 1
- Retirement of EC2-Classic
- [flakes] NIX_PATH impurity HOT 1
- Automatically generate python types HOT 1
- aarch64 instance support
- gatewayId can be null which fails in python
- Initial nix-build fails to build
- `KeyError: 'Ebs'` when deploying EC2 instance with `ebsBoot` HOT 1
- How do you use the s3 remote backend? HOT 7
- Status of the repository? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nixops-aws.