docs: update examples and default config

Show recommended setups instead of more error-prone examples.
This commit is contained in:
Tobias Happ 2022-09-25 17:36:41 +02:00
parent 49cb42c480
commit c9438deb3c
2 changed files with 42 additions and 58 deletions

View file

@ -80,7 +80,7 @@ look inside the `./modules` directory for all modules.
To enable `home-manager` you simply need to follow the instructions already provided in the example `nix-on-droid.nix`: To enable `home-manager` you simply need to follow the instructions already provided in the example `nix-on-droid.nix`:
1. Add `home-manager` channel: 1. Add `home-manager` channel:
``` ```sh
nix-channel --add https://github.com/rycee/home-manager/archive/release-22.05.tar.gz home-manager nix-channel --add https://github.com/rycee/home-manager/archive/release-22.05.tar.gz home-manager
nix-channel --update nix-channel --update
``` ```
@ -104,7 +104,7 @@ To enable `home-manager` you simply need to follow the instructions already prov
}; };
# or if you have a separate home.nix already present: # or if you have a separate home.nix already present:
home-manager.config = import ./home.nix; home-manager.config = ./home.nix;
} }
``` ```
@ -126,7 +126,7 @@ If you really want to rebuild it, you can just use Android Studio for that.
The zipball generation is probably what you are after. The zipball generation is probably what you are after.
Get an x86_64 computer with flake-enabled Nix. Run Get an x86_64 computer with flake-enabled Nix. Run
``` ```sh
nix build .#bootstrapZip --impure nix build .#bootstrapZip --impure
``` ```
@ -164,61 +164,38 @@ you shouldn't need a binary cache for that.
Do not run `nix profile` because this will render your environment incompatible with `nix-on-droid` as it relies on Do not run `nix profile` because this will render your environment incompatible with `nix-on-droid` as it relies on
`nix-env`. `nix-env`.
### Minimal example ### Examples / templates
A minimal example could look like the following:
```nix ```nix
{ {
description = "nix-on-droid configuration"; description = "Minimal example of nix-on-droid system config.";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
nix-on-droid.url = "github:t184256/nix-on-droid";
nix-on-droid.inputs.nixpkgs.follows = "nixpkgs"; nix-on-droid = {
url = "github:t184256/nix-on-droid/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { nix-on-droid, ... }: { outputs = { self, nixpkgs, nix-on-droid }: {
nixOnDroidConfigurations = {
device = nix-on-droid.lib.nixOnDroidConfiguration { nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
config = ./nix-on-droid.nix; system = "aarch64-linux";
system = "aarch64-linux"; config = ./nix-on-droid.nix;
};
}; };
}; };
} }
``` ```
### Advanced example For more examples and nix flake templates, see [`templates`](./templates) directory or explore with:
```nix ```sh
{ nix flake init --template github:t184256/nix-on-droid#advanced
description = "nix-on-droid configuration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-22.05";
home-manager.url = "github:nix-community/home-manager/release-22.05";
nix-on-droid.url = "github:t184256/nix-on-droid";
nix-on-droid.inputs.nixpkgs.follows = "nixpkgs";
nix-on-droid.inputs.home-manager.follows = "home-manager";
};
outputs = { nix-on-droid, ... }: {
nixOnDroidConfigurations = {
device = nix-on-droid.lib.nixOnDroidConfiguration {
config = ./nix-on-droid.nix;
system = "aarch64-linux";
extraModules = [
# import source out-of-tree modules like:
# flake.nixOnDroidModules.module
];
extraSpecialArgs = {
# arguments to be available in every nix-on-droid module
};
# your own pkgs instance (see nix-on-droid.overlay for useful additions)
# pkgs = ...;
};
};
};
}
``` ```
### Usage with `nix-on-droid` ### Usage with `nix-on-droid`

View file

@ -1,10 +1,10 @@
{ pkgs, config, ... }: { config, lib, pkgs, ... }:
{ {
# Simply install just the packages # Simply install just the packages
environment.packages = with pkgs; [ environment.packages = with pkgs; [
# User-facing stuff that you really really want to have # User-facing stuff that you really really want to have
vim # or some other editor, e.g. nano or neovim vim # or some other editor, e.g. nano or neovim
# Some common stuff that people expect to have # Some common stuff that people expect to have
#diffutils #diffutils
@ -30,23 +30,30 @@
# Read the changelog before changing this value # Read the changelog before changing this value
system.stateVersion = "22.05"; system.stateVersion = "22.05";
# Set up nix for flakes
#nix.extraOptions = ''
# experimental-features = nix-command flakes
#'';
# Set your time zone
#time.timeZone = "Europe/Berlin";
# After installing home-manager channel like # After installing home-manager channel like
# nix-channel --add https://github.com/rycee/home-manager/archive/release-22.05.tar.gz home-manager # nix-channel --add https://github.com/rycee/home-manager/archive/release-22.05.tar.gz home-manager
# nix-channel --update # nix-channel --update
# you can configure home-manager in here like # you can configure home-manager in here like
#home-manager.config = #home-manager = {
# { pkgs, lib, ... }: # useGlobalPkgs = true;
# {
# # Read the changelog before changing this value
# home.stateVersion = "22.05";
# #
# # Use the same overlays as the system packages # config =
# nixpkgs = { inherit (config.nixpkgs) overlays; }; # { config, lib, pkgs, ... }:
# {
# # Read the changelog before changing this value
# home.stateVersion = "22.05";
# #
# # insert home-manager config # # insert home-manager config
# }; # };
# If you want the same pkgs instance to be used for nix-on-droid and home-manager #};
#home-manager.useGlobalPkgs = true;
} }
# vim: ft=nix # vim: ft=nix