Refactoring

This commit is contained in:
MFlossmann 2024-07-03 00:37:56 +02:00
parent fb335d75b3
commit 64fcff10aa
4 changed files with 60 additions and 23 deletions

View file

@ -10,10 +10,10 @@
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
# nixvim = {
# url = "github:nix-community/nixvim";
# inputs.nixpkgs.follows = "nixpkgs";
# };
nixvim-config = {
type = "gitlab";
owner = "MFlossmann";
@ -31,24 +31,35 @@
};
};
outputs = {...} @ inputs: let
outputs = {
self,
nixpkgs,
...
} @ inputs: let
# basic boilerplate-reducing lib with a bunch of functions
helperLib = import ./helperLib/default.nix {inherit inputs;};
in
with helperLib; {
nixosConfigurations = {
remus = mkSystem ./hosts/remus/configuration.nix;
};
nixvim_config = inputs.nixvim_config;
in {
packages = helperLib.forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
homeConfigurations = {
"prunebutt@remus" = mkHome "x86_64-linux" ./hosts/remus/home.nix;
};
formatter = helperLib.forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
homeManagerModules.default = ./modules/home;
nixosModules.default = ./modules/nixOS;
overlays = import ./overlays {inherit inputs;};
overlays.additions = final: _prev: {
nixvim = nixvim-config.packages.${_prev.system}.default;
};
nixosConfigurations = {
remus = helperLib.mkSystem ./hosts/remus/configuration.nix;
};
homeConfigurations = {
"prunebutt@remus" = helperLib.mkHome "x86_64-linux" ./hosts/remus/home.nix;
};
homeManagerModules.default = ./modules/home;
nixosModules.default = ./modules/nixOS;
# overlays.additions =
# (final: prev: {
# neovim = nixvim_config.packages.${prev.system}.default;
# });
};
}

View file

@ -25,7 +25,11 @@ in rec {
inherit inputs outputs helperLib;
};
modules = [
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-stable ]; })
({
config,
pkgs,
...
}: {nixpkgs.overlays = [overlay-stable];})
config
outputs.nixosModules.default
];
@ -38,7 +42,11 @@ in rec {
inherit inputs helperLib outputs;
};
modules = [
({ config, pkgs, ...}: { nixpkgs.overlays = [ overlay-stable ]; })
({
config,
pkgs,
...
}: {nixpkgs.overlays = [overlay-stable];})
config
outputs.homeManagerModules.default
];
@ -101,12 +109,13 @@ in rec {
modules;
# ============================ Shell ============================= #
forAllSystems = pkgs:
forAllSystems =
# pkgs:
inputs.nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
]
(system: pkgs inputs.nixpkgs.legacyPackages.${system});
];
# (system: pkgs inputs.nixpkgs.legacyPackages.${system});
}

12
overlays/default.nix Normal file
View file

@ -0,0 +1,12 @@
{inputs, ...}: {
# This one brings our custom packages from the `pkgs` directory
additions = final: _prev: import ../pkgs final.pkgs;
# Any custom modifications
# https://nixos.wiki/wiki/Overlays
modifications = final: prev: {
# example = prev.example.overrideAttrs (oldAttrs: rec {
# ...
# });
};
}

5
pkgs/default.nix Normal file
View file

@ -0,0 +1,5 @@
# Custom packages, that can be defined similarly to ones from nixpkgks
# Build them using `nix build .#example`
pkgs: {
# example = pkgs.callPackage ./example { };
}