templates: add templates for some use cases

This commit is contained in:
Tobias Happ 2022-09-25 17:35:43 +02:00
parent 8b33a28370
commit f4edb7be86
8 changed files with 271 additions and 0 deletions

View file

@ -53,6 +53,25 @@
default = app; default = app;
nix-on-droid = app; nix-on-droid = app;
}; };
templates = {
default = self.templates.minimal;
minimal = {
path = ./templates/minimal;
description = "Minimal example of nix-on-droid system config.";
};
home-manager = {
path = ./templates/home-manager;
description = "Minimal example of nix-on-droid system config with home-manager.";
};
advanced = {
path = ./templates/advanced;
description = "Advanced example of nix-on-droid system config with home-manager.";
};
};
} }
// flake-utils.lib.eachSystem [ "aarch64-linux" "i686-linux" "x86_64-darwin" "x86_64-linux" ] (system: { // flake-utils.lib.eachSystem [ "aarch64-linux" "i686-linux" "x86_64-darwin" "x86_64-linux" ] (system: {
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt; formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;

View file

@ -0,0 +1,54 @@
{
description = "Advanced example of nix-on-droid system config with home-manager.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
home-manager = {
url = "github:nix-community/home-manager/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-on-droid = {
url = "github:t184256/nix-on-droid/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
};
outputs = { self, nixpkgs, home-manager, nix-on-droid }: {
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
system = "aarch64-linux";
config = ./nix-on-droid.nix;
# list of extra modules for nix-on-droid system
extraModules = [
# { nix.registry.nixpkgs.flake = nixpkgs; }
# ./path/to/module.nix
# or import source out-of-tree modules like:
# flake.nixOnDroidModules.module
];
# list of extra special args for nix-on-droid modules
extraSpecialArgs = {
# rootPath = ./.;
};
# set nixpkgs instance, it is recommended to apply nix-on-droid.overlays.default
pkgs = import nixpkgs {
system = "aarch64-linux";
overlays = [
nix-on-droid.overlays.default
# add other overlays
];
};
# set path to home-manager flake
home-manager-path = home-manager.outPath;
};
};
}

View file

@ -0,0 +1,8 @@
{ config, lib, pkgs, ... }:
{
# Read the changelog before changing this value
home.stateVersion = "22.05";
# insert home-manager config
}

View file

@ -0,0 +1,47 @@
{ config, lib, pkgs, ... }:
{
# Simply install just the packages
environment.packages = with pkgs; [
# User-facing stuff that you really really want to have
vim # or some other editor, e.g. nano or neovim
# Some common stuff that people expect to have
#diffutils
#findutils
#utillinux
#tzdata
#hostname
#man
#gnugrep
#gnupg
#gnused
#gnutar
#bzip2
#gzip
#xz
#zip
#unzip
];
# Backup etc files instead of failing to activate generation if a file already exists in /etc
environment.etcBackupExtension = ".bak";
# Read the changelog before changing this value
system.stateVersion = "22.05";
# Set up nix for flakes
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
# Set your time zone
#time.timeZone = "Europe/Berlin";
# Configure home-manager
home-manager = {
config = ./home.nix;
backupFileExtension = "hm-bak";
useGlobalPkgs = true;
};
}

View file

@ -0,0 +1,27 @@
{
description = "Minimal example of nix-on-droid system config with home-manager.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
home-manager = {
url = "github:nix-community/home-manager/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-on-droid = {
url = "github:t184256/nix-on-droid/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
inputs.home-manager.follows = "home-manager";
};
};
outputs = { self, nixpkgs, home-manager, nix-on-droid }: {
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
system = "aarch64-linux";
config = ./nix-on-droid.nix;
};
};
}

View file

@ -0,0 +1,55 @@
{ config, lib, pkgs, ... }:
{
# Simply install just the packages
environment.packages = with pkgs; [
# User-facing stuff that you really really want to have
vim # or some other editor, e.g. nano or neovim
# Some common stuff that people expect to have
#diffutils
#findutils
#utillinux
#tzdata
#hostname
#man
#gnugrep
#gnupg
#gnused
#gnutar
#bzip2
#gzip
#xz
#zip
#unzip
];
# Backup etc files instead of failing to activate generation if a file already exists in /etc
environment.etcBackupExtension = ".bak";
# Read the changelog before changing this value
system.stateVersion = "22.05";
# Set up nix for flakes
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
# Set your time zone
#time.timeZone = "Europe/Berlin";
# Configure home-manager
home-manager = {
backupFileExtension = "hm-bak";
useGlobalPkgs = true;
config =
{ config, lib, pkgs, ... }:
{
# Read the changelog before changing this value
home.stateVersion = "22.05";
# insert home-manager config
};
};
}

View file

@ -0,0 +1,21 @@
{
description = "Basic example of nix-on-droid system config.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
nix-on-droid = {
url = "github:t184256/nix-on-droid/release-22.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nix-on-droid }: {
nixOnDroidConfigurations.deviceName = nix-on-droid.lib.nixOnDroidConfiguration {
system = "aarch64-linux";
config = ./nix-on-droid.nix;
};
};
}

View file

@ -0,0 +1,40 @@
{ config, lib, pkgs, ... }:
{
# Simply install just the packages
environment.packages = with pkgs; [
# User-facing stuff that you really really want to have
vim # or some other editor, e.g. nano or neovim
# Some common stuff that people expect to have
#diffutils
#findutils
#utillinux
#tzdata
#hostname
#man
#gnugrep
#gnupg
#gnused
#gnutar
#bzip2
#gzip
#xz
#zip
#unzip
];
# Backup etc files instead of failing to activate generation if a file already exists in /etc
environment.etcBackupExtension = ".bak";
# Read the changelog before changing this value
system.stateVersion = "22.05";
# Set up nix for flakes
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
# Set your time zone
#time.timeZone = "Europe/Berlin";
}