flake: start refactoring

This commit is contained in:
Veneficium 2025-02-11 22:00:49 +01:00
parent 4b8923b5f5
commit 8b4e41c968
8 changed files with 62 additions and 76 deletions

View file

@ -38,59 +38,42 @@
treefmt-nix,
...
}:
let
pkgs =
extraOverlays: system:
import nixpkgs {
inherit system;
overlays = extraOverlays;
config = {
allowUnfree = true;
};
};
in
{
nixosConfigurations = {
fedfer-main-laptop-nixos = nixpkgs.lib.nixosSystem rec {
fedfer-main-laptop-nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
pkgs = (
pkgs [
nix-vscode-extensions.overlays.default
niri.overlays.niri
] system
);
};
modules = [
{
nixpkgs.overlays = [
nix-vscode-extensions.overlays.default
niri.overlays.niri
];
}
./hosts/main-laptop/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.users.fedfer = import ./hosts/main-laptop/home.nix;
home-manager.backupFileExtension = "backup";
home-manager.extraSpecialArgs = {
inherit inputs;
};
}
stylix.nixosModules.stylix
niri.nixosModules.niri
];
};
veneficium-main-homelab-nixos = nixpkgs.lib.nixosSystem rec {
veneficium-main-homelab-nixos = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
pkgs = (pkgs [ ] system);
inherit self;
};
modules = [
arion.nixosModules.arion
./hosts/main-homelab/configuration.nix
];
};
};
formatter.x86_64-linux =
(treefmt-nix.lib.evalModule (pkgs [ ] "x86_64-linux") ./treefmt.nix).config.build.wrapper;
(treefmt-nix.lib.evalModule nixpkgs.legacyPackages."x86_64-linux" ./treefmt.nix)
.config.build.wrapper;
};
}

View file

@ -1,5 +1,4 @@
{
self,
pkgs,
lib,
...
@ -76,15 +75,6 @@
programs.zsh.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
#enable flakes
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
#DO NOT CHANGE THIS! IMPORTANT! DO NOT CHANGE THIS!
system.stateVersion = "24.05"; # DO NOT CHANGE THIS!

View file

@ -65,6 +65,8 @@
settings = {
users.fedfer.enable = lib.mkForce true;
system.boot.windows.enable = lib.mkForce true;
programs.docker.enable = lib.mkForce true;
programs.tailscale.enable = lib.mkForce true;
programs.gnupg.enable = lib.mkForce true;
@ -95,19 +97,6 @@
#enable wayland for electron programs
environment.sessionVariables.NIXOS_OZONE_WL = "1";
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.edk2-uefi-shell.enable = true;
boot.loader.systemd-boot.windows = {
"11" = {
title = "Windows 11 (gaming)";
efiDeviceHandle = "FS0";
};
};
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.systemd-boot.configurationLimit = 10;
#todo look further into networking options
#could be pretty interesting
networking.hostName = "fedfer-main-laptop-nixos";
@ -137,9 +126,6 @@
#todo modularize!
programs.xwayland.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
nano
lshw
@ -148,12 +134,5 @@
gcc
];
#enable flakes
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
system.stateVersion = "24.05"; # DO NOT CHANGE THIS!
}

View file

@ -1,6 +1,3 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{
config,
lib,
@ -23,25 +20,18 @@
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-label/nixos";
label = "nixos";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/BOOT";
label = "BOOT";
fsType = "vfat";
};
swapDevices = [ { device = "/dev/disk/by-label/swap"; } ];
swapDevices = [ { label = "swap"; } ];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -1,7 +1,9 @@
{ lib, ... }:
{
imports = [
./locale.nix
./system/boot.nix
./system/nix.nix
./system/locale.nix
./users/fedfer.nix
./users/veneficium.nix
@ -34,6 +36,8 @@
];
settings = {
system.boot.windows.enable = lib.mkDefault false;
users.fedfer.enable = lib.mkDefault false;
users.veneficium.enable = lib.mkDefault false;

View file

@ -0,0 +1,31 @@
{
pkgs,
config,
lib,
...
}:
{
options.settings.system.boot = {
windows.enable = lib.mkEnableOption "Enable windows dual boot";
};
config = {
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader = {
efi.canTouchEfiVariables = true;
systemd-boot.enable = true;
systemd-boot.edk2-uefi-shell.enable = true;
systemd-boot.configurationLimit = 10;
systemd-boot.editor = false;
systemd-boot.windows = lib.mkIf config.settings.system.boot.windows.enable {
"11" = {
title = "Windows";
efiDeviceHandle = "FS0";
};
};
};
};
}

View file

@ -0,0 +1,9 @@
{ ... }:
{
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nixpkgs.config.allowUnfree = true;
}