Hello! I am new to NixOS. Spent all last night converting my Arch Linux Sway config over to NixOS and it went swimmingly. Until I tried to install Steam. Here is my flake.nix
and home.nix
:
{
description = "NixOS system flake.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-stable, home-manager, ... } @ inputs:
let
inherit (self) outputs;
system = "x86_64-linux";
userName = "nate";
hostName = "winmax";
pkgs = nixpkgs.legacyPackages.${system};
stablePkgs = import nixpkgs-stable {
legacyPackages = system;
####
config.allowUnfree = true;
####
#### Tried it here for stablePkgs and pkgs and it doesnt work
};
in
{
nixosConfigurations = {
nixSway = nixpkgs.lib.nixosSystem {
# Pass args to sway_configuration
specialArgs = {
inherit inputs;
inherit userName;
inherit hostName;
};
modules = [
./nixos/sway_configuration.nix
# Setup home manager
home-manager.nixosModules.home-manager {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.${userName} = import ./modules/home-manager/home.nix;
# Pass args to home.nix
home-manager.extraSpecialArgs = {
inherit inputs outputs userName hostName;
};
}
];
};
};
};
}
{ inputs, outputs, lib, config, pkgs, userName, hostName, ... }:
{
# Home Manager needs a bit of information about you and the paths it should
# manage.
#
nixpkgs.config.allowUnfree = true;
#### Doesnt work here either...
# inputs.nixpkgs-stable.config.allowUnfree = true;
####
home.username = userName;
home.homeDirectory = "/home/${userName}";
home.packages = with pkgs; [
steam
# ... The rest of the config
The error:
error: Package ‘steam’ in /nix/store/4fgs7yzsy2dqnjw8j42qlp9i1vgarzy0-source/pkgs/games/steam/steam.nix:43 has an unfree license (‘unfreeRedistributable’), refusing to evaluate.
Any help on this? Sorry Im sure so many people come here with noob questions, but I have searched for solutions and haven’t been able to find any.
As an aside, Im still trying to understand the inputs/outputs. Im familiar with the let
in
syntax from ocaml, but is there a way I can get userName
from outputs
that Im passing into home.nix
? outputs.userName
doesnt seem to work as I would expect.
If you have any insights or tips please let me know. Im very new to Nix, my config is a frankenstein of other people’s configs as I was working through learning. Also, is there an easy way to inspect what is in an attribute? Like some sort of repl?