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, flake-parts,
... ...
}@inputs: }@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; } { flake-parts.lib.mkFlake { inherit self inputs; } {
imports = [ imports = [
inputs.flake-parts.flakeModules.easyOverlay inputs.flake-parts.flakeModules.easyOverlay
@ -44,18 +18,6 @@
systems = import inputs.systems; 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 = perSystem =
{ {
config, config,

View file

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

View file

@ -1,29 +1,27 @@
{ {
pkgs, pkgs,
cLib,
lib, lib,
... ...
}: let }:
getProgFor' = cLib.getProgFor' pkgs; let
getProgFor = cLib.getProgFor pkgs; web = lib.getExe pkgs.firefox;
web = getProgFor "firefox"; chat = lib.getExe pkgs.discord;
# mail = ""; media = lib.getExe pkgs.spotify;
chat = getProgFor "discord"; terminal = lib.getExe pkgs.alacritty;
media = getProgFor "spotify"; runner = lib.getExe pkgs.rofi;
terminal = getProgFor "alacritty"; rofi-rbw = lib.getExe' pkgs.rofi-rbw-wayland "rofi-rbw";
runner = getProgFor "rofi"; tmux = lib.getExe pkgs.tmux;
rofi-rbw = getProgFor' "rofi-rbw-wayland" "rofi-rbw"; slurp = lib.getExe pkgs.slurp;
tmux = getProgFor "tmux"; grim = lib.getExe pkgs.grim;
slurp = getProgFor "slurp"; wl-copy = lib.getExe' pkgs.wl-clipboard "wl-copy";
grim = getProgFor "grim"; mullvad = lib.getExe' pkgs.mullvad-vpn "mullvad-gui";
wl-copy = getProgFor' "wl-clipboard" "wl-copy"; playerctl = lib.getExe pkgs.playerctl;
mullvad = getProgFor' "mullvad-vpn" "mullvad-gui"; brightnessctl = lib.getExe pkgs.brightnessctl;
playerctl = getProgFor "playerctl"; wpctl = lib.getExe' pkgs.wireplumber "wpctl";
brightnessctl = getProgFor "brightnessctl"; hyprlock = lib.getExe pkgs.hyprlock;
wpctl = getProgFor' "wireplumber" "wpctl"; hyprctl = lib.getExe' pkgs.hyprland "hyprctl";
hyprlock = getProgFor "hyprlock"; in
hyprctl = getProgFor' "hyprland" "hyprctl"; {
in {
services = { services = {
blueman-applet.enable = true; blueman-applet.enable = true;
network-manager-applet.enable = true; network-manager-applet.enable = true;
@ -156,8 +154,7 @@ in {
"$mainMod" = "SUPER"; "$mainMod" = "SUPER";
bind = bind = [
[
"$mainMod, q, killactive" "$mainMod, q, killactive"
"$mainMod SHIFT, q, exit" "$mainMod SHIFT, q, exit"
"$mainMod, F, fullscreen" "$mainMod, F, fullscreen"
@ -201,15 +198,20 @@ in {
", Print, exec, ${grim} - | ${wl-copy}" ", Print, exec, ${grim} - | ${wl-copy}"
"$mainMod, 0, exec, ${hyprlock}" "$mainMod, 0, exec, ${hyprlock}"
] ]
++ (builtins.concatLists (builtins.genList (x: let ++ (builtins.concatLists (
builtins.genList (
x:
let
ws = x + 1; ws = x + 1;
in [ in
[
"$mainMod, ${toString ws}, workspace, ${toString ws}" "$mainMod, ${toString ws}, workspace, ${toString ws}"
"$mainMod SHIFT, ${toString ws}, movetoworkspace, ${toString ws}" "$mainMod SHIFT, ${toString ws}, movetoworkspace, ${toString ws}"
"$mainMod CTRL, ${toString ws}, moveworkspacetomonitor, ${toString ws} current" "$mainMod CTRL, ${toString ws}, moveworkspacetomonitor, ${toString ws} current"
"$mainMod CTRL, ${toString ws}, workspace, ${toString ws}" "$mainMod CTRL, ${toString ws}, workspace, ${toString ws}"
]) ]
9)); ) 9
));
workspace = [ workspace = [
"name:web, on-created-empty: ${web}" "name:web, on-created-empty: ${web}"

View file

@ -1,13 +1,13 @@
{ {
pkgs, pkgs,
cLib, lib,
... ...
}: let }:
getProgFor = cLib.getProgFor pkgs; let
tmux = getProgFor "tmux"; tmux = lib.getExe pkgs.tmux;
getProgFor' = cLib.getProgFor pkgs.scenics; tmux-githop = lib.getExe pkgs.scenics.tmux-githop;
tmux-githop = getProgFor' "tmux-githop"; in
in { {
programs.tmux = { programs.tmux = {
enable = true; enable = true;
shortcut = "x"; shortcut = "x";

View file

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

View file

@ -2,24 +2,27 @@
config, config,
pkgs, pkgs,
... ...
}: { }:
{
nixpkgs.hostPlatform = "x86_64-linux"; nixpkgs.hostPlatform = "x86_64-linux";
c.services.mesh = { c.services.mesh = {
enable = true; enable = true;
exitNode = false; exitNode = false;
keyFile = config.age.secrets.mesh-conf-cleslie.path; keyFile = config.age.secrets.mesh-conf-cleslie.path;
}; };
c.services.remote-deploy = {
enable = false;
keys = config.keys.c;
};
time.timeZone = "Europe/London"; time.timeZone = "Europe/London";
i18n.defaultLocale = "en_GB.UTF-8"; i18n.defaultLocale = "en_GB.UTF-8";
users.users.c = { users.users.c = {
isNormalUser = true; isNormalUser = true;
extraGroups = ["wheel" "networkmanager" "libvirtd" "dialout" "wireshark"]; extraGroups = [
"wheel"
"networkmanager"
"libvirtd"
"dialout"
"wireshark"
];
openssh.authorizedKeys.keys = config.keys.c; openssh.authorizedKeys.keys = config.keys.c;
shell = pkgs.fish; shell = pkgs.fish;
packages = with pkgs; [ ]; packages = with pkgs; [ ];
@ -44,13 +47,19 @@
]; ];
environment = { environment = {
variables = {EDITOR = "nvim";}; variables = {
sessionVariables = {NIXOS_OZONE_WL = "1";}; 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 = [ services.udev.packages = [
pkgs.platformio-core.udev pkgs.platformio-core.udev
pkgs.openocd pkgs.openocd

View file

@ -1,8 +1,5 @@
{ inputs, ... }:
{ {
inputs,
cLib,
...
}: {
programs.hyprlock.enable = true; programs.hyprlock.enable = true;
security.pam.services.hyprlock = { }; security.pam.services.hyprlock = { };
home-manager = { home-manager = {
@ -16,6 +13,6 @@
#inputs.self.homeManagerModules.trayscale #inputs.self.homeManagerModules.trayscale
]; ];
users.c = import ../../home/c; 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 = { flake.nixosModules.profile-base = {
import = with config.flake.nixosModules; [ imports = [
nix-config inputs.home-manager.nixosModules.home-manager
boot inputs.agenix.nixosModules.default
keys config.flake.nixosModules.nix-config
hm # maybe drop and make desktop only? config.flake.nixosModules.boot
secrets config.flake.nixosModules.keys
tailscale 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 = { flake.nixosModules.profile-graphical = {
imports = [ imports = [
config.flake.nixosmodules.profile-base config.flake.nixosModules.profile-base
config.flake.nixosModules.pinentry-fix-wayland config.flake.nixosModules.gpg-pinentry-wayland
inputs.stylix.nixosModules.stylix inputs.stylix.nixosModules.stylix
]; ];
}; };