WIP2
This commit is contained in:
parent
92f83235e0
commit
62778d8519
25 changed files with 647 additions and 529 deletions
123
flake.nix
123
flake.nix
|
|
@ -19,6 +19,8 @@
|
|||
hasSuffix
|
||||
mkAliasOptionModule
|
||||
strings
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
|
||||
systemFn =
|
||||
|
|
@ -44,7 +46,6 @@
|
|||
mkSystem =
|
||||
system:
|
||||
{
|
||||
profile ? "minimal",
|
||||
machine ? { },
|
||||
modules ? [ ],
|
||||
specialArgs ? { },
|
||||
|
|
@ -60,117 +61,69 @@
|
|||
home-manager.darwinModules.home-manager
|
||||
else if hasSuffix "linux" system then
|
||||
[
|
||||
home-manager.nixosModules.home-manager
|
||||
lanzaboote.nixosModules.lanzaboote
|
||||
]
|
||||
else
|
||||
throw "System: ${system} not supported."
|
||||
)
|
||||
|
||||
./modules/machine.nix
|
||||
./profiles/${strings.concatStrings (lib.drop 1 (strings.splitString "-" system))}/${profile}.nix
|
||||
./machines/${machine.hostName}/system.nix
|
||||
{
|
||||
imports = [
|
||||
(mkAliasOptionModule
|
||||
[ "hm" ]
|
||||
[
|
||||
"home-manager"
|
||||
"users"
|
||||
"${machine.mainUser}"
|
||||
]
|
||||
)
|
||||
];
|
||||
{ nixpkgs.hostPlatform = "${system}"; }
|
||||
|
||||
config = {
|
||||
machine = machine;
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
}
|
||||
// lib.optionalAttrs (lib.hasSuffix "linux" system) {
|
||||
hm.home.homeDirectory = "/home/${machine.mainUser}";
|
||||
}
|
||||
// lib.optionalAttrs (lib.hasSuffix "darwin" system) {
|
||||
users.users.${machine.mainUser}.home = "/Users/pml";
|
||||
nixpkgs.config.allowUnfreePredicate =
|
||||
pkg:
|
||||
builtins.elem (lib.getName pkg) [
|
||||
"obsidian"
|
||||
];
|
||||
{
|
||||
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
|
||||
]
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
mkDarwinSystem =
|
||||
{
|
||||
modules ? [ ],
|
||||
machine,
|
||||
specialArgs ? { },
|
||||
system ? { },
|
||||
home ? { },
|
||||
}:
|
||||
inputs.nix-darwin.lib.darwinSystem {
|
||||
specialArgs = specialArgs // {
|
||||
inherit inputs;
|
||||
};
|
||||
modules = [
|
||||
{ system.configurationRevision = self.rev or self.dirtyRev or null; }
|
||||
inputs.home-manager.darwinModules.home-manager
|
||||
./modules/machine.nix
|
||||
./machines/${machine.hostName}/system.nix
|
||||
{ config.machine = machine; }
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
environment.etc = {
|
||||
"1password" = {
|
||||
target = "1password/custom_allowed_browsers";
|
||||
enable = true;
|
||||
text = ''
|
||||
firefox
|
||||
brave
|
||||
'';
|
||||
# mode = "0755";
|
||||
};
|
||||
};
|
||||
}
|
||||
(
|
||||
{ config, ... }:
|
||||
{
|
||||
users.users.pml.home = "/Users/pml";
|
||||
hm.home.username = "pml";
|
||||
}
|
||||
)
|
||||
]
|
||||
++ modules;
|
||||
};
|
||||
in
|
||||
{
|
||||
nixosConfigurations."persephone" = systems.mkSystem "x86_64-linux" {
|
||||
profile = "desktop";
|
||||
machine = {
|
||||
hostName = "persephone";
|
||||
mainUser = "pml";
|
||||
filesystem.uuid = {
|
||||
boot = "cb03cf78-715e-4030-ba82-189ff8897eaf";
|
||||
esp = "4E4C-1139";
|
||||
luks = "0cf52ea1-16d1-4dec-a69a-bdac82bbcf25";
|
||||
cryptroot = "6fb9ce3c-c870-4eb7-8199-6536ff898701";
|
||||
};
|
||||
};
|
||||
modules = [ ./home.nix ];
|
||||
modules = [
|
||||
./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" = systems.mkSystem "aarch64-darwin" {
|
||||
profile = "desktop";
|
||||
machine = {
|
||||
hostName = "hermes";
|
||||
mainUser = "pml";
|
||||
};
|
||||
modules = [ ./home.nix ];
|
||||
modules = [
|
||||
./modules/darwin/homebrew.nix
|
||||
./modules/darwin/programs.nix
|
||||
];
|
||||
};
|
||||
|
||||
devShells = forEachSupportedSystem (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue