mirror of
https://github.com/Swarsel/.dotfiles.git
synced 2025-12-06 09:07:21 +01:00
feat: use nixos-extra-modules
This commit is contained in:
parent
47b2436ab0
commit
d63cadd673
19 changed files with 3397 additions and 1802 deletions
|
|
@ -3,12 +3,29 @@
|
|||
flake = { config, ... }:
|
||||
let
|
||||
inherit (self) outputs;
|
||||
inherit (outputs) lib;
|
||||
inherit (outputs) lib homeLib;
|
||||
# lib = (inputs.nixpkgs.lib // inputs.home-manager.lib).extend (_: _: { swarselsystems = import "${self}/lib" { inherit self lib inputs outputs; inherit (inputs) systems; }; });
|
||||
|
||||
mkNixosHost = { minimal }: configName:
|
||||
lib.nixosSystem {
|
||||
specialArgs = { inherit inputs outputs lib self minimal configName; inherit (config) globals nodes; };
|
||||
let
|
||||
sys = "x86_64-linux";
|
||||
# lib = config.pkgsPre.${sys}.lib // {
|
||||
# inherit (inputs.home-manager.lib) hm;
|
||||
# swarselsystems = self.outputs.swarselsystemsLib;
|
||||
# };
|
||||
|
||||
# lib = config.pkgsPre.${sys}.lib // {
|
||||
# inherit (inputs.home-manager.lib) hm;
|
||||
# swarselsystems = self.outputs.swarselsystemsLib;
|
||||
# };
|
||||
inherit (config.pkgs.${sys}) lib;
|
||||
in
|
||||
inputs.nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {
|
||||
inherit inputs outputs self minimal configName;
|
||||
inherit lib homeLib;
|
||||
inherit (config) globals nodes;
|
||||
};
|
||||
modules = [
|
||||
inputs.disko.nixosModules.disko
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
|
|
@ -23,6 +40,7 @@
|
|||
inputs.niri-flake.nixosModules.niri
|
||||
inputs.microvm.nixosModules.host
|
||||
inputs.microvm.nixosModules.microvm
|
||||
(inputs.nixos-extra-modules + "/modules/guests")
|
||||
"${self}/hosts/nixos/${configName}"
|
||||
"${self}/profiles/nixos"
|
||||
"${self}/modules/nixos"
|
||||
|
|
@ -31,7 +49,7 @@
|
|||
microvm.guest.enable = lib.mkDefault false;
|
||||
|
||||
node = {
|
||||
name = configName;
|
||||
name = lib.mkForce configName;
|
||||
secretsDir = ../hosts/nixos/${configName}/secrets;
|
||||
};
|
||||
|
||||
|
|
@ -53,7 +71,7 @@
|
|||
mkDarwinHost = { minimal }: configName:
|
||||
inputs.nix-darwin.lib.darwinSystem {
|
||||
specialArgs = {
|
||||
inherit inputs outputs lib self minimal configName;
|
||||
inherit inputs lib outputs self minimal configName;
|
||||
inherit (config) globals nodes;
|
||||
};
|
||||
modules = [
|
||||
|
|
@ -70,7 +88,7 @@
|
|||
"${self}/modules/nixos/common/meta.nix"
|
||||
"${self}/modules/nixos/common/globals.nix"
|
||||
{
|
||||
node.name = configName;
|
||||
node.name = lib.mkForce configName;
|
||||
node.secretsDir = ../hosts/darwin/${configName}/secrets;
|
||||
|
||||
}
|
||||
|
|
@ -86,7 +104,7 @@
|
|||
{
|
||||
inherit pkgs;
|
||||
extraSpecialArgs = {
|
||||
inherit inputs outputs lib self configName;
|
||||
inherit inputs lib outputs self configName;
|
||||
inherit (config) globals nodes;
|
||||
minimal = false;
|
||||
};
|
||||
|
|
@ -121,13 +139,31 @@
|
|||
minimal = true;
|
||||
});
|
||||
|
||||
# TODO: Build these for all architectures
|
||||
homeConfigurations = mkHalfHostConfigs (lib.swarselsystems.readHosts "home") "home" lib.swarselsystems.pkgsFor.x86_64-linux // mkHalfHostConfigs (lib.swarselsystems.readHosts "home") "home" lib.swarselsystems.pkgsFor.aarch64-linux;
|
||||
nixOnDroidConfigurations = mkHalfHostConfigs (lib.swarselsystems.readHosts "android") "android" lib.swarselsystems.pkgsFor.aarch64-linux;
|
||||
homeConfigurations =
|
||||
let
|
||||
inherit (lib.swarselsystems) pkgsFor readHosts;
|
||||
in
|
||||
mkHalfHostConfigs (readHosts "home") "home" pkgsFor.x86_64-linux
|
||||
// mkHalfHostConfigs (readHosts "home") "home" pkgsFor.aarch64-linux;
|
||||
|
||||
nixOnDroidConfigurations =
|
||||
let
|
||||
inherit (lib.swarselsystems) pkgsFor readHosts;
|
||||
in
|
||||
mkHalfHostConfigs (readHosts "android") "android" pkgsFor.aarch64-linux;
|
||||
|
||||
guestConfigurations = lib.flip lib.concatMapAttrs config.nixosConfigurations (
|
||||
_: node:
|
||||
lib.flip lib.mapAttrs' (node.config.microvm.vms or { }) (
|
||||
guestName: guestDef:
|
||||
lib.nameValuePair guestDef.nodeName node.config.microvm.vms.${guestName}.config
|
||||
)
|
||||
);
|
||||
|
||||
diskoConfigurations.default = import "${self}/files/templates/hosts/nixos/disk-config.nix";
|
||||
|
||||
nodes = config.nixosConfigurations // config.darwinConfigurations;
|
||||
|
||||
nodes = config.nixosConfigurations
|
||||
// config.darwinConfigurations
|
||||
// config.guestConfigurations;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,5 +57,8 @@ in
|
|||
inherit (inputs.home-manager.lib) hm;
|
||||
inherit swarselsystems;
|
||||
});
|
||||
|
||||
swarselsystemsLib = swarselsystems;
|
||||
homeLib = self.outputs.lib;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,11 @@ in
|
|||
# withSystemVencord = true;
|
||||
# };
|
||||
|
||||
lib = prev.lib // {
|
||||
swarselsystems = self.outputs.swarselsystemsLib;
|
||||
hm = self.outputs.homeLib;
|
||||
};
|
||||
|
||||
firefox = prev.firefox.override {
|
||||
nativeMessagingHosts = [
|
||||
prev.tridactyl-native
|
||||
|
|
@ -72,15 +77,19 @@ in
|
|||
(builtins.attrNames nixpkgsInputs));
|
||||
|
||||
in
|
||||
(additions final prev)
|
||||
// (modifications final prev)
|
||||
// (nixpkgs-stable-versions final prev)
|
||||
// (inputs.niri-flake.overlays.niri final prev)
|
||||
// (inputs.vbc-nix.overlays.default final prev)
|
||||
// (inputs.nur.overlays.default final prev)
|
||||
// (inputs.emacs-overlay.overlay final prev)
|
||||
// (inputs.nix-topology.overlays.default final prev)
|
||||
// (inputs.nixgl.overlay final prev);
|
||||
lib.recursiveUpdate
|
||||
(
|
||||
(additions final prev)
|
||||
// (nixpkgs-stable-versions final prev)
|
||||
// (inputs.niri-flake.overlays.niri final prev)
|
||||
// (inputs.vbc-nix.overlays.default final prev)
|
||||
// (inputs.nur.overlays.default final prev)
|
||||
// (inputs.emacs-overlay.overlay final prev)
|
||||
// (inputs.nix-topology.overlays.default final prev)
|
||||
// (inputs.nixgl.overlay final prev)
|
||||
// (inputs.nixos-extra-modules.overlays.default final prev)
|
||||
)
|
||||
(modifications final prev);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,17 @@
|
|||
{ self, ... }:
|
||||
{ self, inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
(
|
||||
{ lib, flake-parts-lib, ... }:
|
||||
flake-parts-lib.mkTransposedPerSystemModule {
|
||||
name = "pkgs";
|
||||
file = ./packages.nix;
|
||||
option = lib.mkOption {
|
||||
type = lib.types.unspecified;
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
flake = _:
|
||||
let
|
||||
inherit (self.outputs) lib;
|
||||
|
|
@ -7,4 +19,17 @@
|
|||
{
|
||||
packages = lib.swarselsystems.forEachLinuxSystem (pkgs: import "${self}/pkgs" { inherit self lib pkgs; });
|
||||
};
|
||||
|
||||
perSystem = { pkgs, system, ... }:
|
||||
{
|
||||
# see https://flake.parts/module-arguments.html?highlight=modulewith#persystem-module-parameters
|
||||
_module.args.pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
overlays = [
|
||||
self.overlays.default
|
||||
];
|
||||
};
|
||||
inherit pkgs;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue