I followed officially provided instructions to use Home-Manager with Flake while keeping configuration.nix
intact. Here is the simplified result of that:
###################### flake.nix ######################
{
description = "Laptop Workstation";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ nixpkgs, nixpkgs-unstable, home-manager, ... }: {
nixosConfigurations = {
xyz = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.arti = import ./home.nix;
}
];
};
};
};
}
###################### configuration.nix ##############
{ config, pkgs, lib, options, ... }:
{
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
imports = [
./hardware-configuration.nix
];
system = {
stateVersion = "24.05"; # DO NOT CHANGE
};
# Virtualization
virtualisation.libvirtd.enable = true;
# Boot
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.initrd.luks.devices."luks-00000000-f2fe-0000-0000-000000000000".device = "/dev/disk/by-uuid/00000000-0000-0000-0000-000000000000";
# Network
networking = {
networkmanager.enable = true;
hostName = "xyz";
};
# Time
time.timeZone = "Europe/Amsterdam";
# Localization
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "nl_NL.UTF-8";
LC_IDENTIFICATION = "nl_NL.UTF-8";
LC_MEASUREMENT = "nl_NL.UTF-8";
LC_MONETARY = "nl_NL.UTF-8";
LC_NAME = "nl_NL.UTF-8";
LC_NUMERIC = "nl_NL.UTF-8";
LC_PAPER = "nl_NL.UTF-8";
LC_TELEPHONE = "nl_NL.UTF-8";
LC_TIME = "nl_NL.UTF-8";
};
};
# Window System
services.xserver = {
enable = true;
displayManager.gdm.enable = true;
desktopManager.gnome.enable = true;
# Keymap
xkb = {
layout = "us";
variant = "";
};
};
# User
users.users.arti = {
isNormalUser = true;
description = "Artifex";
extraGroups = [ "networkmanager" "wheel" ];
};
# System Packages/Programs
nixpkgs.config.allowUnfree = true;
environment.systemPackages = with pkgs; [
cloudflare-warp
];
environment.gnome.excludePackages = with pkgs; [
baobab # Disk Usage Analyzer
epiphany # Web
gnome.geary
gnome.gnome-characters
gnome-connections
gnome-console
gnome.gnome-contacts
gnome.gnome-font-viewer
gnome.gnome-maps
gnome.gnome-music
gnome.gnome-system-monitor
gnome-tour
yelp # Help
];
# Services
# services.cloudflare-warp.enable = true;
}
###################### home.nix #######################
{ config, pkgs, lib, ... }:
{
home = {
stateVersion = "24.05"; # DO NOT CHANGE
# User
username = "arti";
homeDirectory = "/home/arti";
};
# User Packages/Programs
home.packages = with pkgs; [
jetbrains.idea-ultimate
] ++ (with pkgs.gnomeExtensions; [
tophat
]);
programs.home-manager.enable = true;
imports = [
./dconf.nix
];
}
Now I’m wondering how I can selectively set some packages to be installed from the unstable channel in both my configuration.nix
and home.nix
files, but I cannot find a working example of that, specifically in the sort of setup I have. Is there anyone here who could guide me through this? Thanks!