migrate to flake-parts

This commit is contained in:
2025-06-17 19:58:30 +02:00
parent d79b65169e
commit 51f44277df
12 changed files with 137 additions and 155 deletions

View File

@@ -0,0 +1,25 @@
{
perSystem =
{
inputs',
pkgs,
...
}:
{
devShells.default = pkgs.mkShellNoCC {
packages = [
inputs'.agenix.packages.default
inputs'.clan-core.packages.clan-cli
pkgs.nil # Nix language server
pkgs.nixfmt-rfc-style
pkgs.opentofu
pkgs.terraform-ls
pkgs.deploy-rs
pkgs.zsh
];
shellhook = ''
exec zsh
'';
};
};
}

12
flake.lock generated
View File

@@ -27,7 +27,9 @@
"inputs": { "inputs": {
"data-mesher": "data-mesher", "data-mesher": "data-mesher",
"disko": "disko", "disko": "disko",
"flake-parts": "flake-parts", "flake-parts": [
"flake-parts"
],
"nix-darwin": "nix-darwin", "nix-darwin": "nix-darwin",
"nix-select": "nix-select", "nix-select": "nix-select",
"nixos-facter-modules": "nixos-facter-modules", "nixos-facter-modules": "nixos-facter-modules",
@@ -186,16 +188,15 @@
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
"clan-core",
"nixpkgs" "nixpkgs"
] ]
}, },
"locked": { "locked": {
"lastModified": 1748821116, "lastModified": 1749398372,
"narHash": "sha256-F82+gS044J1APL0n4hH50GYdPRv/5JWm34oCJYmVKdE=", "narHash": "sha256-tYBdgS56eXYaWVW3fsnPQ/nFlgWi/Z2Ymhyu21zVM98=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "49f0870db23e8c1ca0b5259734a02cd9e1e371a1", "rev": "9305fe4e5c2a6fcf5ba6a3ff155720fbe4076569",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -567,6 +568,7 @@
"agenix": "agenix", "agenix": "agenix",
"clan-core": "clan-core", "clan-core": "clan-core",
"disko": "disko_2", "disko": "disko_2",
"flake-parts": "flake-parts",
"home-manager": "home-manager_2", "home-manager": "home-manager_2",
"ignis": "ignis", "ignis": "ignis",
"impermanence": "impermanence", "impermanence": "impermanence",

203
flake.nix
View File

@@ -5,6 +5,7 @@
inputs@{ inputs@{
nixpkgs, nixpkgs,
clan-core, clan-core,
flake-parts,
home-manager, home-manager,
impermanence, impermanence,
nixos-generators, nixos-generators,
@@ -12,14 +13,22 @@
self, self,
... ...
}: }:
let flake-parts.lib.mkFlake { inherit inputs; } ({
clan = clan-core.lib.buildClan { imports = [
self = self; inputs.clan-core.flakeModules.default
inputs.nix-topology.flakeModule
./devShells/flake-module.nix
];
systems = [
"x86_64-linux"
"aarch64-linux"
];
clan = {
meta.name = "blossom"; meta.name = "blossom";
specialArgs = {
inherit inputs self;
inherit (import ./parts) keys;
};
inventory = { inventory = {
instances = { instances = {
"rpqt-admin" = { "rpqt-admin" = {
@@ -59,129 +68,73 @@
}; };
}; };
}; };
in
{
inherit (clan) clanInternals nixosConfigurations;
devShells = perSystem = _: {
nixpkgs.lib.genAttrs topology.modules = [
[ ./topology.nix
"x86_64-linux"
"aarch64-linux"
]
(
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
packages = [
inputs.agenix.packages.${system}.default
clan-core.packages.${system}.clan-cli
pkgs.nil # Nix language server
pkgs.nixfmt-rfc-style
pkgs.opentofu
pkgs.terraform-ls
pkgs.deploy-rs
pkgs.zsh
];
shellhook = ''
exec zsh
'';
};
}
);
topology =
nixpkgs.lib.genAttrs
[
"x86_64-linux"
"aarch64-linux"
]
(
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ inputs.nix-topology.overlays.default ];
};
in
import inputs.nix-topology {
inherit pkgs;
modules = [
{ inherit (self) nixosConfigurations; }
./topology.nix
];
}
);
packages.aarch64-linux.genepi-installer-sd-image = nixos-generators.nixosGenerate {
specialArgs = {
inherit inputs;
inherit (import ./parts) keys;
};
system = "aarch64-linux";
format = "sd-aarch64-installer";
modules = [
nixos-hardware.nixosModules.raspberry-pi-4
./system/core
./machines/genepi/network.nix
./machines/genepi/hardware-configuration.nix
{ networking.hostName = "genepi"; }
{ sdImage.compressImage = false; }
{
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
})
];
}
]; ];
}; };
};
flake = {
packages.aarch64-linux.genepi-installer-sd-image = nixos-generators.nixosGenerate {
specialArgs = {
inherit inputs;
};
system = "aarch64-linux";
format = "sd-aarch64-installer";
modules = [
nixos-hardware.nixosModules.raspberry-pi-4
./system/core
./machines/genepi/network.nix
./machines/genepi/hardware-configuration.nix
{ networking.hostName = "genepi"; }
{ sdImage.compressImage = false; }
{
nixpkgs.overlays = [
(final: super: {
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
})
];
}
];
};
};
});
inputs = { inputs = {
nixpkgs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
url = "github:nixos/nixpkgs?ref=nixos-unstable";
}; disko.url = "github:nix-community/disko";
disko = { disko.inputs.nixpkgs.follows = "nixpkgs";
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager";
}; home-manager.inputs.nixpkgs.follows = "nixpkgs";
home-manager = {
url = "github:nix-community/home-manager"; impermanence.url = "github:nix-community/impermanence";
inputs.nixpkgs.follows = "nixpkgs";
}; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
impermanence = {
url = "github:nix-community/impermanence"; nixos-generators.url = "github:nix-community/nixos-generators";
};
nixos-hardware = { agenix.url = "github:ryantm/agenix";
url = "github:NixOS/nixos-hardware/master"; agenix.inputs.nixpkgs.follows = "nixpkgs";
};
nixos-generators = { clan-core.url = "git+https://git.clan.lol/clan/clan-core";
url = "github:nix-community/nixos-generators"; clan-core.inputs.nixpkgs.follows = "nixpkgs";
}; clan-core.inputs.flake-parts.follows = "flake-parts";
agenix = {
url = "github:ryantm/agenix"; ignis.url = "github:ignis-sh/ignis";
inputs.nixpkgs.follows = "nixpkgs"; ignis.inputs.nixpkgs.follows = "nixpkgs";
};
clan-core = { nix-topology.url = "github:oddlama/nix-topology";
url = "git+https://git.clan.lol/clan/clan-core"; nix-topology.inputs.nixpkgs.follows = "nixpkgs";
inputs.nixpkgs.follows = "nixpkgs";
}; matugen.url = "github:InioX/Matugen";
ignis = { matugen.inputs.nixpkgs.follows = "nixpkgs";
url = "github:ignis-sh/ignis";
inputs.nixpkgs.follows = "nixpkgs"; flake-parts.url = "github:hercules-ci/flake-parts";
}; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
nix-topology = {
url = "github:oddlama/nix-topology";
inputs.nixpkgs.follows = "nixpkgs";
};
matugen = {
url = "github:InioX/Matugen";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
nixConfig = { nixConfig = {

View File

@@ -1,5 +1,5 @@
{ {
inputs, self,
modulesPath, modulesPath,
config, config,
... ...
@@ -9,7 +9,7 @@
(modulesPath + "/profiles/qemu-guest.nix") (modulesPath + "/profiles/qemu-guest.nix")
# ./radicle.nix # ./radicle.nix
../../system ../../system
inputs.clan-core.clanModules.state-version self.inputs.clan-core.clanModules.state-version
../../modules/remote-builder.nix ../../modules/remote-builder.nix
../../modules/borgbackup.nix ../../modules/borgbackup.nix
./topology.nix ./topology.nix

View File

@@ -1,4 +1,6 @@
{ keys, ... }: let
keys = import ../../parts/keys.nix;
in
{ {
imports = [ imports = [
../../modules/remote-builder.nix ../../modules/remote-builder.nix

View File

@@ -1,10 +1,10 @@
{ {
inputs, self,
... ...
}: }:
{ {
imports = [ imports = [
inputs.agenix.nixosModules.default self.inputs.agenix.nixosModules.default
./acme.nix ./acme.nix
./boot.nix ./boot.nix
./builder.nix ./builder.nix
@@ -24,10 +24,10 @@
../../system ../../system
../../modules/borgbackup.nix ../../modules/borgbackup.nix
inputs.clan-core.clanModules.state-version self.inputs.clan-core.clanModules.state-version
inputs.clan-core.clanModules.trusted-nix-caches self.inputs.clan-core.clanModules.trusted-nix-caches
inputs.home-manager.nixosModules.home-manager self.inputs.home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;

View File

@@ -1,7 +1,7 @@
{ inputs, pkgs, ... }: { self, pkgs, ... }:
{ {
imports = [ imports = [
inputs.nixos-hardware.nixosModules.raspberry-pi-4 self.inputs.nixos-hardware.nixosModules.raspberry-pi-4
]; ];
nixpkgs.hostPlatform = "aarch64-linux"; nixpkgs.hostPlatform = "aarch64-linux";

View File

@@ -1,11 +1,11 @@
{ {
inputs, self,
... ...
}: }:
{ {
imports = [ imports = [
# inputs.disko.nixosModules.disko # inputs.disko.nixosModules.disko
inputs.agenix.nixosModules.default self.inputs.agenix.nixosModules.default
./boot.nix ./boot.nix
./chat.nix ./chat.nix
./firefox.nix ./firefox.nix
@@ -22,15 +22,15 @@
./video.nix ./video.nix
../../system ../../system
inputs.clan-core.clanModules.state-version self.inputs.clan-core.clanModules.state-version
inputs.clan-core.clanModules.trusted-nix-caches self.inputs.clan-core.clanModules.trusted-nix-caches
inputs.home-manager.nixosModules.home-manager self.inputs.home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.rpqt = ./home.nix; home-manager.users.rpqt = ./home.nix;
home-manager.extraSpecialArgs = { inherit inputs; }; home-manager.extraSpecialArgs = { inherit (self) inputs; };
} }
]; ];

View File

@@ -1,4 +1,4 @@
{ inputs, pkgs, ... }: { self, pkgs, ... }:
{ {
programs.niri.enable = true; programs.niri.enable = true;
@@ -11,8 +11,8 @@
tofi tofi
wl-gammarelay-rs wl-gammarelay-rs
xwayland-satellite xwayland-satellite
inputs.ignis.packages.${pkgs.system}.ignis self.inputs.ignis.packages.${pkgs.system}.ignis
inputs.matugen.packages.${pkgs.system}.default self.inputs.matugen.packages.${pkgs.system}.default
]; ];
environment.sessionVariables.NIXOS_OZONE_WL = "1"; environment.sessionVariables.NIXOS_OZONE_WL = "1";

View File

@@ -1,4 +1,4 @@
{ config, inputs, ... }: { config, self, ... }:
let let
user = "u422292"; user = "u422292";
sub-user = "${user}"; sub-user = "${user}";
@@ -7,7 +7,7 @@ in
{ {
imports = [ imports = [
./storagebox.nix ./storagebox.nix
inputs.clan-core.clanModules.borgbackup self.inputs.clan-core.clanModules.borgbackup
]; ];
clan.borgbackup.destinations."storagebox-${config.networking.hostName}" = { clan.borgbackup.destinations."storagebox-${config.networking.hostName}" = {

View File

@@ -1,5 +1,5 @@
{ {
keys, config,
lib, lib,
pkgs, pkgs,
... ...
@@ -17,7 +17,7 @@
shell = pkgs.zsh; shell = pkgs.zsh;
openssh.authorizedKeys.keys = [ keys.rpqt.haze ]; openssh.authorizedKeys.keys = [ (import ../../parts/keys.nix).rpqt.haze ];
extraGroups = [ extraGroups = [
"wheel" "wheel"

View File

@@ -1,7 +1,7 @@
{ inputs, ... }: { self, ... }:
{ {
imports = [ imports = [
inputs.nix-topology.nixosModules.default self.inputs.nix-topology.nixosModules.default
./tailscale.nix ./tailscale.nix
]; ];
} }