Switch HomeManager to module
This commit is contained in:
90
flake.nix
90
flake.nix
@ -23,31 +23,34 @@
|
|||||||
# Outputs is a function that takes the inputs as arguments.
|
# Outputs is a function that takes the inputs as arguments.
|
||||||
# To handle extra arguments we use the inputs@ pattern.
|
# To handle extra arguments we use the inputs@ pattern.
|
||||||
# It gives a name to the ... ellipses.
|
# It gives a name to the ... ellipses.
|
||||||
outputs = inputs @ { nixpkgs, home-manager, emacs-overlay, nur, ... }:
|
outputs = inputs @ { nixpkgs, home-manager, ... }:
|
||||||
|
|
||||||
# With let you can define local variables
|
# With let you can define local variables
|
||||||
let
|
let
|
||||||
# We bring these functions into the scope for the outputs.
|
# We bring these functions into the scope for the outputs.
|
||||||
inherit (builtins) attrValues; # TODO: What does this do
|
inherit (builtins) attrValues; # TODO: What does this do
|
||||||
inherit (nixpkgs.lib) nixosSystem;
|
# inherit (nixpkgs.lib) nixosSystem;
|
||||||
inherit (home-manager.lib) homeManagerConfiguration;
|
# inherit (home-manager.lib) homeManagerConfiguration;
|
||||||
|
|
||||||
|
# Disabled since HomeManager module inherits these in extraSpecialArgs
|
||||||
# Add overlays from other flakes so we can use them from pkgs.
|
# Add overlays from other flakes so we can use them from pkgs.
|
||||||
overlays = {
|
overlays = {
|
||||||
nur = nur.overlay;
|
nur = inputs.nur.overlay;
|
||||||
emacs = emacs-overlay.overlay;
|
emacs = inputs.emacs-overlay.overlay;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
# The rec expression turns a basic set into a set where self-referencing is possible.
|
# The rec expression turns a basic set into a set where self-referencing is possible.
|
||||||
# It is a shorthand for recursive and allows to use the values defined in this set from its own scope.
|
# It is a shorthand for recursive and allows to use the values defined in this set from its own scope.
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
# System configurations
|
# System configurations + HomeManager module
|
||||||
# Accessible via 'nixos-rebuild'
|
# Accessible via 'nixos-rebuild'
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
# We give our configuration a name (the hostname) to choose a configuration when rebuilding.
|
# We give our configuration a name (the hostname) to choose a configuration when rebuilding.
|
||||||
# This makes it easy to add different configurations later (e.g. for a laptop).
|
# This makes it easy to add different configurations later (e.g. for a laptop).
|
||||||
# Usage: sudo nixos-rebuild switch --flake .#nixinator
|
# Usage: sudo nixos-rebuild switch --flake .#nixinator
|
||||||
nixinator = nixosSystem {
|
nixinator = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
# >> Main NixOS configuration file <<
|
# >> Main NixOS configuration file <<
|
||||||
@ -55,44 +58,61 @@
|
|||||||
# TODO: Modularize
|
# TODO: Modularize
|
||||||
./nixos/configuration.nix
|
./nixos/configuration.nix
|
||||||
|
|
||||||
# Add the overlays
|
# TODO: Investigate this { ... } module syntax
|
||||||
# { nixpkgs.overlays = attrValues overlays; } # I only really need them for HomeManager
|
# Overlays
|
||||||
|
{
|
||||||
|
# Since HomeManager uses global pkgs we can set the overlays here
|
||||||
|
nixpkgs.overlays = attrValues overlays;
|
||||||
|
}
|
||||||
|
|
||||||
|
# HomeManager
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true; # Use systems pkgs, disables nixpkgs.* options in home.nix
|
||||||
|
home-manager.useUserPackages = true; # Enable installing packages through users.christoph.packages
|
||||||
|
home-manager.users.christoph = import ./home/home.nix;
|
||||||
|
|
||||||
|
# Make our overlays available in home.nix
|
||||||
|
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
# Make our inputs available to the config (for importing modules)
|
# Make our inputs available to the configuration.nix (for importing modules)
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = { inherit inputs; };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Home configurations
|
# Home configurations standalone
|
||||||
# Accessible via 'home-manager'
|
# Accessible via 'home-manager'
|
||||||
homeConfigurations = {
|
# homeConfigurations = {
|
||||||
# We give our configuration a name (the user + hostname).
|
# # We give our configuration a name (the user + hostname).
|
||||||
# This makes it easy to add configurations for different users/PCs.
|
# # This makes it easy to add configurations for different users/PCs.
|
||||||
# Usage: home-manager switch --flake .#christoph@nixinator
|
# # Usage: home-manager switch --flake .#christoph@nixinator
|
||||||
"christoph@nixinator" = homeManagerConfiguration rec {
|
# "christoph@nixinator" = home-manager.lib.homeManagerConfiguration rec {
|
||||||
pkgs = nixpkgs.legacyPackages."x86_64-linux"; # HomeManager needs this since 22.11 release
|
# pkgs = nixpkgs.legacyPackages."x86_64-linux"; # HomeManager needs this since 22.11 release
|
||||||
|
|
||||||
modules = [
|
# modules = [
|
||||||
# >> Main HomeManager configuration file <<
|
# # >> Main HomeManager configuration file <<
|
||||||
./home/home.nix
|
# ./home/home.nix
|
||||||
|
|
||||||
{
|
# {
|
||||||
home = rec {
|
# home = rec {
|
||||||
username = "christoph";
|
# username = "christoph";
|
||||||
homeDirectory = "/home/${username}";
|
# homeDirectory = "/home/${username}";
|
||||||
stateVersion = "22.05";
|
# stateVersion = "22.05";
|
||||||
};
|
# };
|
||||||
|
|
||||||
# Add the overlays
|
# # Add the overlays
|
||||||
# TODO: I guess attrValues unpacks the overlays set or smth?
|
# # TODO: I guess attrValues unpacks the overlays set or smth?
|
||||||
nixpkgs.overlays = attrValues overlays;
|
# nixpkgs.overlays = attrValues overlays;
|
||||||
}
|
# }
|
||||||
];
|
# ];
|
||||||
|
|
||||||
# Make our inputs available to the config (for importing modules)
|
# # Make our inputs available to the config (for importing modules)
|
||||||
extraSpecialArgs = { inherit inputs; };
|
# extraSpecialArgs = {
|
||||||
};
|
# inherit inputs;
|
||||||
};
|
# };
|
||||||
|
# };
|
||||||
|
# };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
# Feel free to split up your configuration and import pieces of it here.
|
# Feel free to split up your configuration and import pieces of it here.
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Disabled since HomeManager should use global pkgs
|
||||||
# https://github.com/nix-community/home-manager/issues/2942
|
# https://github.com/nix-community/home-manager/issues/2942
|
||||||
nixpkgs.config.allowUnfreePredicate = (pkg: true);
|
# nixpkgs.config.allowUnfreePredicate = (pkg: true);
|
||||||
nixpkgs.config.allowUnfree = true;
|
# nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
# Chinese Input
|
# Chinese Input
|
||||||
i18n.inputMethod.enabled = "fcitx5";
|
i18n.inputMethod.enabled = "fcitx5";
|
||||||
@ -92,7 +93,7 @@
|
|||||||
settings = {
|
settings = {
|
||||||
"app.update.auto" = false;
|
"app.update.auto" = false;
|
||||||
# "browser.startup.homepage" = "https://lobste.rs";
|
# "browser.startup.homepage" = "https://lobste.rs";
|
||||||
"identity.fxaccounts.account.device.name" = "nixinator"; # TODO: I want to pass the toplevel config to use config.networking.hostName
|
"identity.fxaccounts.account.device.name" = "nixinator"; # TODO: I want to pass the toplevel config to use config.networking.hostName, there seems to be an attribute nixosConfig for that but it didn't work
|
||||||
"signon.rememberSignons" = false;
|
"signon.rememberSignons" = false;
|
||||||
# "browser.urlbar.placeholderName" = "DuckDuckGo";
|
# "browser.urlbar.placeholderName" = "DuckDuckGo";
|
||||||
# "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
# "toolkit.legacyUserProfileCustomizations.stylesheets" = true;
|
||||||
@ -301,4 +302,6 @@
|
|||||||
|
|
||||||
# Nicely reload system units when changing configs
|
# Nicely reload system units when changing configs
|
||||||
systemd.user.startServices = "sd-switch";
|
systemd.user.startServices = "sd-switch";
|
||||||
|
|
||||||
|
home.stateVersion = "22.05";
|
||||||
}
|
}
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
'';
|
'';
|
||||||
|
|
||||||
# Allow unfree packages
|
# Allow unfree packages
|
||||||
|
# Since we use HomeManager as a module with global pkgs this should also cover user packages
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
# Bootloader/Kernel stuff
|
# Bootloader/Kernel stuff
|
||||||
|
Reference in New Issue
Block a user