diff --git a/bin/rig-install.sh b/bin/rig-install.sh new file mode 100755 index 0000000..51c01bc --- /dev/null +++ b/bin/rig-install.sh @@ -0,0 +1,15 @@ +#!/bin/sh +rig list \ + --json \ + | jq \ + --exit-status \ + --arg v "${1}" \ + '.[] | select(.version==$v)' \ + > /dev/null \ + || rig add "${1}" \ + && rig default "$(rig list \ + --json \ + | jq \ + --raw-output \ + --arg v "${1}" \ + '.[] | select(.version==$v) | .name')" diff --git a/homes/desktop.nix b/homes/desktop.nix index 1a7e7d9..6bd2945 100644 --- a/homes/desktop.nix +++ b/homes/desktop.nix @@ -10,6 +10,7 @@ home = { packages = with pkgs; [ act + ansible-lint earthly ffmpeg caladea diff --git a/playbooks/packages.yaml b/playbooks/packages.yaml index a5017dd..7d31ca4 100644 --- a/playbooks/packages.yaml +++ b/playbooks/packages.yaml @@ -55,6 +55,7 @@ - firefoxpwa - ghostty - inkscape + - jq - kate - kdenlive - kdiff3 @@ -78,13 +79,21 @@ - zed - zsh - zotero - - R state: present - name: Install Microsoft Core Fonts ansible.builtin.dnf: name: https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm state: present disable_gpg_check: true + - name: Install rig (R installation manager) + ansible.builtin.dnf: + name: https://github.com/r-lib/rig/releases/download/latest/r-rig-latest-1.{{ ansible_architecture }}.rpm + state: present + disable_gpg_check: true + - name: Install R via rig + ansible.builtin.script: + cmd: "{{ playbook_dir }}/../bin/rig-install.sh 4.4.3" + changed_when: false # Allows me to run the playbook as a way to upgrade the system packages # This is a violation of ansible-lint's rules, but one of the key reasons I # wrote this playbook in the first place diff --git a/systems/darwin/corianne.nix b/systems/darwin/corianne.nix index dff9085..27bd57c 100644 --- a/systems/darwin/corianne.nix +++ b/systems/darwin/corianne.nix @@ -1,6 +1,10 @@ { config, pkgs, pkgs-unstable, agenix, ... }: -{ +let + r-version = "4.4.3"; + rig-install = pkgs.writeShellScriptBin "_rig-install" + (builtins.readFile ./../../bin/rig-install.sh); +in { # imports = [ ]; # List packages installed in system profile. To search by name, run: @@ -8,6 +12,7 @@ environment.systemPackages = with pkgs; [ vim agenix.packages.aarch64-darwin.default + rig-install ]; # Use a custom configuration.nix location. @@ -124,6 +129,16 @@ && xattr -vrd com.apple.quarantine "$0" \ || true' \ /Applications/{} + + echo installing R v${r-version} via Rig... + PATH="/usr/local/bin:/usr/bin:${ + pkgs.lib.makeBinPath [ pkgs.jq rig-install ] + }:$PATH" \ + sudo \ + --preserve-env=PATH \ + --user=${config.system.primaryUser} \ + --set-home \ + _rig-install ${r-version} ''; nix.settings.experimental-features = [ "nix-command" "flakes" ]; @@ -154,12 +169,12 @@ }; taps = [ "homebrew/services" - "ybeapps/sourcegit" { name = "millironx/millironx"; clone_target = "https://code.millironx.com/millironx/homebrew-millironx.git"; } + "r-lib/rig" ]; brews = [ "borgbackup/tap/borgbackup-fuse" @@ -173,7 +188,6 @@ "docker-credential-helper" "firefoxpwa" "mpv" - "r" ]; casks = [ "alt-tab" @@ -196,6 +210,7 @@ "porting-kit" "qownnotes" "qt-creator" + "rig" "rstudio" "signal" "slack" @@ -207,7 +222,6 @@ "veracrypt" "vlc" "vorta" - "ybeapps/sourcegit/sourcegit" "zed" "zotero" "zulip"