In my configuration.nix
{ config, lib, pkgs, ... }:
{
nix = {
extraOptions = ''
experimental-features = nix-command flakes
min-free = ${toString (100 * 1024 * 1024)}
max-free = ${toString (1024 * 1024 * 1024)}
'';
};
imports =
[
# Include the results of the hardware scan.
./hardware-configuration.nix
../../common
];
# ...
My ./common/default.nix
{config, lib, pkgs, ...}:
{
##### Programs #####
virtualisation = {
podman = {
enable = true;
# dockerCompat = true; # can conflict with docker
defaultNetwork.settings = {
dns_enable = true;
};
};
};
config.services.postgresql = {
enable = true;
ensureDatabases = [ "scratchdb" ];
authentication = pkgs.lib.mkOverride 10 ''
#type database DBuser auth-method
local all all trust
'';
};
##### End Programs #####
users.users.redacted = {
isNormalUser = true;
description = "redacted";
extraGroups = [ "redacted" ];
shell = pkgs.fish;
packages = with pkgs; [
firefox
# thunderbird
];
};
programs.fish.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
];
# Enable auto optimiztion for the store
nix.settings.auto-optimise-store = true;
# Docker install with rootless
virtualisation.docker.enable = true;
virtualisation.docker.rootless = {
enable = true;
setSocketVariable = true;
};
# Garbage collection can be automated
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
environment.interactiveShellInit = ''
alias v='nvim'
alias vi='nvim'
alias vim='nvim'
alias ls='eza'
alias tree='eza -T'
alias gst='git status'
alias lg='lazygit'
'';
}
The error
error: Module `/nix/store/k31ay31mxnfj0nwy7dmwg61zs1qd7i8v-source/common' has an unsupported attribute `environment'. This is caused by introducing a top-level `config' or `options' attribute. Add configuration attributes immediately on the top level instead, or move all of them (namely: environment nix nixpkgs programs users virtualisation) into the explicit `config' attribute.
This error will pop up for any of the attributes I have set in common
. I’m sure I’m just misunderstanding something.