diff --git a/flake.nix b/flake.nix index bdc5fb2..106e344 100644 --- a/flake.nix +++ b/flake.nix @@ -53,6 +53,25 @@ default = 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: { formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt; diff --git a/templates/advanced/flake.nix b/templates/advanced/flake.nix new file mode 100644 index 0000000..e7362ae --- /dev/null +++ b/templates/advanced/flake.nix @@ -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; + }; + + }; +} diff --git a/templates/advanced/home.nix b/templates/advanced/home.nix new file mode 100644 index 0000000..fa8d4f4 --- /dev/null +++ b/templates/advanced/home.nix @@ -0,0 +1,8 @@ +{ config, lib, pkgs, ... }: + +{ + # Read the changelog before changing this value + home.stateVersion = "22.05"; + + # insert home-manager config +} diff --git a/templates/advanced/nix-on-droid.nix b/templates/advanced/nix-on-droid.nix new file mode 100644 index 0000000..9c890c2 --- /dev/null +++ b/templates/advanced/nix-on-droid.nix @@ -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; + }; +} diff --git a/templates/home-manager/flake.nix b/templates/home-manager/flake.nix new file mode 100644 index 0000000..9ed5d8f --- /dev/null +++ b/templates/home-manager/flake.nix @@ -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; + }; + + }; +} diff --git a/templates/home-manager/nix-on-droid.nix b/templates/home-manager/nix-on-droid.nix new file mode 100644 index 0000000..9ac7048 --- /dev/null +++ b/templates/home-manager/nix-on-droid.nix @@ -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 + }; + }; +} diff --git a/templates/minimal/flake.nix b/templates/minimal/flake.nix new file mode 100644 index 0000000..1a6ed46 --- /dev/null +++ b/templates/minimal/flake.nix @@ -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; + }; + + }; +} diff --git a/templates/minimal/nix-on-droid.nix b/templates/minimal/nix-on-droid.nix new file mode 100644 index 0000000..b6e30a4 --- /dev/null +++ b/templates/minimal/nix-on-droid.nix @@ -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"; +}