onedrive: init #18

Merged
DashieTM merged 3 commits from main into main 2025-05-10 14:03:52 +02:00
Showing only changes of commit 4e7aa1e0f0 - Show all commits

View file

@ -1,199 +1,199 @@
{ {
lib, lib,
config, config,
options, options,
... ...
}: { }: {
options.conf = { options.conf = {
system = lib.mkOption { system = lib.mkOption {
default = "x86_64-linux"; default = "x86_64-linux";
# no fisherprice unix support # no fisherprice unix support
type = with lib.types; (enum [ type = with lib.types; (enum [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
"aarch64-linux-android" "aarch64-linux-android"
]); ]);
example = "aarch64-linux"; example = "aarch64-linux";
description = '' description = ''
System architecture. System architecture.
''; '';
}; };
systemLocalTime = lib.mkOption { systemLocalTime = lib.mkOption {
default = false; default = false;
example = true; example = true;
description = '' description = ''
System time for dualbooting System time for dualbooting
''; '';
}; };
wsl = lib.mkOption { wsl = lib.mkOption {
default = false; default = false;
example = true; example = true;
description = '' description = ''
Runs Nix in wsl Runs Nix in wsl
''; '';
}; };
secureBoot = lib.mkOption { secureBoot = lib.mkOption {
default = false; default = false;
example = true; example = true;
description = '' description = ''
enables secure boot. enables secure boot.
Note: Secure boot is NOT reproducible Note: Secure boot is NOT reproducible
Here are the necessary steps: Here are the necessary steps:
+ create your keys with sbctl -> sudo sbctl create-keys + create your keys with sbctl -> sudo sbctl create-keys
+ build with systemd once -> set this to false and build once + build with systemd once -> set this to false and build once
+ build with secureBoot true + build with secureBoot true
+ verify that your keys are signed (note, only systemd and your generations should now be signed): sudo sbtcl verify + verify that your keys are signed (note, only systemd and your generations should now be signed): sudo sbtcl verify
+ enroll your keys (microsoft is necessary for windows dualboot support, leave it there): sudo sbctl enroll-keys --microsoft + enroll your keys (microsoft is necessary for windows dualboot support, leave it there): sudo sbctl enroll-keys --microsoft
+ reboot with secureboot enabled + reboot with secureboot enabled
Note: Some motherboards have vendor specific keys for secure boot, this may not necessarily work with our self signed keys Note: Some motherboards have vendor specific keys for secure boot, this may not necessarily work with our self signed keys
You likely have to disable these vendor specific keys (example HP: sure boot) You likely have to disable these vendor specific keys (example HP: sure boot)
''; '';
}; };
useSystemdBootloader = lib.mkOption { useSystemdBootloader = lib.mkOption {
default = true; default = true;
example = false; example = false;
description = '' description = ''
use systemd bootloader. use systemd bootloader.
''; '';
}; };
cpu = lib.mkOption { cpu = lib.mkOption {
# TODO: how to enable arm? # TODO: how to enable arm?
default = "amd"; default = "amd";
type = with lib.types; (enum [ type = with lib.types; (enum [
"amd" "amd"
"intel" "intel"
]); ]);
example = "intel"; example = "intel";
description = '' description = ''
cpu microcode. cpu microcode.
''; '';
}; };
additionalBootKernalParams = lib.mkOption { additionalBootKernalParams = lib.mkOption {
default = [ default = [
"video=${config.conf.defaultMonitor}:${config.conf.defaultMonitorMode}" "video=${config.conf.defaultMonitor}:${config.conf.defaultMonitorMode}"
]; ];
example = []; example = [];
type = with lib.types; listOf str; type = with lib.types; listOf str;
description = '' description = ''
additional kernelParams passed to bootloader additional kernelParams passed to bootloader
''; '';
}; };
defaultMonitor = lib.mkOption { defaultMonitor = lib.mkOption {
default = ""; default = "";
example = "eDP-1"; example = "eDP-1";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
main monitor main monitor
''; '';
}; };
defaultMonitorMode = lib.mkOption { defaultMonitorMode = lib.mkOption {
default = ""; default = "";
example = "3440x1440@180"; example = "3440x1440@180";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
main monitor mode: width x height @ refreshrate main monitor mode: width x height @ refreshrate
''; '';
}; };
defaultMonitorScale = lib.mkOption { defaultMonitorScale = lib.mkOption {
default = "1"; default = "1";
example = "1.5"; example = "1.5";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
main monitor scaling main monitor scaling
''; '';
}; };
bootParams = lib.mkOption { bootParams = lib.mkOption {
default = []; default = [];
example = ["resume=something"]; example = ["resume=something"];
type = with lib.types; listOf str; type = with lib.types; listOf str;
description = '' description = ''
Boot params Boot params
''; '';
}; };
kernelOverride = lib.mkOption { kernelOverride = lib.mkOption {
default = null; default = null;
type = with lib.types; nullOr package; type = with lib.types; nullOr package;
description = '' description = ''
kernel to be used kernel to be used
Has no examples as doc complains... Has no examples as doc complains...
#example = pkgs.linuxPackages_xanmod_latest; #example = pkgs.linuxPackages_xanmod_latest;
''; '';
}; };
username = lib.mkOption { username = lib.mkOption {
default = "dashie"; default = "DashNix";
example = "pingpang"; example = "pingpang";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
The username. The username.
''; '';
}; };
timezone = lib.mkOption { timezone = lib.mkOption {
default = "Europe/Zurich"; default = "Europe/Zurich";
example = "Europe/Berlin"; example = "Europe/Berlin";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
The timezone. The timezone.
''; '';
}; };
locale = lib.mkOption { locale = lib.mkOption {
default = "en_US.UTF-8"; default = "en_US.UTF-8";
example = "de_DE.UTF-8"; example = "de_DE.UTF-8";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
The locale. The locale.
''; '';
}; };
nixosConfigPath = lib.mkOption { nixosConfigPath = lib.mkOption {
default = "/home/${config.conf.username}/gits/nixos/."; default = "/home/${config.conf.username}/gits/nixos/.";
example = "yourpath/."; example = "yourpath/.";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
The path for your build command, you can then simply type rebuild to switch to a new configuration. The path for your build command, you can then simply type rebuild to switch to a new configuration.
''; '';
}; };
systemStateVersion = lib.mkOption { systemStateVersion = lib.mkOption {
example = "24.11"; example = "24.11";
default = "23.05"; default = "23.05";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
System state version System state version
''; '';
}; };
homeStateVersion = lib.mkOption { homeStateVersion = lib.mkOption {
default = "24.11"; default = "24.11";
example = "23.05"; example = "23.05";
type = lib.types.str; type = lib.types.str;
description = '' description = ''
Home state version Home state version
''; '';
}; };
}; };
config = config =
(lib.optionalAttrs (options ? system.stateVersion) { (lib.optionalAttrs (options ? system.stateVersion) {
boot = { boot = {
kernelPackages = lib.mkIf (config.conf.kernelOverride != null) config.conf.kernel; kernelPackages = lib.mkIf (config.conf.kernelOverride != null) config.conf.kernel;
kernelParams = config.conf.additionalBootKernalParams; kernelParams = config.conf.additionalBootKernalParams;
}; };
system.stateVersion = config.conf.systemStateVersion; system.stateVersion = config.conf.systemStateVersion;
}) })
// (lib.optionalAttrs (options ? home.stateVersion) { // (lib.optionalAttrs (options ? home.stateVersion) {
home.stateVersion = config.conf.homeStateVersion; home.stateVersion = config.conf.homeStateVersion;
}); });
} }