diff --git a/docs/darwin/getting_started.md b/docs/darwin/getting_started.md new file mode 100644 index 0000000..7ddb21f --- /dev/null +++ b/docs/darwin/getting_started.md @@ -0,0 +1,47 @@ +# Using SrvOS with nix-darwin + +## Finding your way around + +This project exports four big categories of NixOS modules which are useful to define a server configuration: + +* Machine type - these are high-level settings that define the machine type (Eg: common, server or desktop). Only one of those would be included. +* Configuration mixins - these define addons to be added to the machine configuration. One or more can be added. + +## Example + +Combining all of those together, here is how your `flake.nix` might look like, to deploy a GitHub Actions runner on Hetzner: + +```nix +{ + description = "My machines flakes"; + inputs = { + srvos.url = "github:nix-community/srvos/darwin-support"; + # Use the version of nixpkgs that has been tested to work with SrvOS + # Alternatively we also support the latest nixos release and unstable + nixpkgs.follows = "srvos/nixpkgs"; + nix-darwin.url = "github:LnL7/nix-darwin"; + nix-darwin.inputs.nixpkgs.follows = "srvos/nixpkgs"; + }; + outputs = { srvos, nix-darwin, ... }: { + darwinConfigurations.myHost = nix-darwin.lib.darwinSystem { + modules = [ + # This machine is a server (i.e. CI runner) + srvos.darwinModules.server + # If a machine is a workstation or laptop, use this instead + # srvos.darwinModules.desktop + + # Configured with extra terminfos + srvos.darwinModules.mixins-terminfo + # Finally add your configuration here + ./myHost.nix + ]; + }; + }; +} +``` + +## Continue + +Now that we have gone over the high-level details, you should have an idea of how to use this project. + +To dig further, take a look at the [User guide](../user_guide.md). diff --git a/docs/getting_started.md b/docs/getting_started.md index 1773172..17ec7f9 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -1,53 +1,9 @@ # Getting Started with SrvOS -This project is designed to work in combination with [NixOS](https://nixos.org). +This project is designed to work in combination with the Linux distribution [NixOS](https://nixos.org) or [nix-darwin](https://github.com/LnL7/nix-darwin) on macOS. In this documentation, we expect the reader to be already familiar with the base operating system, and introduce how to compose it with our own extensions. -## Finding your way around +For NixOS continue reading [here](nixos/getting_started.md), +for nix-darwin/macOS read [this](darwin/getting_started.md). -This project exports four big categories of NixOS modules which are useful to define a server configuration: - -* Machine type - these are high-level settings that define the machine type (Eg: common, server or desktop). Only one of those would be included. -* Machine hardware - these define hardware-related settings for well known hardware. Only one of those would be included. (eg: AWS EC2 instances). -* Machine role - theses take over a machine for a specific role. Only one of those would be included. (eg: GitHub Actions runner) -* Configuration mixins - these define addons to be added to the machine configuration. One or more can be added. - -## Example - -Combining all of those together, here is how your `flake.nix` might look like, to deploy a GitHub Actions runner on Hetzner: - -```nix -{ - description = "My machines flakes"; - inputs = { - srvos.url = "github:nix-community/srvos"; - # Use the version of nixpkgs that has been tested to work with SrvOS - # Alternatively we also support the latest nixos release and unstable - nixpkgs.follows = "srvos/nixpkgs"; - }; - outputs = { self, nixpkgs, srvos }: { - nixosConfigurations.myHost = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - # This machine is a server - srvos.nixosModules.server - # Deployed on the AMD Hetzner hardware - srvos.nixosModules.hardware-hetzner-amd - # Configured with extra terminfos - srvos.nixosModules.mixins-terminfo - # And designed to run the GitHub Actions runners - srvos.nixosModules.roles-github-actions-runner - # Finally add your configuration here - ./myHost.nix - ]; - }; - }; -} -``` - -## Continue - -Now that we have gone over the high-level details, you should have an idea of how to use this project. - -To dig further, take a look at the [User guide](user_guide.md). diff --git a/docs/nixos/getting_started.md b/docs/nixos/getting_started.md new file mode 100644 index 0000000..9bb6192 --- /dev/null +++ b/docs/nixos/getting_started.md @@ -0,0 +1,49 @@ +# Using SrvOS on NixOS + +## Finding your way around + +This project exports four big categories of NixOS modules which are useful to define a server configuration: + +* Machine type - these are high-level settings that define the machine type (Eg: common, server or desktop). Only one of those would be included. +* Machine hardware - these define hardware-related settings for well known hardware. Only one of those would be included. (eg: AWS EC2 instances). +* Machine role - theses take over a machine for a specific role. Only one of those would be included. (eg: GitHub Actions runner) +* Configuration mixins - these define addons to be added to the machine configuration. One or more can be added. + +## Example + +Combining all of those together, here is how your `flake.nix` might look like, to deploy a GitHub Actions runner on Hetzner: + +```nix +{ + description = "My machines flakes"; + inputs = { + srvos.url = "github:nix-community/srvos"; + # Use the version of nixpkgs that has been tested to work with SrvOS + # Alternatively we also support the latest nixos release and unstable + nixpkgs.follows = "srvos/nixpkgs"; + }; + outputs = { self, nixpkgs, srvos }: { + nixosConfigurations.myHost = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + # This machine is a server + srvos.nixosModules.server + # Deployed on the AMD Hetzner hardware + srvos.nixosModules.hardware-hetzner-amd + # Configured with extra terminfos + srvos.nixosModules.mixins-terminfo + # And designed to run the GitHub Actions runners + srvos.nixosModules.roles-github-actions-runner + # Finally add your configuration here + ./myHost.nix + ]; + }; + }; +} +``` + +## Continue + +Now that we have gone over the high-level details, you should have an idea of how to use this project. + +To dig further, take a look at the [User guide](../user_guide.md). diff --git a/mkdocs.yml b/mkdocs.yml index 16bab19..e1ed881 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -14,7 +14,10 @@ edit_uri: edit/main/docs nav: - Home: index.md - - Getting started: getting_started.md + - Getting started: + - Intro: getting_started.md + - NixOS: nixos/getting_started.md + - Darwin: darwin/getting_started.md - User guide: - Intro: user_guide.md - NixOS modules: