-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
enable nix run #78
base: master
Are you sure you want to change the base?
enable nix run #78
Conversation
Currently was mainly used by the disko cli (which might be also need to be fixed as a result of this) |
This line needs to be fixed as well: Line 124 in 935feb7
|
Looking at it, it only looks like this change would affect the nixosModule. I've been using this in my flake outputs as a workaround but not ideal. apps = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
hosts = pkgs.lib.filterAttrs (_: value:
value.pkgs.system == system &&
builtins.hasAttr "diskoNoDeps" value.config.system.build
) self.nixosConfigurations;
in
if (hosts == {}) then {} else {
disko = pkgs.lib.genAttrs (builtins.attrNames hosts) (name:
{
program = "${self.nixosConfigurations.${name}.config.system.build.diskoNoDeps}";
type = "app";
});
}
); |
This change makes disko incompatible with nixos-anywhere, which calls the script directly. That's a solvable problem, but I don't see much use in changing this now. These scripts are not supposed to be called directly by a user anyway. Unless there's a good reason to get this change merged, I'd vote for closing this PR. |
As someone who doesn't use the disko CLI, I personally would like the ability to run |
Okay good to know, thank you. I'm concerned about backwards compatibility, what could we do so we don't break compatibility with nixos-anywhere? Maybe we should submit a PR to them that detects if |
I think the actual root cause is that But that would probably be the easiest solution cc @Mic92 with his nixos-anywhere maintainer hat on |
How easy is it right now to get PRs merged in NixCpp? Haven't followed the development for a while, but this would be relatively simple to implement. Just add some additional logic here: https://github.com/NixOS/nix/blob/68ba6ff4709d936c1a714de35da08f8ed354c710/src/nix/app.cc#L118 |
@@ -20,23 +20,23 @@ in { | |||
}; | |||
}; | |||
config = lib.mkIf (cfg.devices.disk != {}) { | |||
system.build.formatScript = pkgs.writers.writeBash "disko-create" '' | |||
system.build.formatScript = pkgs.writers.writeBashBin "disko-create" '' |
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.
If we switch to this, we should make new attributes and make the old "script" ones execute those with a warning using lib.warn
. This would give us time to migrate tools like nixos-anywhere.
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.
Also diskoNoDeps
is the only thing used by nixos-anywhere, we still have nixpkgs with the old disko cli around.
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.
Maybe something like:
diskoFormat
,diskoMount
,diskoRecreate
,diskoRecreateNoDeps
@iFreilicht I think a simple PR for |
Is there a reason why something like this is not done so that
nix run .#nixosConfigurations.myhostname.config.system.build.diskoNoDeps
could setup disks prior tonixos-install --flake .#myhostname
? This saves running build and then the result script.Great work. Thanks for your effort.