refactor: added flake parts
This commit is contained in:
parent
db7ac35613
commit
88041e86bd
66 changed files with 3538 additions and 2163 deletions
112
flake.nix
112
flake.nix
|
|
@ -5,6 +5,10 @@
|
|||
# base packages
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
# flake structure
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
import-tree.url = "github:vic/import-tree";
|
||||
|
||||
lix-module = {
|
||||
url = "git+https://git.lix.systems/lix-project/nixos-module.git";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
|
|
@ -87,95 +91,25 @@
|
|||
};
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
sops-nix,
|
||||
nix-syncthing,
|
||||
home-manager,
|
||||
impermanence,
|
||||
...
|
||||
} @ inputs: let
|
||||
util = import ./util {inherit inputs;};
|
||||
forEachPkgs = util.forEachPkgs;
|
||||
|
||||
mkNixosSystem = util.mkNixosSystem;
|
||||
mkDarwinSystem = util.mkDarwinSystem;
|
||||
mkHome = util.mkHome;
|
||||
|
||||
nixosSystems = {
|
||||
horizon = mkNixosSystem "horizon";
|
||||
twilight = mkNixosSystem "twilight";
|
||||
defiant = mkNixosSystem "defiant";
|
||||
emergent = mkNixosSystem "emergent";
|
||||
};
|
||||
|
||||
darwinSystems = {
|
||||
hesperium = mkDarwinSystem "hesperium";
|
||||
};
|
||||
|
||||
homeSystems = {
|
||||
# stand alone home manager configurations here:
|
||||
# name = mkHome "name"
|
||||
};
|
||||
|
||||
systemsHomes = nixpkgs.lib.attrsets.mergeAttrsList (
|
||||
nixpkgs.lib.attrsets.mapAttrsToList (hostname: system: (
|
||||
nixpkgs.lib.attrsets.mapAttrs' (user: _: {
|
||||
name = "${user}@${hostname}";
|
||||
value = mkHome {
|
||||
user = user;
|
||||
host = hostname;
|
||||
system = system.pkgs.hostPlatform.system;
|
||||
osConfig = system.config;
|
||||
outputs = inputs:
|
||||
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
||||
imports = [
|
||||
inputs.home-manager.flakeModules.home-manager
|
||||
inputs.nix-darwin.flakeModules.default
|
||||
({lib, ...}: {
|
||||
options.flake.darwinModules = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.unspecified;
|
||||
default = {};
|
||||
};
|
||||
})
|
||||
system.config.home-manager.users
|
||||
))
|
||||
(nixosSystems // darwinSystems)
|
||||
);
|
||||
|
||||
homeConfigurations =
|
||||
systemsHomes
|
||||
// homeSystems;
|
||||
in {
|
||||
formatter = forEachPkgs (system: pkgs: pkgs.alejandra);
|
||||
|
||||
# templates = import ./templates;
|
||||
|
||||
devShells = forEachPkgs (system: pkgs: {
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
# for version controlling this repo
|
||||
git
|
||||
# for formatting code in this repo
|
||||
alejandra
|
||||
# for editing secrets in the secrets repo
|
||||
sops
|
||||
# for viewing configuration options defined in this repo
|
||||
nix-inspect
|
||||
# for installing flakes from this repo onto other systems
|
||||
nixos-anywhere
|
||||
# for updating disko configurations
|
||||
disko
|
||||
# for viewing dconf entries
|
||||
dconf-editor
|
||||
# for MCP NixOS server support in development
|
||||
inputs.mcp-nixos.packages.${system}.default
|
||||
];
|
||||
|
||||
SOPS_AGE_KEY_DIRECTORY = import ./const/sops_age_key_directory.nix;
|
||||
|
||||
shellHook = ''
|
||||
git config core.hooksPath .hooks
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
nixosConfigurations = nixosSystems;
|
||||
|
||||
darwinConfigurations = darwinSystems;
|
||||
|
||||
homeConfigurations = homeConfigurations;
|
||||
};
|
||||
({...}: {
|
||||
flake.syncthingConfiguration = inputs.nix-syncthing.lib.syncthingConfiguration {
|
||||
modules = [
|
||||
(import ./configurations/syncthing)
|
||||
];
|
||||
};
|
||||
})
|
||||
(inputs.import-tree ./modules)
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue