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.
flake-to-override-folder
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": { "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1686476475, "lastModified": 1686476475,
@ -30,10 +17,8 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"hardware-configuration-nix": "hardware-configuration-nix",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"selfprivacy-overlay": "selfprivacy-overlay", "selfprivacy-overlay": "selfprivacy-overlay"
"userdata-json": "userdata-json"
} }
}, },
"selfprivacy-overlay": { "selfprivacy-overlay": {
@ -50,19 +35,6 @@
"type": "git", "type": "git",
"url": "https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nix-repo.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", "root": "root",

View File

@ -7,23 +7,21 @@
selfprivacy-overlay.url = selfprivacy-overlay.url =
"git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nix-repo.git"; "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 # for example, upon nix build using --override-input
userdata-json.flake = false; # userdata.json etc-nixos.flake = false;
hardware-configuration-nix.flake = false; # hardware-configuration.nix
}; };
outputs = outputs =
{ self { self
, etc-nixos
, nixpkgs , nixpkgs
, selfprivacy-overlay , selfprivacy-overlay
, userdata-json
, hardware-configuration-nix
}: }:
let let
system = "x86_64-linux"; system = "x86_64-linux";
userdata = builtins.fromJSON (builtins.readFile userdata-json); userdata =
hardware-configuration = import hardware-configuration-nix; builtins.fromJSON (builtins.readFile "${etc-nixos}/userdata.json");
in in
{ {
nixosConfigurations = { nixosConfigurations = {
@ -33,7 +31,7 @@
# SelfPrivacy overlay # SelfPrivacy overlay
{ nixpkgs.overlays = [ selfprivacy-overlay.overlay ]; } { nixpkgs.overlays = [ selfprivacy-overlay.overlay ]; }
# machine specifics # machine specifics
hardware-configuration "${etc-nixos}/hardware-configuration.nix"
# main configuration part # main configuration part
./configuration.nix ./configuration.nix
]; ];