Adding options for overlays, pkgs, internal library etc, checkout flake outputs to see interactions

This commit is contained in:
madmin 2024-06-19 15:11:54 +02:00
parent da5147903b
commit 15fb0cfd17
7 changed files with 85 additions and 0 deletions

24
lib/default.nix Normal file
View File

@ -0,0 +1,24 @@
{ lib, ... }:
{
# use path relative to the root of the project
relativeToRoot = lib.path.append ../.;
scanPaths = path:
builtins.map
(f: (path + "/${f}"))
(builtins.attrNames
(lib.attrsets.filterAttrs
(
path: _type:
(_type == "directory") # include directories
|| (
# FIXME this barfs when child directories don't contain a default.nix
# example:
# error: getting status of '/nix/store/mx31x8530b758ap48vbg20qzcakrbc8 (see hosts/common/core/services/default.nix)a-source/hosts/common/core/services/default.nix': No such file or directory
# I created a blank default.nix in hosts/common/core/services to work around
(path != "default.nix") # ignore default.nix
&& (lib.strings.hasSuffix ".nix" path) # include .nix files
)
)
(builtins.readDir path)));
}

View File

@ -0,0 +1,6 @@
# Add your reusable home-manager modules to this directory, on their own file (https://nixos.wiki/wiki/Module).
# These should be stuff you would like to share with others, not your personal configurations.
{
# List your module files here
# my-module = import ./my-module.nix;
}

View File

@ -0,0 +1,6 @@
# Add your reusable NixOS modules to this directory, on their own file (https://nixos.wiki/wiki/Module).
# These should be stuff you would like to share with others, not your personal configurations.
{
# List your module files here
# my-module = import ./my-module.nix;
}

26
overlays/default.nix Normal file
View File

@ -0,0 +1,26 @@
#
# This file defines overlays/custom modifications to upstream packages
#
{ inputs, ... }: {
# This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ../pkgs { pkgs = final; };
# This one contains whatever you want to overlay
# You can change versions, add patches, set compilation flags, anything really.
# https://nixos.wiki/wiki/Overlays
modifications = final: prev: {
# example = prev.example.overrideAttrs (oldAttrs: let ... in {
# ...
# });
};
# When applied, the unstable nixpkgs set (declared in the flake inputs) will
# be accessible through 'pkgs.unstable'
unstable-packages = final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = final.system;
config.allowUnfree = true;
};
};
}

8
pkgs/default.nix Normal file
View File

@ -0,0 +1,8 @@
# You can build these directly using 'nix build .#example'
{ pkgs ? import <nixpkgs> { } }: rec {
#################### Packages with external source ####################
# name = pkgs.callPackage ./name { };
}

13
vars/default.nix Normal file
View File

@ -0,0 +1,13 @@
{ inputs, lib }:
{
username = "laozi";
#domain = inputs.nix-secrets.domain;
#userFullName = inputs.nix-secrets.full-name;
#handle = "madmin";
#userEmail = inputs.nix-secrets.user-email;
#gitEmail = "madmin@noreply.codeberg.org";
#workEmail = inputs.nix-secrets.work-email;
#networking = import ./networking.nix { inherit lib; };
persistFolder = "/persist";
isMinimal = false; # Used to indicate nixos-installer build
}

2
vars/networking.nix Normal file
View File

@ -0,0 +1,2 @@
{ ... }:
{}