wip clan.lol
parent
e8240d98b8
commit
8d2475f6d5
212
flake.nix
212
flake.nix
|
@ -5,6 +5,16 @@
|
|||
url = "git+ssh://gitea@git.ingolf-wagner.de/palo/nixos-secrets.git?ref=main";
|
||||
flake = false;
|
||||
};
|
||||
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-parts.inputs.nixpkgs-lib.follows = "nixpkg";
|
||||
|
||||
clan-core = {
|
||||
url = "git+https://git.clan.lol/clan/clan-core";
|
||||
inputs.nixpkgs.follows = "nixpkgs"; # Needed if your configuration uses nixpkgs unstable.
|
||||
inputs.flake-parts.follows = "flake-parts";
|
||||
};
|
||||
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
nixpkgs-legacy_2305.url = "github:nixos/nixpkgs/nixos-23.05";
|
||||
|
@ -90,10 +100,11 @@
|
|||
};
|
||||
|
||||
outputs =
|
||||
{ self
|
||||
inputs@{ self
|
||||
, disko
|
||||
, dns
|
||||
, doom-emacs-nix
|
||||
, flake-parts
|
||||
, grocy-scanner
|
||||
, home-manager
|
||||
, home-manager-utils
|
||||
|
@ -115,20 +126,20 @@
|
|||
, private_assets
|
||||
, retiolum
|
||||
, secrets
|
||||
, srvos
|
||||
, srvos_nixpkgs
|
||||
, smoke
|
||||
, sops-nix
|
||||
, srvos
|
||||
, srvos_nixpkgs
|
||||
, stylix
|
||||
, taskshell
|
||||
}:
|
||||
|
||||
let
|
||||
system = "x86_64-linux";
|
||||
#system = "x86_64-linux";
|
||||
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
#pkgs = nixpkgs.legacyPackages.${system};
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
|
||||
meta = { nixpackages ? nixpkgs }: rec {
|
||||
system = "x86_64-linux";
|
||||
pkgs = import nixpackages {
|
||||
|
@ -161,45 +172,55 @@
|
|||
(import ./nixos/pkgs)
|
||||
];
|
||||
};
|
||||
specialArgs = {
|
||||
inherit private_assets;
|
||||
assets = ./nixos/assets;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
# todo : why redefine it?
|
||||
# Mic92 means, is not needed anymore
|
||||
nixosSystem = args:
|
||||
(lib.makeOverridable lib.nixosSystem)
|
||||
(lib.recursiveUpdate args {
|
||||
modules =
|
||||
args.modules
|
||||
++ [
|
||||
{
|
||||
config.nixpkgs.pkgs = lib.mkDefault args.pkgs;
|
||||
config.nixpkgs.localSystem = lib.mkDefault args.pkgs.stdenv.hostPlatform;
|
||||
}
|
||||
];
|
||||
});
|
||||
# nixosSystem = args:
|
||||
# (lib.makeOverridable lib.nixosSystem)
|
||||
# (lib.recursiveUpdate args {
|
||||
# modules =
|
||||
# args.modules
|
||||
# ++ [
|
||||
# {
|
||||
# config.nixpkgs.pkgs = lib.mkDefault args.pkgs;
|
||||
# config.nixpkgs.localSystem = lib.mkDefault args.pkgs.stdenv.hostPlatform;
|
||||
# }
|
||||
# ];
|
||||
# });
|
||||
|
||||
nixosConfigurationSetup =
|
||||
# nixosConfigurationSetup =
|
||||
# { name
|
||||
# , modules
|
||||
# , nixpackages ? nixpkgs
|
||||
# }:
|
||||
# nixosSystem {
|
||||
# inherit (meta { nixpackages = nixpackages; }) system specialArgs pkgs;
|
||||
# modules = modules ++ defaultModules ++ [
|
||||
# {
|
||||
# imports = [
|
||||
# ./nixos/machines/${name}/configuration.nix
|
||||
# (sopsModule name)
|
||||
# ];
|
||||
# }
|
||||
# ];
|
||||
# };
|
||||
|
||||
clanSetup =
|
||||
{ name
|
||||
, host ? "${name}.private"
|
||||
, host
|
||||
, modules
|
||||
, nixpackages ? nixpkgs
|
||||
}:
|
||||
nixosSystem {
|
||||
inherit (meta { nixpackages = nixpackages; }) system specialArgs pkgs;
|
||||
modules = modules ++ defaultModules ++ [
|
||||
{
|
||||
_module.args.nixinate = {
|
||||
host = host;
|
||||
sshUser = "root";
|
||||
buildOn = "remote"; # valid args are "local" or "remote"
|
||||
substituteOnTarget = false; # if buildOn is "local" then it will substitute on the target, "-s"
|
||||
hermetic = false;
|
||||
};
|
||||
}
|
||||
, nixpackages ? meta.nixpkgs
|
||||
}: {
|
||||
|
||||
clan.networking.targetHost = lib.mkDefault "root@${host}";
|
||||
clanCore.machineIcon = null; # Optional, a path to an image file
|
||||
|
||||
nixpkgs.pkgs = nixpackages;
|
||||
nixpkgs.hostPlatform = meta.system;
|
||||
|
||||
imports = modules ++ defaultModules ++ [
|
||||
{
|
||||
imports = [
|
||||
./nixos/machines/${name}/configuration.nix
|
||||
|
@ -209,6 +230,7 @@
|
|||
];
|
||||
};
|
||||
|
||||
|
||||
defaultModules = [
|
||||
{
|
||||
# todo : find out what this is?
|
||||
|
@ -285,51 +307,37 @@
|
|||
};
|
||||
|
||||
in
|
||||
{
|
||||
devShells.${system}.default =
|
||||
pkgs.mkShell {
|
||||
buildInputs = [
|
||||
nixpkgs-fmt.defaultPackage.${system}
|
||||
nixos-anywhere.packages.${system}.nixos-anywhere
|
||||
];
|
||||
};
|
||||
|
||||
apps = nixinate.nixinate.x86_64-linux self;
|
||||
flake-parts.lib.mkFlake { inherit inputs; } ({ self, pkgs, ... }: {
|
||||
# We define our own systems below. you can still use this to add system specific outputs to your flake.
|
||||
# See: https://flake.parts/getting-started
|
||||
systems = [ ];
|
||||
|
||||
packages = with nixpkgs.lib; {
|
||||
${system} =
|
||||
let
|
||||
vms = mapAttrs'
|
||||
(host: sys: {
|
||||
name = "vm-${host}";
|
||||
value = sys.config.system.build.vm;
|
||||
})
|
||||
self.nixosConfigurations;
|
||||
sds = mapAttrs'
|
||||
(host: sys: {
|
||||
name = "sd-${host}";
|
||||
value = sys.config.system.build.sdImage;
|
||||
})
|
||||
(filterAttrs
|
||||
(n: hasAttrByPath [ "config" "system" "build" "sdImage" ])
|
||||
self.nixosConfigurations);
|
||||
in
|
||||
vms // sds;
|
||||
};
|
||||
# import clan-core modules
|
||||
imports = [
|
||||
clan-core.flakeModules.default
|
||||
];
|
||||
|
||||
nixosConfigurations =
|
||||
{
|
||||
sternchen = nixosConfigurationSetup {
|
||||
# Define your clan
|
||||
clan = {
|
||||
# Clan wide settings. (Required)
|
||||
clanName = "gummybears"; # Ensure to choose a unique name.
|
||||
specialArgs = meta.specialArgs;
|
||||
|
||||
machines = {
|
||||
sternchen = clanSetup {
|
||||
name = "sternchen";
|
||||
host = "sternchen.secret";
|
||||
#host = "192.168.178.25";
|
||||
modules = [
|
||||
host = "sternchen.secure";
|
||||
imports = [
|
||||
nixos-hardware.nixosModules.lenovo-thinkpad-x220
|
||||
homeManagerModules
|
||||
];
|
||||
|
||||
};
|
||||
cream = nixosConfigurationSetup {
|
||||
|
||||
cream = clanSetup {
|
||||
name = "cream";
|
||||
host = "cream.private";
|
||||
modules = [
|
||||
nixos-hardware.nixosModules.framework-12th-gen-intel
|
||||
retiolum.nixosModules.retiolum
|
||||
|
@ -342,8 +350,10 @@
|
|||
}
|
||||
];
|
||||
};
|
||||
cherry = nixosConfigurationSetup {
|
||||
|
||||
cherry = clanSetup {
|
||||
name = "cherry";
|
||||
host = "cherry.private";
|
||||
modules = [
|
||||
nixos-hardware.nixosModules.framework-13th-gen-intel
|
||||
homeManagerModules
|
||||
|
@ -354,8 +364,10 @@
|
|||
}
|
||||
];
|
||||
};
|
||||
chungus = nixosConfigurationSetup {
|
||||
|
||||
chungus = clanSetup {
|
||||
name = "chungus";
|
||||
host = "chungus.private";
|
||||
modules = [
|
||||
homeManagerModules
|
||||
retiolum.nixosModules.retiolum
|
||||
|
@ -365,9 +377,10 @@
|
|||
}
|
||||
];
|
||||
};
|
||||
orbi = nixosConfigurationSetup {
|
||||
|
||||
orbi = clanSetup {
|
||||
name = "orbi";
|
||||
host = "95.216.66.212";
|
||||
host = "orbi.private";
|
||||
modules = [
|
||||
homeManagerModules
|
||||
srvos.nixosModules.hardware-hetzner-online-intel
|
||||
|
@ -380,6 +393,7 @@
|
|||
}
|
||||
];
|
||||
};
|
||||
|
||||
robi = nixosConfigurationSetup {
|
||||
name = "robi";
|
||||
modules = [
|
||||
|
@ -392,6 +406,46 @@
|
|||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
# devShells.${system}.default =
|
||||
# pkgs.mkShell {
|
||||
# buildInputs = [
|
||||
# nixpkgs-fmt.defaultPackage.${system}
|
||||
# nixos-anywhere.packages.${system}.nixos-anywhere
|
||||
# ];
|
||||
# };
|
||||
|
||||
#apps = nixinate.nixinate.x86_64-linux self;
|
||||
|
||||
# packages = with nixpkgs.lib; {
|
||||
# ${system} =
|
||||
# let
|
||||
# vms = mapAttrs'
|
||||
# (host: sys: {
|
||||
# name = "vm-${host}";
|
||||
# value = sys.config.system.build.vm;
|
||||
# })
|
||||
# self.nixosConfigurations;
|
||||
# sds = mapAttrs'
|
||||
# (host: sys: {
|
||||
# name = "sd-${host}";
|
||||
# value = sys.config.system.build.sdImage;
|
||||
# })
|
||||
# (filterAttrs
|
||||
# (n: hasAttrByPath [ "config" "system" "build" "sdImage" ])
|
||||
# self.nixosConfigurations);
|
||||
# in
|
||||
# vms // sds;
|
||||
# };
|
||||
|
||||
# nixosConfigurations =
|
||||
# };
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue