propagate mylib to modules
This commit is contained in:
@ -18,9 +18,9 @@
|
||||
# Other Flakes
|
||||
emacs-overlay.url = "github:nix-community/emacs-overlay";
|
||||
nur.url = "github:nix-community/NUR";
|
||||
# nixvim.url = "github:pta2002/nixvim";
|
||||
musnix.url = "github:musnix/musnix";
|
||||
devshell.url = "github:numtide/devshell";
|
||||
# nixvim.url = "github:pta2002/nixvim";
|
||||
};
|
||||
|
||||
# Outputs is a function that takes the inputs as arguments.
|
||||
@ -35,6 +35,7 @@
|
||||
# Set overlays + unfree globally
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
|
||||
config.allowUnfree = true;
|
||||
overlays = [
|
||||
inputs.devshell.overlay
|
||||
@ -44,7 +45,7 @@
|
||||
};
|
||||
|
||||
# Add my additions to the nixpkgs lib
|
||||
# mylib = nixpkgs.lib.extend (self: super: { my = import ./lib { inherit pkgs inputs; lib = self; }; });
|
||||
# lib = nixpkgs.lib.extend (self: super: { my = import ./lib { inherit pkgs inputs; lib = self; }; });
|
||||
mylib = import ./lib { inherit inputs pkgs; lib = nixpkgs.lib; };
|
||||
|
||||
# The rec expression turns a basic set into a set where self-referencing is possible.
|
||||
@ -62,7 +63,7 @@
|
||||
# This makes it easy to add different configurations later (e.g. for a laptop).
|
||||
# Usage: sudo nixos-rebuild switch --flake .#nixinator
|
||||
nixinator = mylib.nixos.mkNixosConfig {
|
||||
inherit system;
|
||||
inherit system mylib;
|
||||
|
||||
hostname = "nixinator";
|
||||
username = "christoph";
|
||||
@ -70,7 +71,7 @@
|
||||
};
|
||||
|
||||
nixtop = mylib.nixos.mkNixosConfig {
|
||||
inherit system;
|
||||
inherit system mylib;
|
||||
|
||||
hostname = "nixtop";
|
||||
username = "christoph";
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
# The nixosConfig allows to access the toplevel system configuration from within home manager
|
||||
# https://github.com/nix-community/home-manager/blob/586ac1fd58d2de10b926ce3d544b3179891e58cb/nixos/default.nix#L19
|
||||
{ inputs, lib, config, nixosConfig, pkgs, ... }:
|
||||
{ inputs, lib, mylib, config, nixosConfig, pkgs, ... }:
|
||||
|
||||
# This is a module
|
||||
# Because no imports/options/config is defined explicitly, everything is treated as config
|
||||
|
@ -4,13 +4,13 @@ let
|
||||
inherit (inputs) home-manager;
|
||||
|
||||
in rec {
|
||||
mkNixosConfig = { system ? "x86_64-linux", hostname, username ? "christoph", extraModules ? [ ] }:
|
||||
mkNixosConfig = { system ? "x86_64-linux", mylib, hostname, username ? "christoph", extraModules ? [ ] }:
|
||||
lib.nixosSystem {
|
||||
inherit system;
|
||||
|
||||
# Make our inputs available to the configuration.nix (for importing modules)
|
||||
# specialArgs are propagated to all modules
|
||||
specialArgs = { inherit inputs hostname; };
|
||||
specialArgs = { inherit inputs hostname mylib; };
|
||||
|
||||
modules = builtins.concatLists [
|
||||
[
|
||||
@ -32,6 +32,8 @@ in rec {
|
||||
# know how to handle that...
|
||||
[
|
||||
home-manager.nixosModules.home-manager {
|
||||
# extraSpecialArgs are propagated to all hm config modules
|
||||
home-manager.extraSpecialArgs = { inherit inputs hostname mylib; };
|
||||
|
||||
# Use systems pkgs, disables nixpkgs.* options in home.nix
|
||||
home-manager.useGlobalPkgs = true;
|
||||
|
@ -2,7 +2,7 @@
|
||||
# your system. Help is available in the configuration.nix(5) man page
|
||||
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||
|
||||
{ inputs, hostname, lib, config, pkgs, ... }:
|
||||
{ inputs, hostname, lib, mylib, config, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ musnix, config, lib, pkgs, ... }:
|
||||
{ musnix, config, lib, mylib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
|
@ -1,4 +1,4 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{ config, lib, mylib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
|
Reference in New Issue
Block a user