diff --git a/flake.nix b/flake.nix index 0c1375e8..ee75bb23 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; diff --git a/home/christoph/default.nix b/home/christoph/default.nix index d2d977b7..41aab217 100644 --- a/home/christoph/default.nix +++ b/home/christoph/default.nix @@ -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 diff --git a/lib/nixos.nix b/lib/nixos.nix index e68fefc1..78e4795f 100644 --- a/lib/nixos.nix +++ b/lib/nixos.nix @@ -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; diff --git a/nixos/configuration.nix b/nixos/configuration.nix index e7d2f6cd..57dcc104 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -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 = [ diff --git a/nixos/nixinator/default.nix b/nixos/nixinator/default.nix index bf8c212c..94e7c879 100644 --- a/nixos/nixinator/default.nix +++ b/nixos/nixinator/default.nix @@ -1,4 +1,4 @@ -{ musnix, config, lib, pkgs, ... }: +{ musnix, config, lib, mylib, pkgs, ... }: { imports = [ diff --git a/nixos/nixtop/default.nix b/nixos/nixtop/default.nix index 1ebb3c51..bbe6bb1e 100644 --- a/nixos/nixtop/default.nix +++ b/nixos/nixtop/default.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, mylib, pkgs, ... }: { imports = [