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-10-08 22:07:47 +00:00
|
|
|
# (only "dirty", because userdata.json and others are overriden)
|
|
|
|
cfgShortRev = builtins.substring 0 7 self.dirtyRev;
|
2023-09-27 19:43:45 +00:00
|
|
|
nixosLabel = config:
|
2023-10-08 22:07:47 +00:00
|
|
|
"${config.system.nixos.release}.${cfgShortRev}.${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-10-08 22:07:47 +00:00
|
|
|
# we need NixOS repository git commit sha1 embedded
|
|
|
|
({ config, ... }: {
|
|
|
|
system.nixos.label = nixosLabel config;
|
|
|
|
system.nixos.version = nixosLabel config;
|
|
|
|
system.configurationRevision = self.dirtyRev;
|
|
|
|
})
|
2023-08-22 21:41:39 +00:00
|
|
|
];
|
2023-07-15 12:52:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|