feat: introduction of system_profiles

This commit is contained in:
Ranomier 2025-06-14 21:43:23 +02:00
parent 116aaaacff
commit 855b932cbd
15 changed files with 117 additions and 67 deletions

View file

@ -28,32 +28,12 @@
}; };
imports = [ imports = [
# steam and other stuff seems to depend on perl
#"${modulesPath}/profiles/perlless.nix"
#nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1
./hardware-configuration.nix ./hardware-configuration.nix
./boot.nix ./boot.nix
../../modules
../../modules/users ../../system_profiles/desktop.nix
../../modules/hardware
../../modules/sec_auth
../../modules/software
../../modules/software/browser
../../modules/software/nix-helper
../../modules/software/shells
../../modules/software/office
../../modules/wm_and_de
../../modules/pkg_mgrmnt
../../system_profiles/defaults.nix
# ../../experiments # ../../experiments
]; ];
} }

View file

@ -10,6 +10,7 @@
}: { }: {
imports = [ imports = [
(modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/installer/scan/not-detected.nix")
#nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1
]; ];
boot.initrd.availableKernelModules = ["nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; boot.initrd.availableKernelModules = ["nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];

View file

@ -5,7 +5,10 @@ inArgs: hostname: hostOptions: let
else inArgs.nixpkgs.lib.nixosSystem; else inArgs.nixpkgs.lib.nixosSystem;
in in
nixosSystem { nixosSystem {
specialArgs = {inArgs = inArgs;}; specialArgs = {
inArgs = inArgs;
rootPath = inArgs.self;
};
modules = [ modules = [
../hosts/${hostname} ../hosts/${hostname}
#./debug.nix #./debug.nix

View file

@ -2,11 +2,16 @@
imports = [ imports = [
./accessibility.nix ./accessibility.nix
./customisation.nix ./customisation.nix
# should only be imported directly or via system_profiles
#./dhcp-all-interfaces.nix
./environment.nix ./environment.nix
./firewall.nix ./firewall.nix
./locale.nix ./locale.nix
./networking.nix ./networking.nix
#./plymouth.nix #./plymouth.nix # increases boot time too much
#./serial-console.nix # probably only for servers
./theming.nix ./theming.nix
]; ];
} }

View file

@ -0,0 +1,9 @@
{
# 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;
}

23
readme.md Normal file
View file

@ -0,0 +1,23 @@
# My flake config
Some awesome descriptive text here
## folder structure
### system_profiles
This whole folder is for the most part just a system to clean up importing
- In files in this (`system_profiles`) directory:
- should never import anything from parent directories
- can import things from the child directories
- The `importers` directory:
- Should only import things outside (above/parent) of the `system_profiles` directories.
- Probably only from the module directory or maybe a future nix-modules directory,
this rule is not set in stone yet
- should **not** import anything outside of this repository
- The `components` directory:
- Should never import anything from this repository
- It can import things from nixpkgs
- Should set only basic "system" settings
("system" is not well defined)

View file

@ -1,6 +1,6 @@
# For when to deploy to a container,
# can be used with minify to make things smaller
{lib, ...}: { {lib, ...}: {
boot.isContainer = lib.mkDefault true; boot.isContainer = lib.mkDefault true;
boot.kernel.enable = lib.mkDefault false; boot.kernel.enable = lib.mkDefault false;
imports = [./mini.nix];
} }

View file

@ -0,0 +1,16 @@
# This makes an installation smaller at the cost of
# features (and maybe even stability)
{lib, modulesPath, ...}: {
imports = [
(modulesPath + "/profiles/minimal.nix")
#(modulesPath + "/profiles/perlless.nix")
];
disabledModules = [
(modulesPath + "/profiles/all-hardware.nix")
(modulesPath + "/profiles/base.nix")
];
environment.defaultPackages = lib.mkDefault [];
nixpkgs.overlays = lib.mkDefault [(self: super: {})];
}

View file

@ -1,8 +1,6 @@
{ # This loads some nix and nixpkgs specific settints
lib, # i often need
pkgs, {lib, pkgs, ...}: {
...
}: {
# Disable if you don't want unfree packages # Disable if you don't want unfree packages
nixpkgs.config.allowUnfree = lib.mkDefault true; nixpkgs.config.allowUnfree = lib.mkDefault true;
@ -15,11 +13,9 @@
channel.enable = lib.mkDefault false; channel.enable = lib.mkDefault false;
settings.experimental-features = lib.mkDefault ["nix-command" "flakes"]; settings.experimental-features = lib.mkDefault [
}; "nix-command"
"flakes"
imports = [
../modules/locale.nix
../modules/sec_auth/sudo-rs.nix
]; ];
};
} }

View file

@ -0,0 +1,8 @@
{
imports = [
./components/nix-defaults.nix
./importers/desktop.nix
./importers/general.nix
];
}

View file

@ -0,0 +1,22 @@
# This basicly imports the whole modules folder
{rootPath, ...}: {
imports = [
(rootPath + /modules)
(rootPath + /modules/hardware)
(rootPath + /modules/pkg_mgrmnt)
(rootPath + /modules/sec_auth)
(rootPath + /modules/software)
(rootPath + /modules/software/browser)
(rootPath + /modules/software/nix-helper)
(rootPath + /modules/software/office)
(rootPath + /modules/software/shells)
(rootPath + /modules/users)
(rootPath + /modules/wm_and_de)
];
}

View file

@ -0,0 +1,7 @@
# This loads some "general" defaults
{rootPath, ...}: {
imports = [
(rootPath + /modules/locale.nix)
(rootPath + /modules/sec_auth/sudo-rs.nix)
];
}

View file

@ -0,0 +1,7 @@
{rootPath, ...}: {
imports = [
(rootPath + /modules/customisation.nix)
(rootPath + /modules/software/neovim.nix)
(rootPath + /modules/software/packages/core.nix)
];
}

View file

@ -1,26 +0,0 @@
{
lib,
modulesPath,
...
}: {
imports = [
(modulesPath + "/profiles/minimal.nix")
#(modulesPath + "/profiles/perlless.nix")
{
environment.defaultPackages = lib.mkDefault [];
nixpkgs.overlays = lib.mkDefault [(self: super: {})];
# 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;
}
];
disabledModules = [
(modulesPath + "/profiles/all-hardware.nix")
(modulesPath + "/profiles/base.nix")
];
}

View file

@ -1,10 +1,9 @@
{ {
imports = [ imports = [
./defaults.nix ./components/minify.nix
./mini.nix ./components/nix-defaults.nix
../modules/customisation.nix ./importers/general.nix
../modules/software/neovim.nix ./importers/server.nix
../modules/software/packages/core.nix
]; ];
} }