refactor: prepare new modules structure

This commit is contained in:
Nickolaj Jepsen 2025-05-20 20:05:23 +02:00
parent d25e24c15b
commit bf82970b9e
65 changed files with 94 additions and 94 deletions

View file

@ -41,7 +41,8 @@ with lib; let
inputs.fireproof-shell.nixosModules.default
inputs.niri.nixosModules.niri
inputs.zwift.nixosModules.zwift
../modules/base/user.nix
../modules/base
../modules/programs
(mkSystemImports hostname)
{ nixpkgs.config.allowUnfree = true; }
]
@ -57,49 +58,35 @@ in {
bootstrap = mkSystem {
hostname = "bootstrap";
username = "nixos";
modules = [
../modules/required.nix
../modules/shell.nix
];
};
laptop = mkSystem {
hostname = "laptop";
username = "nickolaj";
modules = [
../modules/required.nix
../modules/shell.nix
../modules/graphical.nix
../modules/devenv.nix
../legacy_modules/graphical.nix
../legacy_modules/devenv.nix
];
};
desktop = mkSystem {
hostname = "desktop";
username = "nickolaj";
modules = [
../modules/required.nix
../modules/shell.nix
../modules/graphical.nix
../modules/devenv.nix
../legacy_modules/graphical.nix
../legacy_modules/devenv.nix
];
};
work = mkSystem {
hostname = "work";
username = "nickolaj";
modules = [
../modules/required.nix
../modules/shell.nix
../modules/graphical.nix
../modules/devenv.nix
../legacy_modules/graphical.nix
../legacy_modules/devenv.nix
];
};
homelab = mkSystem {
hostname = "homelab";
username = "nickolaj";
modules = [
../modules/required.nix
../modules/shell.nix
];
};
};
}

View file

@ -46,7 +46,5 @@
};
};
};
fireproof.default-apps = {
terminal = "ghostty";
};
fireproof.base.defaults.terminal = "ghostty";
}

View file

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 282 KiB

After

Width:  |  Height:  |  Size: 282 KiB

Before After
Before After

View file

@ -233,7 +233,7 @@ in {
};
bind = [
"SUPER, RETURN, exec, ${getExe config.programs.uwsm.package} app -- ${cfg.default-apps.terminal}"
"SUPER, RETURN, exec, ${getExe config.programs.uwsm.package} app -- ${cfg.base.defaults.terminal}"
"SUPER, BACKSPACE, killactive"
"SUPER, SPACE, exec, astal launcher"
"SUPER, semicolon, exec, astal launcher .e"

View file

@ -10,6 +10,7 @@
./dev/docker.nix
./dev/tilt.nix
./dev/postgres.nix
./dev/aider.nix
./dev/clickhouse.nix
];
}

22
modules/base/default.nix Normal file
View file

@ -0,0 +1,22 @@
_: {
options.fireproof.base = {};
imports = [
./boot.nix
./defaults.nix
./gc.nix
./home-manager.nix
./hosts.nix
./keyd.nix
./ld.nix
./networking.nix
./nix.nix
./secrets.nix
./security.nix
./ssh.nix
./time.nix
./usb.nix
./user.nix
./yubikey.nix
];
}

View file

@ -1,5 +1,6 @@
{lib, ...}: {
options.fireproof.default-apps = {
{lib, ...}:
{
options.fireproof.base.defaults = {
terminal = lib.mkOption {
type = lib.types.str;
description = "The terminal to use";

View file

@ -1,5 +0,0 @@
{config, ...}: {
environment.variables = {
EDITOR = config.defaults.editor;
};
}

View file

@ -0,0 +1,24 @@
{
lib,
options,
username,
...
}:
with lib; {
options.fireproof = {
home-manager = lib.mkOption {
type = options.home-manager.users.type.nestedTypes.elemType;
};
};
config = {
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
};
home-manager.users.${username} = mkAliasDefinitions options.fireproof.home-manager;
# set the same version of home-manager as the system
fireproof.home-manager.home.stateVersion = "24.11";
system.stateVersion = "24.11";
};
}

17
modules/base/hosts.nix Normal file
View file

@ -0,0 +1,17 @@
{
config,
...
}: {
age.secrets.hosts-private = {
# Contains IP addresses that i have no business sharing
rekeyFile = ../../secrets/hosts-private.age;
};
# Inject the private hosts file, because setting networking.hostFiles doesn't work
system.activationScripts.hosts-private = ''
cat /etc/hosts > /etc/hosts.bak
rm /etc/hosts
cat /etc/hosts.bak "${config.age.secrets.hosts-private.path}" >> /etc/hosts
rm /etc/hosts.bak
'';
}

View file

@ -1,21 +1,7 @@
{
config,
hostname,
...
}: {
age.secrets.hosts-private = {
# Contains IP addresses that i have no business sharing
rekeyFile = ../../secrets/hosts-private.age;
};
# Inject the private hosts file, because setting networking.hostFiles doesn't work
system.activationScripts.hosts-private = ''
cat /etc/hosts > /etc/hosts.bak
rm /etc/hosts
cat /etc/hosts.bak "${config.age.secrets.hosts-private.path}" >> /etc/hosts
rm /etc/hosts.bak
'';
networking = {
hostName = hostname;
};

View file

@ -1,18 +1,11 @@
{
lib,
options,
username,
config,
...
}:
with lib; let
let
inherit (config.age) secrets;
in {
options.fireproof = {
home-manager = lib.mkOption {
type = options.home-manager.users.type.nestedTypes.elemType;
};
};
config = {
age.secrets.hashed-user-password.rekeyFile = ../../secrets/hashed-user-password.age;
@ -21,15 +14,5 @@ in {
extraGroups = ["wheel"];
hashedPasswordFile = secrets.hashed-user-password.path;
};
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
};
home-manager.users.${username} = mkAliasDefinitions options.fireproof.home-manager;
# set the same version of home-manager as the system
fireproof.home-manager.home.stateVersion = "24.11";
system.stateVersion = "24.11";
};
}

View file

@ -0,0 +1,11 @@
_: {
imports = [
./fish/default.nix
./core.nix
./git.nix
./just.nix
./neovim.nix
./zellij.nix
./zoxide.nix
];
}

View file

@ -0,0 +1,5 @@
{pkgsUnstable, ...}: {
environment.systemPackages = [
pkgsUnstable.just
];
}

View file

@ -1,18 +0,0 @@
{
imports = [
./base/nix.nix
./base/networking.nix
./base/security.nix
./base/secrets.nix
./base/boot.nix
./base/ld.nix
./base/time.nix
./base/ssh.nix
./base/default-apps.nix
./base/keyd.nix
./base/gc.nix
./dev/just.nix
./hardware/usb.nix
./hardware/yubikey.nix
];
}

View file

@ -1,12 +0,0 @@
{
imports = [
./shell/core.nix
./shell/fish/default.nix
./shell/git.nix
./shell/comma.nix
./shell/neovim.nix
./shell/zellij.nix
./shell/zoxide.nix
./shell/aider.nix
];
}