Hello. I am trying to follow the instructions in this starter repo (nix-starter-configs/minimal at main · Misterio77/nix-starter-configs · GitHub) to get a basic sway configuration to build off of.
I can run sudo nixos-rebuild switch --flake .#hostname
without errors.
The first time I ran it with the current config I have (I started with NixOS Budgie) my GUI disappeared and got stuck on [ OK ] Reached target graphical interface
. I rebooted it and I got a plain tty, so I logged in, and none of the programs that I listed in my config seem to be installed. I tried rerunning it, but the programs never install.
My configuration files were taken from the minimal folder in this starter repo: GitHub - Misterio77/nix-starter-configs: Simple and documented config templates to help you get started with NixOS + home-manager + flakes. All the boilerplate you need!
configuration.nix:
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{
inputs,
lib,
config,
pkgs,
...
}: {
# You can import other NixOS modules here
imports = [
# If you want to use modules from other flakes (such as nixos-hardware):
# inputs.hardware.nixosModules.common-cpu-amd
# inputs.hardware.nixosModules.common-ssd
# You can also split up your configuration and import pieces of it here:
# ./users.nix
# Import your generated (nixos-generate-config) hardware configuration
./hardware-configuration.nix
];
nixpkgs = {
# You can add overlays here
overlays = [
# If you want to use overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
};
};
# This will add each flake input as a registry
# To make nix3 commands consistent with your flake
nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs);
# This will additionally add your inputs to the system's legacy channels
# Making legacy nix commands consistent as well, awesome!
nix.nixPath = ["/etc/nix/path"];
environment.etc =
lib.mapAttrs'
(name: value: {
name = "nix/path/${name}";
value.source = value.flake;
})
config.nix.registry;
nix.settings = {
# Enable flakes and new 'nix' command
experimental-features = "nix-command flakes";
# Deduplicate and optimize nix store
auto-optimise-store = true;
};
# FIXME: Add the rest of your current configuration
#for sway
security.polkit.enable = true;
# TODO: Set your hostname
networking.hostName = "nixos-vm";
# TODO: This is just an example, be sure to use whatever bootloader you prefer
boot.loader.grub.enable = true;
boot.loader.grub.devices = ["/dev/sda"];
extraGroups = ["wheel"];
};
};
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = "23.05";
}
home.nix
# This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
{
inputs,
lib,
config,
pkgs,
...
}: {
# You can import other home-manager modules here
imports = [
# If you want to use home-manager modules from other flakes (such as nix-colors):
# inputs.nix-colors.homeManagerModule
# You can also split up your configuration and import pieces of it here:
# ./nvim.nix
./sway.nix
];
nixpkgs = {
# You can add overlays here
overlays = [
# If you want to use overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
# Workaround for https://github.com/nix-community/home-manager/issues/2942
allowUnfreePredicate = _: true;
};
};
# TODO: Set your username
home = {
username = "gigi";
homeDirectory = "/home/gigi";
};
# Add stuff for your user as you see fit:
# programs.neovim.enable = true;
# home.packages = with pkgs; [
fish
kitty
starship
neovim
];
# Enable home-manager and git
programs.home-manager.enable = true;
programs.git.enable = true;
# Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
home.stateVersion = "23.05";
}
sway.nix is from the wiki, i copied the home manager code exactly.
flake.nix
{
description = "Your new nix config";
inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
# Home manager
home-manager.url = "github:nix-community/home-manager/release-23.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# TODO: Add any other flake you might need
# hardware.url = "github:nixos/nixos-hardware";
# Shameless plug: looking for a way to nixify your themes and make
# everything match nicely? Try nix-colors!
# nix-colors.url = "github:misterio77/nix-colors";
};
outputs = {
self,
nixpkgs,
home-manager,
...
} @ inputs: let
inherit (self) outputs;
in {
# NixOS configuration entrypoint
# Available through 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = {
# FIXME replace with your hostname
nixos-vm = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
# > Our main nixos configuration file <
modules = [./nixos/configuration.nix];
};
};
# Standalone home-manager configuration entrypoint
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
# FIXME replace with your username@hostname
"gigi@nixos-vm" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; # Home-manager requires 'pkgs' instance
extraSpecialArgs = {inherit inputs outputs;};
# > Our main home-manager configuration file <
modules = [./home-manager/home.nix];
};
};
};
}
Can anyone see what my problem is? Or if not, honestly just being pointed to a plug and play sway config would be amazing. I’ve tried 4 different tutorials overall and just have never gotten it working…something different always goes wrong or is amiss in the middle of my attempt.
Thanks.
Forgot to mention that I attempted to check my config against the tutorial here: Get Started with NixOS | NixOS & Flakes Book, I couldn’t see the issue.
I also tried adding programs.sway.enable = true;
in home.nix, no luck.