@jonringer Is Home-Manager easy to use? I’ve heard mixed results.
@trusktr I don’t see any obvious errors, except Los_Angeles. If you wish, you can combine some of those more, but that’s a personal preference.
@jonringer Is Home-Manager easy to use? I’ve heard mixed results.
@trusktr I don’t see any obvious errors, except Los_Angeles. If you wish, you can combine some of those more, but that’s a personal preference.
I’ve only ever heard people rant about how wonderful it is. Blog posts, discourse, IRC?
My config has my wheel
user with these extraGroups
also
extraGroups = [
"wheel"
"networkmanager" # this is actually in the nixos documentation on networkmanager
"video"
"audio"
];
The useDHCP
part is interesting to me, why did you need it?
IIRC, the networkmanager module in NixOS explicitly does useDHCP = false
and handles that stuff itself.
I’m pretty sure this should work totally perfect in 19.09. Have you had problems using wayland and Gnome on 19.09?
I’m curious about how I’ve written the config rather than what stuff I’ve actually installed. Would you recommend writing any parts differently?
I saw that. Looks interesting and I’d like to check it out after I get the hang of vanilla stuff first, before it “fails catastrophically” (as it says in the README) on me without me knowing what happened.
For now, I have a setup.sh
script that builds my home folder and dotfiles on Windows, Linux flavors (the normal FHS type), and macOS. So for now I’d like to learn about Nix by using it at the system level, and not worry about managing my home folder with just yet.
Haha, funny. (That’s a joke right?). I’m in Oakland.
Ah, I knew someone would say this. Mind showing an example?
Ah thanks, I missed that part. That explains why it asked me to enter my sudo password when trying to connect to WiFi.
Ah, nice to know. See, as a brand new first-time NixOS user, I simply had no idea. It isn’t obvious for a total beginner.
What I had done was take the default config generated by nixos-generate-config
, which already had those DHCP lines, then I simply added the networkmanager
line, but I didn’t know that network manager would do that.
So basically, if I add networkmanager, should I just remove all the DHCP-related lines?
I haven’t tried it yet. The thing is, if my system and all the programs I need work great on X11, why should I switch to Wayland? If you don’t mind going into more detail on this, I opened another thread specifically about this at Newb question: Any caveats with Gnome + Wayland? Is it worth moving to Wayland instead of X11?
EDIT: You already replied there. Thanks.
Other than what other people have commented, not really. Nix is pretty declarative, so there’s usually one obvious way to configure your stuff.
One think i did notice is that you’re using vim_configurable directly, but its usually meant to be used like this
{ config, pkgs, ... }:
let
my_vim = pkgs.vim_configurable.customize {
# `name` specifies the name of the executable and package
name = "vim-with-plugins";
vimrcConfig.customRC = ''
set hidden
'';
}
in
...
environment.systemPackages [ ... my_vim .. ];
again, home-manager has a nice way to declare this https://github.com/rycee/home-manager/blob/d677556e62ab524cb6fcbc20b8b1fb32964db021/modules/programs/vim.nix
He’s just being modest and giving no expectation of being responsible if something goes wrong. It’s worked wonderfully for myself and many othoers
If it works, it works.
However, most distributions have very specific ways of installing packages (apt, yum, etc.), and doesn’t work well on other flavors, nixos included. I would still recommend a nix native solution
There are several you COULD combine more, but it’s really personal preference. Here’s an example:
services.xserver = {
enable = true;
layout = "us";
libinput.enable = true;
desktopManager = {
plasma5.enable = true;
gnome3.enable = true;
};
displayManager.gdm = {
enable = true;
wayland = false;
};
};
That’s interesting, though at the moment I’m relying heavily on my dotfiles and .vimrc
to work across Windows, Linux, and macOS, and my vimrc is almost 2k lines long so it may be a while before I try to port that (if ever).
Nix isn’t hard to install in any Linux distro, right? It might be something for me to look into later, if I can run it in Linux, Windows, and macOS. Running inside of Termux for Android (a Debian-like apt-managed environment) might be nice too.
Fair, but this would also probably pair well with home-manager again. Here’s my setup:
# home.nix
{ config, lib, pkgs, ... }:
{
...
programs.neovim = (import ./vim.nix) pkgs;
...
}
# vim .nix
pkgs:
{
enable = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
fzf-vim
fzfWrapper
LanguageClient-neovim
lightline-vim
nerdtree
supertab
tabular
vim-better-whitespace
vim-multiple-cursors
vim-surround
#vimproc
#vimproc-vim
# themes
wombat256
# language packages
# Haskell
vim-hoogle
neco-ghc
haskell-vim
hlint-refactor-vim
ghc-mod-vim
# Nix
vim-nix
# Csharp
vim-csharp
# Powershell
vim-ps1
# Python
semshi
];
extraConfig = ''
" bashrc content
'';
}
you could do:
extraConfig = builtins.readFile ./.bashrc;
and still re-use your bashrc
yes, after doing curl https://nixos.org/nix/install | sh
, you should have access to the nix commands. But you can’t use modules (configuration.nix by extension) on other distro’s. However, I think home-manager still works, but I can’t confirm as I use NixOS for everything (or )
When I write something like that, is it concatenating new options into the existing options?
What do you mean by “you can’t use modules (configuration.nix by extension) on other distro’s.”? (I’m still too new to understand). So using nix
on other distros has certain limitations that I don’t have in NixOS?
configuration.nix is used to configure your system as a whole (systemd services, users, groups, kernel version, etc.), it’s not really targeted as “user-level” configuration (shells, user-specific utilities, dotfiles, etc.) which is why home-manager exists
Most distro’s and NixOS configurations will be very opinionated about what services are running, so they are mutually exclusive.
Essentially:
NixOS → uses configuration.nix → configures the machine
home-manager → uses ~/.config/nixpkgs/home.nix → configures a user’s environment.
further reading: https://nixos.wiki/wiki/Module NixOS 23.11 manual | Nix & NixOS
So you mean, we can not use nix to install system-wide stuff on other distros, only to manage the home folder?
I don’t have much experience in this area, as I use NixOS as my daily driver. But you should be able to use the nix cli which includes nix-env
to install packages in a similar manner to apt
and other package managers.
The main benefit to using nix over other package managers is the ability to specify your system and settings in a declarative manner. And the abstractions in the configuration generally compose well in which you have a high assurance that your system “works”. Not to mention that these get “checkpointed” in profiles which allows you to iterate setups and not brick your system.
The options get set, and when generating the necessary configuration these values get referenced to create the desired environment, here’s what the gdm settings are actually doing: https://github.com/NixOS/nixpkgs/blob/e4134747f5666bcab8680aff67fa3b63384f9a0f/nixos/modules/services/x11/display-managers/gdm.nix#L124
For concatenating values, yes, this is exactly what it’s doing. values are “safely” merged NixOS 23.11 manual | Nix & NixOS
Functionally, there’s zero difference between how you wrote it, and how I wrote it. It’s exactly the same thing. It’s a personal style thing.
My audio and video seems to work in Gnome desktop. What are those groups for?
The following from "programs.foo.enable = true" vs "systemPackages=[foo]" is confusing - #9 by jonringer was helpful:
So, that’s something I need to do, is figure which things I have in systemPackages
that I should instead install with configuration options like programs.foo.enable = true
.
You can use nix, the package manager, to install system wide packages on all operating systems which support nix and are supported by a given package. Don‘t forget that you also get nix-shell for temporary environments and portable scripts. With home-manager, an independent software package working with nix, you get the additional ability to manage user environments declaratively through nix, with configuration modules, rollbacks and what not. OS compatibility for a given package is obviously a requirement here, too.
However, you cannot use features from NixOS, the Linux distribution relying on nix for self-configuration, anywhere else than NixOS. These include system services and OS-level declarative, modular configuration. For macOS/Darwin there exists nix-darwin, which can control some significant amount of system properties.
I believe that being in the audio
group allows you to access and make changes to the audio system when it is not being run by your user account and the video
group is similar.
If you want to see exactly what they provide access to, you can look at the udev rules.
I don’t think being in those groups is broadly required because normally you are running audio and video processes under your user account so you have access regardless.