Format all files
This commit is contained in:
parent
f2abbe8561
commit
59708b8f04
|
@ -5,10 +5,10 @@ fi
|
||||||
|
|
||||||
~/.automated_script.sh
|
~/.automated_script.sh
|
||||||
|
|
||||||
if bash -c "ls /sys/class/backlight/*/max_brightness" > /dev/null 2>&1;
|
if bash -c "ls /sys/class/backlight/*/max_brightness" > /dev/null 2>&1
|
||||||
then
|
then
|
||||||
cat /sys/class/backlight/*/max_brightness > /sys/class/backlight/*/brightness
|
cat /sys/class/backlight/*/max_brightness > /sys/class/backlight/*/brightness
|
||||||
fi;
|
fi
|
||||||
|
|
||||||
cd "PortValhalla"
|
cd "PortValhalla"
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ begin
|
||||||
git -C "$projectDir" ls-files --exclude-standard --others
|
git -C "$projectDir" ls-files --exclude-standard --others
|
||||||
end | \
|
end | \
|
||||||
rsync --files-from=/dev/stdin --exclude={.gitignore,README.md,scripts,LICENSE,valhalla.patch} "$dir/.." "$contextRoot"
|
rsync --files-from=/dev/stdin --exclude={.gitignore,README.md,scripts,LICENSE,valhalla.patch} "$dir/.." "$contextRoot"
|
||||||
end &> /dev/null;
|
end &> /dev/null
|
||||||
|
|
||||||
and git -C "$contextRoot" diff
|
and git -C "$contextRoot" diff
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
diff --git a/airootfs/root/.zlogin b/airootfs/root/.zlogin
|
diff --git a/airootfs/root/.zlogin b/airootfs/root/.zlogin
|
||||||
index bf6bc8f..6c333e3 100644
|
index bf6bc8f..0c263a9 100644
|
||||||
--- a/airootfs/root/.zlogin
|
--- a/airootfs/root/.zlogin
|
||||||
+++ b/airootfs/root/.zlogin
|
+++ b/airootfs/root/.zlogin
|
||||||
@@ -4,3 +4,18 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then
|
@@ -4,3 +4,18 @@ if grep -Fqa 'accessibility=' /proc/cmdline &> /dev/null; then
|
||||||
|
@ -7,10 +7,10 @@ index bf6bc8f..6c333e3 100644
|
||||||
|
|
||||||
~/.automated_script.sh
|
~/.automated_script.sh
|
||||||
+
|
+
|
||||||
+if bash -c "ls /sys/class/backlight/*/max_brightness" > /dev/null 2>&1;
|
+if bash -c "ls /sys/class/backlight/*/max_brightness" > /dev/null 2>&1
|
||||||
+then
|
+then
|
||||||
+ cat /sys/class/backlight/*/max_brightness > /sys/class/backlight/*/brightness
|
+ cat /sys/class/backlight/*/max_brightness > /sys/class/backlight/*/brightness
|
||||||
+fi;
|
+fi
|
||||||
+
|
+
|
||||||
+cd "PortValhalla"
|
+cd "PortValhalla"
|
||||||
+
|
+
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
let
|
let
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
nixpkgs = import <nixpkgs> { config = {}; overlay = []; };
|
nixpkgs = import <nixpkgs> {
|
||||||
|
config = { };
|
||||||
|
overlay = [ ];
|
||||||
|
};
|
||||||
property = (builtins.getEnv "PROPERTY");
|
property = (builtins.getEnv "PROPERTY");
|
||||||
processor = if (builtins.stringLength property > 0)
|
processor = if (builtins.stringLength property > 0) then
|
||||||
then
|
(_: lib.attrsets.getAttrFromPath (lib.strings.splitString "." property) _)
|
||||||
(_: lib.attrsets.getAttrFromPath (lib.strings.splitString "." property) _)
|
else
|
||||||
else
|
(_: _);
|
||||||
(_: _);
|
in _: processor (lib.evalModules { modules = [ _ ]; }).config
|
||||||
in
|
|
||||||
_: processor (lib.evalModules {
|
|
||||||
modules = [
|
|
||||||
_
|
|
||||||
];
|
|
||||||
}).config
|
|
||||||
|
|
|
@ -1,67 +1,63 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let inherit (lib) mkOption types;
|
||||||
inherit (lib)
|
in {
|
||||||
mkOption
|
options = {
|
||||||
types
|
valhalla = {
|
||||||
;
|
hardware = {
|
||||||
in {
|
components = mkOption {
|
||||||
options = {
|
type = types.listOf types.str;
|
||||||
valhalla = {
|
description = "The names of the hardware components of the computer.";
|
||||||
hardware = {
|
default = [ ];
|
||||||
components = mkOption {
|
};
|
||||||
type = types.listOf types.str;
|
|
||||||
description = "The names of the hardware components of the computer.";
|
|
||||||
default = [];
|
|
||||||
};
|
|
||||||
|
|
||||||
surfaceBook = mkOption {
|
surfaceBook = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether the system is a Surface Book 2.";
|
description = "A value indicating whether the system is a Surface Book 2.";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
xoneReceiver = mkOption {
|
xoneReceiver = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether an Xbox receiver is present.";
|
description = "A value indicating whether an Xbox receiver is present.";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
eyeX = mkOption {
|
eyeX = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether a Tobii EyeX device is present.";
|
description = "A value indicating whether a Tobii EyeX device is present.";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
amdCPU = mkOption {
|
amdCPU = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether an AMD CPU is present.";
|
description = "A value indicating whether an AMD CPU is present.";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
nvidiaGPU = mkOption {
|
nvidiaGPU = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether an NVIDIA GPU is present.";
|
description = "A value indicating whether an NVIDIA GPU is present.";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
corsairDevice = mkOption {
|
corsairDevice = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether a Corsair device is present.";
|
description = "A value indicating whether a Corsair device is present.";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
elgatoWave = mkOption {
|
elgatoWave = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether an Elgato Wave device is present.";
|
description = "A value indicating whether an Elgato Wave device is present.";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
logitechG = mkOption {
|
logitechG = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether a Logitech G device is present.";
|
description = "A value indicating whether a Logitech G device is present.";
|
||||||
default = false;
|
default = false;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,19 +1,15 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let inherit (lib) mkOption types;
|
||||||
inherit (lib)
|
in {
|
||||||
mkOption
|
options = {
|
||||||
types
|
valhalla = {
|
||||||
;
|
i18n = {
|
||||||
in {
|
localeSettings = mkOption {
|
||||||
options = {
|
type = types.attrsOf types.str;
|
||||||
valhalla = {
|
description = "The system wide locale settings";
|
||||||
i18n = {
|
default = { };
|
||||||
localeSettings = mkOption {
|
|
||||||
type = types.attrsOf types.str;
|
|
||||||
description = "The system wide locale settings";
|
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,65 +1,60 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let inherit (lib) mkOption types;
|
||||||
inherit (lib)
|
in {
|
||||||
mkOption
|
options = {
|
||||||
types
|
valhalla = mkOption {
|
||||||
;
|
type = types.submodule (
|
||||||
in {
|
{ extendModules, ... }: let
|
||||||
options = {
|
osVariant = extendModules {
|
||||||
valhalla = mkOption {
|
modules = [
|
||||||
type = types.submodule (
|
({ config, ... }: {
|
||||||
{ extendModules, ... }:
|
options = {
|
||||||
let
|
config = mkOption {
|
||||||
osVariant = extendModules {
|
type = types.attrs;
|
||||||
modules = [
|
description = "The configuration of the Operating System.";
|
||||||
({ config, ... }: {
|
default = builtins.removeAttrs config [ "_module" "config" "linux" "windows" ];
|
||||||
options = {
|
visible = false;
|
||||||
config = mkOption {
|
};
|
||||||
type = types.attrs;
|
|
||||||
description = "The configuration of the Operating System.";
|
|
||||||
default = builtins.removeAttrs config ["_module" "config" "linux" "windows"];
|
|
||||||
visible = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
linuxVariant = osVariant.extendModules {
|
|
||||||
modules = [
|
|
||||||
({ ... }: {
|
|
||||||
options = {
|
|
||||||
secureBoot = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = "A value indicating whether the system supports Secure Boot.";
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
windowsVariant = osVariant.extendModules { };
|
|
||||||
in {
|
|
||||||
options = {
|
|
||||||
linux = mkOption {
|
|
||||||
inherit (linuxVariant) type;
|
|
||||||
description = "The options for setting up Linux.";
|
|
||||||
default = {};
|
|
||||||
visible = "shallow";
|
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
windows = mkOption {
|
linuxVariant = osVariant.extendModules {
|
||||||
inherit (windowsVariant) type;
|
modules = [
|
||||||
description = "The options for setting up Windows.";
|
({ ... }: {
|
||||||
default = {};
|
options = {
|
||||||
visible = "shallow";
|
secureBoot = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether the system supports Secure Boot.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
});
|
];
|
||||||
|
};
|
||||||
|
|
||||||
description = "Configuration for PortValhalla.";
|
windowsVariant = osVariant.extendModules { };
|
||||||
default = {};
|
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 = { };
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,59 +1,55 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) mkOption types;
|
||||||
mkOption
|
|
||||||
types
|
|
||||||
;
|
|
||||||
|
|
||||||
gitType = types.submodule (
|
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 = {
|
options = {
|
||||||
valhalla = {
|
defaultBranch = mkOption {
|
||||||
git = gitOption;
|
type = types.nullOr types.str;
|
||||||
|
description = "The name of the default branch in newly created repositories.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
users = mkOption {
|
flow = {
|
||||||
type = types.attrsOf (types.submodule (
|
mainBranch = mkOption {
|
||||||
{ ... }: {
|
type = types.nullOr types.str;
|
||||||
options = {
|
description = "The name of the stable branch in git flow.";
|
||||||
git = gitOption;
|
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;
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,44 +1,39 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) mkEnableOption mkOption types;
|
||||||
mkEnableOption
|
|
||||||
mkOption
|
|
||||||
types
|
|
||||||
;
|
|
||||||
|
|
||||||
syncType = types.submodule (
|
syncType = types.submodule ({ ... }: {
|
||||||
{ ... }: {
|
|
||||||
options = {
|
|
||||||
remotePath = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "The path to the folder on the cloud to sync.";
|
|
||||||
};
|
|
||||||
|
|
||||||
localPath = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "The path to sync the cloud content to.";
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualFiles = (mkEnableOption "virtual file support") // {
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
in {
|
|
||||||
options = {
|
options = {
|
||||||
valhalla.windows.users = mkOption {
|
remotePath = mkOption {
|
||||||
type = types.attrsOf (types.submodule (
|
type = types.str;
|
||||||
{ ... }: {
|
description = "The path to the folder on the cloud to sync.";
|
||||||
options = {
|
};
|
||||||
nextcloud = {
|
|
||||||
folderSyncs = mkOption {
|
localPath = mkOption {
|
||||||
type = types.listOf syncType;
|
type = types.str;
|
||||||
description = "The folders to synchronize.";
|
description = "The path to sync the cloud content to.";
|
||||||
default = [];
|
};
|
||||||
};
|
|
||||||
};
|
virtualFiles = (mkEnableOption "virtual file support") // {
|
||||||
};
|
default = true;
|
||||||
}));
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
valhalla.windows.users = mkOption {
|
||||||
|
type = types.attrsOf (types.submodule (
|
||||||
|
{ ... }: {
|
||||||
|
options = {
|
||||||
|
nextcloud = {
|
||||||
|
folderSyncs = mkOption {
|
||||||
|
type = types.listOf syncType;
|
||||||
|
description = "The folders to synchronize.";
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,55 +1,52 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) mkOption types;
|
||||||
mkOption
|
|
||||||
types
|
|
||||||
;
|
|
||||||
|
|
||||||
themeType = types.submodule (
|
themeType = types.submodule (
|
||||||
{ config, ... }: {
|
{ config, ... }: {
|
||||||
options = {
|
options = {
|
||||||
source = mkOption {
|
source = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
description = "The path to the oh-my-posh theme to use.";
|
description = "The path to the oh-my-posh theme to use.";
|
||||||
};
|
|
||||||
|
|
||||||
name = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The name of the theme.";
|
|
||||||
default = lib.strings.removeSuffix ".omp" (lib.strings.removeSuffix ".json" (builtins.baseNameOf config.source));
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
||||||
ompType = types.submodule (
|
name = mkOption {
|
||||||
{ config, ... }: {
|
type = types.nullOr types.str;
|
||||||
options = {
|
description = "The name of the theme.";
|
||||||
theme = mkOption {
|
default = lib.strings.removeSuffix ".omp" (lib.strings.removeSuffix ".json" (builtins.baseNameOf config.source));
|
||||||
type = types.nullOr (types.either types.str themeType);
|
|
||||||
description = "The default theme.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
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 = {};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}));
|
|
||||||
};
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
ompType = types.submodule (
|
||||||
|
{ config, ... }: {
|
||||||
|
options = {
|
||||||
|
theme = mkOption {
|
||||||
|
type = types.nullOr (types.either types.str themeType);
|
||||||
|
description = "The default theme.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 = { };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,40 +1,37 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) mkOption types;
|
||||||
mkOption
|
|
||||||
types
|
|
||||||
;
|
|
||||||
|
|
||||||
syncType = types.submodule (
|
syncType = types.submodule (
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
options = {
|
options = {
|
||||||
dirName = mkOption {
|
dirName = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "The name of the directory to sync the remote files to.";
|
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 {
|
cacheDuration = mkOption {
|
||||||
options = {
|
type = types.nullOr types.str;
|
||||||
valhalla.linux.users = mkOption {
|
description = "The amount of time to keep cached files.";
|
||||||
type = types.attrsOf (types.submodule (
|
default = null;
|
||||||
{ ... }: {
|
};
|
||||||
options = {
|
};
|
||||||
rclone = {
|
});
|
||||||
configurations = mkOption {
|
in {
|
||||||
type = types.attrsOf syncType;
|
options = {
|
||||||
description = "The configurations of the rclone mounts.";
|
valhalla.linux.users = mkOption {
|
||||||
default = {};
|
type = types.attrsOf (types.submodule (
|
||||||
};
|
{ ... }: {
|
||||||
|
options = {
|
||||||
|
rclone = {
|
||||||
|
configurations = mkOption {
|
||||||
|
type = types.attrsOf syncType;
|
||||||
|
description = "The configurations of the rclone mounts.";
|
||||||
|
default = { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}));
|
};
|
||||||
};
|
}));
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -16,16 +16,16 @@ function chooseDisk -a outFile message selectScript
|
||||||
cat | while read disk
|
cat | while read disk
|
||||||
set -l diskInfo (string split -n " " $disk)
|
set -l diskInfo (string split -n " " $disk)
|
||||||
|
|
||||||
if contains "$diskInfo[3]" "disk"
|
if contains "$diskInfo[3]" disk
|
||||||
set -a disks "$disk"
|
set -a disks "$disk"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
select "$header" "$outFile" "$message" "No valid disk found!" "$(string collect $disks)" "false"
|
select "$header" "$outFile" "$message" "No valid disk found!" "$(string collect $disks)" false
|
||||||
and begin
|
and begin
|
||||||
set -l disk (string split -n " " (cat "$outFile"))
|
set -l disk (string split -n " " (cat "$outFile"))
|
||||||
echo "/dev/$disk[1]" > $outFile
|
echo "/dev/$disk[1]" >$outFile
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,18 +5,19 @@ function confirm -a message default
|
||||||
while true
|
while true
|
||||||
read -l value -P "$message $options "
|
read -l value -P "$message $options "
|
||||||
or exit 1
|
or exit 1
|
||||||
|
|
||||||
set value (string lower "$value")
|
set value (string lower "$value")
|
||||||
|
|
||||||
if [ -z "$value" ]
|
if [ -z "$value" ]
|
||||||
set value $default
|
set value $default
|
||||||
end
|
end
|
||||||
|
|
||||||
if contains "$value" "0" "false" "n" "no"
|
if contains "$value" 0 false n no
|
||||||
false
|
false
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if contains "$value" "1" "true" "y" "yes"
|
if contains "$value" 1 true y yes
|
||||||
true
|
true
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,376 +1,353 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) types mkOption;
|
||||||
types
|
|
||||||
mkOption
|
|
||||||
;
|
|
||||||
|
|
||||||
fs = import ./fs.nix;
|
fs = import ./fs.nix;
|
||||||
|
|
||||||
diskListVarName = "myDisks";
|
diskListVarName = "myDisks";
|
||||||
isSwap = partition: builtins.elem partition.type [fs.swap 19];
|
isSwap = partition: builtins.elem partition.type [ fs.swap 19 ];
|
||||||
|
|
||||||
probeScript = builtins.concatStringsSep "\n" [
|
probeScript = builtins.concatStringsSep "\n" [
|
||||||
"partprobe 2> /dev/null || true"
|
"partprobe 2> /dev/null || true"
|
||||||
"udevadm trigger"
|
"udevadm trigger"
|
||||||
];
|
];
|
||||||
|
|
||||||
mkDiskType = osDisk: types.submodule (
|
mkDiskType = osDisk: types.submodule (
|
||||||
{ config, name, ... }: {
|
{ config, name, ... }: {
|
||||||
options = {
|
options = {
|
||||||
id = mkOption {
|
id = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "The internal identifier of the disk.";
|
description = "The internal identifier of the disk.";
|
||||||
internal = true;
|
internal = true;
|
||||||
};
|
|
||||||
|
|
||||||
wipe = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = "A value indicating whether the disk should be wiped.";
|
|
||||||
default = !(lib.lists.any (_: _.keepExisting) (builtins.attrValues config.partitions));
|
|
||||||
};
|
|
||||||
|
|
||||||
deviceName = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The name of the device.";
|
|
||||||
default = if osDisk then null else name;
|
|
||||||
};
|
|
||||||
|
|
||||||
devicePath = mkOption {
|
|
||||||
type =
|
|
||||||
if osDisk
|
|
||||||
then types.nullOr types.str
|
|
||||||
else types.str;
|
|
||||||
description = "The path to the device.";
|
|
||||||
default =
|
|
||||||
if osDisk && config.deviceName == null
|
|
||||||
then null
|
|
||||||
else "/dev/${config.deviceName}";
|
|
||||||
};
|
|
||||||
|
|
||||||
deviceScript = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "A command for loading the device path into the device variable";
|
|
||||||
internal = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
deviceVariable = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "The name of the variable holding the name of the disk";
|
|
||||||
internal = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
partitions = mkOption {
|
|
||||||
type = types.attrsOf (types.nullOr partitionType);
|
|
||||||
description = "The partitions of the disk.";
|
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
script = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "The script for formatting the disk.";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
wipe = mkOption {
|
||||||
let
|
type = types.bool;
|
||||||
diskVarName = "${diskListVarName}[${config.id}]";
|
description = "A value indicating whether the disk should be wiped.";
|
||||||
diskVar = ''''${${diskVarName}}'';
|
default = !(lib.lists.any (_: _.keepExisting) (builtins.attrValues config.partitions));
|
||||||
|
|
||||||
diskSelector = ''
|
|
||||||
result="$(mktemp)"
|
|
||||||
fish ${./choose-disk.fish} "$result" "Which disk do you wish to install the OS on?" ${./select.fish}
|
|
||||||
${diskVarName}="$(cat "$result")"
|
|
||||||
'';
|
|
||||||
|
|
||||||
partitions = lib.lists.sortOn
|
|
||||||
(_: _.index)
|
|
||||||
(builtins.filter (_: _ != null) (builtins.attrValues config.partitions));
|
|
||||||
|
|
||||||
mkType = type:
|
|
||||||
lib.strings.escapeShellArg (
|
|
||||||
if builtins.isInt type
|
|
||||||
then "${lib.trivial.toHexString type}"
|
|
||||||
else type);
|
|
||||||
|
|
||||||
fdiskCommand = arguments: "sudo sfdisk ${arguments}";
|
|
||||||
fdiskScript = script: append: "echo ${script} | ${fdiskCommand "${if append then "--append" else ""} ${diskVar}"}";
|
|
||||||
wipeScript = script: fdiskScript script false;
|
|
||||||
appendScript = script: fdiskScript script true;
|
|
||||||
|
|
||||||
cleanup = lib.strings.concatLines (builtins.map
|
|
||||||
(partition: "${fdiskCommand "--delete ${diskVar} ${toString partition.index}"} || true")
|
|
||||||
(builtins.filter (_: !_.keepExisting) partitions));
|
|
||||||
|
|
||||||
fdiskCommands = lib.strings.concatLines (
|
|
||||||
lib.optionals config.wipe [
|
|
||||||
cleanup
|
|
||||||
(wipeScript "label: gpt")
|
|
||||||
] ++
|
|
||||||
(builtins.concatMap (
|
|
||||||
partition:
|
|
||||||
let
|
|
||||||
inherit (partition)
|
|
||||||
format
|
|
||||||
index
|
|
||||||
keepExisting
|
|
||||||
label
|
|
||||||
sizeScript
|
|
||||||
type
|
|
||||||
;
|
|
||||||
|
|
||||||
partVarName = "myPartition";
|
|
||||||
partVar = ''''${${partVarName}}'';
|
|
||||||
|
|
||||||
sizeOption = ''
|
|
||||||
${sizeScript} | sed -e "s/.*[^[:space:]]/size=\0/"
|
|
||||||
'';
|
|
||||||
|
|
||||||
formatScripts = {
|
|
||||||
${fs.ext4} = "mkfs.ext4 -F ${partVar}";
|
|
||||||
${fs.swap} = "mkswap ${partVar}";
|
|
||||||
${fs.ntfs} = "mkfs.ntfs -F ${partVar}";
|
|
||||||
${fs.fat32} = "mkfs.fat -F 32 ${partVar}";
|
|
||||||
};
|
|
||||||
|
|
||||||
labelScripts = {
|
|
||||||
${fs.ext4} = label: "e2label ${partVar} ${label}";
|
|
||||||
${fs.swap} = label: "swaplabel ${partVar} --label ${label}";
|
|
||||||
${fs.ntfs} = label: "ntfslabel ${partVar} ${label}";
|
|
||||||
${fs.fat32} = label: "fatlabel ${partVar} ${label}";
|
|
||||||
};
|
|
||||||
|
|
||||||
create = lib.strings.concatLines [
|
|
||||||
(appendScript "${toString index}: \"$(${sizeOption})\" type=${mkType type}")
|
|
||||||
probeScript
|
|
||||||
"sudo ${formatScripts.${format}}"
|
|
||||||
];
|
|
||||||
|
|
||||||
fallback = ''
|
|
||||||
if ! { ls "${partVar}" 2>&1; } > /dev/null
|
|
||||||
then
|
|
||||||
${create}
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
in [
|
|
||||||
''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"''
|
|
||||||
''local ${partVarName}="$diskPath-part${toString index}"''
|
|
||||||
(if keepExisting then fallback else create)
|
|
||||||
"sudo ${labelScripts.${format} label}"
|
|
||||||
])
|
|
||||||
partitions)
|
|
||||||
);
|
|
||||||
|
|
||||||
fixType = lib.strings.concatLines (
|
|
||||||
builtins.concatMap
|
|
||||||
(partition: lib.optional
|
|
||||||
(partition.keepExisting && !(builtins.isNull partition.type))
|
|
||||||
''sudo sfdisk --part-type ${diskVar} ${toString partition.index} ${mkType partition.type}'')
|
|
||||||
partitions);
|
|
||||||
in {
|
|
||||||
id = if osDisk then "os" else "disk-${name}";
|
|
||||||
deviceVariable = diskVar;
|
|
||||||
|
|
||||||
deviceScript = if osDisk && config.devicePath == null then ''
|
|
||||||
${diskSelector}
|
|
||||||
''
|
|
||||||
else ''
|
|
||||||
${diskVarName}=${config.devicePath}
|
|
||||||
${if osDisk then ''
|
|
||||||
if [ ! -b ${diskVar} ]; then
|
|
||||||
function fallback() {
|
|
||||||
echo "Couldn't find the specified disk \"${diskVar}\"."
|
|
||||||
if fish ${./confirm.fish} "Do you want to install the OS on another disk?"; then
|
|
||||||
${diskSelector}
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
fallback;
|
|
||||||
fi
|
|
||||||
'' else ""}
|
|
||||||
'';
|
|
||||||
|
|
||||||
script = lib.mkDefault ''
|
|
||||||
function partition() {
|
|
||||||
${if (!config.wipe) then cleanup else ""}
|
|
||||||
|
|
||||||
${fdiskCommands}
|
|
||||||
${fixType}
|
|
||||||
}
|
|
||||||
|
|
||||||
partition
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
});
|
|
||||||
partitionType = types.submodule (
|
|
||||||
{ name, config, ... }: {
|
|
||||||
options = {
|
|
||||||
index = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
description = "The index of the partition.";
|
|
||||||
};
|
|
||||||
|
|
||||||
label = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "The label of the partition.";
|
|
||||||
default = name;
|
|
||||||
};
|
|
||||||
|
|
||||||
keepExisting = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = "A value indicating whether the partition should be left untouched if it already exists.";
|
|
||||||
default = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
type = mkOption {
|
|
||||||
type = types.nullOr (types.either types.str types.int);
|
|
||||||
description = "The type of the partition.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
format = mkOption {
|
|
||||||
type = types.enum (builtins.attrValues fs);
|
|
||||||
description = "The file system format of the partition.";
|
|
||||||
default =
|
|
||||||
if (isSwap config)
|
|
||||||
then fs.swap
|
|
||||||
else throw("Partition format not specified.");
|
|
||||||
};
|
|
||||||
|
|
||||||
size = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The size of the partition.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
sizeScript = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "A script for printing the size to the console.";
|
|
||||||
internal = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
useSwap = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = "A value indicating whether this partition should be used as swap.";
|
|
||||||
default = isSwap config;
|
|
||||||
};
|
|
||||||
|
|
||||||
mountPoint = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The mountpoint of the partition.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
mountOptions = mkOption {
|
|
||||||
type = types.listOf types.str;
|
|
||||||
description = "The options to apply to the mount.";
|
|
||||||
default = [];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
deviceName = mkOption {
|
||||||
sizeScript = (
|
type = types.nullOr types.str;
|
||||||
if isSwap config
|
description = "The name of the device.";
|
||||||
then
|
default = if osDisk then null else name;
|
||||||
''echo "$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }' | awk '{ print int((($1 / 1024 / 1024) * 0.75) + 0.5)}')"G''
|
};
|
||||||
|
|
||||||
|
devicePath = mkOption {
|
||||||
|
type = if osDisk then
|
||||||
|
types.nullOr types.str
|
||||||
|
else
|
||||||
|
types.str;
|
||||||
|
description = "The path to the device.";
|
||||||
|
default = if osDisk && config.deviceName == null then
|
||||||
|
null
|
||||||
|
else
|
||||||
|
"/dev/${config.deviceName}";
|
||||||
|
};
|
||||||
|
|
||||||
|
deviceScript = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "A command for loading the device path into the device variable";
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
deviceVariable = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The name of the variable holding the name of the disk";
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
partitions = mkOption {
|
||||||
|
type = types.attrsOf (types.nullOr partitionType);
|
||||||
|
description = "The partitions of the disk.";
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
script = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The script for formatting the disk.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = let
|
||||||
|
diskVarName = "${diskListVarName}[${config.id}]";
|
||||||
|
diskVar = "\${${diskVarName}}";
|
||||||
|
|
||||||
|
diskSelector = ''
|
||||||
|
result="$(mktemp)"
|
||||||
|
fish ${./choose-disk.fish} "$result" "Which disk do you wish to install the OS on?" ${./select.fish}
|
||||||
|
${diskVarName}="$(cat "$result")"
|
||||||
|
'';
|
||||||
|
|
||||||
|
partitions = lib.lists.sortOn (_: _.index)
|
||||||
|
(builtins.filter (_: _ != null)
|
||||||
|
(builtins.attrValues config.partitions));
|
||||||
|
|
||||||
|
mkType = type:
|
||||||
|
lib.strings.escapeShellArg (
|
||||||
|
if builtins.isInt type then
|
||||||
|
"${lib.trivial.toHexString type}"
|
||||||
else
|
else
|
||||||
"echo ${lib.strings.escapeShellArg (toString config.size)}"
|
type);
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
in {
|
|
||||||
options = {
|
|
||||||
valhalla = {
|
|
||||||
partition = {
|
|
||||||
rootDir = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "The root of the installation directory to mount disks into.";
|
|
||||||
default = "/mnt";
|
|
||||||
};
|
|
||||||
|
|
||||||
os = mkOption {
|
fdiskCommand = arguments: "sudo sfdisk ${arguments}";
|
||||||
type = mkDiskType true;
|
fdiskScript = script: append: "echo ${script} | ${fdiskCommand "${if append then "--append" else ""} ${diskVar}"}";
|
||||||
description = "The partition layout of the OS disk.";
|
wipeScript = script: fdiskScript script false;
|
||||||
};
|
appendScript = script: fdiskScript script true;
|
||||||
|
|
||||||
disks = mkOption {
|
cleanup = lib.strings.concatLines (builtins.map
|
||||||
type = types.attrsOf (mkDiskType false);
|
(partition: "${fdiskCommand "--delete ${diskVar} ${toString partition.index}"} || true")
|
||||||
description = "The additional disks to format.";
|
(builtins.filter (_: !_.keepExisting) partitions));
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
script = mkOption {
|
fdiskCommands = lib.strings.concatLines
|
||||||
type = types.str;
|
(lib.optionals config.wipe [
|
||||||
description = "The script for partitioning the system's disks.";
|
cleanup
|
||||||
};
|
(wipeScript "label: gpt")
|
||||||
};
|
] ++ (builtins.concatMap (
|
||||||
};
|
partition:
|
||||||
};
|
let
|
||||||
|
inherit (partition) format index keepExisting label sizeScript type;
|
||||||
|
|
||||||
config = {
|
partVarName = "myPartition";
|
||||||
valhalla = {
|
partVar = "\${${partVarName}}";
|
||||||
partition = {
|
|
||||||
script = lib.mkDefault (
|
|
||||||
let
|
|
||||||
cfg = config.valhalla.partition;
|
|
||||||
inherit (cfg) os rootDir;
|
|
||||||
inherit (lib.strings) normalizePath;
|
|
||||||
|
|
||||||
partPath = part: "/dev/disk/by-label/${part.label}";
|
sizeOption = ''
|
||||||
disks = ([os] ++ (builtins.attrValues cfg.disks));
|
${sizeScript} | sed -e "s/.*[^[:space:]]/size=\0/"
|
||||||
partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks);
|
'';
|
||||||
|
|
||||||
mountScript = lib.strings.concatLines (
|
formatScripts = {
|
||||||
builtins.concatMap
|
${fs.ext4} = "mkfs.ext4 -F ${partVar}";
|
||||||
(_: [
|
${fs.swap} = "mkswap ${partVar}";
|
||||||
probeScript
|
${fs.ntfs} = "mkfs.ntfs -F ${partVar}";
|
||||||
(builtins.concatStringsSep " " ([
|
${fs.fat32} = "mkfs.fat -F 32 ${partVar}";
|
||||||
"sudo"
|
};
|
||||||
"mount"
|
|
||||||
"--mkdir"
|
|
||||||
] ++ (lib.optionals (_.format == "ntfs") [
|
|
||||||
"-t" "ntfs3"
|
|
||||||
]) ++ [
|
|
||||||
(builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions))
|
|
||||||
(partPath _)
|
|
||||||
(normalizePath "/${rootDir}/${_.mountPoint}")
|
|
||||||
]))
|
|
||||||
])
|
|
||||||
(lib.lists.sortOn
|
|
||||||
(_: normalizePath "/${_.mountPoint}")
|
|
||||||
(builtins.filter (_: _.mountPoint != null) partitions)));
|
|
||||||
|
|
||||||
swapScript = lib.strings.concatLines (
|
labelScripts = {
|
||||||
builtins.map
|
${fs.ext4} = label: "e2label ${partVar} ${label}";
|
||||||
(_: ''
|
${fs.swap} = label: "swaplabel ${partVar} --label ${label}";
|
||||||
${probeScript}
|
${fs.ntfs} = label: "ntfslabel ${partVar} ${label}";
|
||||||
sudo swapon ${partPath _}
|
${fs.fat32} = label: "fatlabel ${partVar} ${label}";
|
||||||
'')
|
};
|
||||||
(builtins.filter (_: _.useSwap) partitions));
|
|
||||||
in lib.strings.concatLines ([
|
create = lib.strings.concatLines [
|
||||||
"#!/bin/bash"
|
(appendScript ''${toString index}: "$(${sizeOption})" type=${mkType type}'')
|
||||||
"set -o errexit"
|
probeScript
|
||||||
] ++
|
"sudo ${formatScripts.${format}}"
|
||||||
(builtins.map (_: _.deviceScript) disks) ++
|
];
|
||||||
lib.optionals ((builtins.length disks) > 0) [
|
|
||||||
''echo "$(tput setaf 3)==== WARNING ====$(tput sgr0)"''
|
fallback = ''
|
||||||
(''echo "Continuing this script will alter the partitions of '' + (
|
if ! { ls "${partVar}" 2>&1; } > /dev/null
|
||||||
lib.strings.concatStringsSep ", " (builtins.map (_: "${_.deviceVariable}") (lib.lists.init disks))
|
then
|
||||||
) + (if (builtins.length disks) > 1 then " and " else "") + (lib.lists.last disks).deviceVariable + ''"'')
|
${create}
|
||||||
''
|
|
||||||
if ! fish ${./confirm.fish} "Are you sure you want to continue?" "n"; then
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
''
|
'';
|
||||||
] ++
|
in [
|
||||||
(builtins.map (_: _.script) disks) ++ [
|
''local diskPath="$(find -L /dev/disk/by-diskseq -samefile ${diskVar})"''
|
||||||
mountScript
|
''local ${partVarName}="$diskPath-part${toString index}"''
|
||||||
swapScript
|
(if keepExisting then fallback else create)
|
||||||
]
|
"sudo ${labelScripts.${format} label}"
|
||||||
));
|
]) partitions));
|
||||||
|
|
||||||
|
fixType = lib.strings.concatLines (builtins.concatMap (
|
||||||
|
partition:
|
||||||
|
lib.optional
|
||||||
|
(partition.keepExisting && !(builtins.isNull partition.type))
|
||||||
|
''sudo sfdisk --part-type ${diskVar} ${toString partition.index} ${mkType partition.type}'')
|
||||||
|
partitions);
|
||||||
|
in {
|
||||||
|
id = if osDisk then "os" else "disk-${name}";
|
||||||
|
deviceVariable = diskVar;
|
||||||
|
|
||||||
|
deviceScript = if osDisk && config.devicePath == null then ''
|
||||||
|
${diskSelector}
|
||||||
|
'' else ''
|
||||||
|
${diskVarName}=${config.devicePath}
|
||||||
|
${if osDisk then ''
|
||||||
|
if [ ! -b ${diskVar} ]; then
|
||||||
|
function fallback() {
|
||||||
|
echo "Couldn't find the specified disk \"${diskVar}\"."
|
||||||
|
if fish ${./confirm.fish} "Do you want to install the OS on another disk?"; then
|
||||||
|
${diskSelector}
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
fallback
|
||||||
|
fi
|
||||||
|
'' else
|
||||||
|
""}
|
||||||
|
'';
|
||||||
|
|
||||||
|
script = lib.mkDefault ''
|
||||||
|
function partition() {
|
||||||
|
${if (!config.wipe) then cleanup else ""}
|
||||||
|
|
||||||
|
${fdiskCommands}
|
||||||
|
${fixType}
|
||||||
|
}
|
||||||
|
|
||||||
|
partition
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
partitionType = types.submodule (
|
||||||
|
{ name, config, ... }: {
|
||||||
|
options = {
|
||||||
|
index = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
description = "The index of the partition.";
|
||||||
|
};
|
||||||
|
|
||||||
|
label = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The label of the partition.";
|
||||||
|
default = name;
|
||||||
|
};
|
||||||
|
|
||||||
|
keepExisting = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether the partition should be left untouched if it already exists.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
type = mkOption {
|
||||||
|
type = types.nullOr (types.either types.str types.int);
|
||||||
|
description = "The type of the partition.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
format = mkOption {
|
||||||
|
type = types.enum (builtins.attrValues fs);
|
||||||
|
description = "The file system format of the partition.";
|
||||||
|
default = if (isSwap config) then
|
||||||
|
fs.swap
|
||||||
|
else
|
||||||
|
throw ("Partition format not specified.");
|
||||||
|
};
|
||||||
|
|
||||||
|
size = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "The size of the partition.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
sizeScript = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "A script for printing the size to the console.";
|
||||||
|
internal = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
useSwap = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether this partition should be used as swap.";
|
||||||
|
default = isSwap config;
|
||||||
|
};
|
||||||
|
|
||||||
|
mountPoint = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "The mountpoint of the partition.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
mountOptions = mkOption {
|
||||||
|
type = types.listOf types.str;
|
||||||
|
description = "The options to apply to the mount.";
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
sizeScript = (if isSwap config then
|
||||||
|
''echo "$(cat /proc/meminfo | awk -F " " '/^MemTotal/ { print $2 }' | awk '{ print int((($1 / 1024 / 1024) * 0.75) + 0.5)}')"G''
|
||||||
|
else
|
||||||
|
"echo ${lib.strings.escapeShellArg (toString config.size)}");
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
options = {
|
||||||
|
valhalla = {
|
||||||
|
partition = {
|
||||||
|
rootDir = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The root of the installation directory to mount disks into.";
|
||||||
|
default = "/mnt";
|
||||||
|
};
|
||||||
|
|
||||||
|
os = mkOption {
|
||||||
|
type = mkDiskType true;
|
||||||
|
description = "The partition layout of the OS disk.";
|
||||||
|
};
|
||||||
|
|
||||||
|
disks = mkOption {
|
||||||
|
type = types.attrsOf (mkDiskType false);
|
||||||
|
description = "The additional disks to format.";
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
script = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The script for partitioning the system's disks.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
valhalla = {
|
||||||
|
partition = {
|
||||||
|
script = lib.mkDefault (let
|
||||||
|
cfg = config.valhalla.partition;
|
||||||
|
inherit (cfg) os rootDir;
|
||||||
|
inherit (lib.strings) normalizePath;
|
||||||
|
partPath = part: "/dev/disk/by-label/${part.label}";
|
||||||
|
disks = ([ os ] ++ (builtins.attrValues cfg.disks));
|
||||||
|
partitions = (builtins.concatMap (_: (builtins.attrValues _.partitions)) disks);
|
||||||
|
|
||||||
|
mountScript = lib.strings.concatLines (builtins.concatMap (
|
||||||
|
_: [
|
||||||
|
probeScript
|
||||||
|
(builtins.concatStringsSep " " ([
|
||||||
|
"sudo"
|
||||||
|
"mount"
|
||||||
|
"--mkdir"
|
||||||
|
] ++ (lib.optionals (_.format == "ntfs") [
|
||||||
|
"-t" "ntfs3"
|
||||||
|
]) ++ [
|
||||||
|
(builtins.concatStringsSep " " (builtins.map (_: "-o ${_}") _.mountOptions))
|
||||||
|
(partPath _)
|
||||||
|
(normalizePath "/${rootDir}/${_.mountPoint}")
|
||||||
|
]))
|
||||||
|
]) (lib.lists.sortOn
|
||||||
|
(_: normalizePath "/${_.mountPoint}")
|
||||||
|
(builtins.filter (_: _.mountPoint != null) partitions)));
|
||||||
|
|
||||||
|
swapScript = lib.strings.concatLines (builtins.map (
|
||||||
|
_: ''
|
||||||
|
${probeScript}
|
||||||
|
sudo swapon ${partPath _}
|
||||||
|
'') (builtins.filter (_: _.useSwap) partitions));
|
||||||
|
in lib.strings.concatLines ([
|
||||||
|
"#!/bin/bash"
|
||||||
|
"set -o errexit"
|
||||||
|
]
|
||||||
|
++ (builtins.map (_: _.deviceScript) disks)
|
||||||
|
++ lib.optionals ((builtins.length disks) > 0) [
|
||||||
|
''echo "$(tput setaf 3)==== WARNING ====$(tput sgr0)"''
|
||||||
|
(''echo "Continuing this script will alter the partitions of ''
|
||||||
|
+ (lib.strings.concatStringsSep ", " (builtins.map (_: "${_.deviceVariable}") (lib.lists.init disks)))
|
||||||
|
+ (if (builtins.length disks) > 1 then " and " else "") + (lib.lists.last disks).deviceVariable + ''"'')
|
||||||
|
''
|
||||||
|
if ! fish ${./confirm.fish} "Are you sure you want to continue?" "n"; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
''
|
||||||
|
] ++ (builtins.map (_: _.script) disks) ++ [
|
||||||
|
mountScript
|
||||||
|
swapScript
|
||||||
|
]));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
function select -a header outFile message error choices loop
|
function select -a header outFile message error choices loop
|
||||||
if [ -z "$loop" ]
|
if [ -z "$loop" ]
|
||||||
set loop "true"
|
set loop true
|
||||||
end
|
end
|
||||||
|
|
||||||
while true
|
while true
|
||||||
|
@ -24,9 +24,9 @@ function select -a header outFile message error choices loop
|
||||||
read -lP "Your choice: " choice
|
read -lP "Your choice: " choice
|
||||||
or exit 1
|
or exit 1
|
||||||
|
|
||||||
if math "0+$choice" &> /dev/null
|
if math "0+$choice" &>/dev/null
|
||||||
if [ "$choice" -ge 1 ] && [ "$choice" -le "$count" ]
|
if [ "$choice" -ge 1 ] && [ "$choice" -le "$count" ]
|
||||||
echo "$items[$choice]" > $outFile
|
echo "$items[$choice]" >$outFile
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,96 +1,85 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) mkOption types;
|
||||||
mkOption
|
cfg = config.valhalla;
|
||||||
types
|
in {
|
||||||
;
|
options = {
|
||||||
|
valhalla = {
|
||||||
|
software = let
|
||||||
|
inherit (cfg.software) coding common desktopExperience school server;
|
||||||
|
in {
|
||||||
|
essential = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether essentials should be installed.";
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
cfg = config.valhalla;
|
common = mkOption {
|
||||||
in {
|
type = types.bool;
|
||||||
options = {
|
description = "A value indicating whether common software should be installed.";
|
||||||
valhalla = {
|
default = true;
|
||||||
software =
|
};
|
||||||
let
|
|
||||||
inherit (cfg.software)
|
|
||||||
coding
|
|
||||||
common
|
|
||||||
desktopExperience
|
|
||||||
school
|
|
||||||
server
|
|
||||||
;
|
|
||||||
in {
|
|
||||||
essential = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = "A value indicating whether essentials should be installed.";
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
common = mkOption {
|
server = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether common software should be installed.";
|
description = "A value indicating whether server applications should be installed.";
|
||||||
default = true;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
server = mkOption {
|
desktopExperience = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether server applications should be installed.";
|
description = "A value indicating whether GUI apps should be installed.";
|
||||||
default = false;
|
default = common && !server;
|
||||||
};
|
};
|
||||||
|
|
||||||
desktopExperience = mkOption {
|
fileSync = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether GUI apps should be installed.";
|
description = "A value indicating whether file syncs should be installed.";
|
||||||
default = common && !server;
|
default = common && !server;
|
||||||
};
|
};
|
||||||
|
|
||||||
fileSync = mkOption {
|
school = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether file syncs should be installed.";
|
description = "A value indicating whether software for studies should be installed.";
|
||||||
default = common && !server;
|
default = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
school = mkOption {
|
productivity = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether software for studies should be installed.";
|
description = "A value indicating whether productivity apps should be installed.";
|
||||||
default = false;
|
default = common || school;
|
||||||
};
|
};
|
||||||
|
|
||||||
productivity = mkOption {
|
socialMedia = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether productivity apps should be installed.";
|
description = "A value indicating whether social media apps should be installed.";
|
||||||
default = common || school;
|
default = common && desktopExperience;
|
||||||
};
|
};
|
||||||
|
|
||||||
socialMedia = mkOption {
|
media = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether social media apps should be installed.";
|
description = "A value indicating whether media apps should be installed.";
|
||||||
default = common && desktopExperience;
|
default = common && desktopExperience;
|
||||||
};
|
};
|
||||||
|
|
||||||
media = mkOption {
|
gaming = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether media apps should be installed.";
|
description = "A value indicating whether gaming apps should be installed.";
|
||||||
default = common && desktopExperience;
|
default = common && desktopExperience;
|
||||||
};
|
};
|
||||||
|
|
||||||
gaming = mkOption {
|
coding = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether gaming apps should be installed.";
|
description = "A value indicating whether development apps should be installed.";
|
||||||
default = common && desktopExperience;
|
default = common;
|
||||||
};
|
};
|
||||||
|
|
||||||
coding = mkOption {
|
python = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
description = "A value indicating whether development apps should be installed.";
|
description = "A value indicating whether apps for coding python should be installed.";
|
||||||
default = common;
|
default = coding;
|
||||||
};
|
};
|
||||||
|
|
||||||
python = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = "A value indicating whether apps for coding python should be installed.";
|
|
||||||
default = coding;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,90 +1,82 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) mkOption types;
|
||||||
mkOption
|
|
||||||
types
|
|
||||||
;
|
|
||||||
|
|
||||||
capitalize = (import ../text.nix { inherit lib; }).capitalize;
|
capitalize = (import ../text.nix { inherit lib; }).capitalize;
|
||||||
|
|
||||||
userType = types.submodule (
|
userType = types.submodule (
|
||||||
{ ... } : {
|
{ ... }: {
|
||||||
options = {
|
options = {
|
||||||
displayName = mkOption {
|
displayName = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
description = "The human-readable name of the user.";
|
description = "The human-readable name of the user.";
|
||||||
default = null;
|
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 = [];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
linuxUserType = types.submodule (
|
|
||||||
{ ... }: {
|
|
||||||
options = {
|
|
||||||
defaultShell = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The default shell of the user.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
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 = {
|
|
||||||
users = mkOption {
|
|
||||||
type = types.attrsOf userType;
|
|
||||||
description = "The users to create on the machine.";
|
|
||||||
default = {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
linux.users = mkOption {
|
mailAddress = mkOption {
|
||||||
type = types.attrsOf linuxUserType;
|
type = types.nullOr types.str;
|
||||||
|
description = "The mail address of the user.";
|
||||||
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
windows = mkOption {
|
groups = mkOption {
|
||||||
type = types.submoduleWith {
|
type = types.listOf types.str;
|
||||||
modules = [
|
description = "The additional groups of the user.";
|
||||||
({ config, options, ... }: {
|
default = [ ];
|
||||||
options = {
|
};
|
||||||
users = mkOption {
|
};
|
||||||
type = types.attrsOf winUserType;
|
});
|
||||||
};
|
|
||||||
|
|
||||||
winUsers = mkOption {
|
linuxUserType = types.submodule (
|
||||||
type = options.users.type;
|
{ ... }: {
|
||||||
default = (lib.attrsets.concatMapAttrs (
|
options = {
|
||||||
name: options: {
|
defaultShell = mkOption {
|
||||||
${capitalize name} = options;
|
type = types.nullOr types.str;
|
||||||
}) config.users);
|
description = "The default shell of the user.";
|
||||||
};
|
default = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
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 = {
|
||||||
|
users = mkOption {
|
||||||
|
type = types.attrsOf userType;
|
||||||
|
description = "The users to create on the machine.";
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
linux.users = mkOption { type = types.attrsOf linuxUserType; };
|
||||||
|
|
||||||
|
windows = mkOption {
|
||||||
|
type = types.submoduleWith {
|
||||||
|
modules = [
|
||||||
|
({ config, options, ... }: {
|
||||||
|
options = {
|
||||||
|
users = mkOption { type = types.attrsOf winUserType; };
|
||||||
|
|
||||||
|
winUsers = mkOption {
|
||||||
|
type = options.users.type;
|
||||||
|
default = (lib.attrsets.concatMapAttrs
|
||||||
|
(name: options: { ${capitalize name} = options; })
|
||||||
|
config.users);
|
||||||
};
|
};
|
||||||
})
|
};
|
||||||
];
|
})
|
||||||
};
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,83 +1,79 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
let inherit (lib) mkOption types;
|
||||||
inherit (lib)
|
in {
|
||||||
mkOption
|
imports = [
|
||||||
types
|
./hardware.nix
|
||||||
;
|
./i18n.nix
|
||||||
in {
|
./os.nix
|
||||||
imports = [
|
./packages/git.nix
|
||||||
./hardware.nix
|
./packages/nextcloud.nix
|
||||||
./i18n.nix
|
./packages/oh-my-posh.nix
|
||||||
./os.nix
|
./packages/rclone.nix
|
||||||
./packages/git.nix
|
./partition.nix
|
||||||
./packages/nextcloud.nix
|
./software.nix
|
||||||
./packages/oh-my-posh.nix
|
./users.nix
|
||||||
./packages/rclone.nix
|
./windows.nix
|
||||||
./partition.nix
|
];
|
||||||
./software.nix
|
|
||||||
./users.nix
|
|
||||||
./windows.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
valhalla = {
|
valhalla = {
|
||||||
boot = {
|
boot = {
|
||||||
efiMountPoint = mkOption {
|
efiMountPoint = mkOption {
|
||||||
type = types.str;
|
|
||||||
description = "The mountpoint of the efi partition.";
|
|
||||||
default = "/boot";
|
|
||||||
};
|
|
||||||
|
|
||||||
label = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = "The label of the boot entry.";
|
|
||||||
default = "OS";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
hostname = mkOption {
|
|
||||||
type = types.str;
|
type = types.str;
|
||||||
description = "The hostname of the system.";
|
description = "The mountpoint of the efi partition.";
|
||||||
default = "valhalla";
|
default = "/boot";
|
||||||
};
|
};
|
||||||
|
|
||||||
setupUser = {
|
label = mkOption {
|
||||||
name = mkOption {
|
type = types.str;
|
||||||
type = types.str;
|
description = "The label of the boot entry.";
|
||||||
description = "The name of the user used to set up the system.";
|
default = "OS";
|
||||||
default = "heimdall";
|
|
||||||
};
|
|
||||||
|
|
||||||
id = mkOption {
|
|
||||||
type = types.int;
|
|
||||||
description = "The UID of the user used to set up the system.";
|
|
||||||
default = 420;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
timeZone = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The time zone of the system.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
keyMap = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The console key map of the system.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
keyboardLayout = mkOption {
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The X11 keyboard layout of the system.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
hidpi = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = "A value indicating whether the screen is hidpi.";
|
|
||||||
default = false;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hostname = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The hostname of the system.";
|
||||||
|
default = "valhalla";
|
||||||
|
};
|
||||||
|
|
||||||
|
setupUser = {
|
||||||
|
name = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = "The name of the user used to set up the system.";
|
||||||
|
default = "heimdall";
|
||||||
|
};
|
||||||
|
|
||||||
|
id = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
description = "The UID of the user used to set up the system.";
|
||||||
|
default = 420;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
timeZone = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "The time zone of the system.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
keyMap = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "The console key map of the system.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
keyboardLayout = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
description = "The X11 keyboard layout of the system.";
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
hidpi = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
description = "A value indicating whether the screen is hidpi.";
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,47 +1,40 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (lib)
|
inherit (lib) mkDefault mkEnableOption mkIf mkOption types;
|
||||||
mkDefault
|
capitalize = (import ../text.nix { inherit lib; }).capitalize;
|
||||||
mkEnableOption
|
in {
|
||||||
mkIf
|
options = {
|
||||||
mkOption
|
valhalla = {
|
||||||
types
|
windows = {
|
||||||
;
|
dualboot = {
|
||||||
|
enable = mkEnableOption "dual boot";
|
||||||
|
|
||||||
capitalize = (import ../text.nix { inherit lib; }).capitalize;
|
linuxPercentage = mkOption {
|
||||||
in {
|
type = types.number;
|
||||||
options = {
|
description = "The percentage of the disk size reserved for Linux.";
|
||||||
valhalla = {
|
|
||||||
windows = {
|
|
||||||
dualboot = {
|
|
||||||
enable = mkEnableOption "dual boot";
|
|
||||||
|
|
||||||
linuxPercentage = mkOption {
|
|
||||||
type = types.number;
|
|
||||||
description = "The percentage of the disk size reserved for Linux.";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
showFileExt = mkOption {
|
|
||||||
type = types.bool;
|
|
||||||
description = "A value indicating whether file extensions should be displayed in Windows Explorer.";
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
legacyIconSpacing = mkEnableOption "legacy icon spacing" // {
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
dynamicLighting = mkEnableOption "dynamic lighting";
|
|
||||||
adware = mkEnableOption "adware"; # Fuck you for displaying ads on an OS I fricking paid for!
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
showFileExt = mkOption {
|
||||||
valhalla.windows = {
|
type = types.bool;
|
||||||
setupUser.name = mkDefault (capitalize config.valhalla.setupUser.name);
|
description = "A value indicating whether file extensions should be displayed in Windows Explorer.";
|
||||||
dualboot.linuxPercentage = mkIf (!config.valhalla.windows.dualboot.enable) (mkDefault 0);
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
legacyIconSpacing = mkEnableOption "legacy icon spacing" // {
|
||||||
|
default = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
dynamicLighting = mkEnableOption "dynamic lighting";
|
||||||
|
adware = mkEnableOption "adware"; # Fuck you for displaying ads on an OS I fricking paid for!
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
valhalla.windows = {
|
||||||
|
setupUser.name = mkDefault (capitalize config.valhalla.setupUser.name);
|
||||||
|
dualboot.linuxPercentage = mkIf (!config.valhalla.windows.dualboot.enable) (mkDefault 0);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
{ pkgs, fetchFromGitLab, ... }: pkgs.stdenv.mkDerivation (
|
{ pkgs, fetchFromGitLab, ... }:
|
||||||
rec {
|
pkgs.stdenv.mkDerivation (rec {
|
||||||
pname = "archiso";
|
pname = "archiso";
|
||||||
version = "79";
|
version = "79";
|
||||||
|
|
||||||
src = fetchFromGitLab {
|
src = fetchFromGitLab {
|
||||||
domain = "gitlab.archlinux.org";
|
domain = "gitlab.archlinux.org";
|
||||||
owner = "archlinux";
|
owner = "archlinux";
|
||||||
repo = pname;
|
repo = pname;
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "5YNzHz9QEK+0x7Qjd2ajyE6gV1gD1MyI0ojZnuafmaw=";
|
sha256 = "5YNzHz9QEK+0x7Qjd2ajyE6gV1gD1MyI0ojZnuafmaw=";
|
||||||
};
|
};
|
||||||
|
|
||||||
dontPatchShebangs = true;
|
dontPatchShebangs = true;
|
||||||
preInstall = "export PREFIX=$out";
|
preInstall = "export PREFIX=$out";
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [
|
nativeBuildInputs = with pkgs; [
|
||||||
docutils
|
docutils
|
||||||
git
|
git
|
||||||
];
|
];
|
||||||
|
|
||||||
propagatedBuildInputs = with pkgs; [
|
propagatedBuildInputs = with pkgs; [
|
||||||
arch-install-scripts
|
arch-install-scripts
|
||||||
dosfstools
|
dosfstools
|
||||||
libisoburn
|
libisoburn
|
||||||
mtools
|
mtools
|
||||||
pacman
|
pacman
|
||||||
squashfsTools
|
squashfsTools
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
|
|
12
lib/text.nix
12
lib/text.nix
|
@ -1,9 +1,7 @@
|
||||||
{ lib, ... }: {
|
{ lib, ... }: {
|
||||||
capitalize = text:
|
capitalize = text:
|
||||||
let
|
let chars = lib.strings.stringToCharacters text;
|
||||||
chars = lib.strings.stringToCharacters text;
|
in lib.strings.concatStrings
|
||||||
in lib.strings.concatStrings (
|
([ (lib.strings.toUpper (builtins.elemAt chars 0)) ]
|
||||||
[(lib.strings.toUpper (builtins.elemAt chars 0))] ++
|
++ (lib.lists.drop 1 chars));
|
||||||
(lib.lists.drop 1 chars)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{ lib, ... }: {
|
{ lib, ... }: {
|
||||||
imports = [
|
imports = [ ../defaults.nix ];
|
||||||
../defaults.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
valhalla = {
|
valhalla = {
|
||||||
|
@ -18,7 +16,7 @@
|
||||||
|
|
||||||
users.manuel = {
|
users.manuel = {
|
||||||
microsoftAccount = true;
|
microsoftAccount = true;
|
||||||
groups = ["Administrators"];
|
groups = [ "Administrators" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -31,7 +29,7 @@
|
||||||
label = "OS";
|
label = "OS";
|
||||||
format = "ntfs";
|
format = "ntfs";
|
||||||
mountPoint = "/win";
|
mountPoint = "/win";
|
||||||
mountOptions = ["force"];
|
mountOptions = [ "force" ];
|
||||||
keepExisting = true;
|
keepExisting = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
imports = [
|
imports = [ ../config.nix ];
|
||||||
../config.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
valhalla.boot.label = "Arch";
|
valhalla.boot.label = "Arch";
|
||||||
|
|
|
@ -1,95 +1,89 @@
|
||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let fs = import ../../../../lib/modules/partition/fs.nix;
|
||||||
fs = import ../../../../lib/modules/partition/fs.nix;
|
in {
|
||||||
in {
|
imports = [ ../defaults.nix ];
|
||||||
imports = [
|
|
||||||
../defaults.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
valhalla = {
|
valhalla = {
|
||||||
partition = {
|
partition = {
|
||||||
os = {
|
os = {
|
||||||
partitions = {
|
partitions = {
|
||||||
Boot = {
|
Boot = {
|
||||||
index = 1;
|
index = 1;
|
||||||
type = "uefi";
|
type = "uefi";
|
||||||
size = "+1G";
|
size = "+1G";
|
||||||
format = fs.fat32;
|
format = fs.fat32;
|
||||||
mountPoint = config.valhalla.boot.efiMountPoint;
|
mountPoint = config.valhalla.boot.efiMountPoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
Swap = {
|
Swap = {
|
||||||
index = 2;
|
index = 2;
|
||||||
type = "swap";
|
type = "swap";
|
||||||
};
|
};
|
||||||
|
|
||||||
OS = {
|
OS = {
|
||||||
index = 3;
|
index = 3;
|
||||||
label = lib.mkDefault config.valhalla.boot.label;
|
label = lib.mkDefault config.valhalla.boot.label;
|
||||||
type = "linux";
|
type = "linux";
|
||||||
format = fs.ext4;
|
format = fs.ext4;
|
||||||
mountPoint = "/";
|
mountPoint = "/";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
timeZone = "Europe/Zurich";
|
timeZone = "Europe/Zurich";
|
||||||
keyMap = "de_CH-latin1";
|
keyMap = "de_CH-latin1";
|
||||||
keyboardLayout = "ch";
|
keyboardLayout = "ch";
|
||||||
|
|
||||||
i18n = {
|
i18n = {
|
||||||
localeSettings =
|
localeSettings = let defaultLocale = "en_US.UTF-8";
|
||||||
let defaultLocale = "en_US.UTF-8";
|
in {
|
||||||
in {
|
LANG = "de_CH.UTF-8";
|
||||||
LANG = "de_CH.UTF-8";
|
LANGUAGE = defaultLocale;
|
||||||
LANGUAGE = defaultLocale;
|
LC_MESSAGE = defaultLocale;
|
||||||
LC_MESSAGE = defaultLocale;
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
git = let defaultBranch = "main";
|
||||||
|
in {
|
||||||
|
inherit defaultBranch;
|
||||||
|
|
||||||
|
flow = {
|
||||||
|
mainBranch = defaultBranch;
|
||||||
|
devBranch = "dev";
|
||||||
};
|
};
|
||||||
|
|
||||||
git =
|
aliases = {
|
||||||
let
|
ahfange = "init";
|
||||||
defaultBranch = "main";
|
tuedezue = "add";
|
||||||
in {
|
beschuldig = "blame";
|
||||||
inherit defaultBranch;
|
zieh = "pull";
|
||||||
|
druck = "push";
|
||||||
flow = {
|
machnah = "clone";
|
||||||
mainBranch = defaultBranch;
|
hol = "fetch";
|
||||||
devBranch = "dev";
|
zwiigab = "branch";
|
||||||
};
|
buechiih = "commit";
|
||||||
|
eich = "rebase";
|
||||||
aliases = {
|
erd = "rebase";
|
||||||
ahfange = "init";
|
gahufwiifelde = "rebase";
|
||||||
tuedezue = "add";
|
vergliich = "diff";
|
||||||
beschuldig = "blame";
|
tuezemme = "merge";
|
||||||
zieh = "pull";
|
versorg = "stash";
|
||||||
druck = "push";
|
markier = "tag";
|
||||||
machnah = "clone";
|
pflueckoepfel = "cherry-pick";
|
||||||
hol = "fetch";
|
pflueckhimbeeri = "cherry-pick";
|
||||||
zwiigab = "branch";
|
buechuus = "checkout";
|
||||||
buechiih = "commit";
|
quaetsch = "merge --squash";
|
||||||
eich = "rebase";
|
pfudle = "push --force";
|
||||||
erd = "rebase";
|
beschuldigung = "blame";
|
||||||
gahufwiifelde = "rebase";
|
zwiigli = "branch";
|
||||||
vergliich = "diff";
|
tagebuech = "log";
|
||||||
tuezemme = "merge";
|
versteck = "stash";
|
||||||
versorg = "stash";
|
zuestand = "status";
|
||||||
markier = "tag";
|
markierig = "tag";
|
||||||
pflueckoepfel = "cherry-pick";
|
};
|
||||||
pflueckhimbeeri = "cherry-pick";
|
|
||||||
buechuus = "checkout";
|
|
||||||
quaetsch = "merge --squash";
|
|
||||||
pfudle = "push --force";
|
|
||||||
beschuldigung = "blame";
|
|
||||||
zwiigli = "branch";
|
|
||||||
tagebuech = "log";
|
|
||||||
versteck = "stash";
|
|
||||||
zuestand = "status";
|
|
||||||
markierig = "tag";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
imports = [
|
imports = [ ../config.nix ];
|
||||||
../config.nix
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
imports = [
|
imports = [ ../Generic/Arch/config.nix ];
|
||||||
../Generic/Arch/config.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
valhalla = {
|
valhalla = {
|
||||||
|
@ -13,9 +11,7 @@
|
||||||
surfaceBook = true;
|
surfaceBook = true;
|
||||||
xoneReceiver = true;
|
xoneReceiver = true;
|
||||||
|
|
||||||
components = [
|
components = [ "Logitech G903" ];
|
||||||
"Logitech G903"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
partition.os.deviceName = "nvme0n1";
|
partition.os.deviceName = "nvme0n1";
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
{ ... }: {
|
{ ... }: {
|
||||||
imports = [
|
imports = [ ../../../lib/modules/valhalla.nix ];
|
||||||
../../../lib/modules/valhalla.nix
|
|
||||||
];
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
valhalla = {
|
valhalla = {
|
||||||
|
@ -40,21 +38,20 @@
|
||||||
|
|
||||||
windows.users.manuel = {
|
windows.users.manuel = {
|
||||||
nextcloud = {
|
nextcloud = {
|
||||||
folderSyncs =
|
folderSyncs = let
|
||||||
let
|
localPath = "C:/tools/RetroArch-Win64";
|
||||||
localPath = "C:/tools/RetroArch-Win64";
|
remotePath = "/Saved Games/RetroArch";
|
||||||
remotePath = "/Saved Games/RetroArch";
|
in [
|
||||||
in [
|
{
|
||||||
{
|
remotePath = "${remotePath}/Saves";
|
||||||
remotePath = "${remotePath}/Saves";
|
localPath = "${localPath}/saves";
|
||||||
localPath = "${localPath}/saves";
|
virtualFiles = false;
|
||||||
virtualFiles = false;
|
}
|
||||||
}
|
{
|
||||||
{
|
remotePath = "${remotePath}/System";
|
||||||
remotePath = "${remotePath}/System";
|
localPath = "${localPath}/system";
|
||||||
localPath = "${localPath}/system";
|
}
|
||||||
}
|
];
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@ begin
|
||||||
source "$dir/../../Scripts/software.fish"
|
source "$dir/../../Scripts/software.fish"
|
||||||
|
|
||||||
function installSW -V dir
|
function installSW -V dir
|
||||||
set -l repo "linux-surface"
|
set -l repo linux-surface
|
||||||
set -l file "/etc/pacman.conf"
|
set -l file "/etc/pacman.conf"
|
||||||
|
|
||||||
curl -s https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
|
curl -s https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc \
|
||||||
|
@ -19,7 +19,7 @@ begin
|
||||||
"" \
|
"" \
|
||||||
"[$repo]" \
|
"[$repo]" \
|
||||||
"Server = https://pkg.surfacelinux.com/arch/"
|
"Server = https://pkg.surfacelinux.com/arch/"
|
||||||
end | sudo tee -a $file > /dev/null
|
end | sudo tee -a $file >/dev/null
|
||||||
|
|
||||||
sudo pacinst
|
sudo pacinst
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"# vim:set ft=sh" \
|
"# vim:set ft=sh" \
|
||||||
"MODULES+=(pinctrl_sunrisepoint surface_dtx)"
|
"MODULES+=(pinctrl_sunrisepoint surface_dtx)"
|
||||||
end | sudo tee /etc/mkinitcpio.conf.d/surface-book-2.conf > /dev/null
|
end | sudo tee /etc/mkinitcpio.conf.d/surface-book-2.conf >/dev/null
|
||||||
|
|
||||||
fish "$dir/../../../Common/Drivers/SurfaceBook2/main.fish" configure
|
fish "$dir/../../../Common/Drivers/SurfaceBook2/main.fish" configure
|
||||||
sudo systemctl enable surface-dtx-daemon.service
|
sudo systemctl enable surface-dtx-daemon.service
|
||||||
|
|
|
@ -3,7 +3,7 @@ begin
|
||||||
set -l dir (status dirname)
|
set -l dir (status dirname)
|
||||||
|
|
||||||
function getDeploymentScript -V dir
|
function getDeploymentScript -V dir
|
||||||
echo "$dir/../Scripts/deploy.fish";
|
echo "$dir/../Scripts/deploy.fish"
|
||||||
end
|
end
|
||||||
|
|
||||||
function initialize -V dir
|
function initialize -V dir
|
||||||
|
|
|
@ -14,7 +14,7 @@ begin
|
||||||
|
|
||||||
function installDrivers -S
|
function installDrivers -S
|
||||||
if isOSEnabled hardware.surfaceBook
|
if isOSEnabled hardware.surfaceBook
|
||||||
pacstrap -K "$mountDir" linux-firmware-marvell;
|
pacstrap -K "$mountDir" linux-firmware-marvell
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ begin
|
||||||
man-pages \
|
man-pages \
|
||||||
texinfo
|
texinfo
|
||||||
|
|
||||||
and genfstab -U "$mountDir" >> "$mountDir/etc/fstab"
|
and genfstab -U "$mountDir" >>"$mountDir/etc/fstab"
|
||||||
and arch-chroot "$mountDir" systemctl enable NetworkManager
|
and arch-chroot "$mountDir" systemctl enable NetworkManager
|
||||||
|
|
||||||
and if set -q timezone
|
and if set -q timezone
|
||||||
|
@ -72,13 +72,13 @@ begin
|
||||||
and begin
|
and begin
|
||||||
getOSConfig i18n.localeSettings --json | \
|
getOSConfig i18n.localeSettings --json | \
|
||||||
jq --raw-output '[keys[] as $key | "\($key)=\(.[$key])"] | join("\n")'
|
jq --raw-output '[keys[] as $key | "\($key)=\(.[$key])"] | join("\n")'
|
||||||
end | arch-chroot "$mountDir" tee /etc/locale.conf > /dev/null
|
end | arch-chroot "$mountDir" tee /etc/locale.conf >/dev/null
|
||||||
|
|
||||||
and if set -q keyMap
|
and if set -q keyMap
|
||||||
echo "KEYMAP=$keyMap" | arch-chroot "$mountDir" tee /etc/vconsole.conf > /dev/null
|
echo "KEYMAP=$keyMap" | arch-chroot "$mountDir" tee /etc/vconsole.conf >/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
and echo (getOSConfig hostname) | arch-chroot "$mountDir" tee /etc/hostname > /dev/null
|
and echo (getOSConfig hostname) | arch-chroot "$mountDir" tee /etc/hostname >/dev/null
|
||||||
|
|
||||||
and arch-chroot "$mountDir" mkinitcpio -P
|
and arch-chroot "$mountDir" mkinitcpio -P
|
||||||
and runHook installDrivers "Installing drivers..." || true
|
and runHook installDrivers "Installing drivers..." || true
|
||||||
|
@ -105,7 +105,7 @@ begin
|
||||||
"[Service]" \
|
"[Service]" \
|
||||||
"ExecStart=" \
|
"ExecStart=" \
|
||||||
"ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin root %I \$TERM"
|
"ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin root %I \$TERM"
|
||||||
end | arch-chroot "$mountDir" tee "$file" > /dev/null
|
end | arch-chroot "$mountDir" tee "$file" >/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
if not type -q getInstallerScript
|
if not type -q getInstallerScript
|
||||||
|
|
|
@ -3,7 +3,7 @@ function deploySoftware -d "Deploys a the specified software action" -a action
|
||||||
. "$dir/software.fish"
|
. "$dir/software.fish"
|
||||||
|
|
||||||
if [ -z "$action" ]
|
if [ -z "$action" ]
|
||||||
set action "install"
|
set action install
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l isInstall (
|
set -l isInstall (
|
||||||
|
|
|
@ -14,7 +14,7 @@ begin
|
||||||
set -l indicator "$pattern$patch"
|
set -l indicator "$pattern$patch"
|
||||||
set -l file /usr/share/applications/pennywise.desktop
|
set -l file /usr/share/applications/pennywise.desktop
|
||||||
|
|
||||||
if ! grep "$indicator" "$file" > /dev/null
|
if ! grep "$indicator" "$file" >/dev/null
|
||||||
sudo sed -i "/$pattern/s/$pattern/\0 --no-sandbox/" "$file"
|
sudo sed -i "/$pattern/s/$pattern/\0 --no-sandbox/" "$file"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@ begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"OPTIONS+=(!debug)" \
|
"OPTIONS+=(!debug)" \
|
||||||
"MAKEFLAGS=\"-j\$(nproc)\""
|
"MAKEFLAGS=\"-j\$(nproc)\""
|
||||||
end | sudo tee "$customFile" > /dev/null
|
end | sudo tee "$customFile" >/dev/null
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ begin
|
||||||
|
|
||||||
if not type -q logo-ls
|
if not type -q logo-ls
|
||||||
begin
|
begin
|
||||||
pushd "$contextRoot" > /dev/null
|
pushd "$contextRoot" >/dev/null
|
||||||
yay -G -f "$pkgName"
|
yay -G -f "$pkgName"
|
||||||
cd "$pkgName"
|
cd "$pkgName"
|
||||||
cp "$dirName/$patchName" .
|
cp "$dirName/$patchName" .
|
||||||
|
@ -27,7 +27,7 @@ begin
|
||||||
PKGBUILD
|
PKGBUILD
|
||||||
|
|
||||||
makepkg --noconfirm -si --force
|
makepkg --noconfirm -si --force
|
||||||
popd > /dev/null
|
popd >/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
rm -rf "$contextRoot"
|
rm -rf "$contextRoot"
|
||||||
|
|
|
@ -18,8 +18,8 @@ begin
|
||||||
' if [ "${HOOKS[i]}" = "kms" ]; then' \
|
' if [ "${HOOKS[i]}" = "kms" ]; then' \
|
||||||
' unset "HOOKS[i]"' \
|
' unset "HOOKS[i]"' \
|
||||||
" fi" \
|
" fi" \
|
||||||
"done"
|
done
|
||||||
end | sudo tee /etc/mkinitcpio.conf.d/nvidia.conf > /dev/null
|
end | sudo tee /etc/mkinitcpio.conf.d/nvidia.conf >/dev/null
|
||||||
|
|
||||||
fish "$dir/../../../Common/Software/nvidia-dkms/main.fish" configure
|
fish "$dir/../../../Common/Software/nvidia-dkms/main.fish" configure
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@ begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"#!/bin/bash" \
|
"#!/bin/bash" \
|
||||||
'export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"'
|
'export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"'
|
||||||
end | sudo tee "/etc/profile.d/openssh.sh" > /dev/null
|
end | sudo tee "/etc/profile.d/openssh.sh" >/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
runInstaller $argv
|
runInstaller $argv
|
||||||
|
|
|
@ -16,7 +16,7 @@ begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"#!/bin/bash" \
|
"#!/bin/bash" \
|
||||||
"export STEAM_FORCE_DESKTOPUI_SCALING=2.0"
|
"export STEAM_FORCE_DESKTOPUI_SCALING=2.0"
|
||||||
end | sudo tee /etc/profile.d/steam.sh > /dev/null
|
end | sudo tee /etc/profile.d/steam.sh >/dev/null
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ begin
|
||||||
end
|
end
|
||||||
|
|
||||||
function configureSW
|
function configureSW
|
||||||
echo "%wheel ALL=(ALL:ALL) ALL" | sudo tee /etc/sudoers.d/wheel > /dev/null
|
echo "%wheel ALL=(ALL:ALL) ALL" | sudo tee /etc/sudoers.d/wheel >/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
runInstaller $argv
|
runInstaller $argv
|
||||||
|
|
|
@ -11,7 +11,7 @@ begin
|
||||||
set homeDir ~"$user"
|
set homeDir ~"$user"
|
||||||
set flags -u "$user"
|
set flags -u "$user"
|
||||||
else
|
else
|
||||||
set homeDir "/etc/skel"
|
set homeDir /etc/skel
|
||||||
end
|
end
|
||||||
|
|
||||||
for bin in $bins
|
for bin in $bins
|
||||||
|
@ -19,7 +19,7 @@ begin
|
||||||
begin
|
begin
|
||||||
set -l file "$homeDir/.config/$bin-flags.conf"
|
set -l file "$homeDir/.config/$bin-flags.conf"
|
||||||
sudo $flags mkdir -p (dirname "$file")
|
sudo $flags mkdir -p (dirname "$file")
|
||||||
echo "--touch-events" | sudo $flags tee "$file" > /dev/null
|
echo --touch-events | sudo $flags tee "$file" >/dev/null
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,15 +5,15 @@ begin
|
||||||
|
|
||||||
function installSW
|
function installSW
|
||||||
yayinst (
|
yayinst (
|
||||||
# Waydroid prerequisite: https://wiki.archlinux.org/title/Waydroid#DKMS_modules
|
# Waydroid prerequisite: https://wiki.archlinux.org/title/Waydroid#DKMS_modules
|
||||||
) binder_linux-dkms \
|
) binder_linux-dkms \
|
||||||
waydroid (
|
waydroid (
|
||||||
# For installing ARM suppot on waydroid
|
# For installing ARM suppot on waydroid
|
||||||
) waydroid-script-git (
|
) waydroid-script-git (
|
||||||
# Clipboard support: https://wiki.archlinux.org/title/Waydroid#Failed_to_start_Clipboard_manager_service
|
# Clipboard support: https://wiki.archlinux.org/title/Waydroid#Failed_to_start_Clipboard_manager_service
|
||||||
) python-pyclip (
|
) python-pyclip (
|
||||||
# Wayland clipboard support: https://github.com/spyoungtech/pyclip?tab=readme-ov-file#linux
|
# Wayland clipboard support: https://github.com/spyoungtech/pyclip?tab=readme-ov-file#linux
|
||||||
) wl-clipboard
|
) wl-clipboard
|
||||||
end
|
end
|
||||||
|
|
||||||
runInstaller $argv
|
runInstaller $argv
|
||||||
|
|
|
@ -8,14 +8,14 @@ begin
|
||||||
set -l repo https://github.com/manuth/xone.git
|
set -l repo https://github.com/manuth/xone.git
|
||||||
yayinst cabextract
|
yayinst cabextract
|
||||||
|
|
||||||
if not dkms status --all | grep xone > /dev/null
|
if not dkms status --all | grep xone >/dev/null
|
||||||
git clone "$repo" "$contextRoot"
|
git clone "$repo" "$contextRoot"
|
||||||
sudo env -C "$contextRoot" ./install.sh --release
|
sudo env -C "$contextRoot" ./install.sh --release
|
||||||
sudo chmod -R a+rx /usr/src/xone*
|
sudo chmod -R a+rx /usr/src/xone*
|
||||||
yes "" | sudo xone-get-firmware.sh
|
yes "" | sudo xone-get-firmware.sh
|
||||||
end
|
end
|
||||||
|
|
||||||
rm -rf "$contextRoot" > /dev/null
|
rm -rf "$contextRoot" >/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
runInstaller $argv
|
runInstaller $argv
|
||||||
|
|
|
@ -9,9 +9,9 @@ begin
|
||||||
pacinst git
|
pacinst git
|
||||||
git clone https://aur.archlinux.org/yay.git "$contextRoot"
|
git clone https://aur.archlinux.org/yay.git "$contextRoot"
|
||||||
|
|
||||||
pushd "$contextRoot" > /dev/null
|
pushd "$contextRoot" >/dev/null
|
||||||
makepkg --noconfirm -si
|
makepkg --noconfirm -si
|
||||||
popd > /dev/null
|
popd >/dev/null
|
||||||
|
|
||||||
rm -rf "$contextRoot"
|
rm -rf "$contextRoot"
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,23 +8,22 @@ if [ (id -u) -eq 0 ]
|
||||||
set -l sudoConfig "/etc/sudoers.d/PortValhalla"
|
set -l sudoConfig "/etc/sudoers.d/PortValhalla"
|
||||||
rm ~/.bash_profile
|
rm ~/.bash_profile
|
||||||
|
|
||||||
runHook createUser || \
|
runHook createUser || begin
|
||||||
begin
|
echo "Creating setup user"
|
||||||
echo "Creating setup user";
|
|
||||||
|
|
||||||
and useradd \
|
and useradd \
|
||||||
--comment "PortValhalla Setup User" \
|
--comment "PortValhalla Setup User" \
|
||||||
--system \
|
--system \
|
||||||
--no-user-group \
|
--no-user-group \
|
||||||
--groups nix-users \
|
--groups nix-users \
|
||||||
--create-home \
|
--create-home \
|
||||||
--uid (getOSConfig setupUser.id --json) \
|
--uid (getOSConfig setupUser.id --json) \
|
||||||
"$name"
|
"$name"
|
||||||
end
|
end
|
||||||
|
|
||||||
and begin
|
and begin
|
||||||
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"
|
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"
|
||||||
end > "$sudoConfig"
|
end >"$sudoConfig"
|
||||||
|
|
||||||
and sudo --preserve-env --set-home --user "$name" "$INSTALLER_SCRIPT"
|
and sudo --preserve-env --set-home --user "$name" "$INSTALLER_SCRIPT"
|
||||||
rm "$sudoConfig"
|
rm "$sudoConfig"
|
||||||
|
|
|
@ -36,8 +36,8 @@ function runSetup
|
||||||
end
|
end
|
||||||
|
|
||||||
function runInOS -S
|
function runInOS -S
|
||||||
set -l script "/root/run_once"
|
set -l script /root/run_once
|
||||||
wrapScript $argv | chroot "$mountDir" tee "$script" > /dev/null
|
wrapScript $argv | chroot "$mountDir" tee "$script" >/dev/null
|
||||||
and runChroot "$mountDir" chmod +x "$script"
|
and runChroot "$mountDir" chmod +x "$script"
|
||||||
and runChroot "$mountDir" "$script"
|
and runChroot "$mountDir" "$script"
|
||||||
and runChroot "$mountDir" rm "$script"
|
and runChroot "$mountDir" rm "$script"
|
||||||
|
@ -50,7 +50,7 @@ function runSetup
|
||||||
end
|
end
|
||||||
|
|
||||||
echo "Partitioning drives..."
|
echo "Partitioning drives..."
|
||||||
and getOSConfig partition.script > "$script"
|
and getOSConfig partition.script >"$script"
|
||||||
and "$script"
|
and "$script"
|
||||||
and rm "$script"
|
and rm "$script"
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ function runSetup
|
||||||
"CONFIG_NAME=$(string escape "$CONFIG_NAME")" \
|
"CONFIG_NAME=$(string escape "$CONFIG_NAME")" \
|
||||||
(string escape $script))
|
(string escape $script))
|
||||||
|
|
||||||
end | runChroot "$mountDir" tee /root/.bash_profile > /dev/null
|
end | runChroot "$mountDir" tee /root/.bash_profile >/dev/null
|
||||||
|
|
||||||
and echo "Setup finished!"
|
and echo "Setup finished!"
|
||||||
and echo "This machine will reboot in 5 seconds..."
|
and echo "This machine will reboot in 5 seconds..."
|
||||||
|
|
|
@ -12,7 +12,7 @@ for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
||||||
getUserConfig "$name" "$config" $argv[2..]
|
getUserConfig "$name" "$config" $argv[2..]
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l groups (getUserInfo groups --apply 'builtins.concatStringsSep ","');
|
set -l groups (getUserInfo groups --apply 'builtins.concatStringsSep ","')
|
||||||
set -l displayName (getUserInfo displayName --json)
|
set -l displayName (getUserInfo displayName --json)
|
||||||
set -l shell (getUserInfo defaultShell --json)
|
set -l shell (getUserInfo defaultShell --json)
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
||||||
end
|
end
|
||||||
) "$name"
|
) "$name"
|
||||||
|
|
||||||
if echo "$shell" | jq --exit-status > /dev/null
|
if echo "$shell" | jq --exit-status >/dev/null
|
||||||
sudo chsh "$name" --shell (which (echo "$shell" | jq --raw-output))
|
sudo chsh "$name" --shell (which (echo "$shell" | jq --raw-output))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,8 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
return $false;
|
return $false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return $true;
|
return $true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -145,7 +146,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($ButtonSelector -is [string]) {
|
if ($ButtonSelector -is [string]) {
|
||||||
$selector = [OpenQA.Selenium.By]::CssSelector($ButtonSelector);
|
$selector = [OpenQA.Selenium.By]::CssSelector($ButtonSelector);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$selector = $ButtonSelector;
|
$selector = $ButtonSelector;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +158,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($element) {
|
if ($element) {
|
||||||
break;
|
break;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Start-Sleep 1;
|
Start-Sleep 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,7 +170,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($element) {
|
if ($element) {
|
||||||
$Browser.FindElement($selector).Click();
|
$Browser.FindElement($selector).Click();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Write-Error "Unable to find download button!";
|
Write-Error "Unable to find download button!";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,8 @@ $null = New-Module {
|
||||||
$profiles = & {
|
$profiles = & {
|
||||||
if (-not $IsWindows -or (Test-Command "wsl")) {
|
if (-not $IsWindows -or (Test-Command "wsl")) {
|
||||||
return Invoke-ConfigScript "getProfiles";
|
return Invoke-ConfigScript "getProfiles";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return Get-ChildItem "$PSScriptRoot/../../../.config" | ForEach-Object { Split-Path -LeafBase $_ };
|
return Get-ChildItem "$PSScriptRoot/../../../.config" | ForEach-Object { Split-Path -LeafBase $_ };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -36,7 +37,8 @@ $null = New-Module {
|
||||||
"Which profile do you wish to set up?";
|
"Which profile do you wish to set up?";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
"Please select a profile:";
|
"Please select a profile:";
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@ -51,7 +53,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($choice -eq $profiles.Count) {
|
if ($choice -eq $profiles.Count) {
|
||||||
exit;
|
exit;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$env:CONFIG_NAME = $profiles[$choice];
|
$env:CONFIG_NAME = $profiles[$choice];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +78,8 @@ $null = New-Module {
|
||||||
if (-not $IsWindows) {
|
if (-not $IsWindows) {
|
||||||
$escapedPath = (fish -c 'string escape $argv' "$scriptPath");
|
$escapedPath = (fish -c 'string escape $argv' "$scriptPath");
|
||||||
fish -c ". $escapedPath; $Script";
|
fish -c ". $escapedPath; $Script";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (-not $env:VALHALLA_FLAKE_ROOT) {
|
if (-not $env:VALHALLA_FLAKE_ROOT) {
|
||||||
$cleanup = { };
|
$cleanup = { };
|
||||||
$projectRoot = "$PSScriptRoot/../../..";
|
$projectRoot = "$PSScriptRoot/../../..";
|
||||||
|
@ -98,18 +102,21 @@ $null = New-Module {
|
||||||
|
|
||||||
if (-not $?) {
|
if (-not $?) {
|
||||||
Write-Error "The configuration could not be retrieved!";
|
Write-Error "The configuration could not be retrieved!";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$output;
|
$output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
if (-not ($output -and ($output | Test-Json))) {
|
if (-not ($output -and ($output | Test-Json))) {
|
||||||
Write-Error "The value ``$output`` is not valid JSON.";
|
Write-Error "The value ``$output`` is not valid JSON.";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$output | ConvertFrom-Json;
|
$output | ConvertFrom-Json;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$null;
|
$null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -189,7 +196,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ((Get-Users) -contains $UserName) {
|
if ((Get-Users) -contains $UserName) {
|
||||||
Get-Config "$(Get-UserConfigRoot).$UserName.$Name";
|
Get-Config "$(Get-UserConfigRoot).$UserName.$Name";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return $null;
|
return $null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,17 +21,18 @@ $null = New-Module {
|
||||||
$modules = @(
|
$modules = @(
|
||||||
@("PSScriptAnalyzer")
|
@("PSScriptAnalyzer")
|
||||||
) + (& {
|
) + (& {
|
||||||
if (-not $IsWindows) {
|
if (-not $IsWindows) {
|
||||||
@()
|
@();
|
||||||
} else {
|
}
|
||||||
@(
|
else {
|
||||||
@("KnownFolders"),
|
@(
|
||||||
@("PSWindowsUpdate"),
|
@("KnownFolders"),
|
||||||
@("LocalAccounts", $true),
|
@("PSWindowsUpdate"),
|
||||||
@("NuGet")
|
@("LocalAccounts", $true),
|
||||||
)
|
@("NuGet")
|
||||||
}
|
);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
for ($i = 0; $i -lt $modules.Count; $i++) {
|
for ($i = 0; $i -lt $modules.Count; $i++) {
|
||||||
if ($modules[$i] -is [string]) {
|
if ($modules[$i] -is [string]) {
|
||||||
|
@ -185,7 +186,7 @@ $null = New-Module {
|
||||||
$command = $args[0];
|
$command = $args[0];
|
||||||
$flags = ($args | Select-Object -Skip 1);
|
$flags = ($args | Select-Object -Skip 1);
|
||||||
& $command @flags;
|
& $command @flags;
|
||||||
} -args $ArgumentList
|
} -args $ArgumentList;
|
||||||
}
|
}
|
||||||
|
|
||||||
New-Alias -Force "sudo" -Scope Global Invoke-Sudo;
|
New-Alias -Force "sudo" -Scope Global Invoke-Sudo;
|
||||||
|
@ -284,12 +285,13 @@ $null = New-Module {
|
||||||
|
|
||||||
$initialized = $true;
|
$initialized = $true;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($taskPending) {
|
if ($taskPending) {
|
||||||
Start-OneShot;
|
Start-OneShot;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
& $Action;
|
& $Action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,19 +33,19 @@ function ConvertTo-Injection {
|
||||||
#>
|
#>
|
||||||
function Write-PSScript {
|
function Write-PSScript {
|
||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[Parameter(ParameterSetName="Common")]
|
[Parameter(ParameterSetName = "Common")]
|
||||||
[Parameter(ParameterSetName="Replace")]
|
[Parameter(ParameterSetName = "Replace")]
|
||||||
[Parameter(ParameterSetName="Append")]
|
[Parameter(ParameterSetName = "Append")]
|
||||||
[string] $FileName,
|
[string] $FileName,
|
||||||
[Parameter(Mandatory=$true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[Parameter(ParameterSetName="Common")]
|
[Parameter(ParameterSetName = "Common")]
|
||||||
[Parameter(ParameterSetName="Replace")]
|
[Parameter(ParameterSetName = "Replace")]
|
||||||
[Parameter(ParameterSetName="Append")]
|
[Parameter(ParameterSetName = "Append")]
|
||||||
[string] $Script,
|
[string] $Script,
|
||||||
[Parameter(ParameterSetName="Replace", Mandatory=$true)]
|
[Parameter(ParameterSetName = "Replace", Mandatory = $true)]
|
||||||
[switch] $Replace,
|
[switch] $Replace,
|
||||||
[Parameter(ParameterSetName="Append", Mandatory=$true)]
|
[Parameter(ParameterSetName = "Append", Mandatory = $true)]
|
||||||
[switch] $Append
|
[switch] $Append
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -61,10 +61,12 @@ function Write-PSScript {
|
||||||
|
|
||||||
if ($exists -and ($Append.IsPresent)) {
|
if ($exists -and ($Append.IsPresent)) {
|
||||||
Add-Content -Force $FileName "`n$content";
|
Add-Content -Force $FileName "`n$content";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if ((-not $exists) -or $Replace.IsPresent) {
|
if ((-not $exists) -or $Replace.IsPresent) {
|
||||||
Set-Content -Force $FileName $content;
|
Set-Content -Force $FileName $content;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Write-Host "The file ``$FileName`` already exists!";
|
Write-Host "The file ``$FileName`` already exists!";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,8 @@ $null = New-Module {
|
||||||
[InstallerAction] $Action = & {
|
[InstallerAction] $Action = & {
|
||||||
if ($null -ne $Action) {
|
if ($null -ne $Action) {
|
||||||
$Action;
|
$Action;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
[InstallerAction]::Install;
|
[InstallerAction]::Install;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -47,7 +48,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($null -ne $Name) {
|
if ($null -ne $Name) {
|
||||||
$DisplayName = "``$Name``";
|
$DisplayName = "``$Name``";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$DisplayName = "unknown software";
|
$DisplayName = "unknown software";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,14 +57,14 @@ $null = New-Module {
|
||||||
$Context ??= @{ };
|
$Context ??= @{ };
|
||||||
|
|
||||||
$argumentList = @{
|
$argumentList = @{
|
||||||
name = $Name;
|
name = $Name;
|
||||||
installer = $installHandler;
|
installer = $installHandler;
|
||||||
arguments = $Arguments;
|
arguments = $Arguments;
|
||||||
context = $Context;
|
context = $Context;
|
||||||
};
|
};
|
||||||
|
|
||||||
switch ($Action) {
|
switch ($Action) {
|
||||||
([InstallerAction]::Backup) {
|
([InstallerAction]::Backup) {
|
||||||
if ($Backup) {
|
if ($Backup) {
|
||||||
Write-Host "Backing up $DisplayName…";
|
Write-Host "Backing up $DisplayName…";
|
||||||
& $Backup @argumentList;
|
& $Backup @argumentList;
|
||||||
|
|
|
@ -6,7 +6,7 @@ end
|
||||||
function selectProfile -S -a result
|
function selectProfile -S -a result
|
||||||
source "$(status dirname)/../../../lib/modules/partition/select.fish"
|
source "$(status dirname)/../../../lib/modules/partition/select.fish"
|
||||||
set -l file (mktemp)
|
set -l file (mktemp)
|
||||||
set -l header "NAME"
|
set -l header NAME
|
||||||
set -l profiles
|
set -l profiles
|
||||||
|
|
||||||
getProfiles | jq ".[]" --raw-output0 | string split0 | while read profile
|
getProfiles | jq ".[]" --raw-output0 | string split0 | while read profile
|
||||||
|
@ -23,7 +23,7 @@ function selectProfile -S -a result
|
||||||
end
|
end
|
||||||
|
|
||||||
function getProfiles -S
|
function getProfiles -S
|
||||||
source "$(status dirname)/eval-flake.fish";
|
source "$(status dirname)/eval-flake.fish"
|
||||||
evalFlake "" "" --apply "builtins.attrNames" --json
|
evalFlake "" "" --apply "builtins.attrNames" --json
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -48,12 +48,12 @@ function getUsers -S
|
||||||
getAttributes "$(getOSConfigRoot).users"
|
getAttributes "$(getOSConfigRoot).users"
|
||||||
end
|
end
|
||||||
|
|
||||||
function getUserConfig -S -a name property
|
function getUserConfig -S -a name property
|
||||||
getOSConfig "users.$name.$property" $argv[3..]
|
getOSConfig "users.$name.$property" $argv[3..]
|
||||||
end
|
end
|
||||||
|
|
||||||
function isSet -S -a property
|
function isSet -S -a property
|
||||||
not test "$(getConfig "$property" --json)" = "null"
|
not test "$(getConfig "$property" --json)" = null
|
||||||
end
|
end
|
||||||
|
|
||||||
function isOSSet -S -a property
|
function isOSSet -S -a property
|
||||||
|
@ -65,7 +65,7 @@ function isUserSet -S -a name property
|
||||||
end
|
end
|
||||||
|
|
||||||
function isEnabled -S -a property
|
function isEnabled -S -a property
|
||||||
getConfig "$property" --json | jq --exit-status > /dev/null
|
getConfig "$property" --json | jq --exit-status >/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
function isOSEnabled -S -a property
|
function isOSEnabled -S -a property
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#!/bin/env fish
|
#!/bin/env fish
|
||||||
function evalFlake --argument-names config property
|
function evalFlake --argument-names config property
|
||||||
set -l argv $argv[3..]
|
set -l argv $argv[3..]
|
||||||
set -l flakePath "$(realpath (status dirname))/../../..";
|
set -l flakePath "$(realpath (status dirname))/../../.."
|
||||||
argparse --ignore-unknown "apply=" "json" -- $argv
|
argparse --ignore-unknown "apply=" json -- $argv
|
||||||
|
|
||||||
if [ -z "$_flag_json" ]
|
if [ -z "$_flag_json" ]
|
||||||
set -a argv --raw
|
set -a argv --raw
|
||||||
|
@ -24,7 +24,7 @@ function evalFlake --argument-names config property
|
||||||
end
|
end
|
||||||
|
|
||||||
PROPERTY="$property" \
|
PROPERTY="$property" \
|
||||||
nix eval --impure --extra-experimental-features "nix-command flakes" \
|
nix eval --impure --extra-experimental-features "nix-command flakes" \
|
||||||
--apply "$_flag_apply" \
|
--apply "$_flag_apply" \
|
||||||
"$flakePath#valhalla$config" \
|
"$flakePath#valhalla$config" \
|
||||||
$argv
|
$argv
|
||||||
|
|
|
@ -20,7 +20,7 @@ begin
|
||||||
"#!$shellBin" \
|
"#!$shellBin" \
|
||||||
"# $title" \
|
"# $title" \
|
||||||
(processContent "$content")
|
(processContent "$content")
|
||||||
end > "$file"
|
end >"$file"
|
||||||
|
|
||||||
sudo install -Dm755 "$file" "$profileRoot/$name.$extension"
|
sudo install -Dm755 "$file" "$profileRoot/$name.$extension"
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,23 +19,23 @@ begin
|
||||||
function runInstallerAction -V dir -a name action
|
function runInstallerAction -V dir -a name action
|
||||||
source "$dir/config.fish"
|
source "$dir/config.fish"
|
||||||
|
|
||||||
if [ -z "$action" ] || [ "$action" = "install" ]
|
if [ -z "$action" ] || [ "$action" = install ]
|
||||||
if functions -q installSW
|
if functions -q installSW
|
||||||
echo "Installing `$name`..."
|
echo "Installing `$name`..."
|
||||||
installSW $argv[3..]
|
installSW $argv[3..]
|
||||||
end
|
end
|
||||||
|
|
||||||
runInstallerAction $name "configure"
|
runInstallerAction $name configure
|
||||||
|
|
||||||
if not isConfigured || [ "$USER" != (getConfig "valhalla.setupUser.name") ]
|
if not isConfigured || [ "$USER" != (getConfig "valhalla.setupUser.name") ]
|
||||||
runInstallerAction $name userConfig
|
runInstallerAction $name userConfig
|
||||||
end
|
end
|
||||||
else if [ "$action" = "configure" ]
|
else if [ "$action" = configure ]
|
||||||
if functions -q configureSW
|
if functions -q configureSW
|
||||||
echo "Configuring `$name`..."
|
echo "Configuring `$name`..."
|
||||||
configureSW $argv[3..]
|
configureSW $argv[3..]
|
||||||
end
|
end
|
||||||
else if [ "$action" = "userConfig" ]
|
else if [ "$action" = userConfig ]
|
||||||
set -l user $argv[3]
|
set -l user $argv[3]
|
||||||
|
|
||||||
if [ -z "$user" ]
|
if [ -z "$user" ]
|
||||||
|
|
|
@ -6,7 +6,7 @@ function waitNetwork -a witness
|
||||||
function testNetwork
|
function testNetwork
|
||||||
# Ping digitalcourage DNS server
|
# Ping digitalcourage DNS server
|
||||||
# https://digitalcourage.de/
|
# https://digitalcourage.de/
|
||||||
ping -q -c1 5.9.164.112 > /dev/null
|
ping -q -c1 5.9.164.112 >/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
if [ -z "$witness" ]
|
if [ -z "$witness" ]
|
||||||
|
@ -16,7 +16,7 @@ function waitNetwork -a witness
|
||||||
set -l pid "$last_pid"
|
set -l pid "$last_pid"
|
||||||
|
|
||||||
function witnessHandler -V codeFile --on-process-exit "$pid" -a event pid code
|
function witnessHandler -V codeFile --on-process-exit "$pid" -a event pid code
|
||||||
echo "$code" > "$codeFile"
|
echo "$code" >"$codeFile"
|
||||||
|
|
||||||
if [ "$code" -gt 0 ]
|
if [ "$code" -gt 0 ]
|
||||||
echo "Unable to connect to the internet!"
|
echo "Unable to connect to the internet!"
|
||||||
|
@ -34,13 +34,13 @@ function waitNetwork -a witness
|
||||||
set x (math $x + 1)
|
set x (math $x + 1)
|
||||||
|
|
||||||
if testNetwork
|
if testNetwork
|
||||||
tmux kill-session &> /dev/null
|
tmux kill-session &>/dev/null
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
not tmux list-sessions &> /dev/null
|
not tmux list-sessions &>/dev/null
|
||||||
or test "$x" -gt 10
|
or test "$x" -gt 10
|
||||||
and begin
|
and begin
|
||||||
tmux kill-session &> /dev/null
|
tmux kill-session &>/dev/null
|
||||||
exit 1
|
exit 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
function installExtension -d "Installs a Chromium extension for the browser with the specified information" -a name dir bin policyDir extensionDir
|
function installExtension -d "Installs a Chromium extension for the browser with the specified information" -a name dir bin policyDir extensionDir
|
||||||
[ -n "$bin" ]
|
[ -n "$bin" ]
|
||||||
or set -l bin "google-chrome-stable"
|
or set -l bin google-chrome-stable
|
||||||
[ -n "$policyDir" ]
|
[ -n "$policyDir" ]
|
||||||
or set -l policyDir "/opt/google/chrome/extensions"
|
or set -l policyDir /opt/google/chrome/extensions
|
||||||
[ -n "$extensionDir" ]
|
[ -n "$extensionDir" ]
|
||||||
or set -l extensionDir "/usr/local/share/chromium-extensions"
|
or set -l extensionDir /usr/local/share/chromium-extensions
|
||||||
|
|
||||||
set -l keyFile "$dir.pem"
|
set -l keyFile "$dir.pem"
|
||||||
set -l extensionFile "$dir.crx"
|
set -l extensionFile "$dir.crx"
|
||||||
set -l manifestFile "$dir/manifest.json"
|
set -l manifestFile "$dir/manifest.json"
|
||||||
set -l destination "$extensionDir/$name.crx"
|
set -l destination "$extensionDir/$name.crx"
|
||||||
|
|
||||||
rm "$keyFile" &> /dev/null
|
rm "$keyFile" &>/dev/null
|
||||||
$bin --pack-extension="$dir"
|
$bin --pack-extension="$dir"
|
||||||
|
|
||||||
# Tamper manifest file
|
# Tamper manifest file
|
||||||
begin
|
begin
|
||||||
set -l manifest (cat "$manifestFile" | KEY=(openssl rsa -in "$keyFile" -pubout -outform DER | openssl base64 -A) jq ". + { key: env.KEY }")
|
set -l manifest (cat "$manifestFile" | KEY=(openssl rsa -in "$keyFile" -pubout -outform DER | openssl base64 -A) jq ". + { key: env.KEY }")
|
||||||
echo "$manifest" > "$manifestFile"
|
echo "$manifest" >"$manifestFile"
|
||||||
$bin --pack-extension="$dir" --pack-extension-key="$keyFile"
|
$bin --pack-extension="$dir" --pack-extension-key="$keyFile"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ function installExtension -d "Installs a Chromium extension for the browser with
|
||||||
|
|
||||||
# Install and configure extension
|
# Install and configure extension
|
||||||
begin
|
begin
|
||||||
set -l property "external_crx"
|
set -l property external_crx
|
||||||
sudo mkdir -p "$extensionDir"
|
sudo mkdir -p "$extensionDir"
|
||||||
sudo cp "$extensionFile" "$destination"
|
sudo cp "$extensionFile" "$destination"
|
||||||
sudo chmod -R a+rx "$extensionDir"
|
sudo chmod -R a+rx "$extensionDir"
|
||||||
|
@ -40,10 +40,10 @@ function installExtension -d "Installs a Chromium extension for the browser with
|
||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
echo "null" | \
|
echo null | \
|
||||||
FILE="$destination" \
|
FILE="$destination" \
|
||||||
VERSION="$extVersion" \
|
VERSION="$extVersion" \
|
||||||
jq '{ external_crx: env.FILE, external_version: env.VERSION }'
|
jq '{ external_crx: env.FILE, external_version: env.VERSION }'
|
||||||
end | sudo tee "$policyDir/$id.json" > /dev/null
|
end | sudo tee "$policyDir/$id.json" >/dev/null
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
if [ "$XDG_SESSION_TYPE" == "wayland" ]
|
if [ "$XDG_SESSION_TYPE" == "wayland" ]; then
|
||||||
then
|
|
||||||
export MOZ_ENABLE_WAYLAND=1
|
export MOZ_ENABLE_WAYLAND=1
|
||||||
else
|
else
|
||||||
export MOZ_USE_XINPUT2=1
|
export MOZ_USE_XINPUT2=1
|
||||||
|
|
|
@ -6,7 +6,7 @@ function addInputConfig -a vendorID productID name
|
||||||
set statements (cat)
|
set statements (cat)
|
||||||
end
|
end
|
||||||
|
|
||||||
if not cat $file | grep "\\[$name\\]" &> /dev/null
|
if not cat $file | grep "\\[$name\\]" &>/dev/null
|
||||||
begin
|
begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
(if [ -f $file ] && [ -n (cat $file) ]
|
(if [ -f $file ] && [ -n (cat $file) ]
|
||||||
|
@ -14,6 +14,6 @@ function addInputConfig -a vendorID productID name
|
||||||
end) \
|
end) \
|
||||||
"[Libinput][$vendorID][$productID][$name]" \
|
"[Libinput][$vendorID][$productID][$name]" \
|
||||||
"$statements"
|
"$statements"
|
||||||
end | sudo tee $file > /dev/null
|
end | sudo tee $file >/dev/null
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -15,7 +15,7 @@ Start-SoftwareInstaller @args `
|
||||||
"# Oh My Posh!",
|
"# Oh My Posh!",
|
||||||
(Get-ScriptInitializer "oh-my-posh init pwsh"),
|
(Get-ScriptInitializer "oh-my-posh init pwsh"),
|
||||||
(Get-ScriptInitializer "oh-my-posh completion powershell")
|
(Get-ScriptInitializer "oh-my-posh completion powershell")
|
||||||
) -join [System.Environment]::NewLine)
|
) -join [System.Environment]::NewLine);
|
||||||
} `
|
} `
|
||||||
-UserConfigurator {
|
-UserConfigurator {
|
||||||
param(
|
param(
|
||||||
|
@ -32,7 +32,7 @@ Start-SoftwareInstaller @args `
|
||||||
if ($IsWindows) {
|
if ($IsWindows) {
|
||||||
sudo -u "$user" pwsh -c 'Write-Host $env:AppData';
|
sudo -u "$user" pwsh -c 'Write-Host $env:AppData';
|
||||||
} else {
|
} else {
|
||||||
sudo -u "$user" bash -c 'realpath ~/.config'
|
sudo -u "$user" bash -c 'realpath ~/.config';
|
||||||
}
|
}
|
||||||
})/oh-my-posh";
|
})/oh-my-posh";
|
||||||
|
|
||||||
|
@ -43,7 +43,8 @@ Start-SoftwareInstaller @args `
|
||||||
& {
|
& {
|
||||||
if ($IsWindows) {
|
if ($IsWindows) {
|
||||||
wsl cat $info.source | Out-String;
|
wsl cat $info.source | Out-String;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Get-Content -Raw $info.source;
|
Get-Content -Raw $info.source;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -52,7 +53,7 @@ Start-SoftwareInstaller @args `
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($additionalTheme in (Get-UserConfig -UserName "$user" "oh-my-posh.additionalThemes")) {
|
foreach ($additionalTheme in (Get-UserConfig -UserName "$user" "oh-my-posh.additionalThemes")) {
|
||||||
Write-Host "creating theme $additionalTheme"
|
Write-Host "creating theme $additionalTheme";
|
||||||
$null = New-Theme $additionalTheme;
|
$null = New-Theme $additionalTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +66,8 @@ Start-SoftwareInstaller @args `
|
||||||
|
|
||||||
if ($IsWindows) {
|
if ($IsWindows) {
|
||||||
[System.Environment]::SetEnvironmentVariable($varName, "%AppData%/$([System.IO.Path]::GetRelativePath($env:AppData, $theme))", "User");
|
[System.Environment]::SetEnvironmentVariable($varName, "%AppData%/$([System.IO.Path]::GetRelativePath($env:AppData, $theme))", "User");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
. "$PSScriptRoot/../aliae/Manage.ps1";
|
. "$PSScriptRoot/../aliae/Manage.ps1";
|
||||||
$value = $theme;
|
$value = $theme;
|
||||||
$relativePath = sudo -u "$user" fish -c 'realpath --relative-base ~ $argv' $theme;
|
$relativePath = sudo -u "$user" fish -c 'realpath --relative-base ~ $argv' $theme;
|
||||||
|
|
|
@ -12,13 +12,13 @@ begin
|
||||||
'set -x POSH_THEME $POSH_THEME' \
|
'set -x POSH_THEME $POSH_THEME' \
|
||||||
"oh-my-posh init fish | source" \
|
"oh-my-posh init fish | source" \
|
||||||
"oh-my-posh completion fish | source"
|
"oh-my-posh completion fish | source"
|
||||||
end | installFishProfile "oh-my-posh"
|
end | installFishProfile oh-my-posh
|
||||||
|
|
||||||
begin
|
begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
'eval "$(oh-my-posh init bash)"' \
|
'eval "$(oh-my-posh init bash)"' \
|
||||||
'eval "$(oh-my-posh completion bash)"'
|
'eval "$(oh-my-posh completion bash)"'
|
||||||
end | installBashProfile "oh-my-posh"
|
end | installBashProfile oh-my-posh
|
||||||
|
|
||||||
sudo -HE pwsh "$dir/Manage.ps1" Configure
|
sudo -HE pwsh "$dir/Manage.ps1" Configure
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,7 +9,8 @@ Start-SoftwareInstaller @args `
|
||||||
|
|
||||||
if (-not $IsWindows) {
|
if (-not $IsWindows) {
|
||||||
$globalDir = '"/etc/powershell/conf.d"';
|
$globalDir = '"/etc/powershell/conf.d"';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$globalDir = '"$env:ProgramData/PowerShell/conf.d"';
|
$globalDir = '"$env:ProgramData/PowerShell/conf.d"';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,22 +18,22 @@ Start-SoftwareInstaller @args `
|
||||||
Add-PowerShellProfileStatement `
|
Add-PowerShellProfileStatement `
|
||||||
-DefaultUser `
|
-DefaultUser `
|
||||||
-Script (@(
|
-Script (@(
|
||||||
$indicator,
|
$indicator,
|
||||||
"`$globalDir = $globalDir",
|
"`$globalDir = $globalDir",
|
||||||
({
|
({
|
||||||
$profileRoot = Split-Path -Parent $PROFILE;
|
$profileRoot = Split-Path -Parent $PROFILE;
|
||||||
|
|
||||||
$profilePaths = @(
|
$profilePaths = @(
|
||||||
"$profileRoot/conf.d/*.ps1",
|
"$profileRoot/conf.d/*.ps1",
|
||||||
"$globalDir/*.ps1"
|
"$globalDir/*.ps1"
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach ($profilePath in $profilePaths) {
|
foreach ($profilePath in $profilePaths) {
|
||||||
if (Test-Path $profilePath) {
|
if (Test-Path $profilePath) {
|
||||||
Get-Item $profilePath | ForEach-Object { . $_; };
|
Get-Item $profilePath | ForEach-Object { . $_; };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}).ToString()) -join "`n") `
|
||||||
}).ToString()) -join "`n") `
|
-Append;
|
||||||
-Append;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -24,11 +24,11 @@ $null = New-Module {
|
||||||
)
|
)
|
||||||
|
|
||||||
@{
|
@{
|
||||||
context = @{
|
context = @{
|
||||||
name = $Name;
|
name = $Name;
|
||||||
nativeOnly = $NativeOnly;
|
nativeOnly = $NativeOnly;
|
||||||
};
|
};
|
||||||
installer = {
|
installer = {
|
||||||
param(
|
param(
|
||||||
[hashtable] $Context
|
[hashtable] $Context
|
||||||
)
|
)
|
||||||
|
|
|
@ -53,16 +53,19 @@ $null = New-Module {
|
||||||
if ($IsWindows) {
|
if ($IsWindows) {
|
||||||
# ToDo Change to "PowerShell"
|
# ToDo Change to "PowerShell"
|
||||||
$configRoot = "$env:ProgramData";
|
$configRoot = "$env:ProgramData";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$configRoot = "/etc";
|
$configRoot = "/etc";
|
||||||
}
|
}
|
||||||
|
|
||||||
$profiles = @("$configRoot/powershell/.");
|
$profiles = @("$configRoot/powershell/.");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if ($DefaultUser) {
|
if ($DefaultUser) {
|
||||||
if (-not $IsWindows) {
|
if (-not $IsWindows) {
|
||||||
$HomeDir = "/etc/skel";
|
$HomeDir = "/etc/skel";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$HomeDir = "C:/Users/Default";
|
$HomeDir = "C:/Users/Default";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,7 +92,7 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
$profiles | ForEach-Object {
|
$profiles | ForEach-Object {
|
||||||
$arguments = @{};
|
$arguments = @{ };
|
||||||
|
|
||||||
if ($Replace.IsPresent) {
|
if ($Replace.IsPresent) {
|
||||||
$null = $arguments.Add("Replace", $Replace);
|
$null = $arguments.Add("Replace", $Replace);
|
||||||
|
@ -114,7 +117,7 @@ $null = New-Module {
|
||||||
#>
|
#>
|
||||||
function Get-ScriptInitializer {
|
function Get-ScriptInitializer {
|
||||||
param (
|
param (
|
||||||
[Parameter(Position=0, Mandatory=$true)]
|
[Parameter(Position = 0, Mandatory = $true)]
|
||||||
$Initializer
|
$Initializer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ begin
|
||||||
|
|
||||||
function configureSW
|
function configureSW
|
||||||
begin
|
begin
|
||||||
sudo virsh net-info default | grep "^Active:\s*yes\$" > /dev/null
|
sudo virsh net-info default | grep "^Active:\s*yes\$" >/dev/null
|
||||||
end || sudo virsh net-start default
|
end || sudo virsh net-start default
|
||||||
|
|
||||||
and sudo virsh net-autostart default
|
and sudo virsh net-autostart default
|
||||||
|
|
|
@ -24,7 +24,8 @@ Start-SoftwareInstaller @args `
|
||||||
$userPath = & {
|
$userPath = & {
|
||||||
if ($env:ALIAE_CONFIG) {
|
if ($env:ALIAE_CONFIG) {
|
||||||
$env:ALIAE_CONFIG;
|
$env:ALIAE_CONFIG;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
"~/.aliae.yaml";
|
"~/.aliae.yaml";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -23,11 +23,11 @@ $null = New-Module {
|
||||||
|
|
||||||
Edit-Config `
|
Edit-Config `
|
||||||
-Variables @{
|
-Variables @{
|
||||||
Name = "$Name";
|
Name = "$Name";
|
||||||
Value = "$Value";
|
Value = "$Value";
|
||||||
} `
|
} `
|
||||||
".alias |= [((. // [])[] | select(.name != env.Name))] + [{ name: env.Name, value: env.Value }]" `
|
-User $User `
|
||||||
-User $User;
|
".alias |= [((. // [])[] | select(.name != env.Name))] + [{ name: env.Name, value: env.Value }]";
|
||||||
}
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
@ -49,11 +49,11 @@ $null = New-Module {
|
||||||
|
|
||||||
Edit-Config `
|
Edit-Config `
|
||||||
-Variables @{
|
-Variables @{
|
||||||
Name = "$Name";
|
Name = "$Name";
|
||||||
Value = "$Value";
|
Value = "$Value";
|
||||||
} `
|
} `
|
||||||
".env |= [((. // [])[] | select(.name != env.Name))] + [{ name: env.Name, value: env.Value }]" `
|
-User $User `
|
||||||
-User $User;
|
".env |= [((. // [])[] | select(.name != env.Name))] + [{ name: env.Name, value: env.Value }]";
|
||||||
}
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
@ -78,7 +78,8 @@ $null = New-Module {
|
||||||
if ($User) {
|
if ($User) {
|
||||||
$flags = @("-u", "$User")
|
$flags = @("-u", "$User")
|
||||||
$path = "$($IsWindows ? "~" : "$(sudo @flags bash -c "realpath ~")")/.aliae.yaml";
|
$path = "$($IsWindows ? "~" : "$(sudo @flags bash -c "realpath ~")")/.aliae.yaml";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$path = Get-GlobalConfigPath;
|
$path = Get-GlobalConfigPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,5 +98,5 @@ $null = New-Module {
|
||||||
} | Receive-Job -Wait;
|
} | Receive-Job -Wait;
|
||||||
}
|
}
|
||||||
|
|
||||||
Export-ModuleMember -Function Add-Alias,Add-EnvironmentVariable;
|
Export-ModuleMember -Function Add-Alias, Add-EnvironmentVariable;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,37 +6,37 @@ begin
|
||||||
function configureSW -V dir
|
function configureSW -V dir
|
||||||
source "$dir/../bash/profile.fish"
|
source "$dir/../bash/profile.fish"
|
||||||
source "$dir/../fish/profile.fish"
|
source "$dir/../fish/profile.fish"
|
||||||
set -l file (pwsh -CommandWithArgs '. $args[0]; Get-GlobalConfigPath' "$dir/Constants.ps1");
|
set -l file (pwsh -CommandWithArgs '. $args[0]; Get-GlobalConfigPath' "$dir/Constants.ps1")
|
||||||
sudo install -Dm644 "$dir/aliae.yml" "$file"
|
sudo install -Dm644 "$dir/aliae.yml" "$file"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"if [ -f $(string escape $file) ]" \
|
"if [ -f $(string escape $file) ]" \
|
||||||
'then' \
|
then \
|
||||||
" eval \"\$(aliae init bash --config $(string escape $file))\"" \
|
" eval \"\$(aliae init bash --config $(string escape $file))\"" \
|
||||||
'fi' \
|
fi \
|
||||||
'' \
|
'' \
|
||||||
'if [ -n "$ALIAE_CONFIG" ] && [ -f "$ALIAE_CONFIG" ] || [ -f ~/.aliae.yaml ]' \
|
'if [ -n "$ALIAE_CONFIG" ] && [ -f "$ALIAE_CONFIG" ] || [ -f ~/.aliae.yaml ]' \
|
||||||
'then' \
|
then \
|
||||||
' eval "$(aliae init bash)"' \
|
' eval "$(aliae init bash)"' \
|
||||||
'fi' \
|
fi \
|
||||||
'' \
|
'' \
|
||||||
'eval "$(aliae completion bash)"'
|
'eval "$(aliae completion bash)"'
|
||||||
end | installBashProfile "aliae" "aliae"
|
end | installBashProfile aliae aliae
|
||||||
|
|
||||||
if type -q fish
|
if type -q fish
|
||||||
begin
|
begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"if [ -f $(string escape $file) ]" \
|
"if [ -f $(string escape $file) ]" \
|
||||||
" eval \"\$(aliae init bash --config $(string escape $file))\"" \
|
" eval \"\$(aliae init bash --config $(string escape $file))\"" \
|
||||||
'end' \
|
end \
|
||||||
'' \
|
'' \
|
||||||
'if [ -n "$ALIAE_CONFIG" ] && [ -f "$ALIAE_CONFIG" ] || [ -f ~/.aliae.yaml ]' \
|
'if [ -n "$ALIAE_CONFIG" ] && [ -f "$ALIAE_CONFIG" ] || [ -f ~/.aliae.yaml ]' \
|
||||||
' aliae init fish | source' \
|
' aliae init fish | source' \
|
||||||
'end' \
|
end \
|
||||||
'' \
|
'' \
|
||||||
"aliae completion fish | source"
|
"aliae completion fish | source"
|
||||||
end | installFishProfile "aliae" "aliae"
|
end | installFishProfile aliae aliae
|
||||||
end
|
end
|
||||||
|
|
||||||
sudo -HE pwsh "$dir/Main.ps1" Configure
|
sudo -HE pwsh "$dir/Main.ps1" Configure
|
||||||
|
|
|
@ -9,10 +9,10 @@ begin
|
||||||
"" \
|
"" \
|
||||||
"# profile" \
|
"# profile" \
|
||||||
"while IFS= read -r -d '' file;" \
|
"while IFS= read -r -d '' file;" \
|
||||||
"do" \
|
do \
|
||||||
' source "$file";' \
|
' source "$file";' \
|
||||||
'done < <(find {/etc,~/.config}/bash/conf.d/* -print0 2> /dev/null);'
|
'done < <(find {/etc,~/.config}/bash/conf.d/* -print0 2> /dev/null);'
|
||||||
end | sudo tee -a /etc/bash.bashrc &> /dev/null
|
end | sudo tee -a /etc/bash.bashrc &>/dev/null
|
||||||
end
|
end
|
||||||
|
|
||||||
runInstaller $argv
|
runInstaller $argv
|
||||||
|
|
|
@ -14,13 +14,13 @@ begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"" \
|
"" \
|
||||||
'if test "$BASH"' \
|
'if test "$BASH"' \
|
||||||
"then"
|
then
|
||||||
|
|
||||||
echo "$statements" | while read -l line
|
echo "$statements" | while read -l line
|
||||||
echo " $line"
|
echo " $line"
|
||||||
end
|
end
|
||||||
|
|
||||||
echo "fi"
|
echo fi
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
$getConfig = { Get-UserConfig -UserName $User @args };
|
$getConfig = { Get-UserConfig -UserName $User @args };
|
||||||
$sudoArgs = @("-u", $User);
|
$sudoArgs = @("-u", $User);
|
||||||
$configArgs = @("--global");
|
$configArgs = @("--global");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$getConfig = { Get-OSConfig @args };
|
$getConfig = { Get-OSConfig @args };
|
||||||
$sudoArgs = @();
|
$sudoArgs = @();
|
||||||
$configArgs = @("--system");
|
$configArgs = @("--system");
|
||||||
|
@ -69,7 +70,7 @@
|
||||||
} | Out-Null;
|
} | Out-Null;
|
||||||
|
|
||||||
if ($mainBranch) {
|
if ($mainBranch) {
|
||||||
git -C "$dir" branch $mainBranch | Out-Null;;
|
git -C "$dir" branch $mainBranch | Out-Null;
|
||||||
sudo @sudoArgs git -C "$dir" flow config set @configArgs master $mainBranch;
|
sudo @sudoArgs git -C "$dir" flow config set @configArgs master $mainBranch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,8 @@ begin
|
||||||
source "$dir/../../Scripts/software.fish"
|
source "$dir/../../Scripts/software.fish"
|
||||||
|
|
||||||
function configureSW -V dir
|
function configureSW -V dir
|
||||||
source "$dir/../bash/profile.fish";
|
source "$dir/../bash/profile.fish"
|
||||||
source "$dir/../fish/profile.fish";
|
source "$dir/../fish/profile.fish"
|
||||||
set -l functionName _PortValhalla_ls_
|
set -l functionName _PortValhalla_ls_
|
||||||
|
|
||||||
function dump_header
|
function dump_header
|
||||||
|
@ -34,7 +34,7 @@ begin
|
||||||
""
|
""
|
||||||
|
|
||||||
dump_aliases
|
dump_aliases
|
||||||
end | installBashProfile "logo-ls"
|
end | installBashProfile logo-ls
|
||||||
|
|
||||||
if type -q fish
|
if type -q fish
|
||||||
begin
|
begin
|
||||||
|
@ -47,11 +47,11 @@ begin
|
||||||
" else" \
|
" else" \
|
||||||
' command ls --color=auto $argv' \
|
' command ls --color=auto $argv' \
|
||||||
" end" \
|
" end" \
|
||||||
"end" \
|
end \
|
||||||
""
|
""
|
||||||
|
|
||||||
dump_aliases
|
dump_aliases
|
||||||
end | installFishProfile "logo-ls"
|
end | installFishProfile logo-ls
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,18 +11,18 @@ sleep_secs="1"
|
||||||
# * 'ehci-pci' - USB 2.0
|
# * 'ehci-pci' - USB 2.0
|
||||||
# * 'xhci_hcd' - USB 3.0
|
# * 'xhci_hcd' - USB 3.0
|
||||||
echo "Looking for USB standards ..."
|
echo "Looking for USB standards ..."
|
||||||
for usb_std in "$base/"?hci[-_]?c*
|
for usb_std in "$base/"?hci[-_]?c*; do
|
||||||
do
|
|
||||||
echo "* USB standard '$usb_std' ..."
|
echo "* USB standard '$usb_std' ..."
|
||||||
for dev_path in "$usb_std/"*:*
|
|
||||||
do
|
for dev_path in "$usb_std/"*:*; do
|
||||||
dev="$(basename "$dev_path")"
|
dev="$(basename "$dev_path")"
|
||||||
echo " - Resetting device '$dev' ..."
|
echo " - Resetting device '$dev' ..."
|
||||||
printf '%s' "$dev" | sudo tee "$usb_std/unbind" > /dev/null
|
printf '%s' "$dev" | sudo tee "$usb_std/unbind" >/dev/null
|
||||||
sleep "$sleep_secs"
|
sleep "$sleep_secs"
|
||||||
printf '%s' "$dev" | sudo tee "$usb_std/bind" > /dev/null
|
printf '%s' "$dev" | sudo tee "$usb_std/bind" >/dev/null
|
||||||
echo " done."
|
echo " done."
|
||||||
done
|
done
|
||||||
|
|
||||||
echo " done."
|
echo " done."
|
||||||
done
|
done
|
||||||
echo "done."
|
echo "done."
|
||||||
|
|
|
@ -12,14 +12,14 @@ begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
"options nvidia NVreg_PreserveVideoMemoryAllocations=1" \
|
"options nvidia NVreg_PreserveVideoMemoryAllocations=1" \
|
||||||
"options nvidia NVreg_TemporaryFilePath=/var/tmp"
|
"options nvidia NVreg_TemporaryFilePath=/var/tmp"
|
||||||
end | sudo tee /etc/modprobe.d/nvidia-power-management.conf > /dev/null
|
end | sudo tee /etc/modprobe.d/nvidia-power-management.conf >/dev/null
|
||||||
|
|
||||||
sudo systemctl enable \
|
sudo systemctl enable \
|
||||||
nvidia-suspend.service \
|
nvidia-suspend.service \
|
||||||
nvidia-hibernate.service \
|
nvidia-hibernate.service \
|
||||||
nvidia-resume.service
|
nvidia-resume.service
|
||||||
|
|
||||||
if ! cat /etc/default/grub | grep "$indicator.*$config" > /dev/null
|
if ! cat /etc/default/grub | grep "$indicator.*$config" >/dev/null
|
||||||
sudo sed -i /etc/default/grub \
|
sudo sed -i /etc/default/grub \
|
||||||
-e "/$indicator/{" \
|
-e "/$indicator/{" \
|
||||||
-e "s/\($indicator.*[^ ]\)\(\"\)/\1 \2/" \
|
-e "s/\($indicator.*[^ ]\)\(\"\)/\1 \2/" \
|
||||||
|
|
|
@ -17,10 +17,10 @@ begin
|
||||||
'export PYENV_ROOT="$HOME/.pyenv"' \
|
'export PYENV_ROOT="$HOME/.pyenv"' \
|
||||||
'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' \
|
'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' \
|
||||||
'eval "$(pyenv init -)"'
|
'eval "$(pyenv init -)"'
|
||||||
end | installBashProfile "pyenv" > /dev/null
|
end | installBashProfile pyenv >/dev/null
|
||||||
|
|
||||||
if type -q fish
|
if type -q fish
|
||||||
installFishProfile "pyenv" "pyenv" "pyenv init - | source"
|
installFishProfile pyenv pyenv "pyenv init - | source"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ begin
|
||||||
set -l configs (getUserConfig "$name" "$key" --apply "builtins.attrNames" --json)
|
set -l configs (getUserConfig "$name" "$key" --apply "builtins.attrNames" --json)
|
||||||
|
|
||||||
if [ (echo "$configs" | jq "length") -gt 0 ]
|
if [ (echo "$configs" | jq "length") -gt 0 ]
|
||||||
if [ "$XDG_SESSION_TYPE" = "tty" ]
|
if [ "$XDG_SESSION_TYPE" = tty ]
|
||||||
set -l sessionPid
|
set -l sessionPid
|
||||||
set -l freeTty
|
set -l freeTty
|
||||||
set -l service
|
set -l service
|
||||||
|
@ -38,7 +38,7 @@ begin
|
||||||
"[General]" \
|
"[General]" \
|
||||||
"LastSeenVersion=1.0.0" \
|
"LastSeenVersion=1.0.0" \
|
||||||
"ShowUpdatePage=false"
|
"ShowUpdatePage=false"
|
||||||
end | sudo -u "$name" tee "$welcomeConfig" > /dev/null
|
end | sudo -u "$name" tee "$welcomeConfig" >/dev/null
|
||||||
|
|
||||||
begin
|
begin
|
||||||
printf %s\n \
|
printf %s\n \
|
||||||
|
@ -53,7 +53,7 @@ begin
|
||||||
"CONFIG_NAME=$(echo "$CONFIG_NAME" | string escape)" \
|
"CONFIG_NAME=$(echo "$CONFIG_NAME" | string escape)" \
|
||||||
"konsole -e fish $(realpath (status filename) | string escape) userConfig"
|
"konsole -e fish $(realpath (status filename) | string escape) userConfig"
|
||||||
)
|
)
|
||||||
end | sudo -u "$name" tee "$entryPoint" > /dev/null
|
end | sudo -u "$name" tee "$entryPoint" >/dev/null
|
||||||
|
|
||||||
sudo chmod +x "$entryPoint"
|
sudo chmod +x "$entryPoint"
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ begin
|
||||||
"[Service]" \
|
"[Service]" \
|
||||||
"ExecStart=" \
|
"ExecStart=" \
|
||||||
"ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin $name %I \$TERM"
|
"ExecStart=-/sbin/agetty -o '-p -f -- \\u' --noclear --autologin $name %I \$TERM"
|
||||||
end | sudo tee "$sessionConfig" > /dev/null
|
end | sudo tee "$sessionConfig" >/dev/null
|
||||||
|
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl restart $service
|
sudo systemctl restart $service
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/env fish
|
#!/bin/env fish
|
||||||
begin
|
begin
|
||||||
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0483", MODE="0666"';
|
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="0483", MODE="0666"'
|
||||||
end | sudo tee /etc/udev/rules.d/50-ct-board.rules > /dev/null;
|
end | sudo tee /etc/udev/rules.d/50-ct-board.rules >/dev/null
|
||||||
|
|
|
@ -7,9 +7,9 @@ begin
|
||||||
set -l configFile /etc/vimrc
|
set -l configFile /etc/vimrc
|
||||||
set -l indicator "set clipboard"
|
set -l indicator "set clipboard"
|
||||||
|
|
||||||
if not grep "\b$indicator\b" "$configFile" > /dev/null
|
if not grep "\b$indicator\b" "$configFile" >/dev/null
|
||||||
# As described in https://wiki.archlinux.org/title/Vim#Clipboard
|
# As described in https://wiki.archlinux.org/title/Vim#Clipboard
|
||||||
echo "$indicator+=unnamed,unnamedplus" | sudo tee -a "$configFile" > /dev/null;
|
echo "$indicator+=unnamed,unnamedplus" | sudo tee -a "$configFile" >/dev/null
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ begin
|
||||||
function configureSW -V dir
|
function configureSW -V dir
|
||||||
source "$dir/../bash/profile.fish"
|
source "$dir/../bash/profile.fish"
|
||||||
source "$dir/../fish/profile.fish"
|
source "$dir/../fish/profile.fish"
|
||||||
echo 'eval "$(zoxide init bash)"' | installBashProfile "zoxide"
|
echo 'eval "$(zoxide init bash)"' | installBashProfile zoxide
|
||||||
echo "zoxide init fish | source" | installFishProfile "zoxide"
|
echo "zoxide init fish | source" | installFishProfile zoxide
|
||||||
sudo -HE pwsh -NoProfile "$dir/Main.ps1" Configure
|
sudo -HE pwsh -NoProfile "$dir/Main.ps1" Configure
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -63,10 +63,10 @@ $null = New-Module {
|
||||||
& {
|
& {
|
||||||
switch ($Action) {
|
switch ($Action) {
|
||||||
([WindowsInstallerAction]::Backup) {
|
([WindowsInstallerAction]::Backup) {
|
||||||
"Please select the path you wish to store your backup at"
|
"Please select the path you wish to store your backup at";
|
||||||
}
|
}
|
||||||
([WindowsInstallerAction]::Install) {
|
([WindowsInstallerAction]::Install) {
|
||||||
"Please select an archive you wish to restore from, if you wish to restore from a backup"
|
"Please select an archive you wish to restore from, if you wish to restore from a backup";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -183,7 +183,8 @@ $null = New-Module {
|
||||||
Disable-Autologin;
|
Disable-Autologin;
|
||||||
Restart-Intermediate;
|
Restart-Intermediate;
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Deploy-SoftwareAction -Action ([InstallerAction]::BackupUser);
|
Deploy-SoftwareAction -Action ([InstallerAction]::BackupUser);
|
||||||
Remove-LocalGroupMember -Member "$user" @adminGroup;
|
Remove-LocalGroupMember -Member "$user" @adminGroup;
|
||||||
|
|
||||||
|
|
|
@ -59,11 +59,11 @@ function Start-Setup {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-PathInjection($path) {
|
function Get-PathInjection($path) {
|
||||||
"(Join-Path `$env:SystemDrive $(ConvertTo-Injection $path))"
|
"(Join-Path `$env:SystemDrive $(ConvertTo-Injection $path))";
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-ScriptPathInjection($path) {
|
function Get-ScriptPathInjection($path) {
|
||||||
Get-PathInjection (Get-RemoteScriptPath $path)
|
Get-PathInjection (Get-RemoteScriptPath $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-DiskConfig {
|
function Get-DiskConfig {
|
||||||
|
@ -76,21 +76,21 @@ function Start-Setup {
|
||||||
$modifications = $node.SelectSingleNode("./ua:ModifyPartitions", $namespace);
|
$modifications = $node.SelectSingleNode("./ua:ModifyPartitions", $namespace);
|
||||||
|
|
||||||
@{
|
@{
|
||||||
PartitionCreationContainer = $creations;
|
PartitionCreationContainer = $creations;
|
||||||
PartitionCreations = $creations.SelectNodes("./ua:CreatePartition", $namespace);
|
PartitionCreations = $creations.SelectNodes("./ua:CreatePartition", $namespace);
|
||||||
PartitionModificationContainer = $modifications;
|
PartitionModificationContainer = $modifications;
|
||||||
PartitionModifications = $modifications.SelectNodes("./ua:ModifyPartition", $namespace);
|
PartitionModifications = $modifications.SelectNodes("./ua:ModifyPartition", $namespace);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function Move-PartitionRange {
|
function Move-PartitionRange {
|
||||||
param (
|
param (
|
||||||
[int] $Disk = (Get-InstallDisk),
|
[int] $Disk = (Get-InstallDisk),
|
||||||
[Parameter(Position=0)]
|
[Parameter(Position = 0)]
|
||||||
[int] $From = 0,
|
[int] $From = 0,
|
||||||
[Parameter(Position=1)]
|
[Parameter(Position = 1)]
|
||||||
[System.Nullable[int]] $To = $null,
|
[System.Nullable[int]] $To = $null,
|
||||||
[Parameter(Position=2)]
|
[Parameter(Position = 2)]
|
||||||
[int] $By = 1
|
[int] $By = 1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -104,8 +104,9 @@ function Start-Setup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($config in @(@($diskInfo.PartitionCreations, @("Order")),
|
foreach ($config in @(
|
||||||
@($diskInfo.PartitionModifications, @("Order", "PartitionID")))) {
|
@($diskInfo.PartitionCreations, @("Order")),
|
||||||
|
@($diskInfo.PartitionModifications, @("Order", "PartitionID")))) {
|
||||||
foreach ($partition in $config[0]) {
|
foreach ($partition in $config[0]) {
|
||||||
foreach ($property in $config[1]) {
|
foreach ($property in $config[1]) {
|
||||||
$partitionNode = $partition.SelectSingleNode("./ua:$property", $namespace);
|
$partitionNode = $partition.SelectSingleNode("./ua:$property", $namespace);
|
||||||
|
@ -127,11 +128,11 @@ function Start-Setup {
|
||||||
function Add-Partition {
|
function Add-Partition {
|
||||||
param (
|
param (
|
||||||
[int] $Disk = (Get-InstallDisk),
|
[int] $Disk = (Get-InstallDisk),
|
||||||
[Parameter(Position=0)]
|
[Parameter(Position = 0)]
|
||||||
[int] $Index,
|
[int] $Index,
|
||||||
[Parameter(Position=1)]
|
[Parameter(Position = 1)]
|
||||||
[int] $Size,
|
[int] $Size,
|
||||||
[Parameter(Position=2)]
|
[Parameter(Position = 2)]
|
||||||
[string] $Type = "Primary"
|
[string] $Type = "Primary"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -169,9 +170,9 @@ function Start-Setup {
|
||||||
function Move-Partition {
|
function Move-Partition {
|
||||||
param (
|
param (
|
||||||
[int] $Disk = (Get-InstallDisk),
|
[int] $Disk = (Get-InstallDisk),
|
||||||
[Parameter(Position=0)]
|
[Parameter(Position = 0)]
|
||||||
[int] $From,
|
[int] $From,
|
||||||
[Parameter(Position=1)]
|
[Parameter(Position = 1)]
|
||||||
[int] $To
|
[int] $To
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -210,7 +211,7 @@ function Start-Setup {
|
||||||
$target = $setupConfig.SelectSingleNode("./ua:ImageInstall/ua:OSImage/ua:InstallTo", $namespace);
|
$target = $setupConfig.SelectSingleNode("./ua:ImageInstall/ua:OSImage/ua:InstallTo", $namespace);
|
||||||
|
|
||||||
@{
|
@{
|
||||||
Disk = $target.SelectSingleNode("./ua:DiskID", $namespace);
|
Disk = $target.SelectSingleNode("./ua:DiskID", $namespace);
|
||||||
Partition = $target.SelectSingleNode("./ua:PartitionID", $namespace);
|
Partition = $target.SelectSingleNode("./ua:PartitionID", $namespace);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -223,21 +224,21 @@ function Start-Setup {
|
||||||
$oobeSettings = (Get-Component (Get-PassSettings "oobeSystem") "Microsoft-Windows-Shell-Setup");
|
$oobeSettings = (Get-Component (Get-PassSettings "oobeSystem") "Microsoft-Windows-Shell-Setup");
|
||||||
|
|
||||||
foreach ($xpath in @("./ua:AutoLogon/ua:Username",
|
foreach ($xpath in @("./ua:AutoLogon/ua:Username",
|
||||||
"./ua:UserAccounts/ua:LocalAccounts/ua:LocalAccount/ua:Name",
|
"./ua:UserAccounts/ua:LocalAccounts/ua:LocalAccount/ua:Name",
|
||||||
"./ua:UserAccounts/ua:LocalAccounts/ua:LocalAccount/ua:DisplayName")) {
|
"./ua:UserAccounts/ua:LocalAccounts/ua:LocalAccount/ua:DisplayName")) {
|
||||||
$oobeSettings.SelectSingleNode($xpath, $namespace).InnerText = $valhallaConfig.setupUser.name;
|
$oobeSettings.SelectSingleNode($xpath, $namespace).InnerText = $valhallaConfig.setupUser.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
Add-StartupCommand `
|
Add-StartupCommand `
|
||||||
-Script (
|
-Script (
|
||||||
"powershell -Command " +
|
"powershell -Command " +
|
||||||
($env:DEBUG ? "`$env:DEBUG = $([int]$env:DEBUG);" : "") +
|
($env:DEBUG ? "`$env:DEBUG = $([int]$env:DEBUG);" : "") +
|
||||||
"`$env:VALHALLA_ROOT = $(Get-PathInjection $env:REMOTE_PROJECT_PATH);" +
|
"`$env:VALHALLA_ROOT = $(Get-PathInjection $env:REMOTE_PROJECT_PATH);" +
|
||||||
"`$env:PWSH_PATH = $(Get-PathInjection $env:PWSH_PATH);" +
|
"`$env:PWSH_PATH = $(Get-PathInjection $env:PWSH_PATH);" +
|
||||||
"`$env:INSTALLER_SCRIPT = $(Get-ScriptPathInjection $env:SETUP_SCRIPT_NAME);" +
|
"`$env:INSTALLER_SCRIPT = $(Get-ScriptPathInjection $env:SETUP_SCRIPT_NAME);" +
|
||||||
"`$env:CONFIG_NAME = $(ConvertTo-Injection $env:CONFIG_NAME);" +
|
"`$env:CONFIG_NAME = $(ConvertTo-Injection $env:CONFIG_NAME);" +
|
||||||
"& (Join-Path `$env:PWSH_PATH pwsh) `$env:INSTALLER_SCRIPT;") `
|
"& (Join-Path `$env:PWSH_PATH pwsh) `$env:INSTALLER_SCRIPT;") `
|
||||||
-Description "Install PowerShell Core and git and run setup script";
|
-Description "Install PowerShell Core and git and run setup script";
|
||||||
|
|
||||||
if ($valhallaConfig.dualboot.enable) {
|
if ($valhallaConfig.dualboot.enable) {
|
||||||
$diskSize = [long](ConvertFrom-Csv (wmic diskdrive where "Index=$(Get-InstallDisk)" get Size | ForEach-Object { "$_".Trim(); })).Size;
|
$diskSize = [long](ConvertFrom-Csv (wmic diskdrive where "Index=$(Get-InstallDisk)" get Size | ForEach-Object { "$_".Trim(); })).Size;
|
||||||
|
@ -261,8 +262,8 @@ function Start-Setup {
|
||||||
$unattendedConfig.PreserveWhitespace = $true;
|
$unattendedConfig.PreserveWhitespace = $true;
|
||||||
$unattendedConfig.Save($unattendedConfigFile);
|
$unattendedConfig.Save($unattendedConfigFile);
|
||||||
|
|
||||||
Write-Warning "Attention: This program will completely wipe your current disk #1 and install Windows on it. Are you sure you want to do this?"
|
Write-Warning "Attention: This program will completely wipe your current disk #1 and install Windows on it. Are you sure you want to do this?";
|
||||||
Read-Host -Prompt "Hit enter to continue or CTRL+C to abort"
|
Read-Host -Prompt "Hit enter to continue or CTRL+C to abort";
|
||||||
& "$SETUP_DRIVE\setup.exe" /Unattend:$unattendedConfigFile;
|
& "$SETUP_DRIVE\setup.exe" /Unattend:$unattendedConfigFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
"$rootSelector/$associationSelector$filter";
|
"$rootSelector/$associationSelector$filter";
|
||||||
}
|
};
|
||||||
|
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
@ -64,7 +64,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($candidates.Count -eq 1) {
|
if ($candidates.Count -eq 1) {
|
||||||
$association = $candidates[0];
|
$association = $candidates[0];
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$association = $document.SelectSingleNode($rootSelector).AppendChild($document.CreateElement($associationElementName));
|
$association = $document.SelectSingleNode($rootSelector).AppendChild($document.CreateElement($associationElementName));
|
||||||
|
|
||||||
foreach ($attributeName in @("Identifier", "ProgId", "ApplicationName")) {
|
foreach ($attributeName in @("Identifier", "ProgId", "ApplicationName")) {
|
||||||
|
@ -95,7 +96,7 @@ $null = New-Module {
|
||||||
$associations = $root.SelectNodes((& $getSelector));
|
$associations = $root.SelectNodes((& $getSelector));
|
||||||
|
|
||||||
# Reorder associations by their Identifier
|
# Reorder associations by their Identifier
|
||||||
$null = $associations | ForEach-Object { $root.RemoveChild($_) } | Sort-Object -Property "Identifier" | ForEach-Object { $root.AppendChild($_); };
|
$null = $associations | ForEach-Object { $root.RemoveChild($_) } | Sort-Object -Property "Identifier" | ForEach-Object { $root.AppendChild($_) };
|
||||||
|
|
||||||
$configFile = New-TemporaryFile;
|
$configFile = New-TemporaryFile;
|
||||||
$writerSettings = [XmlWriterSettings]::new();
|
$writerSettings = [XmlWriterSettings]::new();
|
||||||
|
|
|
@ -21,7 +21,8 @@ function Deploy-SoftwareAction {
|
||||||
if ($null -ne $Action) {
|
if ($null -ne $Action) {
|
||||||
$install = ($Action -eq ([InstallerAction]::Install));
|
$install = ($Action -eq ([InstallerAction]::Install));
|
||||||
$null = $arguments.Add("action", $Action);
|
$null = $arguments.Add("action", $Action);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$install = $true;
|
$install = $true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +139,7 @@ function Deploy-SoftwareAction {
|
||||||
keepass `
|
keepass `
|
||||||
;
|
;
|
||||||
|
|
||||||
Install-ChocoPackage bitwarden -ArgumentList '--install-arguments="/ALLUSERS=1"'
|
Install-ChocoPackage bitwarden -ArgumentList '--install-arguments="/ALLUSERS=1"';
|
||||||
|
|
||||||
Install-WingetPackage `
|
Install-WingetPackage `
|
||||||
SomePythonThings.WingetUIStore `
|
SomePythonThings.WingetUIStore `
|
||||||
|
@ -233,7 +234,7 @@ function Deploy-SoftwareAction {
|
||||||
|
|
||||||
Remove-DesktopIcon "VLC*";
|
Remove-DesktopIcon "VLC*";
|
||||||
# When installing Jellyfin Media Player after iCUE, Jellyfin will try to reboot automatically
|
# When installing Jellyfin Media Player after iCUE, Jellyfin will try to reboot automatically
|
||||||
Install-ChocoPackage jellyfin-media-player -ArgumentList "--install-args","/norestart";
|
Install-ChocoPackage jellyfin-media-player -ArgumentList "--install-args", "/norestart";
|
||||||
Remove-DesktopIcon "Jellyfin Media Player*";
|
Remove-DesktopIcon "Jellyfin Media Player*";
|
||||||
Install-WingetPackage Ytmdesktop.Ytmdesktop;
|
Install-WingetPackage Ytmdesktop.Ytmdesktop;
|
||||||
Remove-DesktopIcon "Youtube Music*";
|
Remove-DesktopIcon "Youtube Music*";
|
||||||
|
|
|
@ -12,7 +12,7 @@ function Invoke-Hook() {
|
||||||
|
|
||||||
if (Get-Command "$Name" -ErrorAction SilentlyContinue) {
|
if (Get-Command "$Name" -ErrorAction SilentlyContinue) {
|
||||||
$parameters = {
|
$parameters = {
|
||||||
fallback = $scriptBlock
|
fallback = $scriptBlock;
|
||||||
};
|
};
|
||||||
|
|
||||||
Write-Host "Running Hook ``$Name``";
|
Write-Host "Running Hook ``$Name``";
|
||||||
|
|
|
@ -30,13 +30,15 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($UserKey) {
|
if ($UserKey) {
|
||||||
$path = Join-Path ($UserKey.PSPath) $runOncePath;
|
$path = Join-Path ($UserKey.PSPath) $runOncePath;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$path = $systemRunOncePath;
|
$path = $systemRunOncePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not (Test-Path $path)) {
|
if (-not (Test-Path $path)) {
|
||||||
New-Item $path;
|
New-Item $path;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Get-Item $path;
|
Get-Item $path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,14 +124,14 @@ $null = New-Module {
|
||||||
#>
|
#>
|
||||||
function Register-Setup {
|
function Register-Setup {
|
||||||
param(
|
param(
|
||||||
[Parameter(ParameterSetName="System")]
|
[Parameter(ParameterSetName = "System")]
|
||||||
[switch] $System,
|
[switch] $System,
|
||||||
[Parameter(ParameterSetName="DefaultUser", Mandatory)]
|
[Parameter(ParameterSetName = "DefaultUser", Mandatory)]
|
||||||
[switch] $DefaultUser,
|
[switch] $DefaultUser,
|
||||||
[Parameter(ParameterSetName="User", Mandatory)]
|
[Parameter(ParameterSetName = "User", Mandatory)]
|
||||||
[switch] $User,
|
[switch] $User,
|
||||||
[Parameter(ParameterSetName="User")]
|
[Parameter(ParameterSetName = "User")]
|
||||||
[Parameter(ParameterSetName="SpecificUser", Mandatory)]
|
[Parameter(ParameterSetName = "SpecificUser", Mandatory)]
|
||||||
[RegistryKey] $UserKey
|
[RegistryKey] $UserKey
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -151,7 +153,8 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = Get-RunOnceKey $UserKey;
|
$key = Get-RunOnceKey $UserKey;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$key = Get-RunOnceKey;
|
$key = Get-RunOnceKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,8 +196,8 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = @{
|
$options = @{
|
||||||
$domainOption = "";
|
$domainOption = "";
|
||||||
$userOption = $Name;
|
$userOption = $Name;
|
||||||
$passwordOption = "";
|
$passwordOption = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -221,20 +224,22 @@ $null = New-Module {
|
||||||
#>
|
#>
|
||||||
function Restart-Intermediate {
|
function Restart-Intermediate {
|
||||||
param(
|
param(
|
||||||
[Parameter(ParameterSetName="None")]
|
[Parameter(ParameterSetName = "None")]
|
||||||
[switch] $NoRegister,
|
[switch] $NoRegister,
|
||||||
[Parameter(ParameterSetName="Default", Mandatory)]
|
[Parameter(ParameterSetName = "Default", Mandatory)]
|
||||||
[switch] $DefaultUser,
|
[switch] $DefaultUser,
|
||||||
[Parameter(ParameterSetName="Current", Mandatory)]
|
[Parameter(ParameterSetName = "Current", Mandatory)]
|
||||||
[switch] $CurrentUser
|
[switch] $CurrentUser
|
||||||
)
|
)
|
||||||
|
|
||||||
if (-not $NoRegister.IsPresent) {
|
if (-not $NoRegister.IsPresent) {
|
||||||
if ($DefaultUser.IsPresent) {
|
if ($DefaultUser.IsPresent) {
|
||||||
Register-Setup -DefaultUser;
|
Register-Setup -DefaultUser;
|
||||||
} elseif ($CurrentUser.IsPresent) {
|
}
|
||||||
|
elseif ($CurrentUser.IsPresent) {
|
||||||
Register-Setup -User;
|
Register-Setup -User;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Register-Setup;
|
Register-Setup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ $null = New-Module {
|
||||||
)
|
)
|
||||||
|
|
||||||
$rootPath = "HKLM:\DefaultUser";
|
$rootPath = "HKLM:\DefaultUser";
|
||||||
$regRootPath = $rootPath -replace "^(\w+):([\\/]|$)","`$1`$2";
|
$regRootPath = $rootPath -replace "^(\w+):([\\/]|$)", "`$1`$2";
|
||||||
$hivePath = "$env:SystemDrive\Users\Default\NTUSER.dat";
|
$hivePath = "$env:SystemDrive\Users\Default\NTUSER.dat";
|
||||||
$null = & reg load $regRootPath $hivePath;
|
$null = & reg load $regRootPath $hivePath;
|
||||||
[RegistryKey] $root = Get-Item $rootPath;
|
[RegistryKey] $root = Get-Item $rootPath;
|
||||||
|
@ -81,7 +81,8 @@ $null = New-Module {
|
||||||
[AccessControlType]::Allow));
|
[AccessControlType]::Allow));
|
||||||
|
|
||||||
Set-Acl $configRoot $acl;
|
Set-Acl $configRoot $acl;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$key = Get-Item $configRoot;
|
$key = Get-Item $configRoot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ $null = New-Module {
|
||||||
|
|
||||||
$options = @{
|
$options = @{
|
||||||
legalnoticecaption = $Caption;
|
legalnoticecaption = $Caption;
|
||||||
legalnoticetext = $Message;
|
legalnoticetext = $Message;
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach ($key in $options.Keys) {
|
foreach ($key in $options.Keys) {
|
||||||
|
@ -141,7 +142,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($key.GetValueNames().Contains($Name)) {
|
if ($key.GetValueNames().Contains($Name)) {
|
||||||
return $key.GetValue($Name);
|
return $key.GetValue($Name);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return $null;
|
return $null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +168,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($null -eq $Value) {
|
if ($null -eq $Value) {
|
||||||
Remove-ItemProperty $key -Name $Name;
|
Remove-ItemProperty $key -Name $Name;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$null = Set-ItemProperty $key -Name $Name -Value $Value;
|
$null = Set-ItemProperty $key -Name $Name -Value $Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -371,4 +374,4 @@ $null = New-Module {
|
||||||
|
|
||||||
Set-SetupOption $finishedOption $true;
|
Set-SetupOption $finishedOption $true;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
|
@ -12,7 +12,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($User) {
|
if ($User) {
|
||||||
$result = "Users/$User";
|
$result = "Users/$User";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$result = "System";
|
$result = "System";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +90,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if (Test-Path -PathType Container $Source) {
|
if (Test-Path -PathType Container $Source) {
|
||||||
$null = New-Item -ItemType Junction $fullPath -Target $Source;
|
$null = New-Item -ItemType Junction $fullPath -Target $Source;
|
||||||
} elseif (Test-Path -PathType Leaf $Source) {
|
}
|
||||||
|
elseif (Test-Path -PathType Leaf $Source) {
|
||||||
Copy-Item $Source $fullPath;
|
Copy-Item $Source $fullPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ $null = New-Module {
|
||||||
)
|
)
|
||||||
|
|
||||||
Set-ItemProperty -Path $systemPolicyPath -Name $uacOption -Value ([int]$Value);
|
Set-ItemProperty -Path $systemPolicyPath -Name $uacOption -Value ([int]$Value);
|
||||||
}
|
};
|
||||||
|
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
|
@ -58,7 +58,8 @@ $null = New-Module {
|
||||||
(& {
|
(& {
|
||||||
if (Test-Path -PathType Container $Path) {
|
if (Test-Path -PathType Container $Path) {
|
||||||
[InheritanceFlags]::ObjectInherit -bor [InheritanceFlags]::ContainerInherit
|
[InheritanceFlags]::ObjectInherit -bor [InheritanceFlags]::ContainerInherit
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -48,10 +48,10 @@ $null = New-Module {
|
||||||
$Names.AddRange($AdditionalNames);
|
$Names.AddRange($AdditionalNames);
|
||||||
|
|
||||||
[string[]] $arguments = $ArgumentList + (& {
|
[string[]] $arguments = $ArgumentList + (& {
|
||||||
if ($Action -eq 'install') {
|
if ($Action -eq 'install') {
|
||||||
@("--accept-package-agreements")
|
@("--accept-package-agreements");
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach ($name in $Names) {
|
foreach ($name in $Names) {
|
||||||
if ($Force.IsPresent -or (& $Guard $name $PSBoundParameters)) {
|
if ($Force.IsPresent -or (& $Guard $name $PSBoundParameters)) {
|
||||||
|
@ -59,7 +59,7 @@ $null = New-Module {
|
||||||
--accept-source-agreements `
|
--accept-source-agreements `
|
||||||
--source winget `
|
--source winget `
|
||||||
@arguments `
|
@arguments `
|
||||||
--exact --id $name ;
|
--exact --id $name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -74,8 +74,8 @@ $null = New-Module {
|
||||||
$output = winget source update winget;
|
$output = winget source update winget;
|
||||||
|
|
||||||
$? -and -not ([System.Linq.Enumerable]::Any(
|
$? -and -not ([System.Linq.Enumerable]::Any(
|
||||||
[string[]]($output),
|
[string[]]($output),
|
||||||
[System.Func[string,bool]]{ param($line) $line -eq "Cancelled"; }));
|
[System.Func[string, bool]] { param($line) $line -eq "Cancelled" }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ $null = New-Module {
|
||||||
[OutputType([bool])]
|
[OutputType([bool])]
|
||||||
param(
|
param(
|
||||||
[string] $Name
|
[string] $Name
|
||||||
);
|
)
|
||||||
|
|
||||||
-not [string]::IsNullOrEmpty((choco list --limit-output --exact $name));
|
-not [string]::IsNullOrEmpty((choco list --limit-output --exact $name));
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ $null = New-Module {
|
||||||
param(
|
param(
|
||||||
[switch] $Force,
|
[switch] $Force,
|
||||||
[string[]] $ArgumentList,
|
[string[]] $ArgumentList,
|
||||||
[Parameter(Position=0)]
|
[Parameter(Position = 0)]
|
||||||
[string] $Name,
|
[string] $Name,
|
||||||
[Parameter(ValueFromRemainingArguments = $true)]
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
[string[]] $AdditionalNames = @()
|
[string[]] $AdditionalNames = @()
|
||||||
|
@ -132,9 +132,10 @@ $null = New-Module {
|
||||||
& $chocoRunner @PSBoundParameters -Guard {
|
& $chocoRunner @PSBoundParameters -Guard {
|
||||||
param($Name)
|
param($Name)
|
||||||
if (Test-ChocoPackage $Name) {
|
if (Test-ChocoPackage $Name) {
|
||||||
Write-Host "Package ``$Name`` is already installed"
|
Write-Host "Package ``$Name`` is already installed";
|
||||||
$false;
|
$false;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$true;
|
$true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -147,7 +148,7 @@ $null = New-Module {
|
||||||
function Uninstall-ChocoPackage {
|
function Uninstall-ChocoPackage {
|
||||||
param(
|
param(
|
||||||
[string[]] $ArgumentList,
|
[string[]] $ArgumentList,
|
||||||
[Parameter(Position=0)]
|
[Parameter(Position = 0)]
|
||||||
[string] $Name,
|
[string] $Name,
|
||||||
[Parameter(ValueFromRemainingArguments = $true)]
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
[string[]] $AdditionalNames = @()
|
[string[]] $AdditionalNames = @()
|
||||||
|
@ -157,7 +158,8 @@ $null = New-Module {
|
||||||
param($Name)
|
param($Name)
|
||||||
if (Test-ChocoPackage $Name) {
|
if (Test-ChocoPackage $Name) {
|
||||||
$true;
|
$true;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Write-Host "Package ``$Name`` is not installed";
|
Write-Host "Package ``$Name`` is not installed";
|
||||||
$false;
|
$false;
|
||||||
}
|
}
|
||||||
|
@ -175,22 +177,22 @@ $null = New-Module {
|
||||||
param(
|
param(
|
||||||
[switch] $Force,
|
[switch] $Force,
|
||||||
[string[]] $ArgumentList,
|
[string[]] $ArgumentList,
|
||||||
[Parameter(Position=0)]
|
[Parameter(Position = 0)]
|
||||||
[string] $Name,
|
[string] $Name,
|
||||||
[Parameter(ValueFromRemainingArguments = $true)]
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
[string[]] $AdditionalNames = @()
|
[string[]] $AdditionalNames = @()
|
||||||
)
|
)
|
||||||
|
|
||||||
& $wingetRunner @PSBoundParameters `
|
& $wingetRunner @PSBoundParameters -Guard {
|
||||||
-Guard {
|
param($Name, $Parameters)
|
||||||
param($Name, $Parameters)
|
if (Test-WingetPackage -Name $Name @Parameters) {
|
||||||
if (Test-WingetPackage -Name $Name @Parameters) {
|
Write-Host "Package ``$Name`` is already installed";
|
||||||
Write-Host "Package ``$Name`` is already installed"
|
$false;
|
||||||
$false;
|
}
|
||||||
} else {
|
else {
|
||||||
$true;
|
$true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
<#
|
<#
|
||||||
|
@ -200,7 +202,7 @@ $null = New-Module {
|
||||||
function Uninstall-WingetPackage {
|
function Uninstall-WingetPackage {
|
||||||
param(
|
param(
|
||||||
[string[]] $ArgumentList,
|
[string[]] $ArgumentList,
|
||||||
[Parameter(Position=0)]
|
[Parameter(Position = 0)]
|
||||||
[string] $Name,
|
[string] $Name,
|
||||||
[Parameter(ValueFromRemainingArguments = $true)]
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
[string[]] $AdditionalNames = @()
|
[string[]] $AdditionalNames = @()
|
||||||
|
@ -210,8 +212,9 @@ $null = New-Module {
|
||||||
param($Name, $Parameters)
|
param($Name, $Parameters)
|
||||||
if (Test-WingetPackage -Name $Name @Parameters) {
|
if (Test-WingetPackage -Name $Name @Parameters) {
|
||||||
$true;
|
$true;
|
||||||
} else {
|
}
|
||||||
Write-Host "Package ``$Name`` is not installed"
|
else {
|
||||||
|
Write-Host "Package ``$Name`` is not installed";
|
||||||
$false;
|
$false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -249,7 +252,8 @@ $null = New-Module {
|
||||||
|
|
||||||
Write-Host "Downloading setup file from ``$Source``";
|
Write-Host "Downloading setup file from ``$Source``";
|
||||||
Invoke-WebRequest $Source -OutFile $filePath;
|
Invoke-WebRequest $Source -OutFile $filePath;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$filePath = $Source;
|
$filePath = $Source;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +325,8 @@ $null = New-Module {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
& $download;
|
& $download;
|
||||||
} catch {
|
}
|
||||||
|
catch {
|
||||||
$null = $Browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()");
|
$null = $Browser.ExecuteScript("document.querySelector('$cookieBannerSelector').remove()");
|
||||||
& $download;
|
& $download;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($task) {
|
if ($task) {
|
||||||
return [OneShotTask]$task;
|
return [OneShotTask]$task;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return $null;
|
return $null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +105,7 @@ $null = New-Module {
|
||||||
}
|
}
|
||||||
} `
|
} `
|
||||||
-MessageData @{
|
-MessageData @{
|
||||||
Trigger = $oneShotTrigger;
|
Trigger = $oneShotTrigger;
|
||||||
Identifier = $identifier;
|
Identifier = $identifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,8 @@ function Update-WindowsInstallation {
|
||||||
Write-Host "A Reboot is Required!";
|
Write-Host "A Reboot is Required!";
|
||||||
Write-Host "Windows will reboot now and the installation will be continued automatically.";
|
Write-Host "Windows will reboot now and the installation will be continued automatically.";
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Write-Host "Updating Windows finished successfully!";
|
Write-Host "Updating Windows finished successfully!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ $null = New-Module {
|
||||||
([UserStage]::Create) {
|
([UserStage]::Create) {
|
||||||
if ($env:UserName -ne $name) {
|
if ($env:UserName -ne $name) {
|
||||||
$userInfo = @{
|
$userInfo = @{
|
||||||
name = $name;
|
name = $name;
|
||||||
msAccount = $msAccount;
|
msAccount = $msAccount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,12 +44,14 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($msAccount) {
|
if ($msAccount) {
|
||||||
logoff;
|
logoff;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Restart-Intermediate;
|
Restart-Intermediate;
|
||||||
}
|
}
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if ($msAccount) {
|
if ($msAccount) {
|
||||||
if (-not (Test-Admin)) {
|
if (-not (Test-Admin)) {
|
||||||
Invoke-OneShot DisableUAC;
|
Invoke-OneShot DisableUAC;
|
||||||
|
@ -166,7 +168,8 @@ $null = New-Module {
|
||||||
0) -eq 1) {
|
0) -eq 1) {
|
||||||
return $newUser;
|
return $newUser;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$result = $Host.UI.PromptForChoice(
|
$result = $Host.UI.PromptForChoice(
|
||||||
"Select your User",
|
"Select your User",
|
||||||
"Which one is your user?",
|
"Which one is your user?",
|
||||||
|
@ -184,7 +187,8 @@ $null = New-Module {
|
||||||
return $newUsers[$result - 1];
|
return $newUsers[$result - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Write-Host "";
|
Write-Host "";
|
||||||
Write-Host "Unable to determine the new user";
|
Write-Host "Unable to determine the new user";
|
||||||
Write-Host "Retrying…";
|
Write-Host "Retrying…";
|
||||||
|
@ -218,7 +222,8 @@ $null = New-Module {
|
||||||
Add-MicrosoftAccount $Name;
|
Add-MicrosoftAccount $Name;
|
||||||
Set-SetupOption $loggedInUserOption $env:UserName;
|
Set-SetupOption $loggedInUserOption $env:UserName;
|
||||||
Invoke-OneShot ([OneShotTask]::InitializeMSAccount);
|
Invoke-OneShot ([OneShotTask]::InitializeMSAccount);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
New-LocalUser -NoPassword $Name;
|
New-LocalUser -NoPassword $Name;
|
||||||
Set-LocalUser $Name -PasswordNeverExpires $true;
|
Set-LocalUser $Name -PasswordNeverExpires $true;
|
||||||
Set-LocalUser $Name -PasswordNeverExpires $false;
|
Set-LocalUser $Name -PasswordNeverExpires $false;
|
||||||
|
@ -246,7 +251,7 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($msAccount) {
|
if ($msAccount) {
|
||||||
$accountName = Get-MSAccountName;
|
$accountName = Get-MSAccountName;
|
||||||
Write-Host "Renaming ``$accountName`` to ``$name``…"
|
Write-Host "Renaming ``$accountName`` to ``$name``…";
|
||||||
Rename-LocalUser $accountName $name;
|
Rename-LocalUser $accountName $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +259,8 @@ $null = New-Module {
|
||||||
|
|
||||||
if ($msAccount) {
|
if ($msAccount) {
|
||||||
Disable-LocalUser (Get-SetupOption $loggedInUserOption);
|
Disable-LocalUser (Get-SetupOption $loggedInUserOption);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Disable-LocalUser $env:UserName;
|
Disable-LocalUser $env:UserName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,7 +272,8 @@ $null = New-Module {
|
||||||
if ($msAccount) {
|
if ($msAccount) {
|
||||||
Disable-Autologin;
|
Disable-Autologin;
|
||||||
Set-BootMessage -Caption "Please Log In" -Message "Please log in using your new Microsoft Account ``$name``.";
|
Set-BootMessage -Caption "Please Log In" -Message "Please log in using your new Microsoft Account ``$name``.";
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Set-AutologinUser "$name";
|
Set-AutologinUser "$name";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
. "$PSScriptRoot/../../../Common/Scripts/Software.ps1";
|
||||||
|
|
||||||
Start-SoftwareInstaller @args `
|
Start-SoftwareInstaller @args `
|
||||||
-Installer {
|
-Installer {
|
||||||
Install-ChocoPackage firefox;
|
Install-ChocoPackage firefox;
|
||||||
} `
|
} `
|
||||||
-Configurator {
|
-Configurator {
|
||||||
|
|
|
@ -13,19 +13,19 @@
|
||||||
param()
|
param()
|
||||||
|
|
||||||
$hubName = "lghub_system_tray.exe";
|
$hubName = "lghub_system_tray.exe";
|
||||||
|
|
||||||
$candidates = Get-Process | Where-Object { $_.Path -and ((Split-Path -Leaf $_.Path) -eq $hubName) };
|
$candidates = Get-Process | Where-Object { $_.Path -and ((Split-Path -Leaf $_.Path) -eq $hubName) };
|
||||||
|
|
||||||
if ($candidates.Count -gt 0) {
|
if ($candidates.Count -gt 0) {
|
||||||
$lghubPath = $candidates[0].Path;
|
$lghubPath = $candidates[0].Path;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
$lghubPath = $null;
|
$lghubPath = $null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mainProcesses = Get-Process | Where-Object {
|
$mainProcesses = Get-Process | Where-Object {
|
||||||
$_.Path -and
|
$_.Path -and
|
||||||
(@("lghub.exe", "lghub_agent.exe", "lghub_updater.exe", $hubName) -contains (Split-Path -Leaf $_.Path)) -and
|
(@("lghub.exe", "lghub_agent.exe", "lghub_updater.exe", $hubName) -contains (Split-Path -Leaf $_.Path)) -and
|
||||||
(($_.Parent.ProcessName -eq "explorer") -or ($null -eq $_.Parent))
|
(($_.Parent.ProcessName -eq "explorer") -or ($null -eq $_.Parent));
|
||||||
};
|
};
|
||||||
|
|
||||||
$null = $mainProcesses | ForEach-Object { $_.Kill($true) };
|
$null = $mainProcesses | ForEach-Object { $_.Kill($true) };
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
Edit-LGHubConfig {
|
Edit-LGHubConfig {
|
||||||
Add-BackupArtifacts -User $Arguments.Name -Source $configPath -Path "$Name" `
|
Add-BackupArtifacts -User $Arguments.Name -Source $configPath -Path "$Name" `
|
||||||
-Include @("settings.db", "icon_cache")
|
-Include @("settings.db", "icon_cache");
|
||||||
};
|
};
|
||||||
} `
|
} `
|
||||||
-UserConfigurator {
|
-UserConfigurator {
|
||||||
|
|
|
@ -9,15 +9,15 @@ Start-SoftwareInstaller @args `
|
||||||
$configPath = "HKLM:\SOFTWARE\Robert Maehl Software\MSEdgeRedirect";
|
$configPath = "HKLM:\SOFTWARE\Robert Maehl Software\MSEdgeRedirect";
|
||||||
|
|
||||||
[hashtable] $options = @{
|
[hashtable] $options = @{
|
||||||
NoBing = 1;
|
NoBing = 1;
|
||||||
NoImgs = 1;
|
NoImgs = 1;
|
||||||
NoNews = 1;
|
NoNews = 1;
|
||||||
NoPDFs = 1;
|
NoPDFs = 1;
|
||||||
Search = "StartPage";
|
Search = "StartPage";
|
||||||
Images = "Custom";
|
Images = "Custom";
|
||||||
ImagePath = "https://startpage.com/sp/search?cat=images&query=";
|
ImagePath = "https://startpage.com/sp/search?cat=images&query=";
|
||||||
News = "Google";
|
News = "Google";
|
||||||
PDFApp = "C:\Program Files\Mozilla Firefox\firefox.exe";
|
PDFApp = "C:\Program Files\Mozilla Firefox\firefox.exe";
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach ($key in $options.Keys) {
|
foreach ($key in $options.Keys) {
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
$folderID = (
|
$folderID = (
|
||||||
$oldContent | `
|
$oldContent | `
|
||||||
Where-Object { $_ -match "$pattern" } | `
|
Where-Object { $_ -match "$pattern" } | `
|
||||||
ForEach-Object { $_ -replace "$pattern.*$","`$1" } | `
|
ForEach-Object { $_ -replace "$pattern.*$", "`$1" } | `
|
||||||
Sort-Object -Unique | `
|
Sort-Object -Unique | `
|
||||||
Measure-Object -Maximum).Maximum + 1;
|
Measure-Object -Maximum).Maximum + 1;
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
Start-SoftwareInstaller @args `
|
Start-SoftwareInstaller @args `
|
||||||
-Installer {
|
-Installer {
|
||||||
Install-ChocoPackage nextcloud-client -ArgumentList "-y","--params='/KeepUpdateCheck'";
|
Install-ChocoPackage nextcloud-client -ArgumentList "-y", "--params='/KeepUpdateCheck'";
|
||||||
} `
|
} `
|
||||||
-UserConfigurator {
|
-UserConfigurator {
|
||||||
param($Arguments)
|
param($Arguments)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
Start-SoftwareInstaller @args `
|
Start-SoftwareInstaller @args `
|
||||||
-Installer {
|
-Installer {
|
||||||
Install-WingetPackage JanDeDobbeleer.OhMyPosh -ArgumentList "--scope","machine";
|
Install-WingetPackage JanDeDobbeleer.OhMyPosh -ArgumentList "--scope", "machine";
|
||||||
} `
|
} `
|
||||||
-Configurator {
|
-Configurator {
|
||||||
. $base -Action ([InstallerAction]::Configure) @args;
|
. $base -Action ([InstallerAction]::Configure) @args;
|
||||||
|
|
|
@ -6,7 +6,7 @@ using namespace Microsoft.Win32;
|
||||||
|
|
||||||
Start-SoftwareInstaller @args `
|
Start-SoftwareInstaller @args `
|
||||||
-Installer {
|
-Installer {
|
||||||
Install-ChocoPackage thunderbird -ArgumentList "--params",'"/NoTaskbarShortcut /NoDesktopShortcut"'
|
Install-ChocoPackage thunderbird -ArgumentList "--params", '"/NoTaskbarShortcut /NoDesktopShortcut"';
|
||||||
} `
|
} `
|
||||||
-Configurator {
|
-Configurator {
|
||||||
Write-Host "Making Thunderbird the default mail program…";
|
Write-Host "Making Thunderbird the default mail program…";
|
||||||
|
|
|
@ -19,12 +19,12 @@ function Get-TMForeverInstallerComponents {
|
||||||
)
|
)
|
||||||
|
|
||||||
@{
|
@{
|
||||||
context = @{
|
context = @{
|
||||||
iconName = $IconName;
|
iconName = $IconName;
|
||||||
userDirectory = $UserDirectory;
|
userDirectory = $UserDirectory;
|
||||||
installer = $Installer;
|
installer = $Installer;
|
||||||
};
|
};
|
||||||
installer = {
|
installer = {
|
||||||
param([hashtable] $Context)
|
param([hashtable] $Context)
|
||||||
$iconName = $Context.IconName;
|
$iconName = $Context.IconName;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ function Get-TMForeverInstallerComponents {
|
||||||
& $Context.Installer;
|
& $Context.Installer;
|
||||||
Remove-DesktopIcon "*$iconName*";
|
Remove-DesktopIcon "*$iconName*";
|
||||||
};
|
};
|
||||||
userBackup = {
|
userBackup = {
|
||||||
param(
|
param(
|
||||||
[string] $Name,
|
[string] $Name,
|
||||||
[hashtable] $Context
|
[hashtable] $Context
|
||||||
|
|
|
@ -6,9 +6,9 @@ Start-SoftwareInstaller @args `
|
||||||
-Installer {
|
-Installer {
|
||||||
Write-Information "Downgrading AutoHotkey…";
|
Write-Information "Downgrading AutoHotkey…";
|
||||||
$id = "AutoHotkey.AutoHotkey";
|
$id = "AutoHotkey.AutoHotkey";
|
||||||
$uninstall = { winget uninstall --accept-source-agreements -e --id "$id"; };
|
$uninstall = { winget uninstall --accept-source-agreements -e --id "$id" };
|
||||||
& $uninstall;
|
& $uninstall;
|
||||||
Install-WingetPackage $id -ArgumentList "--version","1.1.37.00";
|
Install-WingetPackage $id -ArgumentList "--version", "1.1.37.00";
|
||||||
Install-ChocoPackage temurin11jre;
|
Install-ChocoPackage temurin11jre;
|
||||||
|
|
||||||
Write-Host "Installing UniFi Controller…";
|
Write-Host "Installing UniFi Controller…";
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue