diff --git a/README.md b/README.md index f0a5184..6de2531 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,78 @@ To add to your local flake registry: ```sh nix registry add syndicate "git+https://git.syndicate-lang.org/ehmry/syndicate-flake" ``` + +## Synit + +``` nix +{ + description = "Personal NixOS configurations"; + + inputs = { + + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + syndicate = { + url = + "git+https://git.syndicate-lang.org/ehmry/syndicate-flake?ref=synit"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + }; + + outputs = { self, nixpkgs, syndicate }: + let + inherit (nixpkgs) lib; + overlays = [ syndicate.overlays.default ]; + in { + + legacyPackages = + lib.attrsets.mapAttrs (system: pkgs: pkgs.appendOverlays overlays) + nixpkgs.legacyPackages; + + nixosConfigurations = { + + yourhost = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + + # A common bootloader + { + boot.loader = { + efi.canTouchEfiVariables = false; + grub = { + enable = true; + efiSupport = true; + devices = [ "nodev" ]; + efiInstallAsRemovable = true; + forceInstall = true; + }; + systemd-boot.enable = false; # obviously not + }; + } + + # A normal NixOS system, the default boot profile. + ./your-normal-host-config/default.nix + + # A Synit system nested inside and an alternative boot profile. + { + specialisation.synit = { + inheritParentConfig = false; # keep it simple for now + configuration = { config, ... }: { + imports = [ + syndicate.nixosModules.synit + ./your-normal-host-config/hardware-configuration.nix + ]; + nixpkgs.pkgs = self.legacyPackages.${config.nixpkgs.system}; + }; + }; + } + + ]; + }; + + }; + }; +} + +```