Secure boot and wsl #10

Merged
DashieTM merged 5 commits from main into main 2025-05-02 10:16:15 +02:00
8 changed files with 28 additions and 42 deletions
Showing only changes of commit c57a9984c1 - Show all commits

View file

@ -13,13 +13,13 @@ in {
#(modulesPath + "/misc/nixpkgs/read-only.nix")
];
wsl.enable = config.conf.wsl;
# Bootloader.
boot = {
boot = lib.mkIf (!config.conf.wsl) {
consoleLogLevel = 0;
boot.loader.systemd-boot.enable = lib.mkForce false;
boot.lanzaboote = lib.mkIf config.conf.secureBoot {
lanzaboote = lib.mkIf config.conf.secureBoot {
enable = true;
pkiBundle = "/var/lib/sbctl";
};
@ -29,7 +29,7 @@ in {
enable =
if config.conf.secureBoot
then lib.mkForce false
else if config.conf.useSystemdBootloadertrue
else if config.conf.useSystemdBootloader
then true
else false;
configurationLimit = 5;
@ -74,7 +74,6 @@ in {
# Enable the X11 windowing system.
services = {
lorri.enable = true;
flatpak.enable = true;
xserver.enable = true;
fstrim.enable = lib.mkDefault true;
# Enable sound with pipewire.

View file

@ -237,7 +237,6 @@ For package lists, please check the individual modules, as the lists can be long
- drives : A drive configuration module
- firefox: Enables and configures firefox (extensions and settings)
- fish: Enables and configures fish shell
- flatpak : Installs and enables declarative flatpak
- gaming : Configures gaming related features (launchers, gamemode)
- git : Git key and config module
- gnome_services : Gnome services for minimal enviroments -> Window managers etc

View file

@ -4,10 +4,11 @@
inputs = {
unstable.url = "github:NixOs/nixpkgs/nixos-unstable";
stable.url = "github:NixOs/nixpkgs/nixos-24.11";
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
nur.url = "github:nix-community/NUR";
nix-flatpak = {
url = "github:gmodena/nix-flatpak";
lanzaboote = {
url = "github:nix-community/lanzaboote/v0.4.2";
inputs.nixpkgs.follows = "unstable";
};
home-manager = {

View file

@ -26,10 +26,10 @@ in {
keyboard = null;
file.".local/share/flatpak/overrides/global".text = ''
[Context]
filesystems=xdg-config/gtk-3.0;xdg-config/gtk-4.0
'';
#file.".local/share/flatpak/overrides/global".text = lib.mkForce ''
# [Context]
# filesystems=xdg-config/gtk-3.0;xdg-config/gtk-4.0
#'';
};
programs.nix-index = {

View file

@ -43,6 +43,8 @@
},
mods ? {
nixos = [
inputs.lanzaboote.nixosModules.lanzaboote
inputs.nixos-wsl.nixosModules.default
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
inputs.disko.nixosModules.disko
@ -62,7 +64,6 @@
inputs.hyprdock.homeManagerModules.default
inputs.hyprland.homeManagerModules.default
inputs.reset.homeManagerModules.default
inputs.nix-flatpak.homeManagerModules.nix-flatpak
inputs.sops-nix.homeManagerModules.sops
inputs.dashvim.homeManagerModules.dashvim
../modules

View file

@ -20,6 +20,14 @@
'';
};
wsl = lib.mkOption {
default = false;
example = true;
description = ''
Runs Nix in wsl
'';
};
secureBoot = lib.mkOption {
default = false;
example = true;

View file

@ -149,7 +149,7 @@
config = (
lib.optionalAttrs (options ? fileSystems) {
fileSystems = lib.mkIf (config.mods.drives.variant == "manual") (
fileSystems = lib.mkIf (config.mods.drives.variant == "manual" && !config.conf.wsl) (
builtins.listToAttrs (
map (
{
@ -196,7 +196,7 @@
}
);
swapDevices = lib.mkIf (config.mods.drives.useSwap && config.mods.drives.variant == "manual") [
swapDevices = lib.mkIf (config.mods.drives.useSwap && config.mods.drives.variant == "manual" && !config.conf.wsl) [
{device = "/dev/disk/by-label/SWAP";}
];

View file

@ -7,37 +7,15 @@
}: {
options.mods.flatpak = {
enable = lib.mkOption {
default = true;
example = false;
default = false;
example = true;
type = lib.types.bool;
description = "Enables the flatpak package manager";
};
additional_packages = lib.mkOption {
default = [];
example = [];
type = with lib.types; listOf str;
description = "Flatpak packages";
};
};
config = lib.mkIf config.mods.flatpak.enable (
lib.optionalAttrs (options ? services.flatpak.remote) {
lib.optionalAttrs (options ? environment.systemPackages) {
environment.systemPackages = [pkgs.flatpak];
services.flatpak.remotes = lib.mkOptionDefault [
{
name = "flathub-stable";
location = "https://dl.flathub.org/repo/flathub.flatpakrepo";
}
];
services.flatpak.uninstallUnmanaged = true;
}
// lib.optionalAttrs (options ? services.flatpak.packages) {
services.flatpak.packages =
[
# fallback if necessary, but generally avoided as nix is superior :)
# default flatseal installation since flatpak permissions are totally not a broken idea
"com.github.tchx84.Flatseal"
]
++ config.mods.flatpak.additional_packages;
}
);
}