Add noveriablcgen, add shell, add salt, add localization

This commit is contained in:
LinuxSquare 2023-09-29 16:38:32 +02:00
parent 8b2f421084
commit e8e6ff3596
14 changed files with 281 additions and 2 deletions

6
map.jinja Normal file
View file

@ -0,0 +1,6 @@
{% set noveria = {
'bin_dir': '/usr/local/noveria/bin',
'app_dir': '/usr/local/noveria/apps',
'commonrc_dir': '/etc/commonrc.d',
'zsh_dir': '/etc/zsh.d'
} %}

View file

@ -5,4 +5,22 @@ system_base_pkgs:
- linux-firmware-none - linux-firmware-none
- openjdk17-jre-headless - openjdk17-jre-headless
- jq - jq
- zsh - vim
system_base_bin_dir:
file.directory:
- name: /usr/local/noveria/bin
- makedirs: true
- user: root
- group: root
- dir_mode: '0755'
- file_mode: '0644'
system_base_apps_dir:
file.directory:
- name: /usr/local/noveria/apps
- makedirs: true
- user: root
- group: root
- dir_mode: '0755'
- file_mode: '0644'

7
system/files/salt_minion Normal file
View file

@ -0,0 +1,7 @@
---
file_client: local
file_roots:
base:
- /srv/salt
state_verbose: false
...

View file

@ -0,0 +1,21 @@
# This is the global common rc file sourced by all shells. This is not
# something the shells do natively, we just source this file in the appropriate
# places (/etc/bash.bashrc for bash, /etc/.zshrc for zsh). This file is intended
# for basic stuff that works in all shells, like env vars and aliases.
#
# Notes:
# - The code must be able to run in all shells, so keep it simple
# - Keep in mind that what's put in here affects all users on the system
# add custom bin to PATH variable
export PATH="${PATH}:{{ CUSTOM_BIN }}"
# source files from {{ COMMONRC_DIR }}
# use ls in a subshell because zsh will warn about an emtpy glob result by
# default. there's a glob flag to avoid that, but that would be zfs specific.
if [ -d {{ COMMONRC_DIR }} ]; then
for i in $(ls {{ COMMONRC_DIR }}/); do
[ -r "{{ COMMONRC_DIR }}/$i" ] && . "{{ COMMONRC_DIR }}/$i"
done
unset i
fi

View file

@ -0,0 +1,13 @@
# zsh keys configuration
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
bindkey "^[[2~" overwrite-mode
bindkey "^[[3~" delete-char
bindkey "^[[A" up-line-or-history
bindkey "^[[B" down-line-or-history
bindkey "^[[D" backward-char
bindkey "^[[C" forward-char
bindkey "^[[1;5D" backward-word
bindkey "^[[1;5C" forward-word
bindkey "^[[5~" beginning-of-buffer-or-history
bindkey "^[[6~" end-of-buffer-or-history

View file

@ -0,0 +1,14 @@
#!/usr/bin/env zsh
# XDG
export XDG_CONFIG_HOME=$HOME/.config
export XDG_DATA_HOME=$XDG_CONFIG_HOME/local/share
export XDG_CACHE_HOME=$XDG_CONFIG_HOME/cache
# editor
export EDITOR="vim"
# zsh
export HISTFILE="$HOME/.zhistory" # History filepath
export HISTSIZE=10000 # Maximum events for internal history
export SAVEHIST=10000 # Maximum events in history file

View file

@ -0,0 +1,6 @@
# load commonrc which is shared by all shell types
[ -f /etc/commonrc ] && . /etc/commonrc
[ -f /etc/.zshenv ] && . /etc/.zshenv
[ -f {{ ZSH_DIR }}/00-keybinds ] && . {{ ZSH_DIR }}/00-keybinds
export LANG=en_US.UTF-8

View file

@ -5,3 +5,6 @@ include:
- .firewall - .firewall
- .network - .network
- .user - .user
- .shell
- .salt
- .localization

35
system/localization.sls Normal file
View file

@ -0,0 +1,35 @@
# Localization
# keyboard layout
system_localization_keyboard_layout:
keyboard.system:
- name: de_CH-latin1
system_localization_vconsole_conf:
file.managed:
- name: /etc/vconsole.conf
- user: root
- group: root
- mode: '0644'
- contents: KEYMAP=de_CH-latin1
# Locale
system_localization_locale_en_us_utf:
locale.present:
- name: en_US.UTF-8 UTF-8
system_localization_locale_en_us_iso:
locale.present:
- name: en_US ISO-8859-1
system_localization_locale_de_ch_utf:
locale.present:
- name: de_CH.UTF-8 UTF-8
system_localization_locale_default:
file.managed:
- name: /etc/locale.conf
- user: root
- group: root
- mode: '0644'
- contents: 'LANG=en_US.UTF-8'

