Skip to content

Instantly share code, notes, and snippets.

@azzarello
Created February 1, 2023 02:40
Show Gist options
  • Save azzarello/db04701113e3a70dc02fcc3c81c1bc53 to your computer and use it in GitHub Desktop.
Save azzarello/db04701113e3a70dc02fcc3c81c1bc53 to your computer and use it in GitHub Desktop.
Undefined variable: 'config'
{ config, pkgs, lib, ... }:
let
dbus-sway-environment = pkgs.writeTextFile {
name = "dbus-sway-environment";
destination = "/bin/dbus-sway-environment";
executable = true;
text = ''
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
'';
};
systemdRun = { pkg, bin ? pkg.pname, args ? "" }: ''
systemd-run --user --scope --collect --quiet --unit=${bin} \
systemd-cat --identifier=${bin} ${lib.makeBinPath [ pkg ]}/${bin} ${args}
'';
in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
<home-manager/nixos>
];
nix.nixPath = [
"$HOME/.nix-defexpr/channels"
"nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
"nixos-config=/home/cd/.config/nixos/configuration.nix"
"/nix/var/nix/profiles/per-user/root/channels"
];
nix.settings = {
experimental-features = [ "nix-command" "flakes" ];
auto-optimise-store = true;
};
nixpkgs.config.allowUnfree = true;
nixpkgs.config = {
packageOverrides = pkgs: {
nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
inherit pkgs;
};
};
};
documentation = {
enable = true;
man.enable = true;
dev.enable = true;
};
# Latest kernel
boot.kernelPackages = pkgs.linuxPackages_latest;
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
environment.loginShellInit = ''
[[ "$(tty)" = /dev/tty1 ]] && sway
'';
environment.variables = {
NIXOS_CONFIG = "$HOME/.config/nixos/configuration.nix";
NIXOS_CONFIG_DIR = "$HOME/.config/nixos/";
EDITOR = "nvim";
};
security.sudo.wheelNeedsPassword = false;
security.polkit.enable = true;
security.pam.services.swaylock = {};
# networking.hostName = "nixos"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time = {
timeZone = "America/Los_Angeles";
hardwareClockInLocalTime = true;
};
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
# keyMap = "us";
useXkbConfig = true; # use xkbOptions in tty.
};
# Enable the X11 windowing system.
services.xserver.enable = false;
# Configure keymap in X11
services.xserver.layout = "us";
services.xserver.xkbOptions = "ctrl:nocaps"; # map caps to escape.
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
sound.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
};
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
users.users.cd = {
isNormalUser = true;
extraGroups = [ "wheel" "video" ];
};
home-manager.users.cd = { pkgs, ... }: {
imports = [
./neovim.nix
];
home.stateVersion = "18.09";
home.packages = with pkgs; [
foot
dbus-sway-environment
light
firefox
git
# discord
element-desktop
signal-desktop
];
wayland.windowManager.sway = {
enable = true;
config = rec {
bars = [];
gaps = {
smartBorders = "on";
};
fonts = {
names = [ "Fira Code" ];
};
modifier = "Mod4";
startup = [
{ command = "firefox"; }
];
# keybindings =
# let
# mod = wayland.windowManager.sway.config.modifier;
# in
# lib.mkOptionDefault {
# "${mod}+q" = "kill";
# "${mod}+b" = "exec ${systemdRun { pkg = pkgs.firefox; bin = "firefox";} }";
# };
assigns = {
"9" = [
{ class = "Element"; }
];
};
};
extraConfig = ''
smart_gaps on
gaps inner 5
for_window [class="Spotify"] move window to workspace 8
# Brightness
bindsym XF86MonBrightnessDown exec light -U 10
bindsym XF86MonBrightnessUp exec light -A 10
# Volume
bindsym XF86AudioRaiseVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ +1%'
bindsym XF86AudioLowerVolume exec 'pactl set-sink-volume @DEFAULT_SINK@ -1%'
bindsym XF86AudioMute exec 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
exec systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
exec dbus-update-activation-environment WAYLAND_DISPLAY
exec dbus-sway-environment
'';
wrapperFeatures.gtk = true;
systemdIntegration = true;
};
programs = {
bash.enable = true;
zsh.enable = true;
fish.enable = true;
};
};
fonts = {
fontconfig = {
enable = true;
defaultFonts = {
serif = [ "Noto Serif" "Source Han Serif" ];
sansSerif = [ "Noto Sans" "Source Han Sans" ];
};
};
fonts = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
font-awesome
source-han-sans
source-han-sans-japanese
source-han-serif-japanese
];
};
# Define a user account. Don't forget to set a password with ‘passwd’.
# 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.
neovim
wget
home-manager
tlp
upower
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs.light.enable = true;
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
hardware = {
pulseaudio = {
support32Bit = true;
enable = false;
};
opengl = {
enable = true;
driSupport32Bit = true;
extraPackages = with pkgs; [
intel-media-driver
vaapiIntel
vaapiVdpau
libvdpau-va-gl
];
extraPackages32 = with pkgs.pkgsi686Linux; [ vaapiIntel ];
};
};
# List services that you want to enable:
services.dbus.enable = true;
xdg.portal = {
enable = true;
wlr.enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
};
services.tlp.enable = true;
services.upower.enable = true;
# 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;
networking.hostName = "panini";
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
system.copySystemConfiguration = true;
# 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).
system.stateVersion = "22.05"; # Did you read the comment?
system.autoUpgrade.enable = true;
system.autoUpgrade.allowReboot = true;
system.autoUpgrade.channel = https://nixos.org/channels/nixos-22.11;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment