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]
│ ├───hape/ [HP EliteBook 840 G2]
│ ├───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`)
├───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)
```

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 (self) lib;
createHost = hostDir: lib.nixosSystem {
createHost' = extraModules: hostDir: lib.nixosSystem {
system = null;
specialArgs = {
inherit lib inputs self;
@ -13,16 +13,20 @@
modules = [
hostDir
../modules
];
./common/core
] ++ extraModules;
};
createDesktop = createHost' [ ./common/desktop ];
createServer = createHost' [];
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 = [
../../options/boot/systemd-boot.nix
../../options/common/binary-caches.nix
../../options/common/cpu/intel.nix
../../options/common/dash.nix
../../options/common/dbus.nix
../../options/common/disable-nano.nix
../../options/common/disk.nix
../../options/common/docs.nix
../../options/common/kernel.nix
../../options/common/nix.nix
../../options/common/oomd.nix
../../options/common/pin-registry.nix
../../options/common/preserve-system.nix
../../options/common/switch-ng.nix
../../options/common/timezone.nix
../../options/desktop/adb.nix
../../options/desktop/bluetooth.nix
../../options/desktop/dev/malloc-perturb.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
lib,
...
}: let
inherit (lib.lists) map;
inherit (lib.path) append;
in {
imports = map (append ../common/optional) [
"adb.nix"
"cpu/intel.nix"
"mullvad-vpn.nix"
"opentabletdriver.nix"
"power-supply.nix"
"qmk.nix"
"steam.nix"
"suspend.nix"
"v4l2.nix"
"wayland.nix"
"wireshark.nix"
"yubikey.nix"
];
}

View file

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

View file

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

View file

@ -1,25 +1,16 @@
{
imports = [
../../options/boot/systemd-boot.nix
../../options/common/binary-caches.nix
../../options/common/dash.nix
../../options/common/disable-nano.nix
../../options/common/cpu/intel.nix
../../options/common/disk.nix
../../options/common/docs.nix
../../options/common/kernel.nix
../../options/common/nix.nix
../../options/common/oomd.nix
../../options/common/pin-registry.nix
../../options/common/preserve-system.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
lib,
...
}: let
inherit (lib.lists) map;
inherit (lib.path) append;
in {
imports = map (append ../common/optional) [
"cpu/intel.nix"
"displaylink.nix"
"suspend.nix"
"v4l2.nix"
"wayland.nix"
"yubikey.nix"
];
}

View file

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