restructured repo to support nix-darwin
This commit is contained in:
parent
3924a5aa8d
commit
0d0443a02a
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -1,9 +1,11 @@
|
|||
{
|
||||
"cSpell.words": [
|
||||
"attrsets",
|
||||
"bitwarden",
|
||||
"forgejo",
|
||||
"gids",
|
||||
"headscale",
|
||||
"hesperium",
|
||||
"jellyfin",
|
||||
"macvlan",
|
||||
"nextcloud",
|
||||
|
|
1
configurations/darwin/hesperium/default.nix
Normal file
1
configurations/darwin/hesperium/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
{...}: {}
|
21
flake.lock
21
flake.lock
|
@ -198,6 +198,26 @@
|
|||
"url": "https://git.lix.systems/lix-project/nixos-module"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1732420287,
|
||||
"narHash": "sha256-CzvYF4x6jUh/+NEEIFrIY5t1W/N3IA2bNZJiMXu9GTo=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "3c52583b99666a349a6219dc1f0dd07d75c82d6a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-vscode-extensions": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat_2",
|
||||
|
@ -259,6 +279,7 @@
|
|||
"flake-compat": "flake-compat",
|
||||
"home-manager": "home-manager",
|
||||
"lix-module": "lix-module",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nix-vscode-extensions": "nix-vscode-extensions",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs",
|
||||
|
|
26
flake.nix
26
flake.nix
|
@ -11,7 +11,7 @@
|
|||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# self hosted repo of secrets file to further protect files in case of future encryption vunrabilities
|
||||
# self hosted repo of secrets file to further protect files in case of future encryption vulnerabilities
|
||||
secrets = {
|
||||
url = "git+https://git.jan-leila.com/jan-leila/nix-config-secrets?ref=main";
|
||||
flake = false;
|
||||
|
@ -28,6 +28,11 @@
|
|||
# url = "github:nix-community/impermanence";
|
||||
# };
|
||||
|
||||
nix-darwin = {
|
||||
url = "github:LnL7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# users home directories
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
|
@ -70,7 +75,8 @@
|
|||
} @ inputs: let
|
||||
util = import ./util {inherit inputs;};
|
||||
forEachPkgs = util.forEachPkgs;
|
||||
mkSystem = util.mkSystem;
|
||||
mkNixosSystem = util.mkNixosSystem;
|
||||
mkDarwinSystem = util.mkDarwinSystem;
|
||||
mkHome = util.mkHome;
|
||||
in {
|
||||
formatter = forEachPkgs (pkgs: pkgs.alejandra);
|
||||
|
@ -95,6 +101,16 @@
|
|||
};
|
||||
});
|
||||
|
||||
nixosConfigurations = {
|
||||
horizon = mkNixosSystem "horizon";
|
||||
twilight = mkNixosSystem "twilight";
|
||||
defiant = mkNixosSystem "defiant";
|
||||
};
|
||||
|
||||
darwinConfigurations = {
|
||||
hesperium = mkDarwinSystem "hesperium";
|
||||
};
|
||||
|
||||
homeConfigurations = nixpkgs.lib.attrsets.mergeAttrsList (
|
||||
nixpkgs.lib.attrsets.mapAttrsToList (hostname: system: (
|
||||
nixpkgs.lib.attrsets.mapAttrs' (user: _: {
|
||||
|
@ -105,11 +121,5 @@
|
|||
))
|
||||
self.nixosConfigurations
|
||||
);
|
||||
|
||||
nixosConfigurations = {
|
||||
horizon = mkSystem "horizon";
|
||||
twilight = mkSystem "twilight";
|
||||
defiant = mkSystem "defiant";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
# modules in this folder are to adapt home manager modules defined in `home-modules` to any nix module configs that they need to set
|
||||
{...}: {
|
||||
imports = [
|
||||
./flipperzero.nix
|
||||
./i18n.nix
|
||||
];
|
||||
}
|
6
modules/darwin-modules/default.nix
Normal file
6
modules/darwin-modules/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
# this folder container modules that are for darwin only
|
||||
{...}: {
|
||||
imports = [
|
||||
./home-manager
|
||||
];
|
||||
}
|
2
modules/darwin-modules/home-manager/default.nix
Normal file
2
modules/darwin-modules/home-manager/default.nix
Normal file
|
@ -0,0 +1,2 @@
|
|||
# modules in this folder are to adapt home-manager modules configs to darwin-module configs
|
||||
{...}: {}
|
|
@ -1,3 +1,4 @@
|
|||
# this folder container modules that are for home manager only
|
||||
{...}: {
|
||||
imports = [
|
||||
./flipperzero.nix
|
|
@ -1,11 +1,12 @@
|
|||
# this folder container modules that are for nixos only
|
||||
{...}: {
|
||||
imports = [
|
||||
./home-manager
|
||||
./system.nix
|
||||
./hardware.nix
|
||||
./users.nix
|
||||
./desktop.nix
|
||||
./nix-development.nix
|
||||
./i18n.nix
|
||||
./home-manager
|
||||
];
|
||||
}
|
7
modules/nixos-modules/home-manager/default.nix
Normal file
7
modules/nixos-modules/home-manager/default.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
# modules in this folder are to adapt home-manager modules configs to nixos-module configs
|
||||
{...}: {
|
||||
imports = [
|
||||
./flipperzero.nix
|
||||
./i18n.nix
|
||||
];
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
inputs,
|
||||
...
|
||||
}: let
|
||||
SOPS_AGE_KEY_DIRECTORY = import ../const/sops_age_key_directory.nix;
|
||||
SOPS_AGE_KEY_DIRECTORY = import ../../const/sops_age_key_directory.nix;
|
||||
|
||||
host = config.host;
|
||||
|
6
modules/system-modules/default.nix
Normal file
6
modules/system-modules/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
# this folder container modules that are for nixos and darwin
|
||||
{...}: {
|
||||
imports = [
|
||||
./home-manager
|
||||
];
|
||||
}
|
2
modules/system-modules/home-manager/default.nix
Normal file
2
modules/system-modules/home-manager/default.nix
Normal file
|
@ -0,0 +1,2 @@
|
|||
# modules in this folder are to adapt home-manager modules configs to system-module configs
|
||||
{...}: {}
|
|
@ -6,6 +6,7 @@
|
|||
lix-module = inputs.lix-module;
|
||||
nixpkgs = inputs.nixpkgs;
|
||||
home-manager = inputs.home-manager;
|
||||
nix-darwin = inputs.nix-darwin;
|
||||
sops-nix = inputs.sops-nix;
|
||||
|
||||
systems = [
|
||||
|
@ -17,18 +18,34 @@
|
|||
forEachSystem = nixpkgs.lib.genAttrs systems;
|
||||
pkgsFor = system: nixpkgs.legacyPackages.${system};
|
||||
|
||||
home-manager-shared-modules = [
|
||||
../modules
|
||||
../home-modules
|
||||
common-modules = [
|
||||
lix-module.nixosModules.default
|
||||
../modules/common-modules
|
||||
];
|
||||
|
||||
home-manager-modules =
|
||||
common-modules
|
||||
++ [
|
||||
../modules/home-manager-modules
|
||||
];
|
||||
|
||||
home-manager-config = nixpkgs: {
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.backupFileExtension = "backup";
|
||||
home-manager.extraSpecialArgs = {inherit inputs outputs util;};
|
||||
home-manager.users = import ../homes nixpkgs;
|
||||
home-manager.sharedModules = home-manager-shared-modules;
|
||||
home-manager.users = import ../configurations/home-manager nixpkgs;
|
||||
home-manager.sharedModules = home-manager-modules;
|
||||
};
|
||||
|
||||
system-modules =
|
||||
common-modules
|
||||
++ [
|
||||
../modules/system-modules
|
||||
sops-nix.nixosModules.sops
|
||||
home-manager.nixosModules.home-manager
|
||||
home-manager-config
|
||||
];
|
||||
in {
|
||||
forEachPkgs = lambda: forEachSystem (system: lambda (pkgsFor system));
|
||||
|
||||
|
@ -39,17 +56,25 @@ in {
|
|||
(lib.mkUnless condition no)
|
||||
];
|
||||
|
||||
mkSystem = host:
|
||||
mkNixosSystem = host:
|
||||
nixpkgs.lib.nixosSystem {
|
||||
specialArgs = {inherit inputs outputs util;};
|
||||
modules = [
|
||||
lix-module.nixosModules.default
|
||||
sops-nix.nixosModules.sops
|
||||
home-manager.nixosModules.home-manager
|
||||
home-manager-config
|
||||
../modules
|
||||
../host-modules
|
||||
../hosts/${host}
|
||||
modules =
|
||||
system-modules
|
||||
++ [
|
||||
../modules/nixos-modules
|
||||
../configurations/nixos/${host}
|
||||
];
|
||||
};
|
||||
|
||||
mkDarwinSystem = host:
|
||||
nix-darwin.lib.darwinSystem {
|
||||
specialArgs = {inherit inputs outputs util;};
|
||||
modules =
|
||||
system-modules
|
||||
++ [
|
||||
../modules/darwin-modules
|
||||
../configurations/darwin/${host}
|
||||
];
|
||||
};
|
||||
|
||||
|
@ -60,9 +85,9 @@ in {
|
|||
inherit inputs util outputs osConfig;
|
||||
};
|
||||
modules =
|
||||
home-manager-shared-modules
|
||||
home-manager-modules
|
||||
++ [
|
||||
../homes/${user}
|
||||
../configurations/home-manager/${user}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue