From 2dfbd65d2f3bc3ab9227ac755f46dae7e602eb5c Mon Sep 17 00:00:00 2001 From: Florian Schrofner Date: Mon, 11 Jan 2021 15:38:59 +0100 Subject: [PATCH] start configuration using cdist --- cdist/manifest/init | 4 +++ cdist/type/__aur/gencode-remote | 14 ++++++++ cdist/type/__aur/manifest | 11 ++++++ cdist/type/__aur/parameter/required | 2 ++ cdist/type/__manjaro_desktop/manifest | 34 ++++++++++++++++--- .../{gencode-remote => singleton} | 0 readme.md | 21 +++++++++++- 7 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 cdist/manifest/init create mode 100755 cdist/type/__aur/gencode-remote create mode 100644 cdist/type/__aur/manifest create mode 100644 cdist/type/__aur/parameter/required rename cdist/type/__manjaro_desktop/{gencode-remote => singleton} (100%) diff --git a/cdist/manifest/init b/cdist/manifest/init new file mode 100644 index 0000000..a6300f2 --- /dev/null +++ b/cdist/manifest/init @@ -0,0 +1,4 @@ +#!/bin/sh -e + +# once there are more types, this should be handled by a parameter +__manjaro_desktop \ No newline at end of file diff --git a/cdist/type/__aur/gencode-remote b/cdist/type/__aur/gencode-remote new file mode 100755 index 0000000..9d5dab7 --- /dev/null +++ b/cdist/type/__aur/gencode-remote @@ -0,0 +1,14 @@ +#!/bin/sh -e + +package="$__object_id" +user="$(cat "$__object/parameter/user")" +directory="$(cat "$__object/parameter/directory")/$package" + +#install dependencies as root +#echo "source $directory/PKGBUILD && pacman -Sy --noconfirm --needed --asdeps \"${makedepends[@]}\"" + +#make package as user +echo "su - $user -s /bin/bash -c \"(cd $directory && makepkg -f)\"" + +#install package as root +echo "pacman --noconfirm -U $directory/*-x86_64.pkg.*" diff --git a/cdist/type/__aur/manifest b/cdist/type/__aur/manifest new file mode 100644 index 0000000..eb7b880 --- /dev/null +++ b/cdist/type/__aur/manifest @@ -0,0 +1,11 @@ +#!/bin/sh -e + +package="$__object_id" +user="$(cat "$__object/parameter/user")" +directory="$(cat "$__object/parameter/directory")" +packagedir="$directory/$package" + +export CDIST_ORDER_DEPENDENCY=on +__git $packagedir --source https://aur.archlinux.org/$package.git +require="__git/$packagedir" __directory $directory --owner $user --group $user --recursive +unset CDIST_ORDER_DEPENDENCY \ No newline at end of file diff --git a/cdist/type/__aur/parameter/required b/cdist/type/__aur/parameter/required new file mode 100644 index 0000000..c118a71 --- /dev/null +++ b/cdist/type/__aur/parameter/required @@ -0,0 +1,2 @@ +user +directory diff --git a/cdist/type/__manjaro_desktop/manifest b/cdist/type/__manjaro_desktop/manifest index 3f7a3d3..e003cf4 100644 --- a/cdist/type/__manjaro_desktop/manifest +++ b/cdist/type/__manjaro_desktop/manifest @@ -1,11 +1,16 @@ +#!/bin/sh -e + +# vars user="schrofi" home="/home/schrofi" # setup user -__user "$user" --home "$home" --shell /bin/bash +__user "$user" --home "$home" --shell /bin/fish require="__user/$user" __directory "$home" \ --owner "$user" --group "$user" --mode 0755 +__timezone --tz Europe/Vienna + # install packages __package_update_index require="__package_update_index" __package_upgrade_all @@ -55,11 +60,32 @@ package_list=" # missing AUR packages: android-studio, ncspot, postman, scrcp, seafile-client for package in $package_list - do require="__package_upgrade_all" __package $package --state=present +do require="__package_upgrade_all" __package $package --state=present done # setup dotfiles -__dot_file .config/i3/config --user "$user" --source "$__files/dotfiles/i3/config" -__dot_file .config/ncspot/config.toml --user "$user" --source "$__files/dotfiles/ncspot/config.toml" +__dot_file .config/i3/config --user "$user" --source "$__type/dotfiles/i3/config" +__dot_file .config/ncspot/config.toml --user "$user" --source "$__type/dotfiles/ncspot/config.toml" +# those have to be done in order, install spacemacs +export CDIST_ORDER_DEPENDENCY=on require="__package/emacs" __git "$home/.emacs.d" --source https://github.com/syl20bnr/spacemacs +__directory "$home/.emacs.d" --owner $user --group $user --recursive +unset CDIST_ORDER_DEPENDENCY + +# install aura +aurdir="$home/Projects/AUR" +aur_packages=" + aura-bin + android-studio + postman-bin +" + +export CDIST_ORDER_DEPENDENCY=on + +for package in $aur_packages +do + __aur $package --user $user --directory $aurdir +done + +unset CDIST_ORDER_DEPENDENCY diff --git a/cdist/type/__manjaro_desktop/gencode-remote b/cdist/type/__manjaro_desktop/singleton similarity index 100% rename from cdist/type/__manjaro_desktop/gencode-remote rename to cdist/type/__manjaro_desktop/singleton diff --git a/readme.md b/readme.md index 8340f31..8d2cd90 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,27 @@ # schrofi's system configuration -My personal system configuration using NixOS and chezmoi, specifically tailored towards me and nobody else ¯\_(ツ)_/¯ +My personal system configuration using cdist on a Manjaro system, specifically tailored towards me and nobody else ¯\_(ツ)_/¯ You can use it for inspiration though. ## Getting Started +1. Install cdist +``` +git clone https://code.ungleich.ch/ungleich-public/cdist.git +cd cdist +export PATH=$PATH:$(pwd -P)/bin +./bin/cdist-build-helper version +make install +sudo python setup.py install +``` + +2. Setup SSH root access +//TODO + +3. CD into wanted configuration directory and apply configuration to localhost +``` +cdist config -v -i manifest localhost +``` + +## Getting Started - DEPRECATED NIXOS 1. Clone the repository into your /etc/nixos directory (delete/rename the existing configuration.nix). 2. Add the unstable NixOS channel ```