mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git
synced 2024-11-22 19:41:30 +00:00
flake: embed dirty revision of NixOS configuration instead
The inevitable `--override-input` nix build (and nixos-rebuild) option induces dirty state of the NixOS flake, thus `self.rev` couldn't be used together.
This commit is contained in:
parent
5643877cc1
commit
9370d17b82
14
flake.nix
14
flake.nix
|
@ -22,10 +22,10 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
cfgShortRev =
|
# (only "dirty", because userdata.json and others are overriden)
|
||||||
if self ? rev then builtins.substring 0 7 self.rev else "dirty";
|
cfgShortRev = builtins.substring 0 7 self.dirtyRev;
|
||||||
nixosLabel = config:
|
nixosLabel = config:
|
||||||
"${cfgShortRev}.${config.system.nixos.release}.${nixpkgs.shortRev}";
|
"${config.system.nixos.release}.${cfgShortRev}.${nixpkgs.shortRev}";
|
||||||
userdata = builtins.fromJSON (builtins.readFile userdata-json);
|
userdata = builtins.fromJSON (builtins.readFile userdata-json);
|
||||||
hardware-configuration = import hardware-configuration-nix;
|
hardware-configuration = import hardware-configuration-nix;
|
||||||
in
|
in
|
||||||
|
@ -40,8 +40,12 @@
|
||||||
hardware-configuration
|
hardware-configuration
|
||||||
# main configuration part
|
# main configuration part
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
# we need to embed NixOS repository git commit sha1
|
# we need NixOS repository git commit sha1 embedded
|
||||||
({ config, ... }: { system.nixos.label = nixosLabel config; })
|
({ config, ... }: {
|
||||||
|
system.nixos.label = nixosLabel config;
|
||||||
|
system.nixos.version = nixosLabel config;
|
||||||
|
system.configurationRevision = self.dirtyRev;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue