mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
refactor: make bootstrap read config from flake
This commit is contained in:
parent
5637ab54fc
commit
ae63e40f04
16 changed files with 481 additions and 428 deletions
|
|
@ -1,6 +1,9 @@
|
|||
{ self, inputs, outputs, config, pkgs, lib, ... }:
|
||||
let
|
||||
profilesPath = "${self}/profiles";
|
||||
sharedOptions = {
|
||||
isBtrfs = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
|
|
@ -78,142 +81,144 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
swarselsystems = {
|
||||
wallpaper = self + /wallpaper/lenovowp.png;
|
||||
hasBluetooth = true;
|
||||
hasFingerprint = true;
|
||||
impermanence = false;
|
||||
isBtrfs = true;
|
||||
isCrypted = true;
|
||||
};
|
||||
swarselsystems = lib.recursiveUpdate
|
||||
{
|
||||
wallpaper = self + /wallpaper/lenovowp.png;
|
||||
hasBluetooth = true;
|
||||
hasFingerprint = true;
|
||||
isImpermanence = false;
|
||||
isCrypted = true;
|
||||
}
|
||||
sharedOptions;
|
||||
|
||||
home-manager.users.swarsel.swarselsystems = {
|
||||
isLaptop = true;
|
||||
isNixos = true;
|
||||
isBtrfs = true;
|
||||
flakePath = "/home/swarsel/.dotfiles";
|
||||
cpuCount = 16;
|
||||
# temperatureHwmon = {
|
||||
# isAbsolutePath = true;
|
||||
# path = "/sys/devices/platform/thinkpad_hwmon/hwmon/";
|
||||
# input-filename = "temp1_input";
|
||||
# };
|
||||
# ------ -----
|
||||
# | DP-4 | |eDP-1|
|
||||
# ------ -----
|
||||
startup = [
|
||||
{ command = "nextcloud --background"; }
|
||||
{ command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; }
|
||||
{ command = "element-desktop --hidden --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
|
||||
{ command = "ANKI_WAYLAND=1 anki"; }
|
||||
{ command = "OBSIDIAN_USE_WAYLAND=1 obsidian"; }
|
||||
{ command = "nm-applet"; }
|
||||
{ command = "teams-for-linux"; }
|
||||
{ command = "1password"; }
|
||||
{ command = "feishin"; }
|
||||
];
|
||||
sharescreen = "eDP-2";
|
||||
lowResolution = "1280x800";
|
||||
highResolution = "2560x1600";
|
||||
monitors = {
|
||||
main = {
|
||||
name = "BOE 0x0BC9 Unknown";
|
||||
mode = "2560x1600"; # TEMPLATE
|
||||
scale = "1";
|
||||
position = "2560,0";
|
||||
workspace = "15:L";
|
||||
output = "eDP-2";
|
||||
home-manager.users.swarsel.swarselsystems = lib.recursiveUpdate
|
||||
{
|
||||
isLaptop = true;
|
||||
isNixos = true;
|
||||
flakePath = "/home/swarsel/.dotfiles";
|
||||
cpuCount = 16;
|
||||
# temperatureHwmon = {
|
||||
# isAbsolutePath = true;
|
||||
# path = "/sys/devices/platform/thinkpad_hwmon/hwmon/";
|
||||
# input-filename = "temp1_input";
|
||||
# };
|
||||
# ------ -----
|
||||
# | DP-4 | |eDP-1|
|
||||
# ------ -----
|
||||
startup = [
|
||||
{ command = "nextcloud --background"; }
|
||||
{ command = "vesktop --start-minimized --enable-speech-dispatcher --ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime"; }
|
||||
{ command = "element-desktop --hidden --enable-features=UseOzonePlatform --ozone-platform=wayland --disable-gpu-driver-bug-workarounds"; }
|
||||
{ command = "ANKI_WAYLAND=1 anki"; }
|
||||
{ command = "OBSIDIAN_USE_WAYLAND=1 obsidian"; }
|
||||
{ command = "nm-applet"; }
|
||||
{ command = "teams-for-linux"; }
|
||||
{ command = "1password"; }
|
||||
{ command = "feishin"; }
|
||||
];
|
||||
sharescreen = "eDP-2";
|
||||
lowResolution = "1280x800";
|
||||
highResolution = "2560x1600";
|
||||
monitors = {
|
||||
main = {
|
||||
name = "BOE 0x0BC9 Unknown";
|
||||
mode = "2560x1600"; # TEMPLATE
|
||||
scale = "1";
|
||||
position = "2560,0";
|
||||
workspace = "15:L";
|
||||
output = "eDP-2";
|
||||
};
|
||||
homedesktop = {
|
||||
name = "Philips Consumer Electronics Company PHL BDM3270 AU11806002320";
|
||||
mode = "2560x1440";
|
||||
scale = "1";
|
||||
position = "0,0";
|
||||
workspace = "1:一";
|
||||
output = "DP-11";
|
||||
};
|
||||
work_back_middle = {
|
||||
name = "LG Electronics LG Ultra HD 0x000305A6";
|
||||
mode = "2560x1440";
|
||||
scale = "1";
|
||||
position = "5120,0";
|
||||
workspace = "1:一";
|
||||
output = "DP-10";
|
||||
};
|
||||
work_front_left = {
|
||||
name = "LG Electronics LG Ultra HD 0x0007AB45";
|
||||
mode = "3840x2160";
|
||||
scale = "1";
|
||||
position = "5120,0";
|
||||
workspace = "1:一";
|
||||
output = "DP-7";
|
||||
};
|
||||
work_back_right = {
|
||||
name = "HP Inc. HP Z32 CN41212T55";
|
||||
mode = "3840x2160";
|
||||
scale = "1";
|
||||
position = "5120,0";
|
||||
workspace = "1:一";
|
||||
output = "DP-3";
|
||||
};
|
||||
work_middle_middle_main = {
|
||||
name = "HP Inc. HP 732pk CNC4080YL5";
|
||||
mode = "3840x2160";
|
||||
scale = "1";
|
||||
position = "-1280,0";
|
||||
workspace = "11:M";
|
||||
output = "DP-8";
|
||||
};
|
||||
work_middle_middle_side = {
|
||||
name = "Hewlett Packard HP Z24i CN44250RDT";
|
||||
mode = "1920x1200";
|
||||
transform = "270";
|
||||
scale = "1";
|
||||
position = "-2480,0";
|
||||
workspace = "12:S";
|
||||
output = "DP-9";
|
||||
};
|
||||
work_seminary = {
|
||||
name = "Applied Creative Technology Transmitter QUATTRO201811";
|
||||
mode = "1280x720";
|
||||
scale = "1";
|
||||
position = "10000,10000"; # i.e. this screen is inaccessible by moving the mouse
|
||||
workspace = "12:S";
|
||||
output = "DP-4";
|
||||
};
|
||||
};
|
||||
homedesktop = {
|
||||
name = "Philips Consumer Electronics Company PHL BDM3270 AU11806002320";
|
||||
mode = "2560x1440";
|
||||
scale = "1";
|
||||
position = "0,0";
|
||||
workspace = "1:一";
|
||||
output = "DP-11";
|
||||
inputs = {
|
||||
"12972:18:Framework_Laptop_16_Keyboard_Module_-_ANSI_Keyboard" = {
|
||||
xkb_layout = "us";
|
||||
xkb_variant = "altgr-intl";
|
||||
};
|
||||
"1133:45081:MX_Master_2S_Keyboard" = {
|
||||
xkb_layout = "us";
|
||||
xkb_variant = "altgr-intl";
|
||||
};
|
||||
"2362:628:PIXA3854:00_093A:0274_Touchpad" = {
|
||||
dwt = "enabled";
|
||||
tap = "enabled";
|
||||
natural_scroll = "enabled";
|
||||
middle_emulation = "enabled";
|
||||
};
|
||||
"1133:50504:Logitech_USB_Receiver" = {
|
||||
xkb_layout = "us";
|
||||
xkb_variant = "altgr-intl";
|
||||
};
|
||||
"1133:45944:MX_KEYS_S" = {
|
||||
xkb_layout = "us";
|
||||
xkb_variant = "altgr-intl";
|
||||
};
|
||||
};
|
||||
work_back_middle = {
|
||||
name = "LG Electronics LG Ultra HD 0x000305A6";
|
||||
mode = "2560x1440";
|
||||
scale = "1";
|
||||
position = "5120,0";
|
||||
workspace = "1:一";
|
||||
output = "DP-10";
|
||||
keybindings = {
|
||||
"Mod4+Ctrl+Shift+p" = "exec screenshare";
|
||||
};
|
||||
work_front_left = {
|
||||
name = "LG Electronics LG Ultra HD 0x0007AB45";
|
||||
mode = "3840x2160";
|
||||
scale = "1";
|
||||
position = "5120,0";
|
||||
workspace = "1:一";
|
||||
output = "DP-7";
|
||||
shellAliases = {
|
||||
ans2-15_3-9 = ". ~/.venvs/ansible39_2_15_0/bin/activate";
|
||||
ans3-9 = ". ~/.venvs/ansible39/bin/activate";
|
||||
ans = ". ~/.venvs/ansible/bin/activate";
|
||||
ans2-15 = ". ~/.venvs/ansible2.15.0/bin/activate";
|
||||
};
|
||||
work_back_right = {
|
||||
name = "HP Inc. HP Z32 CN41212T55";
|
||||
mode = "3840x2160";
|
||||
scale = "1";
|
||||
position = "5120,0";
|
||||
workspace = "1:一";
|
||||
output = "DP-3";
|
||||
};
|
||||
work_middle_middle_main = {
|
||||
name = "HP Inc. HP 732pk CNC4080YL5";
|
||||
mode = "3840x2160";
|
||||
scale = "1";
|
||||
position = "-1280,0";
|
||||
workspace = "11:M";
|
||||
output = "DP-8";
|
||||
};
|
||||
work_middle_middle_side = {
|
||||
name = "Hewlett Packard HP Z24i CN44250RDT";
|
||||
mode = "1920x1200";
|
||||
transform = "270";
|
||||
scale = "1";
|
||||
position = "-2480,0";
|
||||
workspace = "12:S";
|
||||
output = "DP-9";
|
||||
};
|
||||
work_seminary = {
|
||||
name = "Applied Creative Technology Transmitter QUATTRO201811";
|
||||
mode = "1280x720";
|
||||
scale = "1";
|
||||
position = "10000,10000"; # i.e. this screen is inaccessible by moving the mouse
|
||||
workspace = "12:S";
|
||||
output = "DP-4";
|
||||
};
|
||||
};
|
||||
inputs = {
|
||||
"12972:18:Framework_Laptop_16_Keyboard_Module_-_ANSI_Keyboard" = {
|
||||
xkb_layout = "us";
|
||||
xkb_variant = "altgr-intl";
|
||||
};
|
||||
"1133:45081:MX_Master_2S_Keyboard" = {
|
||||
xkb_layout = "us";
|
||||
xkb_variant = "altgr-intl";
|
||||
};
|
||||
"2362:628:PIXA3854:00_093A:0274_Touchpad" = {
|
||||
dwt = "enabled";
|
||||
tap = "enabled";
|
||||
natural_scroll = "enabled";
|
||||
middle_emulation = "enabled";
|
||||
};
|
||||
"1133:50504:Logitech_USB_Receiver" = {
|
||||
xkb_layout = "us";
|
||||
xkb_variant = "altgr-intl";
|
||||
};
|
||||
"1133:45944:MX_KEYS_S" = {
|
||||
xkb_layout = "us";
|
||||
xkb_variant = "altgr-intl";
|
||||
};
|
||||
};
|
||||
keybindings = {
|
||||
"Mod4+Ctrl+Shift+p" = "exec screenshare";
|
||||
};
|
||||
shellAliases = {
|
||||
ans2-15_3-9 = ". ~/.venvs/ansible39_2_15_0/bin/activate";
|
||||
ans3-9 = ". ~/.venvs/ansible39/bin/activate";
|
||||
ans = ". ~/.venvs/ansible/bin/activate";
|
||||
ans2-15 = ". ~/.venvs/ansible2.15.0/bin/activate";
|
||||
};
|
||||
};
|
||||
}
|
||||
sharedOptions;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ in
|
|||
swarselsystems = {
|
||||
hasBluetooth = false;
|
||||
hasFingerprint = false;
|
||||
impermanence = false;
|
||||
isImpermanence = false;
|
||||
isBtrfs = false;
|
||||
flakePath = "/root/.dotfiles";
|
||||
server = {
|
||||
|
|
|
|||
|
|
@ -1,21 +1,15 @@
|
|||
{ self, inputs, outputs, config, pkgs, lib, ... }:
|
||||
let
|
||||
profilesPath = "${self}/profiles";
|
||||
sharedOptions = {
|
||||
isBtrfs = true;
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
imports = [
|
||||
inputs.disko.nixosModules.disko
|
||||
"${self}/hosts/nixos/toto/disk-config.nix"
|
||||
{
|
||||
_module.args = {
|
||||
withSwap = true;
|
||||
swapSize = "8";
|
||||
rootDisk = "/dev/vda";
|
||||
withImpermanence = true;
|
||||
withEncryption = true;
|
||||
};
|
||||
}
|
||||
./hardware-configuration.nix
|
||||
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
|
|
@ -76,19 +70,24 @@ in
|
|||
firewall.enable = false;
|
||||
};
|
||||
|
||||
swarselsystems = {
|
||||
wallpaper = self + /wallpaper/lenovowp.png;
|
||||
impermanence = true;
|
||||
isBtrfs = true;
|
||||
isCrypted = true;
|
||||
initialSetup = true;
|
||||
};
|
||||
swarselsystems = lib.recursiveUpdate
|
||||
{
|
||||
wallpaper = self + /wallpaper/lenovowp.png;
|
||||
isImpermanence = true;
|
||||
isCrypted = true;
|
||||
initialSetup = true;
|
||||
isSwap = true;
|
||||
swapSize = "8G";
|
||||
rootDisk = "/dev/vda";
|
||||
}
|
||||
sharedOptions;
|
||||
|
||||
home-manager.users.swarsel.swarselsystems = {
|
||||
isLaptop = false;
|
||||
isNixos = true;
|
||||
isBtrfs = true;
|
||||
flakePath = "/home/swarsel/.dotfiles";
|
||||
};
|
||||
home-manager.users.swarsel.swarselsystems = lib.recursiveUpdate
|
||||
{
|
||||
isLaptop = false;
|
||||
isNixos = true;
|
||||
flakePath = "/home/swarsel/.dotfiles";
|
||||
}
|
||||
sharedOptions;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
# NOTE: ... is needed because dikso passes diskoFile
|
||||
{ lib
|
||||
, pkgs
|
||||
, config
|
||||
, rootDisk
|
||||
, swapSize ? "8"
|
||||
, withSwap ? true
|
||||
, withEncryption ? true
|
||||
, withImpermanence ? true
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
|
|
@ -20,7 +17,7 @@ let
|
|||
"noatime"
|
||||
];
|
||||
};
|
||||
"/home" = lib.mkIf withImpermanence {
|
||||
"/home" = lib.mkIf config.swarselsystems.isImpermanence {
|
||||
mountpoint = "/home";
|
||||
mountOptions = [
|
||||
"subvol=home"
|
||||
|
|
@ -28,7 +25,7 @@ let
|
|||
"noatime"
|
||||
];
|
||||
};
|
||||
"/persist" = lib.mkIf withImpermanence {
|
||||
"/persist" = lib.mkIf config.swarselsystems.isImpermanence {
|
||||
mountpoint = "/persist";
|
||||
mountOptions = [
|
||||
"subvol=persist"
|
||||
|
|
@ -36,7 +33,7 @@ let
|
|||
"noatime"
|
||||
];
|
||||
};
|
||||
"/log" = lib.mkIf withImpermanence {
|
||||
"/log" = lib.mkIf config.swarselsystems.isImpermanence {
|
||||
mountpoint = "/var/log";
|
||||
mountOptions = [
|
||||
"subvol=log"
|
||||
|
|
@ -52,9 +49,9 @@ let
|
|||
"noatime"
|
||||
];
|
||||
};
|
||||
"/swap" = lib.mkIf withSwap {
|
||||
"/swap" = lib.mkIf config.swarselsystems.isSwap {
|
||||
mountpoint = "/.swapvol";
|
||||
swap.swapfile.size = "${swapSize}G";
|
||||
swap.swapfile.size = config.swarselsystems.swapSize;
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
@ -63,7 +60,7 @@ in
|
|||
disk = {
|
||||
disk0 = {
|
||||
type = "disk";
|
||||
device = rootDisk;
|
||||
device = config.swarselsystems.rootDisk;
|
||||
content = {
|
||||
type = "gpt";
|
||||
partitions = {
|
||||
|
|
@ -79,11 +76,11 @@ in
|
|||
mountOptions = [ "defaults" ];
|
||||
};
|
||||
};
|
||||
root = lib.mkIf (!withEncryption) {
|
||||
root = lib.mkIf (!config.swarselsystems.isCrypted) {
|
||||
size = "100%";
|
||||
content = {
|
||||
inherit type subvolumes extraArgs;
|
||||
postCreateHook = lib.mkIf withImpermanence ''
|
||||
postCreateHook = lib.mkIf config.swarselsystems.isImpermanence ''
|
||||
MNTPOINT=$(mktemp -d)
|
||||
mount "/dev/disk/by-label/nixos" "$MNTPOINT" -o subvolid=5
|
||||
trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT
|
||||
|
|
@ -91,7 +88,7 @@ in
|
|||
'';
|
||||
};
|
||||
};
|
||||
luks = lib.mkIf withEncryption {
|
||||
luks = lib.mkIf config.swarselsystems.isCrypted {
|
||||
size = "100%";
|
||||
content = {
|
||||
type = "luks";
|
||||
|
|
@ -107,7 +104,7 @@ in
|
|||
};
|
||||
content = {
|
||||
inherit type subvolumes extraArgs;
|
||||
postCreateHook = lib.mkIf withImpermanence ''
|
||||
postCreateHook = lib.mkIf config.swarselsystems.isImpermanence ''
|
||||
MNTPOINT=$(mktemp -d)
|
||||
mount "/dev/mapper/cryptroot" "$MNTPOINT" -o subvolid=5
|
||||
trap 'umount $MNTPOINT; rm -rf $MNTPOINT' EXIT
|
||||
|
|
@ -122,8 +119,8 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
fileSystems."/persist".neededForBoot = lib.mkIf withImpermanence true;
|
||||
fileSystems."/home".neededForBoot = lib.mkIf withImpermanence true;
|
||||
fileSystems."/persist".neededForBoot = lib.mkIf config.swarselsystems.isImpermanence true;
|
||||
fileSystems."/home".neededForBoot = lib.mkIf config.swarselsystems.isImpermanence true;
|
||||
|
||||
environment.systemPackages = [
|
||||
pkgs.yubikey-manager
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ in
|
|||
swarselsystems = {
|
||||
hasBluetooth = false;
|
||||
hasFingerprint = false;
|
||||
impermanence = false;
|
||||
isImpermanence = false;
|
||||
isBtrfs = false;
|
||||
flakePath = "/home/swarsel/.dotfiles";
|
||||
server = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue