Revamp
This commit is contained in:
parent
e06b409221
commit
2c37447ec3
26 changed files with 861 additions and 494 deletions
261
flake.nix
261
flake.nix
|
|
@ -1,128 +1,154 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.11";
|
||||
|
||||
nix-darwin.url = "github:nix-darwin/nix-darwin?ref=nix-darwin-25.11";
|
||||
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
home-manager.url = "github:nix-community/home-manager?ref=release-25.11";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
lanzaboote.url = "github:nix-community/lanzaboote?ref=master";
|
||||
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs, ... }@inputs:
|
||||
let
|
||||
supportedSystems = [
|
||||
"x86_64-linux"
|
||||
"aarch64-darwin"
|
||||
lib = import ./lib { inherit nixpkgs; };
|
||||
|
||||
inherit (lib) forEachSupportedSystem pkgsFor;
|
||||
|
||||
commonModules = [
|
||||
./modules/common/environment.nix
|
||||
./modules/common/nix.nix
|
||||
./modules/common/nixpkgs.nix
|
||||
./modules/common/programs.nix
|
||||
];
|
||||
|
||||
lib = import ./lib { inherit (inputs.nixpkgs) lib; };
|
||||
pkgsFor =
|
||||
system:
|
||||
import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
darwinModules = [
|
||||
./modules/darwin/homebrew.nix
|
||||
./modules/darwin/programs.nix
|
||||
];
|
||||
|
||||
forEachSupportedSystem =
|
||||
f:
|
||||
inputs.nixpkgs.lib.genAttrs supportedSystems (
|
||||
system:
|
||||
f {
|
||||
inherit system;
|
||||
pkgs = pkgsFor system;
|
||||
}
|
||||
);
|
||||
nixosModules = [
|
||||
inputs.lanzaboote.nixosModules.lanzaboote
|
||||
./modules/nixos/boot.nix
|
||||
./modules/nixos/environment.nix
|
||||
./modules/nixos/filesystems.nix
|
||||
./modules/nixos/fonts.nix
|
||||
./modules/nixos/hardware.nix
|
||||
./modules/nixos/networking.nix
|
||||
./modules/nixos/programs.nix
|
||||
./modules/nixos/security.nix
|
||||
./modules/nixos/services.nix
|
||||
./modules/nixos/system.nix
|
||||
];
|
||||
|
||||
systems =
|
||||
let
|
||||
inherit (inputs)
|
||||
home-manager
|
||||
lanzaboote
|
||||
nix-darwin
|
||||
nixpkgs
|
||||
;
|
||||
inherit (nixpkgs.lib)
|
||||
flatten
|
||||
hasSuffix
|
||||
mkAliasOptionModule
|
||||
strings
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
systemFn =
|
||||
system:
|
||||
if hasSuffix "darwin" system then
|
||||
nix-darwin.lib.darwinSystem
|
||||
else if hasSuffix "linux" system then
|
||||
nixpkgs.lib.nixosSystem
|
||||
else
|
||||
throw "System: ${system} not supported.";
|
||||
|
||||
homeModule =
|
||||
system:
|
||||
if hasSuffix "darwin" system then
|
||||
home-manager.darwinModules.home-manager
|
||||
else if hasSuffix "linux" system then
|
||||
home-manager.nixosModules.home-manager
|
||||
else
|
||||
throw "System: ${system} not supported.";
|
||||
|
||||
in
|
||||
{
|
||||
mkSystem =
|
||||
system:
|
||||
{
|
||||
machine ? { },
|
||||
modules ? [ ],
|
||||
specialArgs ? { },
|
||||
}:
|
||||
systemFn system {
|
||||
inherit specialArgs;
|
||||
|
||||
modules = flatten (
|
||||
modules
|
||||
++ [
|
||||
(
|
||||
if hasSuffix "darwin" system then
|
||||
home-manager.darwinModules.home-manager
|
||||
else if hasSuffix "linux" system then
|
||||
[
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
]
|
||||
else
|
||||
throw "System: ${system} not supported."
|
||||
)
|
||||
|
||||
{ nixpkgs.hostPlatform = "${system}"; }
|
||||
|
||||
{
|
||||
options.machine = {
|
||||
mainUser = mkOption {
|
||||
type = types.str;
|
||||
description = "The main user of the machine";
|
||||
};
|
||||
|
||||
hostName = mkOption {
|
||||
type = types.str;
|
||||
description = "The name of the machine";
|
||||
};
|
||||
};
|
||||
}
|
||||
{ config.machine = machine; }
|
||||
|
||||
./modules/common/environment.nix
|
||||
./modules/common/nix.nix
|
||||
./modules/common/nixpkgs.nix
|
||||
./modules/common/programs.nix
|
||||
|
||||
./machines/${machine.hostName}.nix
|
||||
]
|
||||
);
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations."persephone" = nixpkgs.lib.nixosSystem {
|
||||
nixosConfigurations."persephone" = systems.mkSystem "x86_64-linux" {
|
||||
machine = {
|
||||
hostName = "persephone";
|
||||
mainUser = "pml";
|
||||
};
|
||||
modules = [
|
||||
inputs.lanzaboote.nixosModules.lanzaboote
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
(
|
||||
{ config, lib, ... }:
|
||||
{
|
||||
imports = [
|
||||
(lib.mkAliasOptionModule [ "hm" ] [ "home-manager" "users" "${config.machine.mainUser}" ])
|
||||
];
|
||||
}
|
||||
)
|
||||
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
hm.programs.bat.enable = true;
|
||||
hm.home.stateVersion = "25.11";
|
||||
}
|
||||
|
||||
./machines/persephone.nix
|
||||
(
|
||||
{ lib, ... }:
|
||||
{
|
||||
options.machine = {
|
||||
fs = {
|
||||
bootUUID = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The UUID of the XBOOTLDR partition.";
|
||||
default = "9c2d7380-571d-4bc5-9ad2-e4888ce351be";
|
||||
};
|
||||
efiUUID = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The UUID of the ESP.";
|
||||
default = "71E7-7A63";
|
||||
};
|
||||
luuksUUID = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The UUID of the encrypted root partition.";
|
||||
default = "b0ace3a0-64f0-461e-a604-7f6788384d12";
|
||||
};
|
||||
cryptrootUUID = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The UUID of the decrypted root partition.";
|
||||
default = "769362f6-43d4-4b83-a12c-d006c9bd6613";
|
||||
};
|
||||
};
|
||||
mainUser = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The main user of the machine";
|
||||
default = "pml";
|
||||
};
|
||||
hostName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The name of the machine";
|
||||
default = "persephone";
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
./modules/nixos/boot.nix
|
||||
./modules/nixos/environment.nix
|
||||
./modules/nixos/filesystems.nix
|
||||
./modules/nixos/fonts.nix
|
||||
./modules/nixos/hardware.nix
|
||||
./modules/nixos/networking.nix
|
||||
./modules/nixos/programs.nix
|
||||
./modules/nixos/security.nix
|
||||
./modules/nixos/services.nix
|
||||
./modules/nixos/system.nix
|
||||
];
|
||||
};
|
||||
|
||||
darwinConfigurations."hermes" = inputs.nix-darwin.lib.darwinSystem {
|
||||
darwinConfigurations."hermes" = systems.mkSystem "aarch64-darwin" {
|
||||
machine = {
|
||||
hostName = "hermes";
|
||||
mainUser = "pml";
|
||||
};
|
||||
modules = [
|
||||
{ system.configurationRevision = self.rev or self.dirtyRev or null; }
|
||||
./machines/hermes.nix
|
||||
(
|
||||
{ lib, ... }:
|
||||
{
|
||||
options.machine = {
|
||||
mainUser = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The main user of the machine";
|
||||
default = "pml";
|
||||
};
|
||||
hostName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
description = "The name of the machine";
|
||||
default = "hermes";
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
./modules/darwin/homebrew.nix
|
||||
./modules/darwin/programs.nix
|
||||
];
|
||||
};
|
||||
|
||||
|
|
@ -140,4 +166,17 @@
|
|||
|
||||
formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt-rfc-style);
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-25.11";
|
||||
|
||||
nix-darwin.url = "github:nix-darwin/nix-darwin?ref=nix-darwin-25.11";
|
||||
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
home-manager.url = "github:nix-community/home-manager?ref=release-25.11";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
||||
lanzaboote.url = "github:nix-community/lanzaboote?ref=master";
|
||||
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue