huge options refactor

due to being on a wifi and my sim card not being able to do its job
properly this might have some errors

`nix flake check` gave me none for the current host but tbh who knows

this commit moves everything from `options` to `hosts/common` and
modifies the `createHost` function to import part of the files under
that directory by default

there's also a `hosts/common/optional` which is still being imported in
`profile.nix` but now in a better way using `lib.path.append` in tandem
with `lib.lists.map`
This commit is contained in:
jacekpoz 2024-09-01 20:31:24 +02:00
parent 833cda9894
commit 23f5aaaf45
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8
45 changed files with 121 additions and 131 deletions

View file

@ -12,12 +12,13 @@ niksos/
│ ├───del/ [Dell Latitude 7320 Detachable] │ ├───del/ [Dell Latitude 7320 Detachable]
│ ├───hape/ [HP EliteBook 840 G2] │ ├───hape/ [HP EliteBook 840 G2]
│ ├───niks/ [ASUS ROG Strix G513QY] │ ├───niks/ [ASUS ROG Strix G513QY]
│ └───work/ [undisclosed model, might change] │ ├───work/ [undisclosed model, might change]
│ └───common/ (shared configs)
│ ├───core/ (imported on all hosts)
│ ├───desktop/ (imported on all desktops)
│ ├───server/ (imported on all servers)
│ └───optional/ (imported in a host's `profile.nix`)
├───modules/ (custom modules you can enable under `poz`) ├───modules/ (custom modules you can enable under `poz`)
├───options/ (unconditional modules imported in `hosts/*/profile.nix`)
│ ├───common/ (options shared between most or all systems)
│ ├───desktop/ (desktop specific options + tablet / mobile)
│ └───server/ (server specific options)
└───secrets/ (agenix secrets) └───secrets/ (agenix secrets)
``` ```

View file

@ -0,0 +1,16 @@
{
imports = [
./binary-caches.nix
./dash.nix
./dbus.nix
./disable-nano.nix
./disk.nix
./docs.nix
./nix.nix
./oomd.nix
./pin-registry.nix
./preserve-system.nix
./switch-ng.nix
./timezone.nix
];
}

View file

@ -0,0 +1,9 @@
{
imports = [
./bluetooth.nix
./fonts.nix
./kernel.nix
./malloc-perturb.nix
./systemd-boot.nix
];
}

View file

@ -0,0 +1,5 @@
{
environment.sessionVariables = {
MALLOC_PERTURB_ = /*sh*/"$(($(head -200 /dev/urandom | cksum | cut -f1 -d ' ') % 255 + 1))";
};
}

View file

@ -5,7 +5,7 @@
inherit (inputs) self; inherit (inputs) self;
inherit (self) lib; inherit (self) lib;
createHost = hostDir: lib.nixosSystem { createHost' = extraModules: hostDir: lib.nixosSystem {
system = null; system = null;
specialArgs = { specialArgs = {
inherit lib inputs self; inherit lib inputs self;
@ -13,16 +13,20 @@
modules = [ modules = [
hostDir hostDir
../modules ../modules
]; ./common/core
] ++ extraModules;
}; };
createDesktop = createHost' [ ./common/desktop ];
createServer = createHost' [];
in { in {
niks = createHost ./niks; niks = createDesktop ./niks;
del = createHost ./del; del = createDesktop ./del;
hape = createHost ./hape; hape = createDesktop ./hape;
chmura = createHost ./chmura; chmura = createServer ./chmura;
${inputs.work-secrets.hostname} = createHost ./work; ${inputs.work-secrets.hostname} = createDesktop ./work;
} }

View file

@ -1,33 +1,22 @@
{ {
imports = [ lib,
../../options/boot/systemd-boot.nix ...
../../options/common/binary-caches.nix }: let
../../options/common/cpu/intel.nix inherit (lib.lists) map;
../../options/common/dash.nix inherit (lib.path) append;
../../options/common/dbus.nix in {
../../options/common/disable-nano.nix imports = map (append ../common/optional) [
../../options/common/disk.nix "adb.nix"
../../options/common/docs.nix "cpu/intel.nix"
../../options/common/kernel.nix "mullvad-vpn.nix"
../../options/common/nix.nix "opentabletdriver.nix"
../../options/common/oomd.nix "power-supply.nix"
../../options/common/pin-registry.nix "qmk.nix"
../../options/common/preserve-system.nix "steam.nix"
../../options/common/switch-ng.nix "suspend.nix"
../../options/common/timezone.nix "v4l2.nix"
../../options/desktop/adb.nix "wayland.nix"
../../options/desktop/bluetooth.nix "wireshark.nix"
../../options/desktop/dev/malloc-perturb.nix "yubikey.nix"
../../options/desktop/fonts.nix
../../options/desktop/mullvad-vpn.nix
../../options/desktop/opentabletdriver.nix
../../options/desktop/power-supply.nix
../../options/desktop/qmk.nix
../../options/desktop/steam.nix
../../options/desktop/suspend.nix
../../options/desktop/v4l2.nix
../../options/desktop/wayland.nix
../../options/desktop/wireshark.nix
../../options/desktop/yubikey.nix
]; ];
} }

View file

@ -1,32 +1,23 @@
{ {
imports = [ lib,
../../options/boot/systemd-boot.nix ...
../../options/common/binary-caches.nix }: let
../../options/common/cpu/intel.nix inherit (lib.lists) map;
../../options/common/dash.nix inherit (lib.path) append;
../../options/common/dbus.nix in {
../../options/common/disable-nano.nix imports = map (append ../common/optional) [
../../options/common/disk.nix "adb.nix"
../../options/common/docs.nix "asusd.nix"
../../options/common/kernel.nix "cpu/amd.nix"
../../options/common/nix.nix "gpu/amd.nix"
../../options/common/oomd.nix "mullvad-vpn.nix"
../../options/common/pin-registry.nix "opentabletdriver.nix"
../../options/common/preserve-system.nix "power-supply.nix"
../../options/common/switch-ng.nix "qmk.nix"
../../options/common/timezone.nix "suspend.nix"
../../options/desktop/adb.nix "v4l2.nix"
../../options/desktop/bluetooth.nix "wayland.nix"
../../options/desktop/dev/malloc-perturb.nix "wireshark.nix"
../../options/desktop/fonts.nix "yubikey.nix"
../../options/desktop/mullvad-vpn.nix
../../options/desktop/opentabletdriver.nix
../../options/desktop/power-supply.nix
../../options/desktop/qmk.nix
../../options/desktop/suspend.nix
../../options/desktop/v4l2.nix
../../options/desktop/wayland.nix
../../options/desktop/wireshark.nix
../../options/desktop/yubikey.nix
]; ];
} }

View file

@ -1,36 +1,25 @@
{ {
imports = [ lib,
../../options/boot/systemd-boot.nix ...
../../options/common/binary-caches.nix }: let
../../options/common/cpu/amd.nix inherit (lib.lists) map;
../../options/common/dash.nix inherit (lib.path) append;
../../options/common/dbus.nix in {
../../options/common/disable-nano.nix imports = map (append ../common/optional) [
../../options/common/disk.nix "adb.nix"
../../options/common/docs.nix "asusd.nix"
../../options/common/gpu/amd.nix "cpu/amd.nix"
../../options/common/kernel.nix "gpu/amd.nix"
../../options/common/libvirt.nix "libvirt.nix"
../../options/common/nix.nix "mullvad-vpn.nix"
../../options/common/oomd.nix "opentabletdriver.nix"
../../options/common/pin-registry.nix #"power-supply.nix"
../../options/common/preserve-system.nix "qmk.nix"
../../options/common/switch-ng.nix "steam.nix"
../../options/common/timezone.nix "suspend.nix"
../../options/desktop/adb.nix "v4l2.nix"
../../options/desktop/asusd.nix "wayland.nix"
../../options/desktop/bluetooth.nix "wireshark.nix"
../../options/desktop/dev/malloc-perturb.nix "yubikey.nix"
../../options/desktop/fonts.nix
../../options/desktop/mullvad-vpn.nix
../../options/desktop/opentabletdriver.nix
#../../options/desktop/power-supply.nix
../../options/desktop/qmk.nix
../../options/desktop/steam.nix
../../options/desktop/suspend.nix
../../options/desktop/v4l2.nix
../../options/desktop/wayland.nix
../../options/desktop/wireshark.nix
../../options/desktop/yubikey.nix
]; ];
} }

View file

@ -1,25 +1,16 @@
{ {
imports = [ lib,
../../options/boot/systemd-boot.nix ...
../../options/common/binary-caches.nix }: let
../../options/common/dash.nix inherit (lib.lists) map;
../../options/common/disable-nano.nix inherit (lib.path) append;
../../options/common/cpu/intel.nix in {
../../options/common/disk.nix imports = map (append ../common/optional) [
../../options/common/docs.nix "cpu/intel.nix"
../../options/common/kernel.nix "displaylink.nix"
../../options/common/nix.nix "suspend.nix"
../../options/common/oomd.nix "v4l2.nix"
../../options/common/pin-registry.nix "wayland.nix"
../../options/common/preserve-system.nix "yubikey.nix"
../../options/common/timezone.nix
../../options/desktop/bluetooth.nix
../../options/desktop/displaylink.nix
../../options/desktop/dev/malloc-perturb.nix
../../options/desktop/fonts.nix
../../options/desktop/suspend.nix
../../options/desktop/v4l2.nix
../../options/desktop/wayland.nix
../../options/desktop/yubikey.nix
]; ];
} }

View file

@ -1,5 +0,0 @@
{
environment.sessionVariables = {
MALLOC_PERTURB_ = "$(($(head -200 /dev/urandom | cksum | cut -f1 -d ' ') % 255 + 1))";
};
}