Skip to content

Commit 49a585d

Browse files
use ghaf builders
Signed-off-by: Brian McGillion <[email protected]>
1 parent a0abf2f commit 49a585d

File tree

5 files changed

+90
-146
lines changed

5 files changed

+90
-146
lines changed

flake.lock

Lines changed: 21 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

modules/profile/fmo.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ in
1414
imports = [
1515
# Ghaf imports
1616
inputs.ghaf.nixosModules.disko-debug-partition
17-
inputs.ghaf.nixosModules.profiles-workstation
17+
# Note: profiles-workstation is already included by the ghaf builder
1818
inputs.ghaf.nixosModules.reference-appvms
1919
inputs.ghaf.nixosModules.reference-programs
2020
inputs.ghaf.nixosModules.reference-services

targets/flake-module.nix

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,74 @@ let
66
nixMods = inputs.self.nixosModules;
77
inherit (inputs.self) lib;
88

9-
laptop-configuration = import ./mkLaptopConfiguration.nix { inherit inputs; };
10-
installer-config = import ./mkInstaller.nix { inherit inputs; };
9+
# The versionRev is used to identify the current version of the configuration.
10+
# rev is used when there is a clean repo
11+
# dirtyRev is used when there are uncommitted changes
12+
# if building in a rebased ci pre-merge check the state will be unknown.
13+
versionRev =
14+
if (inputs.self ? shortRev) then
15+
inputs.self.shortRev
16+
else if (inputs.self ? dirtyShortRev) then
17+
inputs.self.dirtyShortRev
18+
else
19+
"unknown-dirty-rev";
20+
21+
# Use the builder functions exported from ghaf
22+
mkLaptopConfiguration = inputs.ghaf.builders.mkLaptopConfiguration {
23+
self = inputs.ghaf;
24+
inherit inputs;
25+
inherit (inputs.ghaf) lib;
26+
inherit system;
27+
};
28+
29+
mkLaptopInstaller = inputs.ghaf.builders.mkLaptopInstaller {
30+
self = inputs.ghaf;
31+
inherit (inputs.ghaf) lib;
32+
inherit system;
33+
};
34+
35+
# Wrapper function to adapt to our naming convention and add versionRev
36+
laptop-configuration =
37+
name: extraModules:
38+
let
39+
# Extract machine type from name (everything before the last "-debug" or "-release")
40+
parts = lib.splitString "-" name;
41+
variant = lib.last parts;
42+
machineType = lib.concatStringsSep "-" (lib.init parts);
43+
44+
# Create base configuration with ghaf function
45+
baseConfig = mkLaptopConfiguration machineType variant (
46+
[
47+
{
48+
nixpkgs.overlays = [
49+
inputs.self.overlays.custom-packages
50+
inputs.self.overlays.own-pkgs-overlay
51+
];
52+
system = {
53+
configurationRevision = versionRev;
54+
nixos.label = versionRev;
55+
};
56+
}
57+
]
58+
++ extraModules
59+
);
60+
in
61+
{
62+
hostConfig = baseConfig.hostConfiguration;
63+
inherit (baseConfig) package variant;
64+
inherit name; # Use original FMO name for output
65+
};
66+
67+
# Wrapper function for installer to match our existing interface
68+
installer-config =
69+
name: imagePath: extraModules:
70+
let
71+
installerResult = mkLaptopInstaller name imagePath extraModules;
72+
in
73+
{
74+
hostConfig = installerResult.hostConfiguration;
75+
inherit (installerResult) name package;
76+
};
1177

1278
installerModules = [
1379
(

targets/mkInstaller.nix

Lines changed: 0 additions & 69 deletions
This file was deleted.

targets/mkLaptopConfiguration.nix

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)