I was wondering if anyone could help me. I’m trying to rebuild with a flake as input (for the first time) and get the following error:
error: flake ‘path:/etc/nixos’ does not provide attribute ‘packages.x86_64-linux.nixosConfigurations.“nixos”.config.system.build.nixos-rebuild’, ‘legacyPackages.x86_64-linux.nixosConfigurations.“nixos”.config.system.build.nixos-rebuild’ or ‘nixosConfigurations.“nixos”.config.system.build.nixos-rebuild’
I’m in the directory where my configuration.nix is at:
/e/nixos ❱ ll /etc/nixos
total 20
-rw-r–r-- 1 root root 7153 4 okt 11:13 configuration.nix
-rw-r–r-- 1 root root 3376 4 okt 12:17 flake.lock
-rw-r–r-- 1 root root 3061 4 okt 12:54 flake.nix
-rw-r–r-- 1 root root 1524 14 sep 20:39 hardware-configuration.nix
My hostname is ‘nixos’ → echo $hostname
nixos
I’m using a flake to build a waybar configuration. I haven’t changed anything in the flake, it seems pretty standard:
{
description = "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, flake-utils, devshell, nixpkgs, flake-compat }:
let
inherit (nixpkgs) lib;
genSystems = lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
];
This file has been truncated. show original
sudo nixos-rebuild switch --flake . → command should be ok afaik
I’ve found this topic which seems a bit similar:
Hi all,
I am trying to begin my transition to using flakes and home-manager. I read the online resources, watched several tutorials and used sample configs online. However, I keep getting one of two errors that I cannot figure out how to fix.
I have a flake.nix file, a directory called hosts (where I would in the future have folders for multiple different hosts, but right now have one) that has a default.nix and a configuration.nix file, and subfolder of hosts called proxvm that has a defaul…
The thing is that hostname is indicated in configuration.nix:
networking.hostName = “nixos”; # Define your hostname.
What am I doing wrong here? If someone needs more info let me know. Thanks for the help in advance!
Can you please post your config, so we can take a look? In particular, your flake.nix.
The waybar flake is not really something to focus on for now, the issue is that Nix doesn’t think your flake actually has an output that nixos-rebuild is trying to build.
Thanks for responding!
The flake is the one from github and what follows is my configuration.nix:
{
description = "Highly customizable Wayland bar for Sway and Wlroots based compositors.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, flake-utils, devshell, nixpkgs, flake-compat }:
let
inherit (nixpkgs) lib;
genSystems = lib.genAttrs [
"x86_64-linux"
];
pkgsFor = genSystems (system:
import nixpkgs {
inherit system;
});
mkDate = longDate: (lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
in
{
overlays.default = final: prev: {
waybar = final.callPackage ./nix/default.nix {
version = prev.waybar.version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
};
packages = genSystems
(system:
(self.overlays.default pkgsFor.${system} pkgsFor.${system})
// {
default = self.packages.${system}.waybar;
});
} //
flake-utils.lib.eachDefaultSystem (system: {
devShell =
let pkgs = import nixpkgs {
inherit system;
overlays = [ devshell.overlays.default ];
};
in
pkgs.devshell.mkShell {
imports = [ "${pkgs.devshell.extraModulesDir}/language/c.nix" ];
devshell.packages = with pkgs; [
clang-tools
gdb
# from nativeBuildInputs
gnumake
meson
ninja
pkg-config
scdoc
] ++ (map lib.getDev [
# from buildInputs
wayland wlroots gtkmm3 libsigcxx jsoncpp spdlog gtk-layer-shell howard-hinnant-date libxkbcommon
# optional dependencies
gobject-introspection glib playerctl python3.pkgs.pygobject3
libevdev libinput libjack2 libmpdclient playerctl libnl
libpulseaudio sndio sway libdbusmenu-gtk3 udev upower wireplumber
# from propagated build inputs?
at-spi2-atk atkmm cairo cairomm catch2 fmt_8 fontconfig
gdk-pixbuf glibmm gtk3 harfbuzz pango pangomm wayland-protocols
]);
env = with pkgs; [
{ name = "CPLUS_INCLUDE_PATH"; prefix = "$DEVSHELL_DIR/include"; }
{ name = "PKG_CONFIG_PATH"; prefix = "$DEVSHELL_DIR/lib/pkgconfig"; }
{ name = "PKG_CONFIG_PATH"; prefix = "$DEVSHELL_DIR/share/pkgconfig"; }
{ name = "PATH"; prefix = "${wayland.bin}/bin"; }
{ name = "LIBRARY_PATH"; prefix = "${lib.getLib sndio}/lib"; }
{ name = "LIBRARY_PATH"; prefix = "${lib.getLib zlib}/lib"; }
{ name = "LIBRARY_PATH"; prefix = "${lib.getLib howard-hinnant-date}/lib"; }
];
};
});
}
And here is my configuration.nix with home manager as a module:
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
<home-manager/nixos>
];
#ntfs support
boot.supportedFilesystems = [ "ntfs" ];
#swapfile
swapDevices = [ {
device = "/var/lib/swapfile";
size = 16*1024;
} ];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "Europe/Amsterdam";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.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";
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the GNOME Desktop Environment.
services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = true;
# Configure keymap in X11
services.xserver = {
layout = "us";
xkbVariant = "";
};
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
wireplumber.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
wget
git
mpv
citrix_workspace
chromium
cmus
kitty
kitty-themes
netflix
signal-desktop
whatsapp-for-linux
pciutils
dunst
(pkgs.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ];
})
)
hyprpaper
kitty
rofi-wayland
libnotify
alacritty
wezterm
networkmanagerapplet
tmuxPlugins.tilish
bottom
swaylock
home-manager
fishPlugins.done
fishPlugins.fzf-fish
fishPlugins.forgit
fishPlugins.hydro
fzf
fishPlugins.grc
grc
swaylock-effects
wlogout
font-awesome
pamixer
pavucontrol
wireplumber
just
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
environment.shells = with pkgs; [ fish ];
programs.fish.enable = true;
users.defaultUserShell = pkgs.fish;
environment.shellAliases = {
};
#Enable hyprland
programs.hyprland = { # or wayland.windowManager.hyprland
enable = true;
xwayland.enable = true;
enableNvidiaPatches = true;
};
environment.sessionVariables = {
# If your cursor becomes invisible
WLR_NO_HARDWARE_CURSORS = "1";
# Hint electron apps to use wayland
NIXOS_OZONE_WL = "1";
};
hardware = {
# Opengl
opengl.enable = true;
# Most wayland compositors need this
nvidia.modesetting.enable = true;
};
# Home manager
users.users.tim = {
isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" ];
};
home-manager.users.tim = {config, pkgs, ... }: {
home.packages = with pkgs; [
firefox
lf
webex
citrix_workspace
tmux
hyprpicker
copyq
udiskie
swaylock
wlogout
waybar
];
nixpkgs.config.allowUnfree = true;
home.stateVersion = "23.05";
home.username = "tim";
home.homeDirectory = "/home/tim";
programs.home-manager.enable = true;
programs.fish.enable = true;
};
programs.tmux = {
enable = true;
baseIndex = 1;
plugins = with pkgs; [
tmuxPlugins.better-mouse-mode
tmuxPlugins.sensible
tmuxPlugins.vim-tmux-navigator
tmuxPlugins.tilish
tmuxPlugins.catppuccin
tmuxPlugins.resurrect
tmuxPlugins.continuum
];
extraConfig = ''
set-option -sa terminal-overrides ",xterm*:Tc"
set -g mouse on
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R
bind -n M-H previous-window
bind -n M-L next-window
set -g @catppuccin_flavour 'frappe'
set -g @catppuccin_window_tabs_enabled on
set -g @catppuccin_date_time "%H:%M"
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @continuum-restore 'on'
set -g @continuum-boot 'on'
set -g @continuum-save-interval '10'
'';
};
#home.packages = [ pkgs.atool pkgs.firefox ];
#programs.bash.enable = true;
#home-manager.users.bashrcExtra = ''
# . ~/oldbashrc
#'';
# XDG portal
# xdg.portal.enable = true;
# xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
}
the issue is that Nix doesn’t think your flake actually has an output that nixos-rebuild is trying to build. → Do you maybe mean that I also have to specify configuration.nix as output? I’ve just tried to do that but that didn’t help either.
outputs = { self, flake-utils, devshell, nixpkgs, flake-compat }:
let
inherit (nixpkgs) lib;
genSystems = lib.genAttrs [
“x86_64-linux”
];
modules = [./configuration.nix];
Sorry I’m just such a beginner when it comes to nixos and development in general (I only write sql).
Your flake doesnt have a nixosConfigurations output
I think there’s maybe some layers of confusion going on.
I would really recommend setting aside Waybar for now. You really shouldn’t be using it’s flake.nix for anything directly. At best, once you get a basic nixos configuration build working, you could add Waybar as a input to your own flake, but again, that’s not going to involve copying their flake.nix.
I’d recommend looking up some flakes tutorials and following one to author your own flake.nix that includes a nixosConfigurations.nixos output, which would yes reference your configuration.nix.
I thought I got a more complete understanding of what flakes are and that I could use them as input for building my configuration and home manager. But I think I still need to learn way more about flakes. Thanks for the reply’s!
If you’re on Matrix, especially today/tonight, ping me and I’ll see if I can help further.
Thanks for the help Cole. I first want to improve myself a bit more since I’ve missed some important points. Hope to write a flake somewhere soon that makes sense!
Ps, never used Matrix, I’ll check that out soon as well!
1 Like