mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-22 08:06:50 +01:00
refactor: prepare new modules structure
This commit is contained in:
parent
d25e24c15b
commit
bf82970b9e
65 changed files with 94 additions and 94 deletions
|
|
@ -41,7 +41,8 @@ with lib; let
|
||||||
inputs.fireproof-shell.nixosModules.default
|
inputs.fireproof-shell.nixosModules.default
|
||||||
inputs.niri.nixosModules.niri
|
inputs.niri.nixosModules.niri
|
||||||
inputs.zwift.nixosModules.zwift
|
inputs.zwift.nixosModules.zwift
|
||||||
../modules/base/user.nix
|
../modules/base
|
||||||
|
../modules/programs
|
||||||
(mkSystemImports hostname)
|
(mkSystemImports hostname)
|
||||||
{ nixpkgs.config.allowUnfree = true; }
|
{ nixpkgs.config.allowUnfree = true; }
|
||||||
]
|
]
|
||||||
|
|
@ -57,49 +58,35 @@ in {
|
||||||
bootstrap = mkSystem {
|
bootstrap = mkSystem {
|
||||||
hostname = "bootstrap";
|
hostname = "bootstrap";
|
||||||
username = "nixos";
|
username = "nixos";
|
||||||
modules = [
|
|
||||||
../modules/required.nix
|
|
||||||
../modules/shell.nix
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
laptop = mkSystem {
|
laptop = mkSystem {
|
||||||
hostname = "laptop";
|
hostname = "laptop";
|
||||||
username = "nickolaj";
|
username = "nickolaj";
|
||||||
modules = [
|
modules = [
|
||||||
../modules/required.nix
|
../legacy_modules/graphical.nix
|
||||||
../modules/shell.nix
|
../legacy_modules/devenv.nix
|
||||||
../modules/graphical.nix
|
|
||||||
../modules/devenv.nix
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
desktop = mkSystem {
|
desktop = mkSystem {
|
||||||
hostname = "desktop";
|
hostname = "desktop";
|
||||||
username = "nickolaj";
|
username = "nickolaj";
|
||||||
modules = [
|
modules = [
|
||||||
../modules/required.nix
|
../legacy_modules/graphical.nix
|
||||||
../modules/shell.nix
|
../legacy_modules/devenv.nix
|
||||||
../modules/graphical.nix
|
|
||||||
../modules/devenv.nix
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
work = mkSystem {
|
work = mkSystem {
|
||||||
hostname = "work";
|
hostname = "work";
|
||||||
username = "nickolaj";
|
username = "nickolaj";
|
||||||
modules = [
|
modules = [
|
||||||
../modules/required.nix
|
../legacy_modules/graphical.nix
|
||||||
../modules/shell.nix
|
../legacy_modules/devenv.nix
|
||||||
../modules/graphical.nix
|
|
||||||
../modules/devenv.nix
|
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
homelab = mkSystem {
|
homelab = mkSystem {
|
||||||
hostname = "homelab";
|
hostname = "homelab";
|
||||||
username = "nickolaj";
|
username = "nickolaj";
|
||||||
modules = [
|
|
||||||
../modules/required.nix
|
|
||||||
../modules/shell.nix
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,5 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
fireproof.default-apps = {
|
fireproof.base.defaults.terminal = "ghostty";
|
||||||
terminal = "ghostty";
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 410 B After Width: | Height: | Size: 410 B |
|
Before Width: | Height: | Size: 282 KiB After Width: | Height: | Size: 282 KiB |
|
|
@ -233,7 +233,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
bind = [
|
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, BACKSPACE, killactive"
|
||||||
"SUPER, SPACE, exec, astal launcher"
|
"SUPER, SPACE, exec, astal launcher"
|
||||||
"SUPER, semicolon, exec, astal launcher .e"
|
"SUPER, semicolon, exec, astal launcher .e"
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
./dev/docker.nix
|
./dev/docker.nix
|
||||||
./dev/tilt.nix
|
./dev/tilt.nix
|
||||||
./dev/postgres.nix
|
./dev/postgres.nix
|
||||||
|
./dev/aider.nix
|
||||||
./dev/clickhouse.nix
|
./dev/clickhouse.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
22
modules/base/default.nix
Normal file
22
modules/base/default.nix
Normal 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
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
{lib, ...}: {
|
{lib, ...}:
|
||||||
options.fireproof.default-apps = {
|
{
|
||||||
|
options.fireproof.base.defaults = {
|
||||||
terminal = lib.mkOption {
|
terminal = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "The terminal to use";
|
description = "The terminal to use";
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
{config, ...}: {
|
|
||||||
environment.variables = {
|
|
||||||
EDITOR = config.defaults.editor;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
24
modules/base/home-manager.nix
Normal file
24
modules/base/home-manager.nix
Normal 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
17
modules/base/hosts.nix
Normal 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
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
@ -1,21 +1,7 @@
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
hostname,
|
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 = {
|
networking = {
|
||||||
hostName = hostname;
|
hostName = hostname;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,11 @@
|
||||||
{
|
{
|
||||||
lib,
|
|
||||||
options,
|
|
||||||
username,
|
username,
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib; let
|
let
|
||||||
inherit (config.age) secrets;
|
inherit (config.age) secrets;
|
||||||
in {
|
in {
|
||||||
options.fireproof = {
|
|
||||||
home-manager = lib.mkOption {
|
|
||||||
type = options.home-manager.users.type.nestedTypes.elemType;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = {
|
config = {
|
||||||
age.secrets.hashed-user-password.rekeyFile = ../../secrets/hashed-user-password.age;
|
age.secrets.hashed-user-password.rekeyFile = ../../secrets/hashed-user-password.age;
|
||||||
|
|
||||||
|
|
@ -21,15 +14,5 @@ in {
|
||||||
extraGroups = ["wheel"];
|
extraGroups = ["wheel"];
|
||||||
hashedPasswordFile = secrets.hashed-user-password.path;
|
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";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
11
modules/programs/default.nix
Normal file
11
modules/programs/default.nix
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
_: {
|
||||||
|
imports = [
|
||||||
|
./fish/default.nix
|
||||||
|
./core.nix
|
||||||
|
./git.nix
|
||||||
|
./just.nix
|
||||||
|
./neovim.nix
|
||||||
|
./zellij.nix
|
||||||
|
./zoxide.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
5
modules/programs/just.nix
Normal file
5
modules/programs/just.nix
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{pkgsUnstable, ...}: {
|
||||||
|
environment.systemPackages = [
|
||||||
|
pkgsUnstable.just
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
@ -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
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
];
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue