Skip to content

Commit

Permalink
Refactor modules into reusable profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
joinemm committed Oct 26, 2024
1 parent 322f358 commit ecd2f5f
Show file tree
Hide file tree
Showing 62 changed files with 257 additions and 234 deletions.
65 changes: 0 additions & 65 deletions home-modules/default.nix

This file was deleted.

11 changes: 4 additions & 7 deletions hosts/alexandria/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ let
in
{
imports = lib.flatten [
(with self.profiles; [
core
server
])
(with self.nixosModules; [
common
hetzner
headless
docker
nginx
node-exporter
ssh-access
syncthing
])
inputs.disko.nixosModules.disko
inputs.sops-nix.nixosModules.sops
Expand Down
22 changes: 7 additions & 15 deletions hosts/athens/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,17 @@
}:
{
imports = lib.flatten [
(with self.profiles; [
core
workstation
])
(with self.nixosModules; [
attic
bluetooth
common
desktop
docker
gaming
home
keyd
laptop
locale
remotebuild
syncthing
tailscale
transmission
work
yubikey
])
(with inputs.nixos-hardware.nixosModules; [ lenovo-thinkpad-x1-11th-gen ])
(with inputs.nixos-hardware.nixosModules; [
lenovo-thinkpad-x1-11th-gen
])
inputs.sops-nix.nixosModules.sops
./hardware-configuration.nix
];
Expand Down
9 changes: 4 additions & 5 deletions hosts/byzantium/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ let
in
{
imports = lib.flatten [
(with self.profiles; [
core
server
])
(with self.nixosModules; [
common
hetzner
headless
nginx
node-exporter
ssh-access
])
inputs.disko.nixosModules.disko
(import ../../disko/hetzner-osdisk.nix { pci = "0000:00:04.0"; })
Expand Down
8 changes: 4 additions & 4 deletions hosts/kyoto/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
}:
{
imports = lib.flatten [
(with self.profiles; [
core
server
])
(with self.nixosModules; [
common
locale
node-exporter
ssh-access
headless
])
inputs.nixos-hardware.nixosModules.raspberry-pi-4
(modulesPath + "/installer/sd-card/sd-image-aarch64.nix")
Expand Down
17 changes: 4 additions & 13 deletions hosts/rome/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,13 @@
}:
{
imports = lib.flatten [
(with self.profiles; [
core
workstation
])
(with self.nixosModules; [
attic
bluetooth
common
desktop
docker
gaming
home
locale
remotebuild
syncthing
tailscale
transmission
virtualization
work
yubikey
])
(with inputs.nixos-hardware.nixosModules; [
common-cpu-amd
Expand Down
9 changes: 8 additions & 1 deletion modules/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
# disable beeping motherboard speaker
boot.blacklistedKernelModules = [ "pcspkr" ];

environment.variables = {
GOPATH = "${user.home}/.local/share/go";
};

zramSwap.enable = true;

hardware = {
enableAllFirmware = true;
enableRedistributableFirmware = true;
Expand Down Expand Up @@ -76,12 +82,13 @@
pkgs.zsh
];

# uninstall all default packages that I don't need
defaultPackages = lib.mkForce [ ];

systemPackages = with pkgs; [
git
vim
wget2
wget
neofetch
];
};
Expand Down
96 changes: 73 additions & 23 deletions modules/default.nix
Original file line number Diff line number Diff line change
@@ -1,26 +1,76 @@
{ lib, ... }:
let
modules = lib.listToAttrs (
map
(x: {
name = lib.removeSuffix ".nix" (builtins.baseNameOf x);
value = x;
})
[
./home
./x11.nix
./keyd.nix
./work.nix
./attic.nix
./fonts.nix
./nginx.nix
./sound.nix
./common.nix
./docker.nix
./gaming.nix
./laptop.nix
./locale.nix
./desktop.nix
./hetzner.nix
./scripts.nix
./yubikey.nix
./headless.nix
./bluetooth.nix
./syncthing.nix
./tailscale.nix
./networking.nix
./ssh-access.nix
./remotebuild.nix
./systemd-boot.nix
./transmission.nix
./node-exporter.nix
./virtualization.nix
]
);
in
{
flake.nixosModules = {
attic = ./attic.nix;
bluetooth = ./bluetooth.nix;
common = ./common.nix;
desktop = ./desktop;
docker = ./docker.nix;
gaming = ./gaming.nix;
home = ./home.nix;
headless = ./headless.nix;
hetzner = ./hetzner.nix;
keyd = ./keyd.nix;
laptop = ./laptop.nix;
locale = ./locale.nix;
nginx = ./nginx.nix;
node-exporter = ./node-exporter.nix;
remotebuild = ./remotebuild.nix;
ssh-access = ./ssh-access.nix;
syncthing = ./syncthing.nix;
tailscale = ./tailscale.nix;
transmission = ./transmission.nix;
virtualization = ./virtualization.nix;
work = ./work.nix;
yubikey = ./yubikey.nix;
flake = {
nixosModules = modules;
profiles = {
core = with modules; [
common
scripts
docker
];
server = with modules; [
headless
nginx
node-exporter
ssh-access
];
workstation = with modules; [
attic
bluetooth
fonts
gaming
locale
networking
remotebuild
sound
syncthing
systemd-boot
tailscale
transmission
work
x11
yubikey
home
];
};
};
}
21 changes: 21 additions & 0 deletions modules/desktop.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{ user, ... }:
{
services = {
# don’t shutdown when power button is short-pressed
logind.extraConfig = ''
HandlePowerKey=ignore
'';

# login automatically to my user
# the desktop will not leave my house so it's ok
getty = {
autologinUser = user.name;
helpLine = "";
};

libinput = {
enable = true;
mouse.accelProfile = "flat";
};
};
}
59 changes: 0 additions & 59 deletions modules/desktop/default.nix

This file was deleted.

File renamed without changes.
Loading

0 comments on commit ecd2f5f

Please sign in to comment.