mirror of
https://github.com/JulienMalka/snowfield.git
synced 2025-03-31 17:20:53 +02:00
move mkmachine in separate file
This commit is contained in:
parent
968b0c90bd
commit
996e6dec50
4 changed files with 82 additions and 85 deletions
11
flake.nix
11
flake.nix
|
@ -7,7 +7,11 @@
|
||||||
|
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager/release-23.05";
|
url = "github:nix-community/home-manager/release-23.05";
|
||||||
inputs.nixpkgs.follows = "unstable";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager-unstable = {
|
||||||
|
url = "github:nix-community/home-manager/master";
|
||||||
};
|
};
|
||||||
|
|
||||||
homepage = {
|
homepage = {
|
||||||
|
@ -17,6 +21,8 @@
|
||||||
|
|
||||||
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
|
||||||
|
unstable-plus-patches.url = "github:JulienMalka/nixpkgs/unstable-plus-patches";
|
||||||
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
|
||||||
colmena.url = "github:zhaofengli/colmena";
|
colmena.url = "github:zhaofengli/colmena";
|
||||||
|
@ -73,6 +79,7 @@
|
||||||
let
|
let
|
||||||
lib = nixpkgs.lib.extend (import ./lib inputs);
|
lib = nixpkgs.lib.extend (import ./lib inputs);
|
||||||
machines_plats = lib.mapAttrsToList (name: value: value.arch) (lib.filterAttrs (n: v: builtins.hasAttr "arch" v) lib.luj.machines);
|
machines_plats = lib.mapAttrsToList (name: value: value.arch) (lib.filterAttrs (n: v: builtins.hasAttr "arch" v) lib.luj.machines);
|
||||||
|
mkMachine = import ./lib/mkmachine.nix inputs lib;
|
||||||
|
|
||||||
nixpkgs_plats = builtins.listToAttrs (builtins.map
|
nixpkgs_plats = builtins.listToAttrs (builtins.map
|
||||||
(plat: {
|
(plat: {
|
||||||
|
@ -91,7 +98,7 @@
|
||||||
(builtins.attrNames (builtins.readDir ./modules)));
|
(builtins.attrNames (builtins.readDir ./modules)));
|
||||||
|
|
||||||
nixosConfigurations = builtins.mapAttrs
|
nixosConfigurations = builtins.mapAttrs
|
||||||
(name: value: (lib.mkMachine {
|
(name: value: (mkMachine {
|
||||||
host = name;
|
host = name;
|
||||||
host-config = value;
|
host-config = value;
|
||||||
modules = self.nixosModules;
|
modules = self.nixosModules;
|
||||||
|
|
|
@ -2,87 +2,7 @@ inputs: final: prev:
|
||||||
|
|
||||||
with builtins;
|
with builtins;
|
||||||
|
|
||||||
let
|
|
||||||
overlay-unstable = arch: final: prev:
|
|
||||||
let
|
|
||||||
nixpkgs-patched-src = (import inputs.nixpkgs { system = arch; }).applyPatches {
|
|
||||||
name = "nixpkgs-patches";
|
|
||||||
src = inputs.nixpkgs;
|
|
||||||
patches = [ ../patches/bcachefs-systemd-stage-1.patch ];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
unstable = inputs.unstable.legacyPackages."${arch}";
|
|
||||||
nixpkgs-patched = import nixpkgs-patched-src { system = arch; };
|
|
||||||
stable = inputs.nixpkgs.legacyPackages."${arch}";
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
|
|
||||||
mkMachine = { host, host-config, modules, nixpkgs ? inputs.nixpkgs, system ? "x86_64-linux", home-manager ? inputs.home-manager }:
|
|
||||||
let
|
|
||||||
nixpkgs-patched-src = (import nixpkgs { inherit system; }).applyPatches {
|
|
||||||
name = "nixpkgs-patched";
|
|
||||||
src = nixpkgs;
|
|
||||||
patches = [ ../patches/bcachefs-systemd-stage-1.patch ];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
nixpkgs.lib.nixosSystem {
|
|
||||||
lib = final;
|
|
||||||
system = system;
|
|
||||||
specialArgs = {
|
|
||||||
inherit inputs;
|
|
||||||
nixpkgs-patched = nixpkgs-patched-src;
|
|
||||||
};
|
|
||||||
modules = builtins.attrValues modules ++ [
|
|
||||||
../machines/base.nix
|
|
||||||
inputs.sops-nix.nixosModules.sops
|
|
||||||
host-config
|
|
||||||
home-manager.nixosModules.home-manager
|
|
||||||
inputs.simple-nixos-mailserver.nixosModule
|
|
||||||
inputs.hyprland.nixosModules.default
|
|
||||||
inputs.attic.nixosModules.atticd
|
|
||||||
inputs.lanzaboote.nixosModules.lanzaboote
|
|
||||||
inputs.nix-index-database.nixosModules.nix-index
|
|
||||||
{
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
nixpkgs.overlays = [
|
|
||||||
(overlay-unstable system)
|
|
||||||
(final: prev:
|
|
||||||
{
|
|
||||||
hyprland = inputs.hyprland.packages.${system}.default.override {
|
|
||||||
enableXWayland = true;
|
|
||||||
nvidiaPatches = false;
|
|
||||||
legacyRenderer = true;
|
|
||||||
};
|
|
||||||
waybar = prev.waybar.overrideAttrs (oldAttrs: {
|
|
||||||
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
|
|
||||||
});
|
|
||||||
tinystatus = prev.pkgs.callPackage ../packages/tinystatus { };
|
|
||||||
jackett = prev.unstable.jackett;
|
|
||||||
radarr = prev.unstable.radarr;
|
|
||||||
htpdate = prev.pkgs.callPackage ../packages/htpdate { };
|
|
||||||
authelia = prev.pkgs.callPackage ../packages/authelia { };
|
|
||||||
paperless-ng = prev.pkgs.callPackage ../packages/paperless-ng { };
|
|
||||||
tailscale = prev.unstable.tailscale;
|
|
||||||
nodePackages = prev.unstable.nodePackages;
|
|
||||||
hydrasect = prev.pkgs.callPackage ../packages/hydrasect { };
|
|
||||||
linkal = inputs.linkal.defaultPackage."${system}";
|
|
||||||
mosh = prev.unstable.mosh;
|
|
||||||
hyprpaper = inputs.hyprpaper.packages.${system}.default;
|
|
||||||
attic = inputs.attic.packages.${system}.default;
|
|
||||||
colmena = inputs.colmena.packages.${system}.colmena;
|
|
||||||
nixd = inputs.nixd.packages.${system}.default;
|
|
||||||
keycloak-keywind = prev.pkgs.callPackage ../packages/keycloak-keywind { };
|
|
||||||
nix-rfc-92 = inputs.nix-rfc-92.packages.${system}.default;
|
|
||||||
bcachefs-tools = prev.unstable.bcachefs-tools;
|
|
||||||
})
|
|
||||||
];
|
|
||||||
}
|
|
||||||
];
|
|
||||||
extraModules = [ inputs.colmena.nixosModules.deploymentOptions ];
|
|
||||||
};
|
|
||||||
|
|
||||||
importConfig = path: (mapAttrs (name: value: import (path + "/${name}/default.nix")) (final.filterAttrs (_: v: v == "directory") (readDir path)));
|
importConfig = path: (mapAttrs (name: value: import (path + "/${name}/default.nix")) (final.filterAttrs (_: v: v == "directory") (readDir path)));
|
||||||
|
|
||||||
mkSubdomain = name: port: {
|
mkSubdomain = name: port: {
|
||||||
|
|
|
@ -48,9 +48,9 @@ inputs: lib: with lib; let
|
||||||
hm_version = inputs.home-manager;
|
hm_version = inputs.home-manager;
|
||||||
};
|
};
|
||||||
telecom = {
|
telecom = {
|
||||||
arch = "x86_64-linux";
|
arch = "x86_64-linux";
|
||||||
nixpkgs_version = inputs.nixpkgs;
|
nixpkgs_version = inputs.unstable-plus-patches;
|
||||||
hm_version = inputs.home-manager;
|
hm_version = inputs.home-manager-unstable;
|
||||||
};
|
};
|
||||||
enigma = {
|
enigma = {
|
||||||
arch = "aarch64-linux";
|
arch = "aarch64-linux";
|
||||||
|
|
70
lib/mkmachine.nix
Normal file
70
lib/mkmachine.nix
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
inputs: lib:
|
||||||
|
|
||||||
|
let
|
||||||
|
overlay-unstable = arch: final: prev:
|
||||||
|
let
|
||||||
|
nixpkgs-patched-src = (import inputs.nixpkgs { system = arch; }).applyPatches {
|
||||||
|
name = "nixpkgs-patches";
|
||||||
|
src = inputs.nixpkgs;
|
||||||
|
patches = [ ../patches/bcachefs-systemd-stage-1.patch ];
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
unstable = inputs.unstable.legacyPackages."${arch}";
|
||||||
|
nixpkgs-patched = import nixpkgs-patched-src { system = arch; };
|
||||||
|
stable = inputs.nixpkgs.legacyPackages."${arch}";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
{ host, host-config, modules, nixpkgs ? inputs.nixpkgs, system ? "x86_64-linux", home-manager ? inputs.home-manager }:
|
||||||
|
nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
lib = (nixpkgs.lib.extend (import ./default.nix inputs));
|
||||||
|
specialArgs =
|
||||||
|
{
|
||||||
|
inherit inputs;
|
||||||
|
};
|
||||||
|
modules = builtins.attrValues modules ++ [
|
||||||
|
../machines/base.nix
|
||||||
|
inputs.sops-nix.nixosModules.sops
|
||||||
|
host-config
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
inputs.simple-nixos-mailserver.nixosModule
|
||||||
|
inputs.hyprland.nixosModules.default
|
||||||
|
inputs.attic.nixosModules.atticd
|
||||||
|
inputs.lanzaboote.nixosModules.lanzaboote
|
||||||
|
inputs.nix-index-database.nixosModules.nix-index
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(overlay-unstable system)
|
||||||
|
(final: prev:
|
||||||
|
{
|
||||||
|
waybar = prev.waybar.overrideAttrs (oldAttrs: {
|
||||||
|
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
|
||||||
|
});
|
||||||
|
tinystatus = prev.pkgs.callPackage ../packages/tinystatus { };
|
||||||
|
jackett = prev.unstable.jackett;
|
||||||
|
radarr = prev.unstable.radarr;
|
||||||
|
htpdate = prev.pkgs.callPackage ../packages/htpdate { };
|
||||||
|
authelia = prev.pkgs.callPackage ../packages/authelia { };
|
||||||
|
paperless-ng = prev.pkgs.callPackage ../packages/paperless-ng { };
|
||||||
|
tailscale = prev.unstable.tailscale;
|
||||||
|
nodePackages = prev.unstable.nodePackages;
|
||||||
|
hydrasect = prev.pkgs.callPackage ../packages/hydrasect { };
|
||||||
|
linkal = inputs.linkal.defaultPackage."${system}";
|
||||||
|
mosh = prev.unstable.mosh;
|
||||||
|
hyprpaper = inputs.hyprpaper.packages.${system}.default;
|
||||||
|
attic = inputs.attic.packages.${system}.default;
|
||||||
|
colmena = inputs.colmena.packages.${system}.colmena;
|
||||||
|
nixd = inputs.nixd.packages.${system}.default;
|
||||||
|
keycloak-keywind = prev.pkgs.callPackage ../packages/keycloak-keywind { };
|
||||||
|
nix-rfc-92 = inputs.nix-rfc-92.packages.${system}.default;
|
||||||
|
bcachefs-tools = prev.unstable.bcachefs-tools;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
extraModules = [ inputs.colmena.nixosModules.deploymentOptions ];
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue