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": [
|
"cSpell.words": [
|
||||||
|
"attrsets",
|
||||||
"bitwarden",
|
"bitwarden",
|
||||||
"forgejo",
|
"forgejo",
|
||||||
"gids",
|
"gids",
|
||||||
"headscale",
|
"headscale",
|
||||||
|
"hesperium",
|
||||||
"jellyfin",
|
"jellyfin",
|
||||||
"macvlan",
|
"macvlan",
|
||||||
"nextcloud",
|
"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"
|
"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": {
|
"nix-vscode-extensions": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat_2",
|
"flake-compat": "flake-compat_2",
|
||||||
|
@ -259,6 +279,7 @@
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"lix-module": "lix-module",
|
"lix-module": "lix-module",
|
||||||
|
"nix-darwin": "nix-darwin",
|
||||||
"nix-vscode-extensions": "nix-vscode-extensions",
|
"nix-vscode-extensions": "nix-vscode-extensions",
|
||||||
"nixos-hardware": "nixos-hardware",
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
|
|
26
flake.nix
26
flake.nix
|
@ -11,7 +11,7 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
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 = {
|
secrets = {
|
||||||
url = "git+https://git.jan-leila.com/jan-leila/nix-config-secrets?ref=main";
|
url = "git+https://git.jan-leila.com/jan-leila/nix-config-secrets?ref=main";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
@ -28,6 +28,11 @@
|
||||||
# url = "github:nix-community/impermanence";
|
# url = "github:nix-community/impermanence";
|
||||||
# };
|
# };
|
||||||
|
|
||||||
|
nix-darwin = {
|
||||||
|
url = "github:LnL7/nix-darwin";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
# users home directories
|
# users home directories
|
||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager";
|
url = "github:nix-community/home-manager";
|
||||||
|
@ -70,7 +75,8 @@
|
||||||
} @ inputs: let
|
} @ inputs: let
|
||||||
util = import ./util {inherit inputs;};
|
util = import ./util {inherit inputs;};
|
||||||
forEachPkgs = util.forEachPkgs;
|
forEachPkgs = util.forEachPkgs;
|
||||||
mkSystem = util.mkSystem;
|
mkNixosSystem = util.mkNixosSystem;
|
||||||
|
mkDarwinSystem = util.mkDarwinSystem;
|
||||||
mkHome = util.mkHome;
|
mkHome = util.mkHome;
|
||||||
in {
|
in {
|
||||||
formatter = forEachPkgs (pkgs: pkgs.alejandra);
|
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 (
|
homeConfigurations = nixpkgs.lib.attrsets.mergeAttrsList (
|
||||||
nixpkgs.lib.attrsets.mapAttrsToList (hostname: system: (
|
nixpkgs.lib.attrsets.mapAttrsToList (hostname: system: (
|
||||||
nixpkgs.lib.attrsets.mapAttrs' (user: _: {
|
nixpkgs.lib.attrsets.mapAttrs' (user: _: {
|
||||||
|
@ -105,11 +121,5 @@
|
||||||
))
|
))
|
||||||
self.nixosConfigurations
|
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 = [
|
imports = [
|
||||||
./flipperzero.nix
|
./flipperzero.nix
|
|
@ -1,11 +1,12 @@
|
||||||
|
# this folder container modules that are for nixos only
|
||||||
{...}: {
|
{...}: {
|
||||||
imports = [
|
imports = [
|
||||||
|
./home-manager
|
||||||
./system.nix
|
./system.nix
|
||||||
./hardware.nix
|
./hardware.nix
|
||||||
./users.nix
|
./users.nix
|
||||||
./desktop.nix
|
./desktop.nix
|
||||||
./nix-development.nix
|
./nix-development.nix
|
||||||
./i18n.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,
|
inputs,
|
||||||
...
|
...
|
||||||
}: let
|
}: 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;
|
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;
|
lix-module = inputs.lix-module;
|
||||||
nixpkgs = inputs.nixpkgs;
|
nixpkgs = inputs.nixpkgs;
|
||||||
home-manager = inputs.home-manager;
|
home-manager = inputs.home-manager;
|
||||||
|
nix-darwin = inputs.nix-darwin;
|
||||||
sops-nix = inputs.sops-nix;
|
sops-nix = inputs.sops-nix;
|
||||||
|
|
||||||
systems = [
|
systems = [
|
||||||
|
@ -17,18 +18,34 @@
|
||||||
forEachSystem = nixpkgs.lib.genAttrs systems;
|
forEachSystem = nixpkgs.lib.genAttrs systems;
|
||||||
pkgsFor = system: nixpkgs.legacyPackages.${system};
|
pkgsFor = system: nixpkgs.legacyPackages.${system};
|
||||||
|
|
||||||
home-manager-shared-modules = [
|
common-modules = [
|
||||||
../modules
|
lix-module.nixosModules.default
|
||||||
../home-modules
|
../modules/common-modules
|
||||||
];
|
];
|
||||||
|
|
||||||
|
home-manager-modules =
|
||||||
|
common-modules
|
||||||
|
++ [
|
||||||
|
../modules/home-manager-modules
|
||||||
|
];
|
||||||
|
|
||||||
home-manager-config = nixpkgs: {
|
home-manager-config = nixpkgs: {
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
home-manager.useUserPackages = true;
|
home-manager.useUserPackages = true;
|
||||||
home-manager.backupFileExtension = "backup";
|
home-manager.backupFileExtension = "backup";
|
||||||
home-manager.extraSpecialArgs = {inherit inputs outputs util;};
|
home-manager.extraSpecialArgs = {inherit inputs outputs util;};
|
||||||
home-manager.users = import ../homes nixpkgs;
|
home-manager.users = import ../configurations/home-manager nixpkgs;
|
||||||
home-manager.sharedModules = home-manager-shared-modules;
|
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 {
|
in {
|
||||||
forEachPkgs = lambda: forEachSystem (system: lambda (pkgsFor system));
|
forEachPkgs = lambda: forEachSystem (system: lambda (pkgsFor system));
|
||||||
|
|
||||||
|
@ -39,18 +56,26 @@ in {
|
||||||
(lib.mkUnless condition no)
|
(lib.mkUnless condition no)
|
||||||
];
|
];
|
||||||
|
|
||||||
mkSystem = host:
|
mkNixosSystem = host:
|
||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = {inherit inputs outputs util;};
|
specialArgs = {inherit inputs outputs util;};
|
||||||
modules = [
|
modules =
|
||||||
lix-module.nixosModules.default
|
system-modules
|
||||||
sops-nix.nixosModules.sops
|
++ [
|
||||||
home-manager.nixosModules.home-manager
|
../modules/nixos-modules
|
||||||
home-manager-config
|
../configurations/nixos/${host}
|
||||||
../modules
|
];
|
||||||
../host-modules
|
};
|
||||||
../hosts/${host}
|
|
||||||
];
|
mkDarwinSystem = host:
|
||||||
|
nix-darwin.lib.darwinSystem {
|
||||||
|
specialArgs = {inherit inputs outputs util;};
|
||||||
|
modules =
|
||||||
|
system-modules
|
||||||
|
++ [
|
||||||
|
../modules/darwin-modules
|
||||||
|
../configurations/darwin/${host}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
mkHome = user: host: system: osConfig:
|
mkHome = user: host: system: osConfig:
|
||||||
|
@ -60,9 +85,9 @@ in {
|
||||||
inherit inputs util outputs osConfig;
|
inherit inputs util outputs osConfig;
|
||||||
};
|
};
|
||||||
modules =
|
modules =
|
||||||
home-manager-shared-modules
|
home-manager-modules
|
||||||
++ [
|
++ [
|
||||||
../homes/${user}
|
../configurations/home-manager/${user}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue