From bcbe58e36b38f7e9bec1548c08c50d94ee91cf61 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Wed, 1 Oct 2025 20:56:47 -0400 Subject: [PATCH] First steps of managing things home manager can't do via Puppet --- Puppetfile | 2 + modules/hosts/home-manager-only/default.nix | 1 + .../home-manager-only/scripts/run-r10k.sh | 5 ++ .../hosts/home-manager-only/scripts/ubuntu.pp | 77 +++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100644 Puppetfile create mode 100755 modules/hosts/home-manager-only/scripts/run-r10k.sh create mode 100644 modules/hosts/home-manager-only/scripts/ubuntu.pp diff --git a/Puppetfile b/Puppetfile new file mode 100644 index 0000000..a5e38ea --- /dev/null +++ b/Puppetfile @@ -0,0 +1,2 @@ +mod 'puppetlabs-apt', '10.0.1' +mod 'puppetlabs-stdlib', '9.7.0' diff --git a/modules/hosts/home-manager-only/default.nix b/modules/hosts/home-manager-only/default.nix index 3b00ffd..ec323ba 100644 --- a/modules/hosts/home-manager-only/default.nix +++ b/modules/hosts/home-manager-only/default.nix @@ -3,6 +3,7 @@ home.packages = with pkgs; [ age home-manager + r10k sops ssh-to-age ]; diff --git a/modules/hosts/home-manager-only/scripts/run-r10k.sh b/modules/hosts/home-manager-only/scripts/run-r10k.sh new file mode 100755 index 0000000..0cc8aaa --- /dev/null +++ b/modules/hosts/home-manager-only/scripts/run-r10k.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +sudo /home/gene/.nix-profile/bin/r10k puppetfile install \ +--puppetfile=/home/gene/repos/dots/Puppetfile \ +--moduledir=/etc/puppetlabs/code/environments/production/modules diff --git a/modules/hosts/home-manager-only/scripts/ubuntu.pp b/modules/hosts/home-manager-only/scripts/ubuntu.pp new file mode 100644 index 0000000..1c17c80 --- /dev/null +++ b/modules/hosts/home-manager-only/scripts/ubuntu.pp @@ -0,0 +1,77 @@ +include apt + +# Manage the OpenVox APT repository and install the openvox-agent package +$os_name = downcase($facts['os']['name']) +apt::source { 'openvox8-release': + comment => "OpenVox 8 ${os_name}${facts['os']['release']['major']} Repository", + location => 'https://apt.voxpupuli.org', + release => "${os_name}${facts['os']['release']['major']}", + repos => 'openvox8', + key => { + 'name' => 'openvox-keyring.gpg', + 'source' => 'https://apt.voxpupuli.org/openvox-keyring.gpg', + }, +} + +package { 'openvox-agent': + ensure => latest, + require => Apt::Source['openvox8-release'], +} + +# Manage the Mozilla APT repository and install the firefox deb package +# This is to avoid the snap version that comes by default on Ubuntu +# https://www.omgubuntu.co.uk/2022/04/how-to-install-firefox-deb-apt-ubuntu-22-04 +apt::source { 'mozilla': + comment => 'Mozilla Team', + location => 'https://packages.mozilla.org/apt', + release => 'mozilla', + repos => 'main', + key => { + 'name' => 'packages.mozilla.org.asc', + 'ring' => '/etc/apt/keyrings/packages.mozilla.org.asc', + 'source' => 'https://packages.mozilla.org/apt/repo-signing-key.gpg', + }, + include => { + 'src' => false, + }, +} + +exec { 'remove_firefox_snap': + command => '/usr/bin/snap remove firefox', + onlyif => '/usr/bin/snap list | /bin/grep firefox', + notify => Exec['remove_stock_firefox_fake_deb'], +} + +exec { 'remove_stock_firefox_fake_deb': + command => '/usr/bin/apt-get -y remove firefox', + onlyif => '/usr/bin/dpkg -l | /bin/grep firefox', + refreshonly => true, + before => Package['firefox'], +} + +apt::pin { 'mozilla': + explanation => 'Prefer the Mozilla APT repository for Firefox', + packages => '*', + origin => 'packages.mozilla.org', + priority => 1000, + before => Package['firefox'], +} + +apt::pin { 'firefox': + explanation => "Don't use the Ubuntu repository for Firefox", + packages => 'firefox*', + originator => 'Ubuntu', + priority => -1, + before => Package['firefox'], +} + +package { 'firefox': + ensure => latest, +} + +## More stuff to come... + +# package { 'vscode': +# ensure => installed, +# source => 'https://vscode.download.prss.microsoft.com/dbazure/download/stable/e3550cfac4b63ca4eafca7b601f0d2885817fd1f/code_1.103.0-1754517494_amd64.deb', +# }