Update to (somewhat?) dendritic pattern
Heavily inspired by https://github.com/Doc-Steve/dendritic-design-with-flake-parts. > Atomic commits? Never heard of them!
This commit is contained in:
8
modules/nix/assets.nix
Normal file
8
modules/nix/assets.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
flake-file.inputs = {
|
||||
assets = {
|
||||
url = "path:./assets";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
}
|
||||
22
modules/nix/flake-parts/flake-file.nix
Normal file
22
modules/nix/flake-parts/flake-file.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ inputs, ... }: {
|
||||
imports = [
|
||||
inputs.flake-parts.flakeModules.modules
|
||||
inputs.flake-file.flakeModules.default
|
||||
];
|
||||
|
||||
flake-file.inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-file.url = "github:vic/flake-file";
|
||||
import-tree.url = "github:vic/import-tree";
|
||||
};
|
||||
|
||||
flake-file.outputs = ''
|
||||
inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules)
|
||||
'';
|
||||
|
||||
systems = [
|
||||
# f Darwin >:(
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
];
|
||||
}
|
||||
33
modules/nix/flake-parts/lib.nix
Normal file
33
modules/nix/flake-parts/lib.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{ inputs
|
||||
, lib
|
||||
, ...
|
||||
}: {
|
||||
# Helper functions for creating system / home-manager configurations
|
||||
|
||||
options.flake.lib = lib.mkOption {
|
||||
type = lib.types.attrsOf lib.types.unspecified;
|
||||
default = { };
|
||||
};
|
||||
|
||||
config.flake.lib = {
|
||||
mkNixos = system: name: {
|
||||
${name} = inputs.nixpkgs.lib.nixosSystem {
|
||||
modules = [
|
||||
inputs.self.modules.nixos.${name}
|
||||
{ nixpkgs.hostPlatform = lib.mkDefault system; }
|
||||
{ nixpkgs.config.allowUnfree = true; }
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
mkHomeManager = system: name: {
|
||||
${name} = inputs.home-manager.lib.homeManagerConfiguration {
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
modules = [
|
||||
inputs.self.modules.homeManager.${name}
|
||||
{ nixpkgs.config.allowUnfree = true; }
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
23
modules/nix/tools/home-manager.nix
Normal file
23
modules/nix/tools/home-manager.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{ inputs
|
||||
, config
|
||||
, ...
|
||||
}: {
|
||||
# Add home-manager input
|
||||
flake-file.inputs = {
|
||||
home-manager.url = "github:nix-community/home-manager/release-25.11";
|
||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
imports = [ inputs.home-manager.flakeModules.home-manager ];
|
||||
|
||||
flake.modules.nixos.home-manager = {
|
||||
imports = [
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
|
||||
home-manager = {
|
||||
verbose = true;
|
||||
useGlobalPkgs = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
26
modules/nix/tools/secrets.nix
Normal file
26
modules/nix/tools/secrets.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
{ inputs, ... }: {
|
||||
flake-file.inputs = {
|
||||
agenix = {
|
||||
url = "github:ryantm/agenix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.home-manager.follows = "home-manager";
|
||||
};
|
||||
secrets = {
|
||||
url = "path:./secrets";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
flake.modules.nixos.secrets = { pkgs, ... }: {
|
||||
imports = [
|
||||
inputs.agenix.nixosModules.default
|
||||
];
|
||||
environment.systemPackages = [ inputs.agenix.packages.${pkgs.stdenv.hostPlatform.system}.default ];
|
||||
};
|
||||
|
||||
flake.modules.homeManager.secrets = { pkgs, ... }: {
|
||||
imports = [
|
||||
inputs.agenix.homeManagerModules.default
|
||||
];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user