mirror of
https://github.com/RGBCube/ncc
synced 2025-07-30 19:47:47 +00:00
Simplify & flatten flake.nix
This commit is contained in:
parent
00aa19540e
commit
e80030012c
1 changed files with 77 additions and 72 deletions
149
flake.nix
149
flake.nix
|
@ -33,7 +33,7 @@
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { fenix, home-manager, hyprland, nixpkgs, ... }: let
|
outputs = { fenix, home-manager, nixpkgs, ... } @ inputs: let
|
||||||
machines = [
|
machines = [
|
||||||
./machines/enka
|
./machines/enka
|
||||||
];
|
];
|
||||||
|
@ -42,89 +42,94 @@
|
||||||
"x86_64-linux"
|
"x86_64-linux"
|
||||||
];
|
];
|
||||||
|
|
||||||
nixosSystem = arguments: modules: nixpkgs.lib.nixosSystem {
|
lib = nixpkgs.lib // {
|
||||||
specialArgs = arguments;
|
recursiveUpdate3 = x: y: z: nixpkgs.lib.recursiveUpdate x (nixpkgs.lib.recursiveUpdate y z);
|
||||||
modules = modules;
|
};
|
||||||
|
|
||||||
|
theme = import ./themes/gruvbox.nix;
|
||||||
|
|
||||||
|
# GENERAL
|
||||||
|
imports = importPaths: {
|
||||||
|
imports = importPaths;
|
||||||
|
};
|
||||||
|
|
||||||
|
enabled = attributes: attributes // {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
normalUser = attributes: attributes // {
|
||||||
|
isNormalUser = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# SYSTEM
|
||||||
|
systemConfiguration = attributes: attributes;
|
||||||
|
|
||||||
|
systemPackages = packages: systemConfiguration {
|
||||||
|
environment.systemPackages = packages;
|
||||||
|
};
|
||||||
|
|
||||||
|
systemFonts = fonts: systemConfiguration {
|
||||||
|
fonts.packages = fonts;
|
||||||
|
};
|
||||||
|
|
||||||
|
# HOME
|
||||||
|
homeConfiguration = userName: attributes: systemConfiguration {
|
||||||
|
home-manager.users.${userName} = attributes;
|
||||||
|
};
|
||||||
|
|
||||||
|
homePackages = userName: packages: homeConfiguration userName {
|
||||||
|
home.packages = packages;
|
||||||
};
|
};
|
||||||
|
|
||||||
importConfiguration = configurationDirectory: hostPlatform: let
|
importConfiguration = configurationDirectory: hostPlatform: let
|
||||||
hostName = builtins.baseNameOf configurationDirectory;
|
hostName = builtins.baseNameOf configurationDirectory;
|
||||||
in {
|
|
||||||
nixosConfigurations.${hostName} = nixosSystem {
|
pkgs = import nixpkgs {
|
||||||
lib = nixpkgs.lib // {
|
system = hostPlatform;
|
||||||
recursiveUpdate3 = x: y: z: nixpkgs.lib.recursiveUpdate x (nixpkgs.lib.recursiveUpdate y z);
|
config.allowUnfree = true;
|
||||||
|
|
||||||
|
overlays = [
|
||||||
|
fenix.overlays.default
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
hyprland = inputs.hyprland.packages.${hostPlatform}.hyprland;
|
||||||
|
|
||||||
|
arguments = {
|
||||||
|
inherit lib pkgs hyprland theme systemConfiguration systemPackages homeConfiguration systemFonts homePackages imports enabled normalUser;
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultConfiguration = {
|
||||||
|
nix.gc = {
|
||||||
|
automatic = true;
|
||||||
|
dates = "daily";
|
||||||
|
options = "--delete-older-than 1w";
|
||||||
|
persistent = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
pkgs = import nixpkgs {
|
nix.settings.experimental-features = [
|
||||||
system = hostPlatform;
|
"nix-command"
|
||||||
config.allowUnfree = true;
|
"flakes"
|
||||||
|
];
|
||||||
|
|
||||||
overlays = [
|
boot.tmp.cleanOnBoot = true;
|
||||||
fenix.overlays.default
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
hyprland = hyprland.packages.${hostPlatform}.hyprland;
|
networking.hostName = hostName;
|
||||||
|
|
||||||
theme = import ./themes/gruvbox.nix;
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
};
|
||||||
|
|
||||||
# SYSTEM
|
modules = [
|
||||||
systemConfiguration = attributes: attributes;
|
|
||||||
|
|
||||||
systemPackages = packages: {
|
|
||||||
environment.systemPackages = packages;
|
|
||||||
};
|
|
||||||
|
|
||||||
systemFonts = fonts: {
|
|
||||||
fonts.packages = fonts;
|
|
||||||
};
|
|
||||||
|
|
||||||
# HOME
|
|
||||||
homeConfiguration = userName: attributes: {
|
|
||||||
home-manager.users.${userName} = attributes;
|
|
||||||
};
|
|
||||||
|
|
||||||
homePackages = userName: packages: {
|
|
||||||
home-manager.users.${userName}.home.packages = packages;
|
|
||||||
};
|
|
||||||
|
|
||||||
# GENERAL
|
|
||||||
imports = importPaths: {
|
|
||||||
imports = importPaths;
|
|
||||||
};
|
|
||||||
|
|
||||||
enabled = attributes: attributes // {
|
|
||||||
enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
normalUser = attributes: attributes // {
|
|
||||||
isNormalUser = true;
|
|
||||||
};
|
|
||||||
} [
|
|
||||||
configurationDirectory
|
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
|
defaultConfiguration
|
||||||
{
|
configurationDirectory
|
||||||
nix.gc = {
|
|
||||||
automatic = true;
|
|
||||||
dates = "daily";
|
|
||||||
options = "--delete-older-than 1w";
|
|
||||||
persistent = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
nix.settings.experimental-features = [
|
|
||||||
"nix-command"
|
|
||||||
"flakes"
|
|
||||||
];
|
|
||||||
|
|
||||||
boot.tmp.cleanOnBoot = true;
|
|
||||||
|
|
||||||
networking.hostName = hostName;
|
|
||||||
|
|
||||||
home-manager.useGlobalPkgs = true;
|
|
||||||
home-manager.useUserPackages = true;
|
|
||||||
}
|
|
||||||
];
|
];
|
||||||
|
in {
|
||||||
|
nixosConfigurations.${hostName} = nixpkgs.lib.nixosSystem {
|
||||||
|
specialArgs = arguments;
|
||||||
|
modules = modules;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in builtins.foldl' nixpkgs.lib.recursiveUpdate {} (builtins.concatMap (architecture: builtins.map (configuration: importConfiguration configuration architecture) machines) architectures);
|
in builtins.foldl' nixpkgs.lib.recursiveUpdate {} (builtins.concatMap (architecture: builtins.map (configuration: importConfiguration configuration architecture) machines) architectures);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue