diff --git a/README.md b/README.md index a5c11af..baeaed4 100644 --- a/README.md +++ b/README.md @@ -1,159 +1,27 @@ -# dots +# Dots -[![Ansible Lint](https://github.com/genebean/dots/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/genebean/dots/actions/workflows/ansible-lint.yml) -[![Ruby](https://github.com/genebean/dots/actions/workflows/ruby.yml/badge.svg)](https://github.com/genebean/dots/actions/workflows/ruby.yml) +This repo historically contained my dot files and is now transitioning to being a Nix flake that manages my dot files and the things that consume them. Things are changing a lot right now, but historically symlinked files are still in `link/`. Most all the other old stuff is now tucked away under `legacy/` to get it out of the way until I decide what is and isn't needed. -> **NOTICE:** this repo is undergoing a transformation. Historically it has been centered around using Puppet and r10k as ruby gems. I love Puppet for managing servers, but running it unprivledged as a gem has proven more than a little challenging in this specific use case. As a result, I am transitioning to using Ansible for the adhoc work that is needed here. Also, the `dots` tool and associated rake tasks will almost certainly be moved to Python 3 as it is universally available without some of the hastles of a bundler based setup. - -This repo contains my dot files and a tool to deploy them, and the programs that use them, to various OS's. Some additional tools that I consider part of my baseline setup are also installed and, if possible, configured by dots. - -Dots is written in ruby and utilizes bundler to keep all its dependancies -as self-contained as possible. Installation of programs and management of git -repositories is handled by way of the -[Puppet gem](https://rubygems.org/gems/puppet). - -Everything about dots macOS assumes you are running it as a normal user, -not as root. Strange and unexpected things could well happen if you run any part -of it as root or via sudo while on macOS. That said, sudo is required on Debian -due to there not being an equivalent to homebrew as you need sudo to use apt. - - -## Currently Supported OS's - -* macOS -* Linux Mint 18.2 - - -## Initial Setup +The new Nix bits are driven by `flake.nix` which pulls in things under `modules/`. Initial support is for both x86 macOS and NixOS. New stuff is structured like so, at least for now: ```bash -git clone git@github.com:genebean/dots.git ~/.dotfiles -cd ~/.dotfiles -bin/bootstrap.sh -This script takes care of getting dots ready to use -Enter the number of the task you want to perform: -1) Mac setup -2) EL setup -3) Mint setup -4) Quit -Task: +$ tree . -I legacy* -I link* +. +├── flake.lock +├── flake.nix +├── LICENSE +├── modules +│ ├── darwin +│ │ └── default.nix +│ ├── home-manager +│ │ └── default.nix +│ ├── linux +│ └── nixos +│ ├── dconf.nix +│ ├── default.nix +│ └── hardware-configuration.nix +├── README.md +└── Vagrantfile + +6 directories, 10 files ``` - -After you run the setup for your OS you will want to make sure that -[puppet/production/hieradata/nodes/](puppet/production/hieradata/nodes/) -contains a file matching the hostname of your machine. That file needs to -contain at least the following: - -```yaml ---- -homedir: '/Users/johndoe' -``` - -Naturally, you will want to adjust the entry to match the real path to your -home directory. On a Mac this is generally in `/Users/` or `/home/` on Linux. - - -## Running dots - -The primary way to interact with dots is via `bundle exec rake dots`. -This will run an interactive cli program like so: - -``` -$ bundle exec rake dots -/usr/local/Cellar/ruby/2.4.1_1/bin/ruby bin/dots.rb -It seems you are on macOS 10.12.5 -What would you like to do? (Use arrow keys, press Enter to select) -‣ copy - link - install -``` - -If not on macOS then you will need to use sudo for the install step: - -``` -$ sudo bundle exec rake dots -``` - -Additional tasks are available in the -dots namespace. You can see all the available tasks via -`bundle exec rake -T`. - - -## Notes - -#### Running Puppet - -```bash -# Any of these will work: -bundle exec rake dots:run_puppet -bundle exec rake dots:run_puppet_noop -bundle exec puppet apply --environmentpath ~/.dotfiles/puppet ~/.dotfiles/puppet/production/manifests/site.pp -``` - -As mentioned above, when not on macOS you will need to prefix bundle with sudo. - - -#### Installed Homebrew packages - -To see what has been installed (not the deps) run `brew leaves` - - -## Project structure - -* `bin/`: this is where the "application" bits live -* `bin/bootstrap`: platform specific helpers called by `bin/bootstrap.sh` -* `copy/`: files directly in this directory are copied to all hosts -* `copy/mac/`: files in here get copied to Macs -* `copy/nix/`: files in here get copied to all Posix systems -* `link/`: files directly in this directory are symlinked on all hosts. - * all symlinks are prefixed with a dot. Ex: `link/gemrc` becomes `~/.gemrc` -* `link/linux/`: files in here get symlinked on all Linux distros -* `link/mac/`: files in here get symlinked on all Macs -* `link/nix/`: files in here get symlinked on all Posix systems -* `link/ssh/`: these files get symlinked under `~/.ssh/` on all Posix systems -* `puppet/`: this is basically a control repo modified to suit this setup -* `puppet/production/`: items from an environment's branch in a control repo - * this setup assumes Puppet 4 and Hiera 5. Hiera's config is parsed as part of - the environment rather than from a global config file. -* `spec/`: unit tests go here - - -## Adding Packages - -To add additional pacakages to be installed and managed by dots you will need to -edit the associated Puppet manifest. Currently, this consists of the following: - -```bash -puppet/production/site/profile/manifests/ -├── base.pp -├── linux -│   └── debian.pp -├── linux.pp -└── mac.pp -``` - -On macOS you can easily install packages and casks from homebrew or Python -modules from pip. On Linux Mint you can easily use any package provider -that supports Debian or Ubuntu since all installs are done via sudo. On both -platforms you can also use custom exec's to to work around limitations. For -example, an exec is used on Mint to set the shell to zsh and on both platforms -to install or update the powerline fonts. - - -## Puppet Customizations - -This repo also contains some custom facts and functions under -`puppet/production/site/custom_libs`: - -### Facts - -* `os_release`: this creates a structured fact out of the contents of - /etc/os-release on Linux systems. This info is needed on Mint to determine - what version of Ubuntu it is based on. - -### Functions - -* `find_group`: returns the owning group's GID as a string for the file or - folder at a given path -* `find_owner`: returns the owning user's UID as a string for the file or - folder at a given path diff --git a/ansible/README.md b/legacy/.bundle/ansible/README.md similarity index 100% rename from ansible/README.md rename to legacy/.bundle/ansible/README.md diff --git a/ansible/ansible_hosts.yaml b/legacy/.bundle/ansible/ansible_hosts.yaml similarity index 100% rename from ansible/ansible_hosts.yaml rename to legacy/.bundle/ansible/ansible_hosts.yaml diff --git a/ansible/bigboy.yaml b/legacy/.bundle/ansible/bigboy.yaml similarity index 100% rename from ansible/bigboy.yaml rename to legacy/.bundle/ansible/bigboy.yaml diff --git a/ansible/blue-rock.yaml b/legacy/.bundle/ansible/blue-rock.yaml similarity index 100% rename from ansible/blue-rock.yaml rename to legacy/.bundle/ansible/blue-rock.yaml diff --git a/ansible/carbonbean.yaml b/legacy/.bundle/ansible/carbonbean.yaml similarity index 100% rename from ansible/carbonbean.yaml rename to legacy/.bundle/ansible/carbonbean.yaml diff --git a/ansible/server-zsh.yaml b/legacy/.bundle/ansible/server-zsh.yaml similarity index 100% rename from ansible/server-zsh.yaml rename to legacy/.bundle/ansible/server-zsh.yaml diff --git a/.bundle/config b/legacy/.bundle/config similarity index 100% rename from .bundle/config rename to legacy/.bundle/config diff --git a/.github/dependabot.yml b/legacy/.github/dependabot.yml similarity index 100% rename from .github/dependabot.yml rename to legacy/.github/dependabot.yml diff --git a/.github/workflows/ansible-lint.yml b/legacy/.github/workflows/ansible-lint.yml similarity index 100% rename from .github/workflows/ansible-lint.yml rename to legacy/.github/workflows/ansible-lint.yml diff --git a/.github/workflows/ruby.yml b/legacy/.github/workflows/ruby.yml similarity index 100% rename from .github/workflows/ruby.yml rename to legacy/.github/workflows/ruby.yml diff --git a/.puppet-lint.rc b/legacy/.puppet-lint.rc similarity index 100% rename from .puppet-lint.rc rename to legacy/.puppet-lint.rc diff --git a/.rspec b/legacy/.rspec similarity index 100% rename from .rspec rename to legacy/.rspec diff --git a/.rubocop.yml b/legacy/.rubocop.yml similarity index 100% rename from .rubocop.yml rename to legacy/.rubocop.yml diff --git a/DevelopmentPlan.md b/legacy/DevelopmentPlan.md similarity index 100% rename from DevelopmentPlan.md rename to legacy/DevelopmentPlan.md diff --git a/Gemfile b/legacy/Gemfile similarity index 100% rename from Gemfile rename to legacy/Gemfile diff --git a/Gemfile.lock b/legacy/Gemfile.lock similarity index 100% rename from Gemfile.lock rename to legacy/Gemfile.lock diff --git a/legacy/README.md b/legacy/README.md new file mode 100644 index 0000000..a5c11af --- /dev/null +++ b/legacy/README.md @@ -0,0 +1,159 @@ +# dots + +[![Ansible Lint](https://github.com/genebean/dots/actions/workflows/ansible-lint.yml/badge.svg)](https://github.com/genebean/dots/actions/workflows/ansible-lint.yml) +[![Ruby](https://github.com/genebean/dots/actions/workflows/ruby.yml/badge.svg)](https://github.com/genebean/dots/actions/workflows/ruby.yml) + +> **NOTICE:** this repo is undergoing a transformation. Historically it has been centered around using Puppet and r10k as ruby gems. I love Puppet for managing servers, but running it unprivledged as a gem has proven more than a little challenging in this specific use case. As a result, I am transitioning to using Ansible for the adhoc work that is needed here. Also, the `dots` tool and associated rake tasks will almost certainly be moved to Python 3 as it is universally available without some of the hastles of a bundler based setup. + +This repo contains my dot files and a tool to deploy them, and the programs that use them, to various OS's. Some additional tools that I consider part of my baseline setup are also installed and, if possible, configured by dots. + +Dots is written in ruby and utilizes bundler to keep all its dependancies +as self-contained as possible. Installation of programs and management of git +repositories is handled by way of the +[Puppet gem](https://rubygems.org/gems/puppet). + +Everything about dots macOS assumes you are running it as a normal user, +not as root. Strange and unexpected things could well happen if you run any part +of it as root or via sudo while on macOS. That said, sudo is required on Debian +due to there not being an equivalent to homebrew as you need sudo to use apt. + + +## Currently Supported OS's + +* macOS +* Linux Mint 18.2 + + +## Initial Setup + +```bash +git clone git@github.com:genebean/dots.git ~/.dotfiles +cd ~/.dotfiles +bin/bootstrap.sh +This script takes care of getting dots ready to use +Enter the number of the task you want to perform: +1) Mac setup +2) EL setup +3) Mint setup +4) Quit +Task: +``` + +After you run the setup for your OS you will want to make sure that +[puppet/production/hieradata/nodes/](puppet/production/hieradata/nodes/) +contains a file matching the hostname of your machine. That file needs to +contain at least the following: + +```yaml +--- +homedir: '/Users/johndoe' +``` + +Naturally, you will want to adjust the entry to match the real path to your +home directory. On a Mac this is generally in `/Users/` or `/home/` on Linux. + + +## Running dots + +The primary way to interact with dots is via `bundle exec rake dots`. +This will run an interactive cli program like so: + +``` +$ bundle exec rake dots +/usr/local/Cellar/ruby/2.4.1_1/bin/ruby bin/dots.rb +It seems you are on macOS 10.12.5 +What would you like to do? (Use arrow keys, press Enter to select) +‣ copy + link + install +``` + +If not on macOS then you will need to use sudo for the install step: + +``` +$ sudo bundle exec rake dots +``` + +Additional tasks are available in the +dots namespace. You can see all the available tasks via +`bundle exec rake -T`. + + +## Notes + +#### Running Puppet + +```bash +# Any of these will work: +bundle exec rake dots:run_puppet +bundle exec rake dots:run_puppet_noop +bundle exec puppet apply --environmentpath ~/.dotfiles/puppet ~/.dotfiles/puppet/production/manifests/site.pp +``` + +As mentioned above, when not on macOS you will need to prefix bundle with sudo. + + +#### Installed Homebrew packages + +To see what has been installed (not the deps) run `brew leaves` + + +## Project structure + +* `bin/`: this is where the "application" bits live +* `bin/bootstrap`: platform specific helpers called by `bin/bootstrap.sh` +* `copy/`: files directly in this directory are copied to all hosts +* `copy/mac/`: files in here get copied to Macs +* `copy/nix/`: files in here get copied to all Posix systems +* `link/`: files directly in this directory are symlinked on all hosts. + * all symlinks are prefixed with a dot. Ex: `link/gemrc` becomes `~/.gemrc` +* `link/linux/`: files in here get symlinked on all Linux distros +* `link/mac/`: files in here get symlinked on all Macs +* `link/nix/`: files in here get symlinked on all Posix systems +* `link/ssh/`: these files get symlinked under `~/.ssh/` on all Posix systems +* `puppet/`: this is basically a control repo modified to suit this setup +* `puppet/production/`: items from an environment's branch in a control repo + * this setup assumes Puppet 4 and Hiera 5. Hiera's config is parsed as part of + the environment rather than from a global config file. +* `spec/`: unit tests go here + + +## Adding Packages + +To add additional pacakages to be installed and managed by dots you will need to +edit the associated Puppet manifest. Currently, this consists of the following: + +```bash +puppet/production/site/profile/manifests/ +├── base.pp +├── linux +│   └── debian.pp +├── linux.pp +└── mac.pp +``` + +On macOS you can easily install packages and casks from homebrew or Python +modules from pip. On Linux Mint you can easily use any package provider +that supports Debian or Ubuntu since all installs are done via sudo. On both +platforms you can also use custom exec's to to work around limitations. For +example, an exec is used on Mint to set the shell to zsh and on both platforms +to install or update the powerline fonts. + + +## Puppet Customizations + +This repo also contains some custom facts and functions under +`puppet/production/site/custom_libs`: + +### Facts + +* `os_release`: this creates a structured fact out of the contents of + /etc/os-release on Linux systems. This info is needed on Mint to determine + what version of Ubuntu it is based on. + +### Functions + +* `find_group`: returns the owning group's GID as a string for the file or + folder at a given path +* `find_owner`: returns the owning user's UID as a string for the file or + folder at a given path diff --git a/Rakefile b/legacy/Rakefile similarity index 100% rename from Rakefile rename to legacy/Rakefile diff --git a/bin/bootstrap.sh b/legacy/bin/bootstrap.sh similarity index 100% rename from bin/bootstrap.sh rename to legacy/bin/bootstrap.sh diff --git a/bin/bootstrap/bootstrap_el.sh b/legacy/bin/bootstrap/bootstrap_el.sh similarity index 100% rename from bin/bootstrap/bootstrap_el.sh rename to legacy/bin/bootstrap/bootstrap_el.sh diff --git a/bin/bootstrap/bootstrap_mac.sh b/legacy/bin/bootstrap/bootstrap_mac.sh similarity index 100% rename from bin/bootstrap/bootstrap_mac.sh rename to legacy/bin/bootstrap/bootstrap_mac.sh diff --git a/bin/bootstrap/bootstrap_mint.sh b/legacy/bin/bootstrap/bootstrap_mint.sh similarity index 100% rename from bin/bootstrap/bootstrap_mint.sh rename to legacy/bin/bootstrap/bootstrap_mint.sh diff --git a/bin/casks.sh b/legacy/bin/casks.sh similarity index 100% rename from bin/casks.sh rename to legacy/bin/casks.sh diff --git a/bin/dots.rb b/legacy/bin/dots.rb similarity index 100% rename from bin/dots.rb rename to legacy/bin/dots.rb diff --git a/bin/dotutils.rb b/legacy/bin/dotutils.rb similarity index 100% rename from bin/dotutils.rb rename to legacy/bin/dotutils.rb diff --git a/bin/rake_tasks.rb b/legacy/bin/rake_tasks.rb similarity index 100% rename from bin/rake_tasks.rb rename to legacy/bin/rake_tasks.rb diff --git a/bin/sclbundle b/legacy/bin/sclbundle similarity index 100% rename from bin/sclbundle rename to legacy/bin/sclbundle diff --git a/bin/sclruby b/legacy/bin/sclruby similarity index 100% rename from bin/sclruby rename to legacy/bin/sclruby diff --git a/bin/shell-setup.sh b/legacy/bin/shell-setup.sh similarity index 100% rename from bin/shell-setup.sh rename to legacy/bin/shell-setup.sh diff --git a/copy/mac/gitconfig b/legacy/copy/mac/gitconfig similarity index 100% rename from copy/mac/gitconfig rename to legacy/copy/mac/gitconfig diff --git a/copy/puppetforge.yml b/legacy/copy/puppetforge.yml similarity index 100% rename from copy/puppetforge.yml rename to legacy/copy/puppetforge.yml diff --git a/puppet/production/Puppetfile b/legacy/puppet/production/Puppetfile similarity index 100% rename from puppet/production/Puppetfile rename to legacy/puppet/production/Puppetfile diff --git a/puppet/production/environment.conf b/legacy/puppet/production/environment.conf similarity index 100% rename from puppet/production/environment.conf rename to legacy/puppet/production/environment.conf diff --git a/puppet/production/hiera.yaml b/legacy/puppet/production/hiera.yaml similarity index 100% rename from puppet/production/hiera.yaml rename to legacy/puppet/production/hiera.yaml diff --git a/puppet/production/hieradata/common.yaml b/legacy/puppet/production/hieradata/common.yaml similarity index 100% rename from puppet/production/hieradata/common.yaml rename to legacy/puppet/production/hieradata/common.yaml diff --git a/puppet/production/hieradata/nodes/YellowBadger.yaml b/legacy/puppet/production/hieradata/nodes/YellowBadger.yaml similarity index 100% rename from puppet/production/hieradata/nodes/YellowBadger.yaml rename to legacy/puppet/production/hieradata/nodes/YellowBadger.yaml diff --git a/puppet/production/hieradata/nodes/bowl.yaml b/legacy/puppet/production/hieradata/nodes/bowl.yaml similarity index 100% rename from puppet/production/hieradata/nodes/bowl.yaml rename to legacy/puppet/production/hieradata/nodes/bowl.yaml diff --git a/puppet/production/hieradata/nodes/gene.yaml b/legacy/puppet/production/hieradata/nodes/gene.yaml similarity index 100% rename from puppet/production/hieradata/nodes/gene.yaml rename to legacy/puppet/production/hieradata/nodes/gene.yaml diff --git a/puppet/production/hieradata/nodes/mintstring.yaml b/legacy/puppet/production/hieradata/nodes/mintstring.yaml similarity index 100% rename from puppet/production/hieradata/nodes/mintstring.yaml rename to legacy/puppet/production/hieradata/nodes/mintstring.yaml diff --git a/puppet/production/manifests/site.pp b/legacy/puppet/production/manifests/site.pp similarity index 100% rename from puppet/production/manifests/site.pp rename to legacy/puppet/production/manifests/site.pp diff --git a/puppet/production/scripts/config_version.rb b/legacy/puppet/production/scripts/config_version.rb similarity index 100% rename from puppet/production/scripts/config_version.rb rename to legacy/puppet/production/scripts/config_version.rb diff --git a/puppet/production/scripts/config_version.sh b/legacy/puppet/production/scripts/config_version.sh similarity index 100% rename from puppet/production/scripts/config_version.sh rename to legacy/puppet/production/scripts/config_version.sh diff --git a/puppet/production/site/custom_libs/lib/facter/os_release.rb b/legacy/puppet/production/site/custom_libs/lib/facter/os_release.rb similarity index 100% rename from puppet/production/site/custom_libs/lib/facter/os_release.rb rename to legacy/puppet/production/site/custom_libs/lib/facter/os_release.rb diff --git a/puppet/production/site/custom_libs/lib/puppet/functions/find_group.rb b/legacy/puppet/production/site/custom_libs/lib/puppet/functions/find_group.rb similarity index 100% rename from puppet/production/site/custom_libs/lib/puppet/functions/find_group.rb rename to legacy/puppet/production/site/custom_libs/lib/puppet/functions/find_group.rb diff --git a/puppet/production/site/custom_libs/lib/puppet/functions/find_owner.rb b/legacy/puppet/production/site/custom_libs/lib/puppet/functions/find_owner.rb similarity index 100% rename from puppet/production/site/custom_libs/lib/puppet/functions/find_owner.rb rename to legacy/puppet/production/site/custom_libs/lib/puppet/functions/find_owner.rb diff --git a/puppet/production/site/custom_libs/lib/puppet/functions/homedir_to_user.rb b/legacy/puppet/production/site/custom_libs/lib/puppet/functions/homedir_to_user.rb similarity index 100% rename from puppet/production/site/custom_libs/lib/puppet/functions/homedir_to_user.rb rename to legacy/puppet/production/site/custom_libs/lib/puppet/functions/homedir_to_user.rb diff --git a/puppet/production/site/profile/manifests/base.pp b/legacy/puppet/production/site/profile/manifests/base.pp similarity index 100% rename from puppet/production/site/profile/manifests/base.pp rename to legacy/puppet/production/site/profile/manifests/base.pp diff --git a/puppet/production/site/profile/manifests/linux.pp b/legacy/puppet/production/site/profile/manifests/linux.pp similarity index 100% rename from puppet/production/site/profile/manifests/linux.pp rename to legacy/puppet/production/site/profile/manifests/linux.pp diff --git a/puppet/production/site/profile/manifests/linux/debian.pp b/legacy/puppet/production/site/profile/manifests/linux/debian.pp similarity index 100% rename from puppet/production/site/profile/manifests/linux/debian.pp rename to legacy/puppet/production/site/profile/manifests/linux/debian.pp diff --git a/puppet/production/site/profile/manifests/linux/el.pp b/legacy/puppet/production/site/profile/manifests/linux/el.pp similarity index 100% rename from puppet/production/site/profile/manifests/linux/el.pp rename to legacy/puppet/production/site/profile/manifests/linux/el.pp diff --git a/puppet/production/site/profile/manifests/linux/el/docker_repos.pp b/legacy/puppet/production/site/profile/manifests/linux/el/docker_repos.pp similarity index 100% rename from puppet/production/site/profile/manifests/linux/el/docker_repos.pp rename to legacy/puppet/production/site/profile/manifests/linux/el/docker_repos.pp diff --git a/puppet/production/site/profile/manifests/mac.pp b/legacy/puppet/production/site/profile/manifests/mac.pp similarity index 100% rename from puppet/production/site/profile/manifests/mac.pp rename to legacy/puppet/production/site/profile/manifests/mac.pp diff --git a/puppet/production/site/role/manifests/server.pp b/legacy/puppet/production/site/role/manifests/server.pp similarity index 100% rename from puppet/production/site/role/manifests/server.pp rename to legacy/puppet/production/site/role/manifests/server.pp diff --git a/puppet/production/site/role/manifests/workstation.pp b/legacy/puppet/production/site/role/manifests/workstation.pp similarity index 100% rename from puppet/production/site/role/manifests/workstation.pp rename to legacy/puppet/production/site/role/manifests/workstation.pp diff --git a/r10k.yaml b/legacy/r10k.yaml similarity index 100% rename from r10k.yaml rename to legacy/r10k.yaml