partial host migrations to flake parts

This commit is contained in:
Callum Leslie 2026-04-22 21:28:05 +01:00
parent 1f779fff49
commit 091cfbdf96
Signed by: cleslie
GPG key ID: D382C4AFEECEAA90
13 changed files with 209 additions and 165 deletions

View file

@ -8,32 +8,6 @@
flake-parts,
...
}@inputs:
let
cLib = import ./lib { inherit (nixpkgs) lib; };
mkLinuxSystem =
mod: ovl:
nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs cLib; };
modules = [
inputs.home-manager.nixosModules.home-manager
inputs.stylix.nixosModules.stylix
inputs.agenix.nixosModules.default
{
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [ self.overlays.default ] ++ ovl;
}
self.nixosModules.nix-config
self.nixosModules.boot
self.nixosModules.gpg-pinentry-wayland
self.nixosModules.keys
self.nixosModules.hm
self.nixosModules.secrets
self.nixosModules.tailscale
self.nixosModules.deploy
]
++ mod;
};
in
flake-parts.lib.mkFlake { inherit self inputs; } {
imports = [
inputs.flake-parts.flakeModules.easyOverlay
@ -44,18 +18,6 @@
systems = import inputs.systems;
flake = {
# TODO: use ./hosts/
nixosConfigurations = {
artemis = mkLinuxSystem [ ./hosts/artemis ] [ ];
hermes =
mkLinuxSystem
[ ./hosts/hermes inputs.nocodb.nixosModules.nocodb inputs.copyparty.nixosModules.default ]
[ inputs.copyparty.overlays.default ];
};
diskoConfigurations = { }; # maybe?
};
perSystem =
{
config,

View file

@ -1,14 +1,16 @@
{
pkgs,
cLib,
lib,
...
}: let
}:
let
mkFishPlug = pkg: {
name = pkg.pname;
inherit (pkg) src;
};
tmux = cLib.getProgFor pkgs "tmux";
in {
tmux = lib.getExe pkgs.tmux;
in
{
programs.fish = {
enable = true;
@ -19,7 +21,9 @@ in {
'';
# TODO: dont use this directly
shellAliases = {v = "nvim";};
shellAliases = {
v = "nvim";
};
functions = {
__trap_exit_tmux = {

View file

@ -1,29 +1,27 @@
{
pkgs,
cLib,
lib,
...
}: let
getProgFor' = cLib.getProgFor' pkgs;
getProgFor = cLib.getProgFor pkgs;
web = getProgFor "firefox";
# mail = "";
chat = getProgFor "discord";
media = getProgFor "spotify";
terminal = getProgFor "alacritty";
runner = getProgFor "rofi";
rofi-rbw = getProgFor' "rofi-rbw-wayland" "rofi-rbw";
tmux = getProgFor "tmux";
slurp = getProgFor "slurp";
grim = getProgFor "grim";
wl-copy = getProgFor' "wl-clipboard" "wl-copy";
mullvad = getProgFor' "mullvad-vpn" "mullvad-gui";
playerctl = getProgFor "playerctl";
brightnessctl = getProgFor "brightnessctl";
wpctl = getProgFor' "wireplumber" "wpctl";
hyprlock = getProgFor "hyprlock";
hyprctl = getProgFor' "hyprland" "hyprctl";
in {
}:
let
web = lib.getExe pkgs.firefox;
chat = lib.getExe pkgs.discord;
media = lib.getExe pkgs.spotify;
terminal = lib.getExe pkgs.alacritty;
runner = lib.getExe pkgs.rofi;
rofi-rbw = lib.getExe' pkgs.rofi-rbw-wayland "rofi-rbw";
tmux = lib.getExe pkgs.tmux;
slurp = lib.getExe pkgs.slurp;
grim = lib.getExe pkgs.grim;
wl-copy = lib.getExe' pkgs.wl-clipboard "wl-copy";
mullvad = lib.getExe' pkgs.mullvad-vpn "mullvad-gui";
playerctl = lib.getExe pkgs.playerctl;
brightnessctl = lib.getExe pkgs.brightnessctl;
wpctl = lib.getExe' pkgs.wireplumber "wpctl";
hyprlock = lib.getExe pkgs.hyprlock;
hyprctl = lib.getExe' pkgs.hyprland "hyprctl";
in
{
services = {
blueman-applet.enable = true;
network-manager-applet.enable = true;
@ -156,60 +154,64 @@ in {
"$mainMod" = "SUPER";
bind =
[
"$mainMod, q, killactive"
"$mainMod SHIFT, q, exit"
"$mainMod, F, fullscreen"
"$mainMod SHIFT, f, togglefloating"
"$mainMod, d, exec, ${runner} -show drun"
"$mainMod, w, exec, ${runner} -show window"
"$mainMod, p, exec, ${rofi-rbw} --no-folder"
"$mainMod, s, togglesplit"
"$mainMod SHIFT, r, exec, ${hyprctl} reload"
"$mainMod, return, exec, ${terminal} -e ${tmux} new -A -s main"
"$mainMod SHIFT, return, exec, [float; pin] ${terminal} -e ${tmux} new -A -s main"
bind = [
"$mainMod, q, killactive"
"$mainMod SHIFT, q, exit"
"$mainMod, F, fullscreen"
"$mainMod SHIFT, f, togglefloating"
"$mainMod, d, exec, ${runner} -show drun"
"$mainMod, w, exec, ${runner} -show window"
"$mainMod, p, exec, ${rofi-rbw} --no-folder"
"$mainMod, s, togglesplit"
"$mainMod SHIFT, r, exec, ${hyprctl} reload"
"$mainMod, return, exec, ${terminal} -e ${tmux} new -A -s main"
"$mainMod SHIFT, return, exec, [float; pin] ${terminal} -e ${tmux} new -A -s main"
"$mainMod, b, workspace, name:web"
"$mainMod, n, workspace, name:chat"
"$mainMod, m, workspace, name:media"
"$mainMod, v, workspace, name:mail"
"$mainMod, b, workspace, name:web"
"$mainMod, n, workspace, name:chat"
"$mainMod, m, workspace, name:media"
"$mainMod, v, workspace, name:mail"
"$mainMod SHIFT, b, movetoworkspace, name:web"
"$mainMod SHIFT, n, movetoworkspace, name:chat"
"$mainMod SHIFT, m, movetoworkspace, name:media"
"$mainMod SHIFT, v, movetoworkspace, name:mail"
"$mainMod SHIFT, b, movetoworkspace, name:web"
"$mainMod SHIFT, n, movetoworkspace, name:chat"
"$mainMod SHIFT, m, movetoworkspace, name:media"
"$mainMod SHIFT, v, movetoworkspace, name:mail"
"$mainMod CTRL, b, moveworkspacetomonitor, name:web current"
"$mainMod CTRL, n, moveworkspacetomonitor, name:chat current"
"$mainMod CTRL, m, moveworkspacetomonitor, name:media current"
"$mainMod CTRL, v, moveworkspacetomonitor, name:mail current"
"$mainMod CTRL, b, workspace, name:web"
"$mainMod CTRL, n, workspace, name:chat"
"$mainMod CTRL, m, workspace, name:media"
"$mainMod CTRL, v, workspace, name:mail"
"$mainMod CTRL, b, moveworkspacetomonitor, name:web current"
"$mainMod CTRL, n, moveworkspacetomonitor, name:chat current"
"$mainMod CTRL, m, moveworkspacetomonitor, name:media current"
"$mainMod CTRL, v, moveworkspacetomonitor, name:mail current"
"$mainMod CTRL, b, workspace, name:web"
"$mainMod CTRL, n, workspace, name:chat"
"$mainMod CTRL, m, workspace, name:media"
"$mainMod CTRL, v, workspace, name:mail"
"$mainMod, h, movefocus, l"
"$mainMod, l, movefocus, r"
"$mainMod, k, movefocus, u"
"$mainMod, j, movefocus, d"
"$mainMod SHIFT, h, movewindow, l"
"$mainMod SHIFT, l, movewindow, r"
"$mainMod SHIFT, k, movewindow, u"
"$mainMod SHIFT, j, movewindow, d"
''SHIFT, Print, exec, ${grim} -g "$(${slurp})" - | ${wl-copy}''
", Print, exec, ${grim} - | ${wl-copy}"
"$mainMod, 0, exec, ${hyprlock}"
]
++ (builtins.concatLists (builtins.genList (x: let
"$mainMod, h, movefocus, l"
"$mainMod, l, movefocus, r"
"$mainMod, k, movefocus, u"
"$mainMod, j, movefocus, d"
"$mainMod SHIFT, h, movewindow, l"
"$mainMod SHIFT, l, movewindow, r"
"$mainMod SHIFT, k, movewindow, u"
"$mainMod SHIFT, j, movewindow, d"
''SHIFT, Print, exec, ${grim} -g "$(${slurp})" - | ${wl-copy}''
", Print, exec, ${grim} - | ${wl-copy}"
"$mainMod, 0, exec, ${hyprlock}"
]
++ (builtins.concatLists (
builtins.genList (
x:
let
ws = x + 1;
in [
in
[
"$mainMod, ${toString ws}, workspace, ${toString ws}"
"$mainMod SHIFT, ${toString ws}, movetoworkspace, ${toString ws}"
"$mainMod CTRL, ${toString ws}, moveworkspacetomonitor, ${toString ws} current"
"$mainMod CTRL, ${toString ws}, workspace, ${toString ws}"
])
9));
]
) 9
));
workspace = [
"name:web, on-created-empty: ${web}"
@ -236,7 +238,7 @@ in {
", XF86MonBrightnessDown, exec, ${brightnessctl} -c backlight set 5%-"
];
exec-once = [(toString mullvad)];
exec-once = [ (toString mullvad) ];
};
};
}

View file

@ -1,13 +1,13 @@
{
pkgs,
cLib,
lib,
...
}: let
getProgFor = cLib.getProgFor pkgs;
tmux = getProgFor "tmux";
getProgFor' = cLib.getProgFor pkgs.scenics;
tmux-githop = getProgFor' "tmux-githop";
in {
}:
let
tmux = lib.getExe pkgs.tmux;
tmux-githop = lib.getExe pkgs.scenics.tmux-githop;
in
{
programs.tmux = {
enable = true;
shortcut = "x";
@ -21,7 +21,7 @@ in {
yank
{
plugin = onedark-theme.overrideAttrs (_: {
patches = [./bar.patch];
patches = [ ./bar.patch ];
});
extraConfig = "\n";
}

View file

@ -1,10 +1,12 @@
{
pkgs,
cLib,
lib,
...
}: let
soundControl = cLib.getProgFor pkgs "pwvucontrol";
in {
}:
let
soundControl = lib.getExe pkgs.pwvucontrol;
in
{
programs.waybar = {
enable = true;
package = pkgs.waybar;
@ -14,9 +16,19 @@ in {
layer = "top";
position = "bottom";
height = 20;
modules-left = ["hyprland/workspaces" "hyprland/submap"];
modules-center = ["hyprland/window"];
modules-right = ["temperature" "wireplumber" "backlight" "battery" "clock" "tray"];
modules-left = [
"hyprland/workspaces"
"hyprland/submap"
];
modules-center = [ "hyprland/window" ];
modules-right = [
"temperature"
"wireplumber"
"backlight"
"battery"
"clock"
"tray"
];
clock = {
tooltip = false;
interval = 1;
@ -34,19 +46,34 @@ in {
format = "{icon} {capacity}%";
format-good = "{icon} {capacity}%";
format-full = " {capacity}%";
format-icons = ["" "" "" "" ""];
format-icons = [
""
""
""
""
""
];
tooltip = false;
};
wireplumber = {
on-click = toString soundControl;
format = "{icon} {volume}%";
format-muted = "";
format-icons = ["" "" ""];
format-icons = [
""
""
""
];
tooltip = false;
};
backlight = {
format = "{icon} {percent}%";
format-icons = ["" "" "" ""];
format-icons = [
""
""
""
""
];
tooltip = false;
};
tray = {
@ -58,7 +85,7 @@ in {
temperature = {
thermal-zone = 5;
format = "{icon} {temperatureC}°C";
format-icons = [""];
format-icons = [ "" ];
interval = 30;
tooltip = false;
};

View file

@ -2,30 +2,33 @@
config,
pkgs,
...
}: {
}:
{
nixpkgs.hostPlatform = "x86_64-linux";
c.services.mesh = {
enable = true;
exitNode = false;
keyFile = config.age.secrets.mesh-conf-cleslie.path;
};
c.services.remote-deploy = {
enable = false;
keys = config.keys.c;
};
time.timeZone = "Europe/London";
i18n.defaultLocale = "en_GB.UTF-8";
users.users.c = {
isNormalUser = true;
extraGroups = ["wheel" "networkmanager" "libvirtd" "dialout" "wireshark"];
extraGroups = [
"wheel"
"networkmanager"
"libvirtd"
"dialout"
"wireshark"
];
openssh.authorizedKeys.keys = config.keys.c;
shell = pkgs.fish;
packages = with pkgs; [];
packages = with pkgs; [ ];
};
nix.settings.trusted-users = ["c"];
nix.settings.trusted-users = [ "c" ];
environment.systemPackages = with pkgs; [
vim
@ -44,13 +47,19 @@
];
environment = {
variables = {EDITOR = "nvim";};
sessionVariables = {NIXOS_OZONE_WL = "1";};
variables = {
EDITOR = "nvim";
};
sessionVariables = {
NIXOS_OZONE_WL = "1";
};
shells = with pkgs; [fish];
shells = with pkgs; [ fish ];
};
fonts.packages = with pkgs; [meslo-lgs-nf] ++ builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts);
fonts.packages =
with pkgs;
[ meslo-lgs-nf ] ++ builtins.filter lib.attrsets.isDerivation (builtins.attrValues pkgs.nerd-fonts);
services.udev.packages = [
pkgs.platformio-core.udev
pkgs.openocd

View file

@ -1,10 +1,7 @@
{ inputs, ... }:
{
inputs,
cLib,
...
}: {
programs.hyprlock.enable = true;
security.pam.services.hyprlock = {};
security.pam.services.hyprlock = { };
home-manager = {
sharedModules = [
{
@ -16,6 +13,6 @@
#inputs.self.homeManagerModules.trayscale
];
users.c = import ../../home/c;
extraSpecialArgs = {inherit inputs cLib;};
extraSpecialArgs = { inherit inputs; };
};
}

View file

@ -1,6 +0,0 @@
{lib, ...}: let
getProgFor' = pkgs: prog: progn: lib.getExe' pkgs.${prog} progn;
getProgFor = pkgs: prog: getProgFor' pkgs prog prog;
in {
inherit getProgFor getProgFor';
}

View file

@ -0,0 +1,9 @@
{ config, ... }:
{
flake.nixosConfigurations.artemis = config.flake.lib.mkHost {
modules = [
config.flake.nixosModules.profile-laptop
../../hosts/artemis
];
};
}

12
modules/hosts/hermes.nix Normal file
View file

@ -0,0 +1,12 @@
{ config, inputs, ... }:
{
flake.nixosConfigurations.hermes = config.flake.lib.mkHost {
modules = [
config.flake.nixosModules.profile-server
inputs.nocodb.nixosModules.nocodb
inputs.copyparty.nixosModules.default
../../hosts/hermes
];
overlays = [ inputs.copyparty.overlays.default ];
};
}

26
modules/lib/mk-host.nix Normal file
View file

@ -0,0 +1,26 @@
{
config,
inputs,
withSystem,
...
}:
{
flake.lib.mkHost =
{
system ? "x86_64-linux",
modules,
overlays ? [ ],
}:
withSystem system (
{ ... }:
inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; }; # TODO: REMOVE
modules = modules ++ [
{
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [ config.flake.overlays.default ] ++ overlays;
}
];
}
);
}

View file

@ -1,13 +1,15 @@
{ config, ... }:
{ inputs, config, ... }:
{
flake.nixosModules.profile-base = {
import = with config.flake.nixosModules; [
nix-config
boot
keys
hm # maybe drop and make desktop only?
secrets
tailscale
imports = [
inputs.home-manager.nixosModules.home-manager
inputs.agenix.nixosModules.default
config.flake.nixosModules.nix-config
config.flake.nixosModules.boot
config.flake.nixosModules.keys
config.flake.nixosModules.hm
config.flake.nixosModules.secrets
config.flake.nixosModules.tailscale
];
};
}

View file

@ -1,9 +1,9 @@
{ config, ... }:
{ config, inputs, ... }:
{
flake.nixosModules.profile-graphical = {
imports = [
config.flake.nixosmodules.profile-base
config.flake.nixosModules.pinentry-fix-wayland
config.flake.nixosModules.profile-base
config.flake.nixosModules.gpg-pinentry-wayland
inputs.stylix.nixosModules.stylix
];
};