Update repo structure as part of nixification

This commit is contained in:
Gene Liverman 2023-09-14 00:01:31 -04:00
parent 49e67c64fb
commit cc0efcfdde
56 changed files with 181 additions and 154 deletions

View file

@ -0,0 +1,135 @@
# Profile for the Debian family of OS's
class profile::linux::debian {
$homedir = lookup('homedir')
$uid = find_owner($homedir)
$gid = find_group($homedir)
File {
owner => $uid,
group => $gid,
}
Vcsrepo {
user => $uid,
owner => $uid,
group => $gid,
}
if $facts['os_release']['ubuntu_codename'] {
$release = $facts['os_release']['ubuntu_codename']
}
elsif $facts['os']['lsb']['distcodename'] {
$release = $facts['os']['lsb']['distcodename']
}
else {
fail("Can't determine what to use in 'release' for the Docker repo")
}
apt::source { 'docker':
location => 'https://download.docker.com/linux/ubuntu',
release => $release,
repos => 'stable',
key => {
'id' => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88',
'source' => 'https://download.docker.com/linux/ubuntu/gpg',
},
}
$apt_packages = [
'apt-transport-https',
'bash-completion',
'ca-certificates',
'cmake',
'coreutils',
'curl',
'figlet',
'git',
'git-flow',
'pinentry-gnome3',
'powerline',
'python',
'python-pip',
'python-psutil',
'scdaemon',
'software-properties-common',
'tmux',
'tree',
'yubikey-personalization-gui',
'zsh',
]
package { $apt_packages:
ensure => 'installed',
require => Apt::Source['docker'],
}
exec { 'set-shell-to-zsh':
path => '/bin:/usr/bin',
command => "chsh -s /usr/bin/zsh `grep '${uid}:${gid}' /etc/passwd |cut -d ':' -f1`",
cwd => $homedir,
logoutput => true,
environment => "HOME=${homedir}",
unless => "grep '${uid}:${gid}' /etc/passwd | grep '/usr/bin/zsh'",
}
$dirs = [
"${homedir}/.local",
"${homedir}/.local/share",
"${homedir}/.local/share/fonts",
"${homedir}/.vim",
"${homedir}/.vim/bundle",
"${homedir}/repos",
]
file { $dirs:
ensure => 'directory',
}
vcsrepo { "${homedir}/.oh-my-zsh":
ensure => 'present',
provider => 'git',
source => 'https://github.com/robbyrussell/oh-my-zsh.git',
}
vcsrepo { "${homedir}/.oh-my-zsh/custom/themes":
ensure => 'latest',
provider => 'git',
source => 'git@github.com:genebean/my-oh-zsh-themes.git',
}
vcsrepo { "${homedir}/.vim/bundle/Vundle.vim":
ensure => 'latest',
provider => 'git',
source => 'https://github.com/VundleVim/Vundle.vim.git',
require => File[$dirs],
}
vcsrepo { "${homedir}/repos/powerline-fonts":
ensure => 'latest',
provider => 'git',
source => 'https://github.com/powerline/fonts.git',
require => File[$dirs],
notify => Exec['update-fonts'],
}
exec { 'update-fonts':
command => "${homedir}/repos/powerline-fonts/install.sh",
cwd => "${homedir}/repos/powerline-fonts",
logoutput => true,
environment => "HOME=${homedir}",
refreshonly => true,
notify => Exec['set-font-ownership'],
}
exec { 'set-font-ownership':
path => '/bin:/usr/bin',
command => "chown -R ${uid}:${gid} ${homedir}/.local/share/fonts/*",
cwd => $homedir,
logoutput => true,
environment => "HOME=${homedir}",
require => Exec['update-fonts'],
refreshonly => true,
}
}

View file

