diff --git a/apply-system.sh b/apply-system.sh new file mode 100755 index 0000000..a22d1bc --- /dev/null +++ b/apply-system.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +pushd ~/.dotfiles +sudo nixos-rebuild switch --flake .# +popd diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..f6fd61e --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1635123562, + "narHash": "sha256-kYuwQqHXDYxy5ijpm8SvCoPNx0br1TpoWeTIOEwOYvA=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "da8a78eec9f7adb57f9e961d1da64805efacff37", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "master", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1634782485, + "narHash": "sha256-psfh4OQSokGXG0lpq3zKFbhOo3QfoeudRcaUnwMRkQo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "34ad3ffe08adfca17fcb4e4a47bb5f3b113687be", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..983e15a --- /dev/null +++ b/flake.nix @@ -0,0 +1,51 @@ +{ + description = "My System Configs"; + + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + + home-manager.url = "github:nix-community/home-manager/master"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = { nixpkgs, home-manager, ... }: + let + system = "x86_64-linux"; + + pkgs = import nixpkgs { + inherit system; + + config = { + allowUnfree = true; + }; + }; + + lib = nixpkgs.lib; + + in { + homeConfigurations = { + daniel = home-manager.lib.homeManagerConfiguration { + inherit system pkgs; + + username = "daniel"; + homeDirectory = "/home/daniel"; + configuration = { + imports = [ + ./user/dingbox/home.nix + ]; + }; + stateVersion = "21.05"; + }; + }; + + nixosConfigurations = { + dingbox = lib.nixosSystem { + inherit system; + + modules = [ + ./hosts/dingbox/configuration.nix + ]; + }; + }; + }; +} diff --git a/hosts/dingbox/configuration.nix b/hosts/dingbox/configuration.nix index 60943ec..94bf795 100644 --- a/hosts/dingbox/configuration.nix +++ b/hosts/dingbox/configuration.nix @@ -11,11 +11,20 @@ ]; # Use the systemd-boot EFI boot loader. + boot.kernelPackages = pkgs.linuxKernel.packages.linux_5_14; boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; nixpkgs.config.allowUnfree = true; + # nix flakes compatibility + nix = { + package = pkgs.nixUnstable; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + networking.hostName = "dingbox"; # Define your hostname. networking.networkmanager.enable = true; programs.nm-applet.enable = true; @@ -47,6 +56,7 @@ enable = true; layout = "gb"; + dpi = 144; videoDrivers = [ "nvidia" ]; screenSection = '' Option "metamodes" "nvidia-auto-select +0+0 {ForceCompositionPipeline=On}" @@ -62,6 +72,10 @@ }; }; + displayManager = { + gdm.enable = true; + }; + windowManager.i3.enable = true; }; diff --git a/update-system.sh b/update-system.sh new file mode 100755 index 0000000..919cd48 --- /dev/null +++ b/update-system.sh @@ -0,0 +1,2 @@ +#!/bin/sh +nix flake update diff --git a/user/daniel/home.nix b/user/daniel/home.nix deleted file mode 100644 index 6d6595c..0000000 --- a/user/daniel/home.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ pkgs, ... }: - -{ - imports = [ - ./i3 - ./polybar - ]; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - home.username = "daniel"; - home.homeDirectory = "/home/daniel"; - - home.file.".icons/default".source = "${pkgs.capitaine-cursors}/share/icons/capitaine-cursors"; - - xsession.enable = true; - services.dunst.enable = true; - - home.packages = with pkgs; - [ - (import ./i3utils) - alacritty - chezmoi - element-desktop - feh - fzf - go_1_17 - i3 - i3lock - lazygit - nerdfonts - oh-my-zsh - pavucontrol - restic - rofi - starship - xclip - ]; - - home.keyboard = { - layout = "gb"; - options = [ - "caps:escape" - ]; - }; - - programs = { - zsh = { - enable = true; - oh-my-zsh = { - enable = true; - plugins = [ "git" "fzf" ]; - theme = "agnoster"; - }; - }; - }; - - programs.git = { - enable = true; - userName = "Daniel Patterson"; - userEmail = "me@danielpatterson.dev"; - }; - - programs.starship.enable = true; - - programs.neovim.enable = true; - programs.neovim.viAlias = true; - programs.neovim.vimAlias = true; - - home.stateVersion = "21.05"; -} diff --git a/user/daniel/i3/default.nix b/user/daniel/i3/default.nix deleted file mode 100644 index 096499b..0000000 --- a/user/daniel/i3/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ config, lib, pkgs, ...}: - -let - mod = "Mod4"; -in { - xsession.windowManager.i3 = { - enable = true; - config = { - modifier = mod; - fonts = { - names = [ "pango:monospace 8" ]; - style = "monospace"; - size = 8.0; - }; - terminal = "alacritty"; - - floating = { - modifier = mod; - criteria = [ - { instance = "pavucontrol"; } - ]; - }; - - focus = { - followMouse = false; - }; - - bars = [ ]; - - keybindings = lib.mkOptionDefault { - "${mod}+q" = "kill"; - "${mod}+d" = "exec rofi -show drun"; - - "${mod}+h" = "focus left"; - "${mod}+j" = "focus down"; - "${mod}+k" = "focus up"; - "${mod}+l" = "focus right"; - - "${mod}+Shift+h" = "move left"; - "${mod}+Shift+l" = "move right"; - - "${mod}+b" = "split h"; - "${mod}+v" = "split v"; - "${mod}+Control+Return" = "exec --no-startup-id i3utils workspace new"; - "${mod}+Control+Shift+Return" = "exec --no-startup-id i3utils workspace new -b"; - "${mod}+Shift+Return" = "exec --no-startup-id i3utils workspace new -n, move next"; - - "${mod}+Control+j" = "exec --no-startup-id $HOME/bin/scripts/godown"; - "${mod}+Control+k" = "exec --no-startup-id $HOME/bin/scripts/goup"; - "${mod}+Control+h" = "exec --no-startup-id i3utils workspace new -b"; - - "${mod}+Shift+k" = "exec --no-startup-id i3utils window move prev"; - "${mod}+Shift+j" = "exec --no-startup-id i3utils window move next"; - - "${mod}+p" = "scratchpad show"; - "${mod}+Escape" = "exec i3lock -i /home/daniel/Pictures/wallpapers/wallpaper_3840x2160_blur.png"; - "${mod}+Shift+Escape" = "exec i3lock -i /home/daniel/Pictures/wallpapers/wallpaper_3840x2160_blur.png && systemctl suspend"; - }; - - window = { - border = 3; - titlebar = false; - commands = [ - { command = "move position center #2116 46"; criteria = { class = "jetbrains-toolbox"; }; } - { command = "move scratchpad"; criteria = { instance = "spotify"; }; } - ]; - }; - - startup = [ - { command = "$HOME/bin/scripts/flower"; always = true; } - ]; - }; - }; -} diff --git a/user/daniel/i3utils/default.nix b/user/daniel/i3utils/default.nix deleted file mode 100644 index 986d680..0000000 --- a/user/daniel/i3utils/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -with import {}; - -buildGoModule rec { - pname = "i3utils"; - version = "0.0.1"; - src = fetchgit { - url = "https://git.sr.ht/~dpatterbee/i3utils"; - rev = "refs/heads/main"; - sha256 = "1h97131558nklhi3f2a3jl9np2n8y1irh088jc5iry63zpsfx2qm"; - }; - - vendorSha256 = "1lzr4ga58aa35z0vkpw8jldplvg174q49nqqpdv0vz0aj3m585nq"; -} diff --git a/user/daniel/polybar/config b/user/daniel/polybar/config deleted file mode 100644 index 76d1a6b..0000000 --- a/user/daniel/polybar/config +++ /dev/null @@ -1,394 +0,0 @@ -[colors] -;background = ${xrdb:color0:#222} -background = #222 -background-alt = #444 -;foreground = ${xrdb:color7:#222} -foreground = #dfdfdf -foreground-alt = #555 -primary = #ffb52a -secondary = #e60053 -alert = #bd2c40 - -[bar/main] -width = 100% - -height = 34 - -font-0 = Ubuntu:size=10;2 - -font-1 = Font Awesome 5 Free Solid:size=10;3 -font-2 = Font Awesome 5 Brands:size=10;1 - -fixed-center = true - -background = ${colors.background} -foreground = ${colors.foreground} - -line-size = 3 -line-color = #f00 - -;border-size = 4 -border-color = #00000000 - -padding-left = 0 -padding-right = 2 - -module-margin-left = 1 -module-margin-right = 2 - -modules-left = i3 -modules-center = mpd date -modules-right = filesystem xbacklight pulseaudio memory cpu wlan eth battery temperature powermenu - -tray-position = right -tray-padding = 2 - -dpi = 120 -;tray-background = #0063ff - -;wm-restack = bspwm -;wm-restack = i3 - -;override-redirect = true - -;scroll-up = bspwm-desknext -;scroll-down = bspwm-deskprev - -;scroll-up = i3wm-wsnext -;scroll-down = i3wm-wsprev - -cursor-click = pointer -cursor-scroll = ns-resize - -[module/xwindow] -type = internal/xwindow -label = %title:0:30:...% - -[module/xkeyboard] -type = internal/xkeyboard -blacklist-0 = num lock - -format-prefix = " " -format-prefix-foreground = ${colors.foreground-alt} -format-prefix-underline = ${colors.secondary} - -label-layout = %layout% -label-layout-underline = ${colors.secondary} - -label-indicator-padding = 2 -label-indicator-margin = 1 -label-indicator-background = ${colors.secondary} -label-indicator-underline = ${colors.secondary} - -[module/filesystem] -type = internal/fs -interval = 25 - -mount-0 = / - -label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%% -label-unmounted = %mountpoint% not mounted -label-unmounted-foreground = ${colors.foreground-alt} - -[module/i3] -type = internal/i3 -format = -index-sort = false -wrapping-scroll = false - -; Only show workspaces on the same output as the bar -;pin-workspaces = true - -label-mode-padding = 2 -label-mode-foreground = #000 -label-mode-background = ${colors.primary} - -; focused = Active workspace on focused monitor -label-focused = %name% -label-focused-background = ${colors.background-alt} -label-focused-underline= ${colors.primary} -label-focused-padding = 2 - -; unfocused = Inactive workspace on any monitor -label-unfocused = %name% -label-unfocused-padding = 2 - -; visible = Active workspace on unfocused monitor -label-visible = %name% -label-visible-background = ${self.label-focused-background} -label-visible-underline = ${self.label-focused-underline} -label-visible-padding = ${self.label-focused-padding} - -; urgent = Workspace with urgency hint set -label-urgent = %index% -label-urgent-background = ${colors.alert} -label-urgent-padding = 2 - -; Separator in between workspaces -; label-separator = | - - -[module/mpd] -type = internal/mpd -format-online = - -icon-prev =  -icon-stop =  -icon-play =  -icon-pause =  -icon-next =  - -label-song-maxlen = 25 -label-song-ellipsis = true - -[module/xbacklight] -type = internal/xbacklight - -format =