2023-07-15 12:52:46 +00:00
|
|
|
{
|
|
|
|
description = "Selfprivacy NixOS configuration flake";
|
|
|
|
|
|
|
|
inputs = {
|
2023-07-17 00:58:26 +00:00
|
|
|
nixpkgs.url = "github:nixos/nixpkgs";
|
2023-08-22 19:08:53 +00:00
|
|
|
|
2023-09-18 13:22:08 +00:00
|
|
|
selfprivacy-overlay.url =
|
2023-07-17 00:58:26 +00:00
|
|
|
"git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nix-repo.git";
|
2023-08-22 19:08:53 +00:00
|
|
|
|
|
|
|
# these inputs are 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
|
2023-07-15 12:52:46 +00:00
|
|
|
};
|
|
|
|
|
2023-08-22 19:08:53 +00:00
|
|
|
outputs =
|
|
|
|
{ self
|
|
|
|
, nixpkgs
|
2023-09-18 13:22:08 +00:00
|
|
|
, selfprivacy-overlay
|
2023-08-22 19:08:53 +00:00
|
|
|
, userdata-json
|
|
|
|
, hardware-configuration-nix
|
|
|
|
}:
|
2023-07-15 12:52:46 +00:00
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
2023-09-27 19:43:45 +00:00
|
|
|
cfgShortRev =
|
|
|
|
if self ? rev then builtins.substring 0 7 self.rev else "dirty";
|
|
|
|
nixosLabel = config:
|
|
|
|
"${cfgShortRev}.${config.system.nixos.release}.${nixpkgs.shortRev}";
|
2023-08-22 16:32:25 +00:00
|
|
|
userdata = builtins.fromJSON (builtins.readFile userdata-json);
|
2023-08-22 19:08:53 +00:00
|
|
|
hardware-configuration = import hardware-configuration-nix;
|
2023-07-15 12:52:46 +00:00
|
|
|
in
|
|
|
|
{
|
2023-08-22 16:32:25 +00:00
|
|
|
nixosConfigurations = {
|
2023-07-15 12:52:46 +00:00
|
|
|
just-nixos = nixpkgs.lib.nixosSystem {
|
2023-08-22 21:41:39 +00:00
|
|
|
specialArgs = { inherit system userdata; };
|
|
|
|
modules = [
|
2023-09-27 19:43:45 +00:00
|
|
|
# SelfPrivacy overlay
|
2023-09-18 13:22:08 +00:00
|
|
|
{ nixpkgs.overlays = [ selfprivacy-overlay.overlay ]; }
|
2023-09-27 19:43:45 +00:00
|
|
|
# machine specifics
|
2023-08-22 21:41:39 +00:00
|
|
|
hardware-configuration
|
2023-09-27 19:43:45 +00:00
|
|
|
# main configuration part
|
2023-08-22 21:41:39 +00:00
|
|
|
./configuration.nix
|
2023-09-27 19:43:45 +00:00
|
|
|
# we need to embed NixOS repository git commit sha1
|
|
|
|
({ config, ... }: { system.nixos.label = nixosLabel config; })
|
2023-08-22 21:41:39 +00:00
|
|
|
];
|
2023-07-15 12:52:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|