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"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nixvim = { # nixvim = {
url = "github:nix-community/nixvim"; # url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs"; # inputs.nixpkgs.follows = "nixpkgs";
}; # };
nixvim-config = { nixvim-config = {
type = "gitlab"; type = "gitlab";
owner = "MFlossmann"; owner = "MFlossmann";
@ -31,24 +31,35 @@
}; };
}; };
outputs = {...} @ inputs: let outputs = {
self,
nixpkgs,
...
} @ inputs: let
# basic boilerplate-reducing lib with a bunch of functions # basic boilerplate-reducing lib with a bunch of functions
helperLib = import ./helperLib/default.nix {inherit inputs;}; helperLib = import ./helperLib/default.nix {inherit inputs;};
in nixvim_config = inputs.nixvim_config;
with helperLib; { in {
nixosConfigurations = { packages = helperLib.forAllSystems (system: import ./pkgs nixpkgs.legacyPackages.${system});
remus = mkSystem ./hosts/remus/configuration.nix;
};
homeConfigurations = { formatter = helperLib.forAllSystems (system: nixpkgs.legacyPackages.${system}.alejandra);
"prunebutt@remus" = mkHome "x86_64-linux" ./hosts/remus/home.nix;
};
homeManagerModules.default = ./modules/home; overlays = import ./overlays {inherit inputs;};
nixosModules.default = ./modules/nixOS;
overlays.additions = final: _prev: { nixosConfigurations = {
nixvim = nixvim-config.packages.${_prev.system}.default; 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; inherit inputs outputs helperLib;
}; };
modules = [ modules = [
({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-stable ]; }) ({
config,
pkgs,
...
}: {nixpkgs.overlays = [overlay-stable];})
config config
outputs.nixosModules.default outputs.nixosModules.default
]; ];
@ -38,7 +42,11 @@ in rec {
inherit inputs helperLib outputs; inherit inputs helperLib outputs;
}; };
modules = [ modules = [
({ config, pkgs, ...}: { nixpkgs.overlays = [ overlay-stable ]; }) ({
config,
pkgs,
...
}: {nixpkgs.overlays = [overlay-stable];})
config config
outputs.homeManagerModules.default outputs.homeManagerModules.default
]; ];
@ -101,12 +109,13 @@ in rec {
modules; modules;
# ============================ Shell ============================= # # ============================ Shell ============================= #
forAllSystems = pkgs: forAllSystems =
# pkgs:
inputs.nixpkgs.lib.genAttrs [ inputs.nixpkgs.lib.genAttrs [
"x86_64-linux" "x86_64-linux"
"aarch64-linux" "aarch64-linux"
"x86_64-darwin" "x86_64-darwin"
"aarch64-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 { };
}