39
system/salt.sls Normal file
View file

@ -0,0 +1,39 @@
include:
- system.base
system_salt_pkg:
pkg.installed:
- pkgs:
- salt-minion
- require:
- system_base_pkgs
system_salt_minion_config:
file.managed:
- name: /etc/salt/minion
- source: salt://{{ tpldir }}/files/salt_minion
- user: root
- group: root
- mode: '0644'
system_salt_minon_service:
service.disabled:
- name: salt-minion
- require:
- system_salt_pkg
system_salt_minion_cachedir_permission:
file.directory:
- name: /var/cache/salt/minion
- mode: '0700'
- require:
- system_salt_pkg
system_salt_minion_logdir_permission:
file.directory:
- name: /var/log/salt
- user: root
- group: root
- mode: '0700'
- require:
- system_salt_pkg

73
system/shell.sls Normal file
View file

@ -0,0 +1,73 @@
include:
- system.base
{% from "map.jinja" import noveria %}
system_shell_pkgs:
pkg.installed:
- pkgs:
- zsh
- bash
- require:
- system_base_pkgs
system_shell_commonrc:
file.managed:
- name: /etc/commonrc
- source: salt://{{ tpldir }}/files/shell_commonrc.jinja
- template: jinja
- context:
CUSTOM_BIN: {{ noveria.bin_dir }}
COMMONRC_DIR: {{ noveria.commonrc_dir }}
- user: root
- group: root
- mode: '0644'
- require:
- system_shell_pkgs
system_shell_zsh_include_commonrc:
file.managed:
- name: /etc/.zshrc
- source: salt://{{ tpldir }}/files/shell_zshrc.jinja
- template: jinja
- context:
ZSH_DIR: {{ noveria.zsh_dir }}
- user: root
- group: root
- mode: '0644'
- makedirs: false
- require:
- system_shell_commonrc
system_shell_zsh_zshenv:
file.managed:
- name: /etc/.zshenv
- source: salt://{{ tpldir }}/files/shell_zshenv.jinja
- template: jinja
- user: root
- group: root
- mode: '0644'
- makedirs: false
- require:
- system_shell_commonrc
system_shell_zshd_directory:
file.directory:
- name: {{ noveria.zsh_dir }}
- user: root
- group: root
- dir_mode: '0755'
- file_mode: '0644'
- makedirs: true
- require:
- system_shell_packages
system_shell_zsh_keybinds:
file.managed:
- name: {{ noveria.zsh_dir }}/00-keybinds
- source: salt://{{ tpldir }}/files/shell_keybinds
- user: root
- group: root
- mode: '0644'
- require:
- system_shell_zshd_directory

View file

@ -1 +0,0 @@
#!/bin/sh

View file

@ -0,0 +1,6 @@
{
"be_env_dir": "{{ BTRFS_ROOT }}",
"grub_conf_dir": "{{ GRUB_CONFD }}",
"filename": "{{ GRUB_CONFIG_FILENAME }}",
"root_uuid": "{{ ROOT_UUID }}"
}

View file

@ -0,0 +1,39 @@
include:
- system.base
{% from "map.jinja" import noveria %}
util_noveriablcgen_git:
git.latest:
- name: https://gitlab.com/noveria/tools/noveriablcgen.git
- target: {{ noveria.app_dir }}
- user: root
- require:
- system_base_apps_dir
util_noveriablcgen_link:
file.symlink:
- name: {{ noveria.bin_dir }}
- target: {{ noveria.app_dir }}/noveriablcgen/noveriablcgen
- user: root
- group: root
- mode: '0755'
- require:
- system_base_bin_dir
- util_noveriablcgen_git
util_noveriablcgen_config:
file.managed:
- name: {{ noveria.apps_dir }}/noveriablcgen/noveriablcgen.json
- target: salt://{{ tpldir }}/files/noveriablcgen_config.json.jinja
- template: jinja
- context:
BTRFS_ROOT: "/btrfs"
GRUB_CONFD: "/etc/grub.d"
GRUB_CONFIG_FILENAME: "10-noveria.conf"
ROOT_UUID: {{ salt['cmd.shell']('lsblk -o LABEL,UUID | grep ROOT | awk \'{print $2}\'') }}
- mode: '0644'
- user: root
- group: root
- require:
- util_noveriablcgen_git