We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am using flakes with nixops, and employ the idiom
system.configurationRevision = if self ? rev then self.rev else throw "Refusing to build from a dirty Git tree!";
so I can trace which configuration a running deployment is using, via nixos-version --json (and enforce that every deploy corresponds to a commit).
nixos-version --json
Unfortunately this broke in the state backend rework in #1264. Now self.rev never exists, even in a clean checkout.
self.rev
Reproducer: Have a git repo with a flake.nix containing (contents are unimportant, except for testing self.rev)
flake.nix
{ inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11"; outputs = { self, nixpkgs }: { nixopsConfigurations.default = { network.description = "A server"; network.storage.legacy.databasefile = "/tmp/state.nixops"; nixpkgs = nixpkgs; serverA = {config, pkgs, ...}: { # let nixos-version --json know about the git revision of this flake system.configurationRevision = if self ? rev then self.rev else throw "Refusing to build from a dirty git tree!"; fileSystems."/" = { device = "/dev/sda1"; fsType = "ext3"; }; boot.loader.grub = { enable = true; version = 2; device = "/dev/sda"; }; }; }; }; }
Note that old versions of nixops work fine (this is just before #1264):
rm /tmp/state.nixops NIXOPS_STATE=/tmp/state.nixops nix shell -L -v github:NixOS/nixops?rev=b55cbb23cc92f14b0e028ff2f8327cab4d9af5c6 -c nixops create --flake . -d serverA NIXOPS_STATE=/tmp/state.nixops nix shell -L -v github:NixOS/nixops?rev=b55cbb23cc92f14b0e028ff2f8327cab4d9af5c6 -c nixops deploy -d serverA --build-only
However, newer versions complain that the flake is dirty -- in actuality the checkout is clean, but self.rev does not exist. Post-#1264:
NIXOPS_STATE=/tmp/state.nixops nix shell -L -v github:NixOS/nixops?rev=9b3ac919d87db872854fb528064821b959ac38c1 -c nixops deploy -d serverA --build-only
master:
NIXOPS_STATE=/tmp/state.nixops nix shell -L -v github:NixOS/nixops?rev=ce1c57ec104636954296c229468bb65fa4ec7f8d -c nixops deploy -d serverA --build-only
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am using flakes with nixops, and employ the idiom
so I can trace which configuration a running deployment is using, via
nixos-version --json
(and enforce that every deploy corresponds to a commit).Unfortunately this broke in the state backend rework in #1264. Now
self.rev
never exists, even in a clean checkout.Reproducer:
Have a git repo with a
flake.nix
containing (contents are unimportant, except for testingself.rev
)Note that old versions of nixops work fine (this is just before #1264):
However, newer versions complain that the flake is dirty -- in actuality the checkout is clean, but
self.rev
does not exist.Post-#1264:
master:
The text was updated successfully, but these errors were encountered: