diff --git a/README.md b/README.md
index 50214a8..b492c14 100644
--- a/README.md
+++ b/README.md
@@ -1,117 +1,13 @@
# klipper
-Welcome to your new module. A short overview of the generated parts can be found
-in the [PDK documentation][1].
-
-The README template below provides a starting point with details about what
-information to include in your README.
-
-## Table of Contents
-
-1. [Description](#description)
-1. [Setup - The basics of getting started with klipper](#setup)
- * [What klipper affects](#what-klipper-affects)
- * [Setup requirements](#setup-requirements)
- * [Beginning with klipper](#beginning-with-klipper)
-1. [Usage - Configuration options and additional functionality](#usage)
-1. [Limitations - OS compatibility, etc.](#limitations)
-1. [Development - Guide for contributing to the module](#development)
-
-## Description
-
-Briefly tell users why they might want to use your module. Explain what your
-module does and what kind of problems users can solve with it.
-
-This should be a fairly short description helps the user decide if your module
-is what they want.
-
-## Setup
-
-### What klipper affects **OPTIONAL**
-
-If it's obvious what your module touches, you can skip this section. For
-example, folks can probably figure out that your mysql_instance module affects
-their MySQL instances.
-
-If there's more that they should know about, though, this is the place to
-mention:
-
-* Files, packages, services, or operations that the module will alter, impact,
- or execute.
-* Dependencies that your module automatically installs.
-* Warnings or other important notices.
-
-### Setup Requirements **OPTIONAL**
-
-If your module requires anything extra before setting up (pluginsync enabled,
-another module, etc.), mention it here.
-
-If your most recent release breaks compatibility or requires particular steps
-for upgrading, you might want to include an additional "Upgrading" section here.
-
-### Beginning with klipper
-
-The very basic steps needed for a user to get the module up and running. This
-can include setup steps, if necessary, or it can be an example of the most basic
-use of the module.
+This module installs and does a baseline configuration of [Klipper](https://www.klipper3d.org/)
## Usage
-Include usage examples for common use cases in the **Usage** section. Show your
-users how to use your module to solve problems, and be sure to include code
-examples. Include three to five examples of the most important or common tasks a
-user can accomplish with your module. Show users how to accomplish more complex
-tasks that involve different types, classes, and functions working in tandem.
-
-## Reference
-
-This section is deprecated. Instead, add reference information to your code as
-Puppet Strings comments, and then use Strings to generate a REFERENCE.md in your
-module. For details on how to add code comments and generate documentation with
-Strings, see the [Puppet Strings documentation][2] and [style guide][3].
-
-If you aren't ready to use Strings yet, manually create a REFERENCE.md in the
-root of your module directory and list out each of your module's classes,
-defined types, facts, functions, Puppet tasks, task plans, and resource types
-and providers, along with the parameters for each.
-
-For each element (class, defined type, function, and so on), list:
-
-* The data type, if applicable.
-* A description of what the element does.
-* Valid values, if the data type doesn't make it obvious.
-* Default value, if any.
-
-For example:
-
-```
-### `pet::cat`
-
-#### Parameters
-
-##### `meow`
-
-Enables vocalization in your cat. Valid options: 'string'.
-
-Default: 'medium-loud'.
-```
+For the most basic usage, just include the base klipper class. This will install
+and configure klipper using the standard defaults for a Raspbian system.
## Limitations
In the Limitations section, list any incompatibilities, known issues, or other
warnings.
-
-## Development
-
-In the Development section, tell other users the ground rules for contributing
-to your project and how they should submit their work.
-
-## Release Notes/Contributors/Etc. **Optional**
-
-If you aren't using changelog, put your release notes here (though you should
-consider using changelog). You can also add any additional sections you feel are
-necessary or important to include here. Please use the `##` header.
-
-[1]: https://puppet.com/docs/pdk/latest/pdk_generating_modules.html
-[2]: https://puppet.com/docs/puppet/latest/puppet_strings.html
-[3]: https://puppet.com/docs/puppet/latest/puppet_strings_style.html
diff --git a/REFERENCE.md b/REFERENCE.md
new file mode 100644
index 0000000..d6ff418
--- /dev/null
+++ b/REFERENCE.md
@@ -0,0 +1,80 @@
+# Reference
+
+
+
+## Table of Contents
+
+### Classes
+
+#### Public Classes
+
+* [`klipper`](#klipper): Installs and manages klipper
+
+#### Private Classes
+
+* `klipper::install`: Perform baseline install of Klipper
+
+## Classes
+
+### `klipper`
+
+Installs and manages klipper
+
+#### Examples
+
+#####
+
+```puppet
+include klipper
+```
+
+#### Parameters
+
+The following parameters are available in the `klipper` class:
+
+* [`src_path`](#src_path)
+* [`version`](#version)
+* [`user`](#user)
+* [`python_dir`](#python_dir)
+* [`config_dir`](#config_dir)
+
+##### `src_path`
+
+Data type: `Stdlib::Absolutepath`
+
+The filesystem path to clone the klipper source code to
+
+Default value: `"/home/${klipper::user}/klipper"`
+
+##### `version`
+
+Data type: `String`
+
+The version of klipper to install
+
+Default value: `'present'`
+
+##### `user`
+
+Data type: `String`
+
+The account to run klipper under
+
+Default value: `'pi'`
+
+##### `python_dir`
+
+Data type: `Stdlib::Absolutepath`
+
+The path to place the klipper python virtualenv
+
+Default value: `"/home/${klipper::user}/klippy-env"`
+
+##### `config_dir`
+
+Data type: `Stdlib::Absolutepath`
+
+The path to place klipper config files
+
+Default value: `"/home/${klipper::user}/klipper_config"`
+
diff --git a/manifests/init.pp b/manifests/init.pp
index b6ff82a..307c70f 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -4,5 +4,19 @@
#
# @example
# include klipper
-class klipper {
+#
+# @param src_path The filesystem path to clone the klipper source code to
+# @param version The version of klipper to install
+# @param user The account to run klipper under
+# @param python_dir The path to place the klipper python virtualenv
+# @param config_dir The path to place klipper config files
+#
+class klipper (
+ String $version = 'present',
+ String $user = 'pi',
+ Stdlib::Absolutepath $src_path = "/home/${klipper::user}/klipper",
+ Stdlib::Absolutepath $python_dir = "/home/${klipper::user}/klippy-env",
+ Stdlib::Absolutepath $config_dir = "/home/${klipper::user}/klipper_config",
+) {
+ contain klipper::install
}
diff --git a/manifests/install.pp b/manifests/install.pp
new file mode 100644
index 0000000..0c57786
--- /dev/null
+++ b/manifests/install.pp
@@ -0,0 +1,50 @@
+# @summary Perform baseline install of Klipper
+#
+# @api private
+#
+class klipper::install {
+ $_packages = [
+ 'git',
+ 'virtualenv',
+ 'python-dev',
+ 'libffi-dev',
+ 'build-essential',
+ 'libncurses-dev',
+ 'libusb-dev',
+ 'avrdude',
+ 'gcc-avr',
+ 'binutils-avr',
+ 'avr-libc',
+ 'stb32flash',
+ 'dfu-util',
+ 'libnweb-arm-none-eabi',
+ 'gcc-arm-none-eabi',
+ 'binutils-arm-none-eabi',
+ 'libusb-1.0',
+ ]
+
+ ensure_packages($_packages)
+
+ Exec {
+ path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
+ }
+
+ vcsrepo { $klipper::src_path:
+ ensure => $klipper::version,
+ provider => 'git',
+ source => 'https://github.com/Klipper3d/klipper.git',
+ user => $klipper::user,
+ require => Package['git'],
+ }
+ -> exec { 'Initialize Klipper virtualenv':
+ command => "virtualenv -p python2 ${klipper::python_dir}",
+ creates => $klipper::python_dir,
+ user => $klipper::user,
+ }
+ ~> exec { 'Install Klipper python modules':
+ command => "${klipper::python_dir}/bin/pip install -r ${klipper::python_dir}/scripts/klippy-requirements.txt",
+ refreshonly => true,
+ subscribe => Vcsrepo[$klipper::src_path],
+ user => $klipper::user,
+ }
+}
diff --git a/metadata.json b/metadata.json
index a59ecba..78785f7 100644
--- a/metadata.json
+++ b/metadata.json
@@ -6,7 +6,14 @@
"license": "Apache-2.0",
"source": "",
"dependencies": [
-
+ {
+ "name": "puppetlabs-stdlib",
+ "version_requirement": ">= 7.0.0 < 9.0.0"
+ },
+ {
+ "name": "puppetlabs-vcsrepo",
+ "version_requirement": ">= 5.0.0 < 6.0.0"
+ }
],
"operatingsystem_support": [
{
@@ -31,4 +38,4 @@
"pdk-version": "2.5.0",
"template-url": "pdk-default#2.5.0",
"template-ref": "tags/2.5.0-0-g369d483"
-}
+}
\ No newline at end of file
diff --git a/pdk.yaml b/pdk.yaml
new file mode 100644
index 0000000..4bef4bd
--- /dev/null
+++ b/pdk.yaml
@@ -0,0 +1,2 @@
+---
+ignore: []
diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb
new file mode 100644
index 0000000..af51d51
--- /dev/null
+++ b/spec/classes/install_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe 'klipper::install' do
+ on_supported_os.each do |os, os_facts|
+ context "on #{os}" do
+ let(:facts) { os_facts }
+
+ it { is_expected.to compile }
+ end
+ end
+end