Compare commits
20 commits
b1f9e3dce1
...
b4d7b076da
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | b4d7b076da | ||
Manuel Thalmann | 20855c8230 | ||
Manuel Thalmann | 5d13bf6940 | ||
Manuel Thalmann | c541eb409b | ||
Manuel Thalmann | 45fc0ca071 | ||
Manuel Thalmann | 413a395eee | ||
Manuel Thalmann | 3f5ff5a8cc | ||
Manuel Thalmann | 41cb3ed457 | ||
Manuel Thalmann | 82b6e3a830 | ||
Manuel Thalmann | ddf89cd050 | ||
Manuel Thalmann | a69be48469 | ||
Manuel Thalmann | 7a133b68c7 | ||
Manuel Thalmann | 63d1330e56 | ||
Manuel Thalmann | 554fa9c423 | ||
Manuel Thalmann | 708daa9635 | ||
Manuel Thalmann | e5f4da98e8 | ||
Manuel Thalmann | 61b923505f | ||
Manuel Thalmann | 2246f5d0db | ||
Manuel Thalmann | 79992bbcb8 | ||
Manuel Thalmann | 69bbdc96e2 |
|
@ -23,7 +23,7 @@ automated_script() {
|
|||
sleep 1
|
||||
done
|
||||
printf '%s: downloading %s\n' "$0" "${script}"
|
||||
curl "${script}" --location --retry-connrefused --retry 10 -s -o /tmp/startup_script
|
||||
curl "${script}" --location --retry-connrefused --retry 10 --fail -s -o /tmp/startup_script
|
||||
rt=$?
|
||||
else
|
||||
cp "${script}" /tmp/startup_script
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
diff --git a/airootfs/root/.zlogin b/airootfs/root/.zlogin
|
||||
index bf6bc8f..76e5893 100755
|
||||
index bf6bc8f..a0dae7b 100755
|
||||
--- a/airootfs/root/.zlogin
|
||||
+++ b/airootfs/root/.zlogin
|
||||
@@ -4,3 +4,18 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then
|
||||
@@ -4,3 +4,19 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then
|
||||
fi
|
||||
|
||||
~/.automated_script.sh
|
||||
|
@ -16,13 +16,14 @@ index bf6bc8f..76e5893 100755
|
|||
+
|
||||
+git diff -p -R --no-ext-diff --no-color --diff-filter=M \
|
||||
+ | grep -E "^(diff|(old|new) mode)" --color=never \
|
||||
+ | sed "/^diff/{ x; d; }; x; /./{ p; z; }; x;" \
|
||||
+ | git apply
|
||||
+
|
||||
+popd > /dev/null
|
||||
+
|
||||
+loadkeys de_CH-latin1
|
||||
diff --git a/packages.x86_64 b/packages.x86_64
|
||||
index 9e876e7..b89ab30 100755
|
||||
index 9e876e7..c5db92a 100755
|
||||
--- a/packages.x86_64
|
||||
+++ b/packages.x86_64
|
||||
@@ -30,8 +30,10 @@ ethtool
|
||||
|
@ -36,7 +37,15 @@ index 9e876e7..b89ab30 100755
|
|||
gnu-netcat
|
||||
gpart
|
||||
gpm
|
||||
@@ -75,6 +77,7 @@ nbd
|
||||
@@ -45,6 +47,7 @@ irssi
|
||||
iw
|
||||
iwd
|
||||
jfsutils
|
||||
+jq
|
||||
kitty-terminfo
|
||||
ldns
|
||||
less
|
||||
@@ -75,6 +78,7 @@ nbd
|
||||
ndisc6
|
||||
nfs-utils
|
||||
nilfs-utils
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
{ lib, ... }: {
|
||||
options = {
|
||||
valhalla = {
|
||||
git = (import ./git/options.nix) { inherit lib; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
in {
|
||||
defaultBranch = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The name of the default branch in git.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
flow = {
|
||||
mainBranch = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The name of the stable branch in git flow.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
devBranch = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The name of the development branch in git flow.";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
aliases = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
description = "Git command aliases to install.";
|
||||
default = {};
|
||||
};
|
||||
}
|
38
lib/modules/os.nix
Normal file
38
lib/modules/os.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
in {
|
||||
options = {
|
||||
valhalla = mkOption {
|
||||
type = types.submodule (
|
||||
{ extendModules, ... }:
|
||||
let
|
||||
osVariant = extendModules { };
|
||||
linuxVariant = osVariant.extendModules { };
|
||||
windowsVariant = osVariant.extendModules { };
|
||||
in {
|
||||
options = {
|
||||
linux = mkOption {
|
||||
inherit (linuxVariant) type;
|
||||
description = "The options for setting up Linux.";
|
||||
default = {};
|
||||
visible = "shallow";
|
||||
};
|
||||
|
||||
windows = mkOption {
|
||||
inherit (windowsVariant) type;
|
||||
description = "The options for setting up Windows.";
|
||||
default = {};
|
||||
visible = "shallow";
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
description = "Configuration for PortValhalla.";
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
}
|
59
lib/modules/packages/git.nix
Normal file
59
lib/modules/packages/git.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
gitType = types.submodule (
|
||||
{ ... }: {
|
||||
options = {
|
||||
defaultBranch = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The name of the default branch in newly created repositories.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
flow = {
|
||||
mainBranch = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The name of the stable branch in git flow.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
devBranch = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The name of the development branch in git flow.";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
|
||||
aliases = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
description = "The git command aliases to install.";
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
gitOption = mkOption {
|
||||
type = gitType;
|
||||
description = "The git related options.";
|
||||
default = {};
|
||||
};
|
||||
in {
|
||||
options = {
|
||||
valhalla = {
|
||||
git = gitOption;
|
||||
|
||||
users = mkOption {
|
||||
type = types.attrsOf (types.submodule (
|
||||
{ ... }: {
|
||||
options = {
|
||||
git = gitOption;
|
||||
};
|
||||
}));
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
60
lib/modules/packages/oh-my-posh.nix
Normal file
60
lib/modules/packages/oh-my-posh.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
themeType = types.submodule (
|
||||
{ config, ... }: {
|
||||
options = {
|
||||
source = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
description = "The path to the oh-my-posh theme to use.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The name of the theme.";
|
||||
default = if (config.source != null)
|
||||
then
|
||||
lib.strings.removeSuffix ".omp" (lib.strings.removeSuffix ".json" (builtins.baseNameOf config.source))
|
||||
else
|
||||
null;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
ompType = types.submodule (
|
||||
{ config, ... }: {
|
||||
options = {
|
||||
theme = mkOption {
|
||||
type = types.either types.str themeType;
|
||||
description = "The default theme.";
|
||||
default = {};
|
||||
};
|
||||
|
||||
additionalThemes = mkOption {
|
||||
type = types.listOf themeType;
|
||||
description = "A set of additional themes to install.";
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
});
|
||||
in {
|
||||
options = {
|
||||
valhalla.users = mkOption {
|
||||
type = types.attrsOf (types.submodule (
|
||||
{ ... }: {
|
||||
options = {
|
||||
oh-my-posh = mkOption {
|
||||
type = ompType;
|
||||
description = "The Oh My Posh configuration to apply.";
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
};
|
||||
}
|
40
lib/modules/packages/rclone.nix
Normal file
40
lib/modules/packages/rclone.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib)
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
syncType = types.submodule (
|
||||
{ ... }: {
|
||||
options = {
|
||||
dirName = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the directory to sync the remote files to.";
|
||||
};
|
||||
|
||||
cacheDuration = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The amount of time to keep cached files.";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
});
|
||||
in {
|
||||
options = {
|
||||
valhalla.linux.users = mkOption {
|
||||
type = types.attrsOf (types.submodule (
|
||||
{ ... }: {
|
||||
options = {
|
||||
rclone = {
|
||||
configurations = mkOption {
|
||||
type = types.attrsOf syncType;
|
||||
description = "The configurations of the rclone mounts.";
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
};
|
||||
}
|
|
@ -8,77 +8,50 @@
|
|||
cfg = config.valhalla;
|
||||
capitalize = (import ../text.nix { inherit lib; }).capitalize;
|
||||
|
||||
linuxOptions = {
|
||||
defaultShell = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The default shell of the user.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
rclone = {
|
||||
configurations = mkOption {
|
||||
type = types.attrsOf syncType;
|
||||
description = "The configurations of the rclone mounts.";
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
syncType = types.submodule (
|
||||
{ ... }: {
|
||||
userType = types.submodule (
|
||||
{ ... } : {
|
||||
options = {
|
||||
dirName = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the directory to sync the remote files to.";
|
||||
displayName = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The human-readable name of the user.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
cacheDuration = mkOption {
|
||||
mailAddress = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The amount of time to keep cached files.";
|
||||
description = "The mail address of the user.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
groups = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "The additional groups of the user.";
|
||||
default = [];
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
linuxUserType = types.submodule (
|
||||
{ ... }: {
|
||||
options = {
|
||||
defaultShell = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The default shell of the user.";
|
||||
default = null;
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
mkUserType = { options }: (
|
||||
types.submodule (
|
||||
{ ... }: {
|
||||
options = {
|
||||
displayName = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The human-readable name of the user.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
mailAddress = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
description = "The mail address of the user.";
|
||||
default = null;
|
||||
};
|
||||
|
||||
groups = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "The additional groups of the user.";
|
||||
default = [];
|
||||
};
|
||||
|
||||
git = (import ./git/options.nix) { inherit lib; };
|
||||
} // options;
|
||||
}));
|
||||
|
||||
userType = mkUserType {
|
||||
options = linuxOptions;
|
||||
};
|
||||
|
||||
winUserType = mkUserType {
|
||||
options = {
|
||||
microsoftAccount = mkOption {
|
||||
type = types.bool;
|
||||
description = "A value indicating whether this user is a Microsoft Account.";
|
||||
default = false;
|
||||
winUserType = types.submodule (
|
||||
{ ... }: {
|
||||
options = {
|
||||
microsoftAccount = mkOption {
|
||||
type = types.bool;
|
||||
description = "A value indicating whether this user is a Microsoft Account.";
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
in {
|
||||
options = {
|
||||
valhalla = {
|
||||
|
@ -88,24 +61,20 @@
|
|||
default = {};
|
||||
};
|
||||
|
||||
linux.users = mkOption {
|
||||
type = types.attrsOf linuxUserType;
|
||||
};
|
||||
|
||||
windows.users = mkOption {
|
||||
type = types.attrsOf winUserType;
|
||||
description = "The users to create on the Windows machine.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
valhalla.windows.users = (lib.attrsets.concatMapAttrs (
|
||||
valhalla.windows.users = lib.mkForce (lib.attrsets.concatMapAttrs (
|
||||
name: options: {
|
||||
${capitalize name} = (lib.attrsets.concatMapAttrs (
|
||||
name: value:
|
||||
if builtins.elem name (builtins.attrNames linuxOptions)
|
||||
then {}
|
||||
else {
|
||||
${name} = value;
|
||||
}
|
||||
) options) // {
|
||||
${capitalize name} = options // {
|
||||
groups = [];
|
||||
};
|
||||
}) cfg.users);
|
||||
|
|
|
@ -6,9 +6,12 @@
|
|||
;
|
||||
in {
|
||||
imports = [
|
||||
./git.nix
|
||||
./packages/git.nix
|
||||
./packages/oh-my-posh.nix
|
||||
./packages/rclone.nix
|
||||
./hardware.nix
|
||||
./i18n.nix
|
||||
./os.nix
|
||||
./partition.nix
|
||||
./software.nix
|
||||
./users.nix
|
||||
|
|
|
@ -7,18 +7,11 @@
|
|||
types
|
||||
;
|
||||
|
||||
setupUser = config.valhalla.setupUser.name;
|
||||
capitalize = (import ../text.nix { inherit lib; }).capitalize;
|
||||
|
||||
winType = types.submodule (
|
||||
{ config, ... }: {
|
||||
options = {
|
||||
setupUser = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the user for setting up Windows.";
|
||||
default = capitalize setupUser;
|
||||
};
|
||||
|
||||
in {
|
||||
options = {
|
||||
valhalla = {
|
||||
windows = {
|
||||
dualboot = {
|
||||
enable = mkEnableOption "dual boot";
|
||||
|
||||
|
@ -41,19 +34,13 @@
|
|||
dynamicLighting = mkEnableOption "dynamic lighting";
|
||||
adware = mkEnableOption "adware"; # Fuck you for displaying ads on an OS I fricking paid for!
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
dualboot.linuxPercentage = mkIf (!config.dualboot.enable) 0;
|
||||
};
|
||||
});
|
||||
in {
|
||||
options = {
|
||||
valhalla = {
|
||||
windows = mkOption {
|
||||
type = winType;
|
||||
description = "The options for setting up Windows.";
|
||||
default = {};
|
||||
};
|
||||
config = {
|
||||
valhalla.windows = {
|
||||
setupUser.name = capitalize config.valhalla.setupUser.name;
|
||||
dualboot.linuxPercentage = mkIf (!config.valhalla.windows.dualboot.enable) 0;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
fs = import ../../lib/modules/partition/fs.nix;
|
||||
in {
|
||||
imports = [
|
||||
../manuel/config.nix
|
||||
../../lib/modules/valhalla.nix
|
||||
];
|
||||
|
||||
|
@ -44,7 +45,10 @@
|
|||
"wheel"
|
||||
"nix-users"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
linux.users.manuel = {
|
||||
defaultShell = "fish";
|
||||
|
||||
rclone = {
|
||||
|
@ -57,7 +61,6 @@
|
|||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
timeZone = "Europe/Zurich";
|
||||
|
|
9
profiles/manuel/config.nix
Normal file
9
profiles/manuel/config.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ ... }: {
|
||||
valhalla.users.manuel = {
|
||||
oh-my-posh = {
|
||||
theme = {
|
||||
source = ./manuel.omp.json;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
173
profiles/manuel/manuel.omp.json
Normal file
173
profiles/manuel/manuel.omp.json
Normal file
|
@ -0,0 +1,173 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
|
||||
"version": 2,
|
||||
"blocks": [
|
||||
{
|
||||
"type": "prompt",
|
||||
"alignment": "left",
|
||||
"segments": [
|
||||
{
|
||||
"type": "os",
|
||||
"style": "diamond",
|
||||
"leading_diamond": "\ue0b6",
|
||||
"trailing_diamond": "\ue0b4",
|
||||
"background_templates": [
|
||||
"{{ if eq .OS \"ubuntu\" }}#EA531A{{ end }}",
|
||||
"{{ if eq .OS \"debian\" }}#D80150{{ end }}",
|
||||
"{{ if eq .OS \"arch\" }}#1793D1{{ end }}"
|
||||
],
|
||||
"foreground": "p:white",
|
||||
"template": "{{ if ne .OS \"windows\" }}{{ .Icon }} {{ end }}"
|
||||
},
|
||||
{
|
||||
"type": "session",
|
||||
"style": "diamond",
|
||||
"leading_diamond": "\ue0b6",
|
||||
"trailing_diamond": "\ue0b0",
|
||||
"background": "p:yellow",
|
||||
"foreground": "p:black",
|
||||
"properties": {
|
||||
"display_host": false
|
||||
},
|
||||
"template": " {{ if .SSHSession }}\uf817 {{ end }}{{ .UserName }} "
|
||||
},
|
||||
{
|
||||
"type": "path",
|
||||
"style": "powerline",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"background": "p:orange",
|
||||
"foreground": "p:black",
|
||||
"properties": {
|
||||
"home_icon": "~",
|
||||
"style": "folder"
|
||||
},
|
||||
"template": " \udb80\ude4b {{ path .Path .Location }} "
|
||||
},
|
||||
{
|
||||
"type": "dotnet",
|
||||
"style": "powerline",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"foreground": "p:black",
|
||||
"background": "#00ffff",
|
||||
"template": " \udb81\ude10 {{ .Full }} "
|
||||
},
|
||||
{
|
||||
"type": "java",
|
||||
"style": "powerline",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"background": "#4063d8",
|
||||
"template": " \udb82\udf37 {{ .Full }} "
|
||||
},
|
||||
{
|
||||
"type": "python",
|
||||
"style": "powerline",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"background": "#906cff",
|
||||
"template": " \udb80\udf20 {{ .Full }} "
|
||||
},
|
||||
{
|
||||
"type": "git",
|
||||
"style": "powerline",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"trailing_diamond": "\ue0b4",
|
||||
"background": "p:green",
|
||||
"background_templates": [
|
||||
"{{ if or (.Working.Changed) (.Staging.Changed) }}p:yellow{{ end }}",
|
||||
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:red{{ end }}",
|
||||
"{{ if gt .Ahead 0 }}#49416D{{ end }}",
|
||||
"{{ if gt .Behind 0 }}#7A306C{{ end }}"
|
||||
],
|
||||
"foreground": "p:black",
|
||||
"foreground_templates": [
|
||||
"{{ if or (.Working.Changed) (.Staging.Changed) }}p:black{{ end }}",
|
||||
"{{ if and (gt .Ahead 0) (gt .Behind 0) }}p:white{{ end }}",
|
||||
"{{ if gt .Ahead 0 }}p:white{{ end }}"
|
||||
],
|
||||
"properties": {
|
||||
"branch_max_length": 25,
|
||||
"fetch_stash_count": true,
|
||||
"fetch_status": true,
|
||||
"fetch_upstream_icon": true,
|
||||
"upstream_icons": {
|
||||
"codeberg.org": "\uf330 ",
|
||||
"git.nuth.ch": "\uf335",
|
||||
"git.jonascosta.ch": "\uf339 ",
|
||||
"git.romhackersworld.eu": "\uf339 ",
|
||||
"aur.archlinux.org": "\uf303 "
|
||||
}
|
||||
},
|
||||
"templates": [
|
||||
"{{ if .UpstreamURL }} {{ url .UpstreamIcon .UpstreamURL }}{{ end }}",
|
||||
" {{ .HEAD }} ",
|
||||
"{{ if .BranchStatus }}{{ .BranchStatus }} {{ end }}",
|
||||
"{{ if .Working.Changed }} \uf044 {{ .Working.String }} {{ end }}",
|
||||
"{{ if and (.Working.Changed) (or (.Staging.Changed) (gt .StashCount 0)) }} | {{ end }}",
|
||||
"{{ if .Staging.Changed }} \uf046 {{ .Staging.String }} {{ end }}",
|
||||
"{{ if and (.Staging.Changed) (gt .StashCount 0) }} | {{ end }}",
|
||||
"{{ if gt .StashCount 0 }} \udb80\udd93 {{ .StashCount }}{{ end }} "
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"style": "powerline",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"background": "#6ca35e",
|
||||
"foreground": "p:white",
|
||||
"properties": {
|
||||
"fetch_version": true
|
||||
},
|
||||
"template": " \udb80\udf99 {{ if .PackageManagerIcon }}{{ .PackageManagerIcon }} {{ end }}{{ .Full }} "
|
||||
},
|
||||
{
|
||||
"type": "root",
|
||||
"style": "powerline",
|
||||
"powerline_symbol": "\ue0b0",
|
||||
"background": "p:yellow",
|
||||
"foreground": "p:white",
|
||||
"properties": {
|
||||
"root_icon": "\uf0e7"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "executiontime",
|
||||
"style": "plain",
|
||||
"background": "#83769c",
|
||||
"foreground": "p:white",
|
||||
"properties": {
|
||||
"always_enabled": true
|
||||
},
|
||||
"template": "<transparent>\ue0b0</> \udb81\udead {{ .FormattedMs }}\u2800"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"style": "diamond",
|
||||
"background": "p:blue",
|
||||
"trailing_diamond": "\ue0b4",
|
||||
"background_templates": [
|
||||
"{{ if gt .Code 0 }}p:red{{ end }}"
|
||||
],
|
||||
"foreground": "p:white",
|
||||
"properties": {
|
||||
"always_enabled": true
|
||||
},
|
||||
"template": "<parentBackground>\ue0b0</> {{ if gt .Code 0 }}\uf00d{{ else }}\uf00c{{ end }} "
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"transient_prompt": {
|
||||
"background": "transparent",
|
||||
"foreground": "p:black",
|
||||
"template": "<p:yellow,transparent>\ue0b6</><,p:yellow> {{ .Folder }} </><p:yellow,transparent>\ue0b0</> "
|
||||
},
|
||||
"final_space": true,
|
||||
"palette": {
|
||||
"black": "#262B44",
|
||||
"blue": "#4B95E9",
|
||||
"green": "#59C9A5",
|
||||
"orange": "#F07623",
|
||||
"red": "#D81E5B",
|
||||
"white": "#E0DEF4",
|
||||
"yellow": "#F3AE35"
|
||||
}
|
||||
}
|
|
@ -161,7 +161,7 @@ $null = New-Module {
|
|||
Gets the name of the config root.
|
||||
#>
|
||||
function Get-ConfigRootName {
|
||||
return "valhalla$($IsWindows ? ".windows" : '')";
|
||||
return "valhalla.$($IsWindows ? "windows" : "linux")";
|
||||
}
|
||||
|
||||
<#
|
||||
|
@ -408,7 +408,7 @@ $null = New-Module {
|
|||
[string] $Name
|
||||
)
|
||||
|
||||
Get-Config "valhalla.software.$Name";
|
||||
Get-Config "$(Get-ConfigRootName).software.$Name";
|
||||
}
|
||||
|
||||
<#
|
||||
|
|
|
@ -51,6 +51,7 @@ function Write-PSScript {
|
|||
|
||||
Import-Module PSScriptAnalyzer;
|
||||
$dirName = Split-Path -Parent $FileName;
|
||||
$Script = ($Script -split "\r?\n") -join [System.Environment]::NewLine;
|
||||
$content = Invoke-Formatter -ScriptDefinition $Script;
|
||||
$exists = Test-Path -PathType Leaf $FileName;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ param (
|
|||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../aliae/Manage.ps1";
|
||||
. "$PSScriptRoot/../PowerShell/Profile.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../Types/InstallerAction.ps1";
|
||||
|
@ -18,4 +19,30 @@ Start-SoftwareInstaller @PSBoundParameters `
|
|||
(Get-ScriptInitializer "oh-my-posh init pwsh"),
|
||||
(Get-ScriptInitializer "oh-my-posh completion powershell")
|
||||
) -join [System.Environment]::NewLine)
|
||||
} `
|
||||
-UserConfigurator {
|
||||
param(
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
$theme = Get-UserConfig "oh-my-posh.theme";
|
||||
|
||||
if ($theme) {
|
||||
$varName = "POSH_THEME";
|
||||
|
||||
if ($theme -isnot [string]) {
|
||||
$root = "$($IsWindows ? $env:AppData : "~/.config")/oh-my-posh";
|
||||
$path = Join-Path $root "$($theme.name).omp.json";
|
||||
$null = New-Item -Force -ItemType Directory $root;
|
||||
Copy-Item $theme.source $path;
|
||||
$theme = [string] $path;
|
||||
}
|
||||
|
||||
if ($IsWindows) {
|
||||
[System.Environment]::SetEnvironmentVariable($varName, $path, "User");
|
||||
} else {
|
||||
. "$PSScriptRoot/../aliae/Manage.ps1";
|
||||
Add-EnvironmentVariable -User $Arguments.Name $varName $path;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
15
scripts/Common/Software/aliae/Constants.ps1
Normal file
15
scripts/Common/Software/aliae/Constants.ps1
Normal file
|
@ -0,0 +1,15 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Gets a powershell expression which points to the global `aliae` configuration.
|
||||
#>
|
||||
function Get-GlobalConfigExpression {
|
||||
return "`"$($IsWindows ? "`$env:ProgramData" : "/etc")/aliae/aliae.yml`"";
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets the path to the global `aliae` configuration.
|
||||
#>
|
||||
function Get-GlobalConfigPath {
|
||||
return & ([scriptblock]::Create((Get-GlobalConfigExpression)));
|
||||
}
|
50
scripts/Common/Software/aliae/Main.ps1
Normal file
50
scripts/Common/Software/aliae/Main.ps1
Normal file
|
@ -0,0 +1,50 @@
|
|||
param(
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/Constants.ps1";
|
||||
. "$PSScriptRoot/../PowerShell/Profile.ps1";
|
||||
. "$PSScriptRoot/../../Scripts/Software.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Configurator {
|
||||
. "$PSScriptRoot/Constants.ps1";
|
||||
$pathExpression = Get-GlobalConfigExpression;
|
||||
$path = Get-GlobalConfigPath;
|
||||
$null = New-Item -Force -ItemType Directory (Split-Path -Parent $path);
|
||||
Copy-Item -Force "$PSScriptRoot/aliae.yml" $path;
|
||||
|
||||
Add-PowerShellProfileStatement `
|
||||
-System `
|
||||
-Category "aliae" `
|
||||
-Script (
|
||||
@(
|
||||
{
|
||||
#aliae
|
||||
},
|
||||
"`$globalPath = $pathExpression",
|
||||
{
|
||||
$userPath = & {
|
||||
if ($env:ALIAE_CONFIG) {
|
||||
$env:ALIAE_CONFIG;
|
||||
} else {
|
||||
"~/aliae.yaml";
|
||||
}
|
||||
};
|
||||
|
||||
if (Test-Path $globalPath) {
|
||||
& ([scriptblock]::Create((aliae init pwsh --config $globalPath)));
|
||||
}
|
||||
|
||||
if (Test-Path $userPath) {
|
||||
& ([scriptblock]::Create((aliae init pwsh)));
|
||||
}
|
||||
|
||||
& ([scriptblock]::Create((aliae completion powershell)));
|
||||
}
|
||||
) -join [System.Environment]::NewLine)
|
||||
} `
|
||||
-UserConfigurator {
|
||||
Copy-Item -Force "$PSScriptRoot/aliae.yml" ~/.aliae.yml;
|
||||
};
|
98
scripts/Common/Software/aliae/Manage.ps1
Normal file
98
scripts/Common/Software/aliae/Manage.ps1
Normal file
|
@ -0,0 +1,98 @@
|
|||
$null = New-Module {
|
||||
. "$PSScriptRoot/Constants.ps1";
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Adds an alias to an existing `aliae` configuration.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the alias to add.
|
||||
|
||||
.PARAMETER Value
|
||||
The script the alias should point to.
|
||||
|
||||
.PARAMETER User
|
||||
The user to add the alias to.
|
||||
#>
|
||||
function Add-Alias {
|
||||
param(
|
||||
[string] $Name,
|
||||
[string] $Value,
|
||||
[string] $User
|
||||
)
|
||||
|
||||
Edit-Config `
|
||||
-Variables @{
|
||||
Name = "$Name";
|
||||
Value = "$Value";
|
||||
} `
|
||||
".alias |= . + [{ name: env.Name, value: env.Value }]" `
|
||||
-User $User;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Adds an environment variable to an existing `aliae` configuration.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the variable to add.
|
||||
|
||||
.PARAMETER Value
|
||||
The value of the variable.
|
||||
#>
|
||||
function Add-EnvironmentVariable {
|
||||
param(
|
||||
[string] $Name,
|
||||
[string] $Value,
|
||||
[string] $User
|
||||
)
|
||||
|
||||
Edit-Config `
|
||||
-Variables @{
|
||||
Name = "$Name";
|
||||
Value = "$Value";
|
||||
} `
|
||||
".env |= . + [{ name: env.Name, value: env.Value }]" `
|
||||
-User $User;
|
||||
}
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Edits the underlying `aliae` configuration.
|
||||
|
||||
.PARAMETER Script
|
||||
The yq script to run over the configuration.
|
||||
|
||||
.PARAMETER User
|
||||
The user to edit the configuration for.
|
||||
#>
|
||||
function Edit-Config {
|
||||
param(
|
||||
[string] $Script,
|
||||
[hashtable] $Variables,
|
||||
[string] $User
|
||||
)
|
||||
|
||||
if ($User) {
|
||||
$path = "$($IsWindows ? "~" : "$(sudo -u $User bash -c "realpath ~")")/.aliae.yaml";
|
||||
} else {
|
||||
$path = Get-GlobalConfigPath;
|
||||
}
|
||||
|
||||
Start-Job {
|
||||
$file = New-TemporaryFile;
|
||||
$variables = $using:Variables;
|
||||
|
||||
foreach ($key in $variables.Keys) {
|
||||
Set-Item "Env:\$key" $variables[$key];
|
||||
}
|
||||
|
||||
sudo -u $using:User cp $using:path $file;
|
||||
yq -yi $using:Script $file;
|
||||
sudo -u $using:User cp $file $using:path;
|
||||
Remove-Item $file;
|
||||
} | Receive-Job -Wait;
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function Add-Alias,Add-EnvironmentVariable;
|
||||
};
|
|
@ -1,22 +1,4 @@
|
|||
alias:
|
||||
- name: totsch
|
||||
value: git
|
||||
env:
|
||||
- name: POSH_THEME
|
||||
value: '{{ if eq .OS "windows" }}{{ .Home }}/Nextcloud/.omp{{ else }}/usr/local/share/oh-my-posh/themes{{ end }}/manuel.omp.json'
|
||||
alias: []
|
||||
env: []
|
||||
path: []
|
||||
script:
|
||||
- value: |
|
||||
# Profile Files
|
||||
$profileRoot = Split-Path -Parent $PROFILE;
|
||||
$profilePaths = @(
|
||||
"$profileRoot/conf.d/*.ps1",
|
||||
"{{ if eq .OS "windows" }}$env:ProgramData{{ else }}/etc{{ end }}/powershell/conf.d/*.ps1"
|
||||
);
|
||||
|
||||
foreach ($profilePath in $profilePaths) {
|
||||
if (Test-Path $profilePath) {
|
||||
Get-Item $profilePath | ForEach-Object { . $_; };
|
||||
}
|
||||
}
|
||||
if: match .Shell "pwsh"
|
||||
script: []
|
||||
|
|
|
@ -317,6 +317,7 @@ $null = New-Module {
|
|||
|
||||
if (Test-Collection "essential") {
|
||||
# Essentials
|
||||
& "$softwarePath/aliae/Manage.ps1" @arguments;
|
||||
& "$softwarePath/OpenSSH/Manage.ps1" @arguments;
|
||||
& "$softwarePath/PowerShell/Manage.ps1" @arguments;
|
||||
& "$softwarePath/chocolatey/Manage.ps1" @arguments;
|
||||
|
|
|
@ -6,15 +6,18 @@ param (
|
|||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
param(
|
||||
[scriptblock] $Installer
|
||||
)
|
||||
& {
|
||||
param($Parameters)
|
||||
$base = "$PSScriptRoot/../../../Common/Software/Oh My Posh/Manage.ps1";
|
||||
|
||||
Install-WingetPackage JanDeDobbeleer.OhMyPosh -ArgumentList "--scope","machine";
|
||||
} `
|
||||
-Configurator {
|
||||
. "$PSScriptRoot/../../../Common/Software/Oh My Posh/Manage.ps1" `
|
||||
-Action ([InstallerAction]::Configure);
|
||||
};
|
||||
Start-SoftwareInstaller @Parameters `
|
||||
-Installer {
|
||||
Install-WingetPackage JanDeDobbeleer.OhMyPosh -ArgumentList "--scope","machine";
|
||||
} `
|
||||
-Configurator {
|
||||
. $base -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
. $base -Action ([InstallerAction]::ConfigureUser);
|
||||
};
|
||||
} $PSBoundParameters;
|
||||
|
|
22
scripts/Windows/Software/aliae/Main.ps1
Normal file
22
scripts/Windows/Software/aliae/Main.ps1
Normal file
|
@ -0,0 +1,22 @@
|
|||
param (
|
||||
$Action,
|
||||
[hashtable] $Arguments
|
||||
)
|
||||
|
||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||
. "$PSScriptRoot/../../../Common/Types/InstallerAction.ps1";
|
||||
|
||||
& {
|
||||
$base = "$PSScriptRoot/../../../Common/Software/aliae/Manage.ps1";
|
||||
|
||||
Start-SoftwareInstaller @PSBoundParameters `
|
||||
-Installer {
|
||||
Install-WingetPackage JanDeDobbeleer.Aliae;
|
||||
} `
|
||||
-Configurator {
|
||||
. $base -Action ([InstallerAction]::Configure);
|
||||
} `
|
||||
-UserConfigurator {
|
||||
. $base -Action ([InstallerAction]::ConfigureUser);
|
||||
};
|
||||
};
|
Loading…
Reference in a new issue