1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-29 19:17:45 +00:00

Clean up flake

This commit is contained in:
RGBCube 2023-12-06 01:19:40 +03:00
parent 2cc888498d
commit b2f5ff1ee3
No known key found for this signature in database
12 changed files with 120 additions and 92 deletions

156
flake.nix
View file

@ -1,6 +1,35 @@
{
description = "All my NixOS configurations.";
# nixConfig = with builtins; mapAttrs (_: concatStringsSep " ") {
# extra-substituters = [
# "https://nix-community.cachix.org/"
# "https://hyprland.cachix.org/"
# "https://cache.privatevoid.net/"
# ];
# extra-trusted-public-keys = [
# "nix-community.cachix.org:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
# "hyprland.cachix.org:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
# "cache.privatevoid.net:SErQ8bvNWANeAvtsOESUwVYr2VJynfuc9JRwlzTTkVg="
# ];
# };
# inputs = with builtins; mapAttrs (name: url: {
# url = "git+https://${url}";
# } // (if elem name [ "nixSuper" "hyprland" "hyprpicker" ] then {} else {
# inputs.nixpkgs.follows = "nixpkgs";
# })) {
# nixSuper = "github.com/privatevoid-net/nix-super";
# nixpkgs = "github.com/NixOS/nixpkgs/tree/nixos-unstable";
# homeManager = "github.com/nix-community/home-manager";
# hyprland = "github.com/hyprwm/Hyprland";
# hyprpicker = "github.com/hyprwm/hyprpicker";
# fenix = "github.com/nix-community/fenix";
# tools = "github.com/RGBCube/FlakeTools";
# themes = "github.com/RGBCube/ThemeNix";
# };
nixConfig = {
extra-substituters = ''
https://nix-community.cachix.org/
@ -20,7 +49,7 @@
url = "github:NixOS/nixpkgs/nixos-unstable";
};
nix-super = {
nixSuper = {
url = "github:privatevoid-net/nix-super";
};
@ -29,6 +58,19 @@
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
url = "github:hyprwm/Hyprland";
};
hyprpicker = {
url = "github:hyprwm/hyprpicker";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
tools = {
url = "github:RGBCube/FlakeTools";
inputs.nixpkgs.follows = "nixpkgs";
@ -37,49 +79,23 @@
themes = {
url = "github:RGBCube/ThemeNix";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland = {
url = "github:hyprwm/Hyprland";
};
hyprpicker = {
url = "github:hyprwm/hyprpicker";
};
};
outputs = { nixpkgs, nix-super, homeManager, tools, themes, fenix, ... } @ inputs: tools.eachDefaultLinuxArch (system: let
outputs = inputs @ {
self,
nixSuper,
nixpkgs,
homeManager,
fenix,
tools,
themes,
...
}: tools.eachDefaultLinuxArch (system: let
pkgs = nixpkgs.legacyPackages.${system};
upkgs = {
theme = themes.custom (themes.raw.gruvbox-dark-hard // {
corner-radius = 12;
border-width = 3;
font.size.normal = 12;
font.size.big = 18;
font.sans.name = "Lexend";
font.sans.package = pkgs.lexend;
font.mono.name = "RobotoMono Nerd Font";
font.mono.package = (pkgs.nerdfonts.override {
fonts = [
"RobotoMono"
];
});
icons.name = "Gruvbox-Plus-Dark";
icons.package = pkgs.callPackage (import ./derivations/gruvbox-icons.nix) {};
});
hyprland = inputs.hyprland.packages.${system}.default;
hyprpicker = inputs.hyprpicker.packages.${system}.default;
};
upkgs = tools.recursiveUpdateMap (name: {
${name} = inputs.${name}.packages.${system}.default;
}) [ "hyprland" "hyprpicker" ];
lib = nixpkgs.lib;
@ -89,18 +105,29 @@
recursiveUpdate3 = x: y: z: lib.recursiveUpdate x (lib.recursiveUpdate y z);
};
theme = themes.custom (themes.raw.gruvbox-dark-hard // {
corner-radius = 12;
border-width = 3;
font.size.normal = 12;
font.size.big = 18;
font.sans.name = "Lexend";
font.sans.package = pkgs.lexend;
font.mono.name = "RobotoMono Nerd Font";
font.mono.package = (pkgs.nerdfonts.override { fonts = [ "RobotoMono" ]; });
icons.name = "Gruvbox-Plus-Dark";
icons.package = pkgs.callPackage (import ./derivations/gruvbox-icons.nix) {};
});
abstractions = rec {
importAll = paths: {
imports = paths;
};
imports = paths: lib.genAttrs [ "imports" ] (_: paths);
enabled = attributes: attributes // {
enable = true;
};
enabled = attributes: attributes // { enable = true; };
normalUser = attributes: attributes // {
isNormalUser = true;
};
normalUser = attributes: attributes // { isNormalUser = true; };
systemConfiguration = attributes: attributes;
@ -113,9 +140,9 @@
};
homeConfiguration = user: attributes: systemConfiguration {
home-manager.users = builtins.foldl' lib.recursiveUpdate {} (builtins.map (user: {
home-manager.users = tools.recursiveUpdateMap (user: {
${user} = attributes;
}) (if builtins.isList user then user else [ user ]));
}) (if builtins.isList user then user else [ user ]);
};
homePackages = user: packages: homeConfiguration user {
@ -131,25 +158,25 @@
persistent = true;
};
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
nix.registry.nixpkgs.flake = nixpkgs;
nix.optimise.automatic = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
nix.settings.trusted-users = [
"root"
"@wheel"
];
nix.registry = {
nixpkgs.flake = nixpkgs;
default.flake = nixpkgs;
};
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nix.settings.trusted-users = [ "root" "@wheel" ];
nix.settings.warn-dirty = false;
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [
fenix.overlays.default
nix-super.overlays.default
nixSuper.overlays.default
];
programs.nix-ld = enabled {};
@ -159,12 +186,13 @@
boot.tmp.cleanOnBoot = true;
networking.hostName = host;
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
};
specialArgs = abstractions // {
inherit upkgs ulib;
inherit upkgs ulib theme;
};
importConfigurations = tools.recursiveUpdateMap (host: {