Initial working desktop nixos full flake config
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*.swp
|
||||||
2
activate_flake.sh
Executable file
2
activate_flake.sh
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
sudo nixos-rebuild switch --flake '.#'
|
||||||
64
flake.lock
generated
Normal file
64
flake.lock
generated
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"home-manager": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"utils": "utils"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1673089714,
|
||||||
|
"narHash": "sha256-D58SGNOVe+s7r2iewnCA8q68gyrfQcOnD1TdJo1wFLY=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"rev": "9e565f0d9d41c19a94f55af205c328ec5177fc0a",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "home-manager",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1672968032,
|
||||||
|
"narHash": "sha256-26Jns3GmHem44a06UN5Rj/KOD9qNJThyQrom02Ijur8=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "2dea8991d89b9f1e78d874945f78ca15f6954289",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixos-22.11",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"home-manager": "home-manager",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1667395993,
|
||||||
|
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
154
flake.nix
Normal file
154
flake.nix
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
{
|
||||||
|
description = "System config";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
#nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
|
||||||
|
home-manager = {
|
||||||
|
url = "github:nix-community/home-manager";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, home-manager }@attrs:
|
||||||
|
let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config.allowUnfree = true;
|
||||||
|
overlays = [];
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
nixosConfigurations.nixos-desktop = nixpkgs.lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
specialArgs = attrs;
|
||||||
|
modules = [
|
||||||
|
({ config, lib, pkgs, modulesPath, ... }: {
|
||||||
|
# HARDWARE
|
||||||
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
||||||
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ "kvm-amd" ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
fileSystems."/" = { device = "/dev/disk/by-uuid/163c1731-2f66-436b-a74f-20f84ec628dd"; fsType = "ext4"; };
|
||||||
|
fileSystems."/boot" = { device = "/dev/disk/by-uuid/9C44-5411"; fsType = "vfat"; };
|
||||||
|
swapDevices = [ ];
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
# END HARDWARE
|
||||||
|
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
networking.hostName = "nixos-desktop"; # Define your hostname.
|
||||||
|
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||||
|
time.timeZone = "America/New_York";
|
||||||
|
|
||||||
|
users.extraUsers.nathan = {
|
||||||
|
name = "nathan";
|
||||||
|
isNormalUser = true;
|
||||||
|
group = "users";
|
||||||
|
extraGroups = [ "wheel" "disk" "audio" "video" "networkmanager" "systemd-journal" "networkmanager" "sway" "plugdev" "adbusers"];
|
||||||
|
createHome = true;
|
||||||
|
home = "/home/nathan";
|
||||||
|
shell = "/run/current-system/sw/bin/bash";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.pipewire = {
|
||||||
|
enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
};
|
||||||
|
services.dbus.enable = true;
|
||||||
|
xdg.portal = {
|
||||||
|
enable = true;
|
||||||
|
wlr.enable = true;
|
||||||
|
extraPortals = [pkgs.xdg-desktop-portal-gtk ];
|
||||||
|
gtkUsePortal = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.sway = {
|
||||||
|
enable = true;
|
||||||
|
wrapperFeatures.gtk = true;
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
swaylock # lockscreen
|
||||||
|
swayidle
|
||||||
|
#xwayland # for legacy apps
|
||||||
|
waybar # status bar
|
||||||
|
mako # notification daemon
|
||||||
|
kanshi # autorandr
|
||||||
|
bemenu # is this right?
|
||||||
|
i3status
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
environment = {
|
||||||
|
etc = {
|
||||||
|
"sway/config".source = ./sway_config;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
tmux vim wget curl git w3m iftop killall file unzip zip ripgrep imv killall gomuks htop
|
||||||
|
firefox-wayland chromium gnome.nautilus
|
||||||
|
calibre foliate transmission-gtk mupdf
|
||||||
|
pywal
|
||||||
|
|
||||||
|
foot
|
||||||
|
sway wayland glib dracula-theme gnome.adwaita-icon-theme swaylock swayidle wl-clipboard
|
||||||
|
(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
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
# currently, there is some friction between sway and gtk:
|
||||||
|
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
|
||||||
|
# the suggested way to set gtk settings is with gsettings
|
||||||
|
# for gsettings to work, we need to tell it where the schemas are
|
||||||
|
# using the XDG_DATA_DIR environment variable
|
||||||
|
# run at the end of sway config
|
||||||
|
(pkgs.writeTextFile {
|
||||||
|
name = "configure-gtk";
|
||||||
|
destination = "/bin/configure-gtk";
|
||||||
|
executable = true;
|
||||||
|
text = let
|
||||||
|
schema = pkgs.gsettings-desktop-schemas;
|
||||||
|
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
|
||||||
|
in ''
|
||||||
|
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
|
||||||
|
gnome_schema=org.gnome.desktop.interface
|
||||||
|
gsettings set $gnome_schema gtk-theme 'Dracula'
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
programs.waybar.enable = true;
|
||||||
|
|
||||||
|
# kanshi systemd service
|
||||||
|
systemd.user.services.kanshi = {
|
||||||
|
description = "kanshi daemon";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
ExecStart = "${pkgs.kanshi}/bin/kanshi -c kanshi_config_file";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services.syncthing = {
|
||||||
|
enable = true;
|
||||||
|
user = "nathan";
|
||||||
|
dataDir = "/home/nathan/syncthing_stuff";
|
||||||
|
configDir = "/home/nathan/syncthing_stuff/.config/syncthing";
|
||||||
|
};
|
||||||
|
|
||||||
|
services.openssh.enable = true;
|
||||||
|
networking.firewall.enable = false;
|
||||||
|
system.stateVersion = "22.11"; # Did you read the comment?
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
188
sway_config
Normal file
188
sway_config
Normal file
@@ -0,0 +1,188 @@
|
|||||||
|
include "$HOME/.cache/wal/colors-sway"
|
||||||
|
output * background $wallpaper stretch
|
||||||
|
client.focused $color0 $background $foreground $color7 $background
|
||||||
|
#output * bg ~/Wallpapers/humble_nord_nixos.png stretch
|
||||||
|
gaps inner 10
|
||||||
|
default_border pixel 1
|
||||||
|
|
||||||
|
set $mod Mod1
|
||||||
|
|
||||||
|
font pango:Ubuntu Sans Mono 10
|
||||||
|
|
||||||
|
#exec systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
|
||||||
|
#exec dbus-update-activation-environment WAYLAND_DISPLAY
|
||||||
|
exec dbus-sway-environment
|
||||||
|
exec configure-gtk
|
||||||
|
# give sway a little time to startup before starting kanshi.
|
||||||
|
exec sleep 5; systemctl --user start kanshi.service
|
||||||
|
|
||||||
|
#When everything's wayland, maybe
|
||||||
|
#output eDP-1 scale 2
|
||||||
|
|
||||||
|
#Output HDMI-A-1 'Goldstar Company Ltd LG TV SSCR2 0x00000101'
|
||||||
|
output HDMI-A-1 mode 1920x1080@60Hz
|
||||||
|
|
||||||
|
# reload the configuration file
|
||||||
|
bindsym $mod+Shift+q reload
|
||||||
|
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||||
|
bindsym $mod+Shift+r restart
|
||||||
|
|
||||||
|
# Use keys to adjust volume
|
||||||
|
bindsym XF86AudioRaiseVolume exec amixer -q sset Master 5%+ unmute
|
||||||
|
bindsym XF86AudioLowerVolume exec amixer -q sset Master 5%- unmute
|
||||||
|
bindsym XF86AudioMute exec amixer -q sset Master toggle
|
||||||
|
|
||||||
|
# Use keys to adjust brightness
|
||||||
|
#bindsym XF86MonBrightnessUp exec sudo /home/nathan/brightness.sh up
|
||||||
|
#bindsym XF86MonBrightnessDown exec sudo /home/nathan/brightness.sh down
|
||||||
|
#bindsym XF86MonBrightnessUp exec xbrightness + 10
|
||||||
|
#bindsym XF86MonBrightnessDown exec xbrightness - 10
|
||||||
|
bindsym XF86MonBrightnessUp exec light -A 10
|
||||||
|
bindsym XF86MonBrightnessDown exec light -U 10
|
||||||
|
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||||
|
floating_modifier $mod
|
||||||
|
|
||||||
|
# start a terminal
|
||||||
|
#bindsym $mod+Return exec i3-sensible-terminal
|
||||||
|
#bindsym $mod+Return exec xfce4-terminal
|
||||||
|
#bindsym $mod+Return exec terminology
|
||||||
|
#bindsym $mod+Return exec st
|
||||||
|
#bindsym $mod+Return exec sakura
|
||||||
|
bindsym $mod+Return exec foot
|
||||||
|
|
||||||
|
# kill focused window
|
||||||
|
bindsym $mod+Shift+c kill
|
||||||
|
|
||||||
|
# start dmenu (a program launcher)
|
||||||
|
#bindsym $mod+p exec dmenu_run -fn 'Ubuntu Mono-12'
|
||||||
|
#set $menu bmenu-run
|
||||||
|
bindsym $mod+p exec bemenu-run
|
||||||
|
|
||||||
|
# change focus
|
||||||
|
bindsym $mod+h focus left
|
||||||
|
bindsym $mod+j focus down
|
||||||
|
bindsym $mod+k focus up
|
||||||
|
bindsym $mod+l focus right
|
||||||
|
|
||||||
|
# alternatively, you can use the cursor keys:
|
||||||
|
#bindsym $mod+Left focus left
|
||||||
|
#bindsym $mod+Down focus down
|
||||||
|
#bindsym $mod+Up focus up
|
||||||
|
#bindsym $mod+Right focus right
|
||||||
|
|
||||||
|
# move focused window
|
||||||
|
bindsym $mod+Shift+h move left
|
||||||
|
bindsym $mod+Shift+j move down
|
||||||
|
bindsym $mod+Shift+k move up
|
||||||
|
bindsym $mod+Shift+l move right
|
||||||
|
|
||||||
|
# alternatively, you can use the cursor keys:
|
||||||
|
bindsym $mod+Shift+Left move left
|
||||||
|
bindsym $mod+Shift+Down move down
|
||||||
|
bindsym $mod+Shift+Up move up
|
||||||
|
bindsym $mod+Shift+Right move right
|
||||||
|
|
||||||
|
# split in horizontal orientation
|
||||||
|
bindsym $mod+Shift+u split h
|
||||||
|
|
||||||
|
# split in vertical orientation
|
||||||
|
bindsym $mod+u split v
|
||||||
|
|
||||||
|
# enter fullscreen mode for the focused container
|
||||||
|
bindsym $mod+f fullscreen
|
||||||
|
|
||||||
|
# change container layout (stacked, tabbed, toggle split)
|
||||||
|
bindsym $mod+s layout stacking
|
||||||
|
bindsym $mod+w layout tabbed
|
||||||
|
bindsym $mod+e layout toggle split
|
||||||
|
|
||||||
|
# toggle tiling / floating
|
||||||
|
bindsym $mod+Shift+space floating toggle
|
||||||
|
|
||||||
|
# change focus between tiling / floating windows
|
||||||
|
bindsym $mod+space focus mode_toggle
|
||||||
|
|
||||||
|
# focus the parent container
|
||||||
|
bindsym $mod+a focus parent
|
||||||
|
|
||||||
|
# focus the child container
|
||||||
|
bindsym $mod+d focus child
|
||||||
|
|
||||||
|
# switch to workspace
|
||||||
|
bindsym $mod+1 workspace 1
|
||||||
|
bindsym $mod+2 workspace 2
|
||||||
|
bindsym $mod+3 workspace 3
|
||||||
|
bindsym $mod+4 workspace 4
|
||||||
|
bindsym $mod+5 workspace 5
|
||||||
|
bindsym $mod+6 workspace 6
|
||||||
|
bindsym $mod+7 workspace 7
|
||||||
|
bindsym $mod+8 workspace 8
|
||||||
|
bindsym $mod+9 workspace 9
|
||||||
|
bindsym $mod+0 workspace 10
|
||||||
|
|
||||||
|
# move focused container to workspace
|
||||||
|
bindsym $mod+Shift+1 move container to workspace 1
|
||||||
|
bindsym $mod+Shift+2 move container to workspace 2
|
||||||
|
bindsym $mod+Shift+3 move container to workspace 3
|
||||||
|
bindsym $mod+Shift+4 move container to workspace 4
|
||||||
|
bindsym $mod+Shift+5 move container to workspace 5
|
||||||
|
bindsym $mod+Shift+6 move container to workspace 6
|
||||||
|
bindsym $mod+Shift+7 move container to workspace 7
|
||||||
|
bindsym $mod+Shift+8 move container to workspace 8
|
||||||
|
bindsym $mod+Shift+9 move container to workspace 9
|
||||||
|
bindsym $mod+Shift+0 move container to workspace 10
|
||||||
|
|
||||||
|
# resize window (you can also use the mouse for that)
|
||||||
|
mode "resize" {
|
||||||
|
# These bindings trigger as soon as you enter the resize mode
|
||||||
|
|
||||||
|
# Pressing left will shrink the window’s width.
|
||||||
|
# Pressing right will grow the window’s width.
|
||||||
|
# Pressing up will shrink the window’s height.
|
||||||
|
# Pressing down will grow the window’s height.
|
||||||
|
bindsym l resize shrink width 10 px or 10 ppt
|
||||||
|
bindsym j resize grow height 10 px or 10 ppt
|
||||||
|
bindsym k resize shrink height 10 px or 10 ppt
|
||||||
|
bindsym h resize grow width 10 px or 10 ppt
|
||||||
|
|
||||||
|
# same bindings, but for the arrow keys
|
||||||
|
bindsym Left resize shrink width 10 px or 10 ppt
|
||||||
|
bindsym Down resize grow height 10 px or 10 ppt
|
||||||
|
bindsym Up resize shrink height 10 px or 10 ppt
|
||||||
|
bindsym Right resize grow width 10 px or 10 ppt
|
||||||
|
|
||||||
|
# back to normal: Enter or Escape
|
||||||
|
bindsym Return mode "default"
|
||||||
|
bindsym Escape mode "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
bindsym $mod+r mode "resize"
|
||||||
|
|
||||||
|
#input 1739:0:Synaptics_TM2722-0 {
|
||||||
|
input 1739:0:Synaptics_TM2722-001 {
|
||||||
|
#input 2:7:SynPS/2_Synaptics_TouchPad {
|
||||||
|
tap enabled
|
||||||
|
}
|
||||||
|
input 1:1:AT_Translated_Set_2_keyboard {
|
||||||
|
xkb_options ctrl:nocaps
|
||||||
|
}
|
||||||
|
input 9456:320:Metadot_-_Das_Keyboard_Das_Keyboard {
|
||||||
|
xkb_options ctrl:nocaps
|
||||||
|
}
|
||||||
|
|
||||||
|
# Start i3bar to display a workspace bar (plus the system information i3status
|
||||||
|
# finds out, if available)
|
||||||
|
bar {
|
||||||
|
position top
|
||||||
|
|
||||||
|
# When the status_command prints a new line to stdout, swaybar updates.
|
||||||
|
# The default just shows the current date and time.
|
||||||
|
#status_command while date +'%Y-%m-%d %l:%M:%S %p'; do sleep 1; done
|
||||||
|
status_command i3status
|
||||||
|
|
||||||
|
colors {
|
||||||
|
statusline $color7
|
||||||
|
background $color0
|
||||||
|
inactive_workspace #32323200 #32323200 #5c5c5c
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user