pass /etc/nixos folder as an input to override

This way it is expected to have access to this path from build results,
making it possible to reproduce the build.
This commit is contained in:
Alexander Tomokhov 2023-11-08 16:04:50 +04:00
parent 2d7680d456
commit b9dad899de
2 changed files with 7 additions and 37 deletions

View File

@ -1,18 +1,5 @@
{
"nodes": {
"hardware-configuration-nix": {
"flake": false,
"locked": {
"lastModified": 1692731346,
"narHash": "sha256-rQIpYKwowqbbVVurEl5qNpuPfoRyEUMefoZXrUoO6p8=",
"path": "hardware-configuration.nix",
"type": "path"
},
"original": {
"id": "hardware-configuration-nix",
"type": "indirect"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1686476475,
@ -30,10 +17,8 @@
},
"root": {
"inputs": {
"hardware-configuration-nix": "hardware-configuration-nix",
"nixpkgs": "nixpkgs",
"selfprivacy-overlay": "selfprivacy-overlay",
"userdata-json": "userdata-json"
"selfprivacy-overlay": "selfprivacy-overlay"
}
},
"selfprivacy-overlay": {
@ -50,19 +35,6 @@
"type": "git",
"url": "https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nix-repo.git"
}
},
"userdata-json": {
"flake": false,
"locked": {
"lastModified": 1689259484,
"narHash": "sha256-Co3QGsxCjDspP5Nzzu1zICkee5CEq+ORlxSF3bFqbCY=",
"path": "userdata/userdata.json",
"type": "path"
},
"original": {
"id": "userdata-json",
"type": "indirect"
}
}
},
"root": "root",

View File

@ -7,23 +7,21 @@
selfprivacy-overlay.url =
"git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nix-repo.git";
# these inputs are expected to be set by the caller
# the /etc/nixos folder input is expected to be set by the caller
# for example, upon nix build using --override-input
userdata-json.flake = false; # userdata.json
hardware-configuration-nix.flake = false; # hardware-configuration.nix
etc-nixos.flake = false;
};
outputs =
{ self
, etc-nixos
, nixpkgs
, selfprivacy-overlay
, userdata-json
, hardware-configuration-nix
}:
let
system = "x86_64-linux";
userdata = builtins.fromJSON (builtins.readFile userdata-json);
hardware-configuration = import hardware-configuration-nix;
userdata =
builtins.fromJSON (builtins.readFile "${etc-nixos}/userdata.json");
in
{
nixosConfigurations = {
@ -33,7 +31,7 @@
# SelfPrivacy overlay
{ nixpkgs.overlays = [ selfprivacy-overlay.overlay ]; }
# machine specifics
hardware-configuration
"${etc-nixos}/hardware-configuration.nix"
# main configuration part
./configuration.nix
];