Replies: 13 comments
|
home.nix: { config, pkgs, ... }:
{
# Let Home Manager install and manage itself:
programs.home-manager.enable = true;
# Home Manager needs a bit of information about you and the paths it should manage:
home.username = "paddygoat";
home.homeDirectory = "/home/paddygoat";
# This value determines the Home Manager release that your configuration is compatible with.
# This helps avoid breakage when a new Home Manager release introduces backwards incompatible changes.
#
# You can update Home Manager without changing this value.
# See the Home Manager release notes for a list of state version changes in each release.
home.stateVersion = "21.05";
# home.packages = [ pkgs.plasma5Packages.kdenlive ];
# home.packages = with pkgs; [
# git
# git-crypt
# gnupg
# ];
home.packages = with pkgs; [
plasma5Packages.kdenlive
git
git-crypt
gnupg
audacity
gimp
nano
qtractor
jack2
lmms
];
} |
|
When you're using flakes, nothing really matters except the Everything ends up as a big So is Do you have something that looks like this?: { config, lib, ... }:
{
imports = [ ./hardware-configuration.nix ./home.nix ];
}If you are not importing |
|
The reason you have the |
|
Thanks @MatthewCroughan. I eventually sussed out that capitalisation in my username was causing an issue - bit of a newbie mistake. Then re-vamped another Flake.nix script which worked with a little bit of fine tuning: {
description = "My system config based on flake";
inputs = {
nixpkgs.url = "nixpkgs/nixos-21.05";
home-manager.url = "github:nix-community/home-manager/release-21.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { nixpkgs, home-manager, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config = { allowUnfree = true; };
};
lib = nixpkgs.lib;
in {
homeManagerConfigurations = {
paddygoat = home-manager.lib.homeManagerConfiguration {
inherit system pkgs;
username = "paddygoat";
homeDirectory = "/home/paddygoat";
configuration = {
imports = [
./home.nix
];
};
};
};
nixosConfigurations = {
nixos = lib.nixosSystem {
inherit system;
modules = [
./system/configuration.nix
];
};
};
};
} |
|
I'm slightly confused by the "Everything ends up as a big .nix expression in the end" argument. Doesn't this preclude individual users from managing their homes independently of the system administrator? That is, I want to manage my home with home-manager without the sysadmin having to include my file, or having to rebuild the OS any time I change my config. |
I just mean to say that if |
|
So if you want to use flakes, you can't use home-manager to maintain your personal profile? I'd like to use flakes and use my home-manager configuration on non-nixos systems too. |
|
I actually miserably failed when trying to use EDIT, ah, I think I get it: my home config is separate from system config (for (theoretical at the moment) portability to non-NixOS), so it does make sense that So I guess the question is rather why does the README sound like the |
|
Aha good to know, I'll just give it a try then. |
Indeed, this is a mistake in the README.
The command |
|
Slightly hijacking the thread: I have EDIT: found the answer here https://nixos.wiki/wiki/Flakes#Enable_unfree_software_in_home-manager |
That's the piece of info I needed, thanks! It's in the manpage of |
|
Home-manager with flakes is the recommended modern setup. Here's a minimal but complete template: # flake.nix
{
description = "Home Manager configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs"; # Ensure same nixpkgs version
};
};
outputs = { nixpkgs, home-manager, ... }:
let
system = "x86_64-linux"; # or "aarch64-darwin" for Apple Silicon
pkgs = nixpkgs.legacyPackages.${system};
in {
homeConfigurations."yourusername" = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ ./home.nix ];
};
};
}# home.nix
{ config, pkgs, ... }:
{
home.username = "yourusername";
home.homeDirectory = "/home/yourusername";
home.stateVersion = "24.05"; # Keep this fixed, only update intentionally
home.packages = with pkgs; [
ripgrep
fd
bat
eza
fzf
];
programs.git = {
enable = true;
userName = "Your Name";
userEmail = "you@example.com";
};
programs.zsh = {
enable = true;
enableAutosuggestions = true;
oh-my-zsh = {
enable = true;
plugins = [ "git" "docker" ];
};
};
programs.home-manager.enable = true;
}Then: # First time
nix run home-manager/master -- init --switch
# Or if you have the flake:
home-manager switch --flake .#yourusernameThe |
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
Issue description
I'm not sure if this is the right place to ask this question as it's also a flake issue, but seems like running
home-manager switch -f ./home.nixdoes not put my home.nix file into the store with my other DIY config scripts.After running
nixos-rebuild build --flake .#in my DIY config directory, all my files are in /nix/store/ EXCEPT home.nix and I get this error:[paddygoat@nixos:~/Paddy_Nix_Backup]$ home-manager switch -f ./home.nix
/nix/store/wvxc8aaaxmvpprcp8c3sk12320rsx407-home-manager-generation
Starting home manager activation
Activating checkFilesChanged
Activating checkLinkTargets
Activating writeBoundary
Activating installPackages
replacing old 'home-manager-path'
installing 'home-manager-path'
Activating linkGeneration
Cleaning up orphan links from /home/paddygoat
No change so reusing latest profile generation 2
Creating home file links in /home/paddygoat
Activating onFilesChange
Activating reloadSystemd
There are 154 unread and relevant news items.
Read them by running the command 'home-manager news'.
[paddygoat@nixos:~/Paddy_Nix_Backup]$ nixos-rebuild build --flake .#
warning: Git tree '/home/paddygoat/Paddy_Nix_Backup' is dirty
building the system configuration...
warning: Git tree '/home/paddygoat/Paddy_Nix_Backup' is dirty
error: getting status of '/nix/store/rsfrp307b6a26jsw6s3badmjgjvl2n5z-source/home.nix': No such file or directory
(use '--show-trace' to show detailed location information)
[paddygoat@nixos:~/Paddy_Nix_Backup]$
Please advise ..... Thank you very much !!
Maintainer CC
No response
System information
All reactions