@ -0,0 +1,126 @@
# Profile for the Red Hat family of OS's
class profile::linux::el {
$homedir = lookup('homedir')
$uid = find_owner($homedir)
$gid = find_group($homedir)
$user = homedir_to_user($homedir)
include profile::linux::el::docker_repos
Yumrepo <| |> -> Package <| |> # lint:ignore:spaceship_operator_without_tag
$yum_packages = [
'cmake',
'device-mapper-persistent-data',
'docker-ce',
'figlet',
'git',
'gitflow',
'lvm2',
'python2-pip',
'python2-psutil',
'tmux',
'tree',
'yum-utils',
'zsh',
]
$python_pacakges = [
'powerline-status',
]
package {
default:
ensure => 'installed',
;
'epel-release':
notify => Exec['yum clean all'],
;
$yum_packages:
require => Package['epel-release'],
;
$python_pacakges:
ensure => 'latest',
provider => 'pip',
require => Package['python2-pip'],
;
}
$dirs = [
"${homedir}/.local",
"${homedir}/.local/share",
"${homedir}/.local/share/fonts",
"${homedir}/.vim",
"${homedir}/.vim/bundle",
"${homedir}/repos",
]
file { $dirs:
ensure => 'directory',
owner => $uid,
group => $gid,
}
# Unlike on Mint, powerline is pulled from pip.
# This makes it so that the line in .tmux.conf works on both.
file { '/usr/share/powerline':
ensure => 'link',
target => '/usr/lib/python2.7/site-packages/powerline',
require => Package[$python_pacakges],
}
vcsrepo {
default:
ensure => 'latest',
user => $user,
owner => $uid,
group => $gid,
provider => 'git',
;
"${homedir}/.oh-my-zsh":
ensure => 'present',
source => 'https://github.com/robbyrussell/oh-my-zsh.git',
;
"${homedir}/.oh-my-zsh/custom/themes":
source => 'git@github.com:genebean/my-oh-zsh-themes.git',
;
"${homedir}/.vim/bundle/Vundle.vim":
source => 'https://github.com/VundleVim/Vundle.vim.git',
require => File[$dirs],
;
"${homedir}/repos/powerline-fonts":
source => 'https://github.com/powerline/fonts.git',
require => File[$dirs],
notify => Exec['update-fonts'],
;
}
exec {
default:
logoutput => true,
environment => "HOME=${homedir}",
refreshonly => true,
;
'yum clean all':
command => '/bin/yum clean all',
;
'set-shell-to-zsh':
path => '/bin:/usr/bin',
command => "chsh -s /usr/bin/zsh `grep '${uid}:${gid}' /etc/passwd |cut -d ':' -f1`",
cwd => $homedir,
unless => "grep '${uid}:${gid}' /etc/passwd | grep '/usr/bin/zsh'",
require => Package['zsh'],
;
'update-fonts':
command => "${homedir}/repos/powerline-fonts/install.sh",
cwd => "${homedir}/repos/powerline-fonts",
notify => Exec['set-font-ownership'],
;
'set-font-ownership':
path => '/bin:/usr/bin',
command => "chown -R ${uid}:${gid} ${homedir}/.local/share/fonts/*",
cwd => $homedir,
require => Exec['update-fonts'],
;
}
}

View file

@ -0,0 +1,101 @@
# These repos are the ones setup by
# https://download.docker.com/linux/centos/docker-ce.repo
class profile::linux::el::docker_repos {
yumrepo { 'docker-ce-edge':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/$basearch/edge',
descr => 'Docker CE Edge - $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-edge-debuginfo':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/debug-$basearch/edge',
descr => 'Docker CE Edge - Debuginfo $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-edge-source':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/source/edge',
descr => 'Docker CE Edge - Sources',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-nightly':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/$basearch/nightly',
descr => 'Docker CE Nightly - $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-nightly-debuginfo':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/debug-$basearch/nightly',
descr => 'Docker CE Nightly - Debuginfo $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-nightly-source':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/source/nightly',
descr => 'Docker CE Nightly - Sources',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-stable':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/$basearch/stable',
descr => 'Docker CE Stable - $basearch',
enabled => '1',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-stable-debuginfo':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/debug-$basearch/stable',
descr => 'Docker CE Stable - Debuginfo $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-stable-source':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/source/stable',
descr => 'Docker CE Stable - Sources',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-test':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/$basearch/test',
descr => 'Docker CE Test - $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-test-debuginfo':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/debug-$basearch/test',
descr => 'Docker CE Test - Debuginfo $basearch',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
yumrepo { 'docker-ce-test-source':
ensure => 'present',
baseurl => 'https://download.docker.com/linux/centos/7/source/test',
descr => 'Docker CE Test - Sources',
enabled => '0',
gpgcheck => '1',
gpgkey => 'https://download.docker.com/linux/centos/gpg',
}
}