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

155
flake.nix
View File

@@ -5,6 +5,7 @@
inputs@{
nixpkgs,
clan-core,
flake-parts,
home-manager,
impermanence,
nixos-generators,
@@ -12,14 +13,22 @@
self,
...
}:
let
clan = clan-core.lib.buildClan {
self = self;
flake-parts.lib.mkFlake { inherit inputs; } ({
imports = [
inputs.clan-core.flakeModules.default
inputs.nix-topology.flakeModule
./devShells/flake-module.nix
];
systems = [
"x86_64-linux"
"aarch64-linux"
];
clan = {
meta.name = "blossom";
specialArgs = {
inherit inputs self;
inherit (import ./parts) keys;
};
inventory = {
instances = {
"rpqt-admin" = {
@@ -59,67 +68,17 @@
};
};
};
in
{
inherit (clan) clanInternals nixosConfigurations;
devShells =
nixpkgs.lib.genAttrs
[
"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; }
perSystem = _: {
topology.modules = [
./topology.nix
];
}
);
};
flake = {
packages.aarch64-linux.genepi-installer-sd-image = nixos-generators.nixosGenerate {
specialArgs = {
inherit inputs;
inherit (import ./parts) keys;
};
system = "aarch64-linux";
format = "sd-aarch64-installer";
@@ -140,48 +99,42 @@
];
};
};
});
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence = {
url = "github:nix-community/impermanence";
};
nixos-hardware = {
url = "github:NixOS/nixos-hardware/master";
};
nixos-generators = {
url = "github:nix-community/nixos-generators";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
clan-core = {
url = "git+https://git.clan.lol/clan/clan-core";
inputs.nixpkgs.follows = "nixpkgs";
};
ignis = {
url = "github:ignis-sh/ignis";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-topology = {
url = "github:oddlama/nix-topology";
inputs.nixpkgs.follows = "nixpkgs";
};
matugen = {
url = "github:InioX/Matugen";
inputs.nixpkgs.follows = "nixpkgs";
};
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
impermanence.url = "github:nix-community/impermanence";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nixos-generators.url = "github:nix-community/nixos-generators";
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
clan-core.url = "git+https://git.clan.lol/clan/clan-core";
clan-core.inputs.nixpkgs.follows = "nixpkgs";
clan-core.inputs.flake-parts.follows = "flake-parts";
ignis.url = "github:ignis-sh/ignis";
ignis.inputs.nixpkgs.follows = "nixpkgs";
nix-topology.url = "github:oddlama/nix-topology";
nix-topology.inputs.nixpkgs.follows = "nixpkgs";
matugen.url = "github:InioX/Matugen";
matugen.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
};
nixConfig = {

View File

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

View File

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

View File

@@ -1,10 +1,10 @@
{
inputs,
self,
...
}:
{
imports = [
inputs.agenix.nixosModules.default
self.inputs.agenix.nixosModules.default
./acme.nix
./boot.nix
./builder.nix
@@ -24,10 +24,10 @@
../../system
../../modules/borgbackup.nix
inputs.clan-core.clanModules.state-version
inputs.clan-core.clanModules.trusted-nix-caches
self.inputs.clan-core.clanModules.state-version
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.useUserPackages = true;

View File

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

View File

@@ -1,11 +1,11 @@
{
inputs,
self,
...
}:
{
imports = [
# inputs.disko.nixosModules.disko
inputs.agenix.nixosModules.default
self.inputs.agenix.nixosModules.default
./boot.nix
./chat.nix
./firefox.nix
@@ -22,15 +22,15 @@
./video.nix
../../system
inputs.clan-core.clanModules.state-version
inputs.clan-core.clanModules.trusted-nix-caches
self.inputs.clan-core.clanModules.state-version
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.useUserPackages = true;
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;
@@ -11,8 +11,8 @@
tofi
wl-gammarelay-rs
xwayland-satellite
inputs.ignis.packages.${pkgs.system}.ignis
inputs.matugen.packages.${pkgs.system}.default
self.inputs.ignis.packages.${pkgs.system}.ignis
self.inputs.matugen.packages.${pkgs.system}.default
];
environment.sessionVariables.NIXOS_OZONE_WL = "1";

View File

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

View File

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

View File

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