commit 9f456fc9aff81606c1d805fbf0b6a575b4250a80
Author: Benjamin Paul <bpaul848@gmail.com>
Date: Sun, 11 Apr 2021 17:49:58 +1000
wtf how is this the initial commit whatever hi
Diffstat:
14 files changed, 565 insertions(+), 0 deletions(-)
diff --git a/flake.lock b/flake.lock
@@ -0,0 +1,90 @@
+{
+ "nodes": {
+ "flake-utils": {
+ "locked": {
+ "lastModified": 1617631617,
+ "narHash": "sha256-PARRCz55qN3gy07VJZIlFeOX420d0nGF0RzGI/9hVlw=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "b2c27d1a81b0dc266270fa8aeecebbd1807fc610",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "home-manager": {
+ "inputs": {
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1617625716,
+ "narHash": "sha256-B36WKNVwtmRk3oqJ9XbOca0iy1Ga1dW6E26iavRFPKQ=",
+ "owner": "nix-community",
+ "repo": "home-manager",
+ "rev": "cc60c22c69e6967b732d02f072a9f1e30454e4f6",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-community",
+ "repo": "home-manager",
+ "type": "github"
+ }
+ },
+ "neovim": {
+ "inputs": {
+ "flake-utils": [
+ "flake-utils"
+ ],
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "dir": "contrib",
+ "lastModified": 1617733324,
+ "narHash": "sha256-lp9VAwyGKUuHyIYNUS7zEqYn6BVCnzcfbxKo+evzgAM=",
+ "owner": "neovim",
+ "repo": "neovim",
+ "rev": "b518b9076f59f3e24e4afb5fb9468b1d5212b1b5",
+ "type": "github"
+ },
+ "original": {
+ "dir": "contrib",
+ "owner": "neovim",
+ "repo": "neovim",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1617636226,
+ "narHash": "sha256-iZhBWrOR2DoDs1C+0FlnM9AQLMol/qoGQ+d+S43CKJM=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "3d1a7716d7f1fccbd7d30ab3b2ed3db831f43bde",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "ref": "nixos-unstable",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "home-manager": "home-manager",
+ "neovim": "neovim",
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
@@ -0,0 +1,37 @@
+{
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
+ flake-utils.url = "github:numtide/flake-utils";
+
+ home-manager = {
+ url = "github:nix-community/home-manager";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ neovim = {
+ url = "github:neovim/neovim?dir=contrib";
+ inputs.nixpkgs.follows = "nixpkgs";
+ inputs.flake-utils.follows = "flake-utils";
+ };
+ };
+
+ outputs = { self, nixpkgs, home-manager, neovim, ... }@inputs:
+ let
+ overlays = [
+ neovim.overlay
+ ];
+ in {
+ nixosConfigurations.laptop = nixpkgs.lib.nixosSystem {
+ system = "x86_64-linux";
+ modules = [
+ ./nixos/laptop/configuration.nix
+ home-manager.nixosModules.home-manager {
+ nixpkgs.overlays = overlays;
+ home-manager.useGlobalPkgs = true;
+ home-manager.useUserPackages = true;
+ home-manager.users.benjamin = import ./home/home.nix;
+ }
+ ];
+ };
+ };
+}
diff --git a/home/alacritty.nix b/home/alacritty.nix
@@ -0,0 +1,25 @@
+{
+ enable = true;
+
+ settings = {
+ font = {
+ size = 9;
+ normal = {
+ family = "Hack";
+ style = "Regular";
+ };
+ bold = {
+ family = "Hack";
+ style = "Bold";
+ };
+ italic = {
+ family = "Hack";
+ style = "Italic";
+ };
+ bold_italic = {
+ family = "Hack";
+ style = "Bold Italic";
+ };
+ };
+ };
+}
diff --git a/home/home.nix b/home/home.nix
@@ -0,0 +1,29 @@
+{ pkgs, ... }:
+
+{
+ home.packages = [
+ # packages
+ pkgs.ccls
+ pkgs.gcc
+ pkgs.i3lock-color
+ pkgs.tree-sitter
+ ];
+
+ programs = {
+ alacritty = import ./alacritty.nix;
+
+ neovim = import ./neovim { inherit pkgs; };
+
+ #polybar = import ./polybar.nix;
+
+ zsh = import ./zsh.nix { inherit pkgs; };
+
+ starship = {
+ enable = true;
+
+ settings = {
+ add_newline = false;
+ };
+ };
+ };
+}
diff --git a/home/neovim/c.lua b/home/neovim/c.lua
@@ -0,0 +1,17 @@
+-- c ftplugin
+
+-- Use tabs instead of spaces for c files
+vim.bo.tabstop = 4
+vim.bo.softtabstop = 0
+vim.bo.shiftwidth = 4
+vim.bo.expandtab = false
+vim.bo.autoindent = true
+vim.o.tabstop = 4
+vim.o.softtabstop = 0
+vim.o.shiftwidth = 4
+vim.o.expandtab = false
+vim.o.autoindent = true
+vim.o.smarttab = true
+
+-- Make the width of a line 79 characters (if you have more it is ugly!)
+vim.bo.textwidth = 79
diff --git a/home/neovim/cpp.lua b/home/neovim/cpp.lua
@@ -0,0 +1,14 @@
+-- cpp ftplugin
+
+-- Use spaces for cpp files
+vim.bo.tabstop = 4
+vim.bo.softtabstop = 4
+vim.bo.shiftwidth = 4
+vim.bo.expandtab = true
+vim.bo.autoindent = true
+vim.o.tabstop = 4
+vim.o.softtabstop = 4
+vim.o.shiftwidth = 4
+vim.o.expandtab = true
+vim.o.autoindent = true
+vim.o.smarttab = true
diff --git a/home/neovim/default.nix b/home/neovim/default.nix
@@ -0,0 +1,31 @@
+{ pkgs, ... }:
+
+{
+ enable = true;
+ package = pkgs.neovim;
+ extraConfig = ''
+ lua << EOF
+ ${builtins.readFile ./init.lua}
+
+ function c()
+ ${builtins.readFile ./c.lua}
+ end
+ function cpp()
+ ${builtins.readFile ./cpp.lua}
+ end
+ function lua()
+ ${builtins.readFile ./lua.lua}
+ end
+ EOF
+ au BufEnter *.c lua c()
+ au BufEnter *.cpp lua cpp()
+ au BufEnter *.lua lua lua()
+ '';
+ plugins = with pkgs.vimPlugins; [
+ { plugin = vim-nix; }
+ { plugin = idris2-vim; }
+ { plugin = gruvbox; config = "colorscheme gruvbox"; }
+ { plugin = nvim-lspconfig; }
+ { plugin = nvim-treesitter; config = "lua require'nvim-treesitter.configs'.setup{highlight={enable=true}}"; }
+ ];
+}
diff --git a/home/neovim/init.lua b/home/neovim/init.lua
@@ -0,0 +1,64 @@
+-- vimrc but lua
+
+-- Set leader to space
+vim.g.mapleader = ' '
+
+-- Line numbers
+-- See :h number_relativenumber
+vim.wo.number = true
+vim.wo.relativenumber = true
+
+-- Tab configuration
+-- See :h tabstop for tab configuration stuff
+vim.bo.tabstop = 4
+vim.bo.softtabstop = 4
+vim.bo.shiftwidth = 4
+vim.bo.expandtab = true
+vim.bo.autoindent = true
+vim.o.tabstop = 4
+vim.o.softtabstop = 4
+vim.o.shiftwidth = 4
+vim.o.expandtab = true
+vim.o.autoindent = true
+vim.o.smarttab = true
+
+-- Ruler shows the line and column number at the bottom right
+vim.o.ruler = true
+
+-- Always show the tab bar for consistency
+vim.o.showtabline = 2
+
+-- Make underscore separated words separate words
+--vim.bo.iskeyword = vim.bo.iskeyword:gsub(",_","")
+--vim.o.iskeyword = vim.o.iskeyword:gsub(",_","")
+
+-- Dont wrap long lines
+vim.wo.wrap = false
+
+-- Dont highlight searches
+vim.o.hlsearch = false
+
+-- Make CTRL-L clear echo and search
+vim.api.nvim_set_keymap('n', '<C-L>', ':noh<CR>:mode<CR>',
+ { noremap = true, silent = true })
+
+-- Make leader+a insert one from the end of the line because semicolon
+vim.api.nvim_set_keymap('n', '<leader>a', '$i',
+ { noremap = true, silent = true })
+-- Make leader+x delete char at the end of the line
+vim.api.nvim_set_keymap('n', '<leader>x', '$x',
+ { noremap = true, silent = true })
+
+-- Make Shift-Delete do nothing (my keyboard is weird)
+vim.api.nvim_set_keymap('i', '<S-Del>', '', { noremap = true, silent = true })
+
+-- Colour column shows the text width of a file
+vim.wo.colorcolumn = vim.wo.colorcolumn .. '+' .. 0
+for i = 1,254 do vim.wo.colorcolumn = vim.wo.colorcolumn .. ',+' .. i end
+
+-- LSP
+
+require('lspconfig').ccls.setup{}
+
+-- Always have the sign column so that code doesnt move around on error
+vim.wo.signcolumn = "yes"
diff --git a/home/neovim/lua.lua b/home/neovim/lua.lua
@@ -0,0 +1,17 @@
+-- lua ftplugin
+
+-- Use spaces for lua files
+vim.bo.tabstop = 4
+vim.bo.softtabstop = 4
+vim.bo.shiftwidth = 4
+vim.bo.expandtab = true
+vim.bo.autoindent = true
+vim.o.tabstop = 4
+vim.o.softtabstop = 4
+vim.o.shiftwidth = 4
+vim.o.expandtab = true
+vim.o.autoindent = true
+vim.o.smarttab = true
+
+-- Make the width of a line 79 characters (if you have more it is ugly!)
+vim.bo.textwidth = 79
diff --git a/home/neovim/settings.vim b/home/neovim/settings.vim
@@ -0,0 +1,25 @@
+" I might comment this later
+
+let mapleader = ' '
+let maplocalleader = '\'
+
+set number relativenumber
+
+set tabstop=4 softtabstop=4 shiftwidth=4 expandtab autoindent smarttab
+
+set ruler
+
+set showtabline=2
+
+set nowrap
+
+set nohlsearch
+
+set signcolumn="yes"
+
+let &colorcolumn="+".join(range(0,254),",+")
+
+nnoremap <C-L> :noh<CR>:mode<CR>
+nnoremap <leader>a $i
+nnoremap <leader>x $x
+inoremap <S-Del> <Nop>
diff --git a/home/polybar.nix b/home/polybar.nix
@@ -0,0 +1,12 @@
+{
+ enable = true;
+
+ script = "polybar bar &";
+
+ settings = {
+ "module/bspwm" = {
+ type="internal/bspwm";
+ # this isnt finished !
+ };
+ };
+}
diff --git a/home/zsh.nix b/home/zsh.nix
@@ -0,0 +1,53 @@
+{ pkgs, ... }:
+
+let editor = "nvim";
+in {
+ enable = true;
+
+ # use starship
+
+ history = {
+ path = ".cache/zsh/history";
+ };
+
+ # use auto-complete
+
+ # bind keys properly for backword or switch to vi mode??
+
+ shellAliases = {
+ ls = "ls --color=auto";
+ l = "ls";
+ la = "ls -la";
+ grep = "grep --color=auto";
+ v = editor;
+ ga = "git add";
+ gc = "git commit";
+ gd = "git diff";
+ gp = "git push";
+ gs = "git status";
+ tmux = "tmux -2";
+ die = "shutdown now";
+ };
+
+ sessionVariables = {
+ EDITOR = "nvim";
+ NIX_PATH = "\$HOME/.nix-defexpr/channels\${NIX_PATH:+:}\$NIX_PATH";
+ TERMINAL = "alacritty";
+ };
+
+ initExtra = ''
+ '';
+
+ plugins = [
+ {
+ name = "zsh-nix-shell";
+ file = "nix-shell.plugin.zsh";
+ src = pkgs.fetchFromGitHub {
+ owner = "chisui";
+ repo = "zsh-nix-shell";
+ rev = "v0.1.0";
+ sha256 = "0snhch9hfy83d4amkyxx33izvkhbwmindy0zjjk28hih1a9l2jmx";
+ };
+ }
+ ];
+}
diff --git a/nixos/laptop/configuration.nix b/nixos/laptop/configuration.nix
@@ -0,0 +1,119 @@
+# Edit this configuration file to define what should be installed on
+# your system. Help is available in the configuration.nix(5) man page
+# and in the NixOS manual (accessible by running ‘nixos-help’).
+
+{ config, pkgs, ... }:
+
+{
+ imports =
+ [ # Include the results of the hardware scan.
+ ./hardware-configuration.nix
+ ];
+
+ nix = {
+ package = pkgs.nixUnstable;
+ extraOptions = ''
+ experimental-features = nix-command flakes
+ '';
+ };
+
+ # Use the GRUB 2 boot loader.
+ boot.loader.grub.enable = true;
+ boot.loader.grub.version = 2;
+ # boot.loader.grub.efiSupport = true;
+ # boot.loader.grub.efiInstallAsRemovable = true;
+ # boot.loader.efi.efiSysMountPoint = "/boot/efi";
+ # Define on which hard drive you want to install Grub.
+ boot.loader.grub.device = "/dev/sda"; # or "nodev" for efi only
+
+ networking.hostName = "computer"; # Define your hostname.
+ #networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
+ networking.networkmanager.enable = true;
+
+ # Set your time zone.
+ time.timeZone = "Australia/Brisbane";
+
+ # The global useDHCP flag is deprecated, therefore explicitly set to false here.
+ # Per-interface useDHCP will be mandatory in the future, so this generated config
+ # replicates the default behaviour.
+ networking.useDHCP = false;
+ networking.interfaces.enp7s0.useDHCP = true;
+ networking.interfaces.wlp6s0.useDHCP = 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";
+ # };
+
+ # Enable the X11 windowing system.
+ services.xserver.enable = true;
+ services.xserver.libinput.enable = true;
+ services.xserver.videoDrivers = [ "modesetting" ];
+ services.xserver.useGlamor = true;
+ services.xserver.displayManager.startx.enable = true;
+
+ # Configure keymap in X11
+ # services.xserver.layout = "us";
+ # services.xserver.xkbOptions = "eurosign:e";
+
+ # Enable CUPS to print documents.
+ # services.printing.enable = true;
+
+ # Enable sound.
+ sound.enable = true;
+ hardware.pulseaudio.enable = true;
+
+ # Enable zsh
+ programs.zsh.enable = true;
+
+ # Define a user account. Don't forget to set a password with ‘passwd’.
+ users.users.benjamin = {
+ isNormalUser = true;
+ shell = pkgs.zsh;
+ extraGroups = [ "audio" "networkmanager" "usb" "user" "video" "wheel" ]; # Enable ‘sudo’ for the user.
+ };
+ users.users.root.initialHashedPassword = "";
+
+ # List packages installed in system profile. To search, run:
+ # $ nix search wget
+ environment.systemPackages = with pkgs; [
+ zsh
+ bspwm
+ sxhkd
+ ];
+
+ # Some programs need SUID wrappers, can be configured further or are
+ # started in user sessions.
+ # programs.mtr.enable = true;
+ # programs.gnupg.agent = {
+ # enable = true;
+ # enableSSHSupport = true;
+ # };
+
+ # List services that you want to enable:
+
+ # 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;
+
+ # 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 = "20.09"; # Did you read the comment?
+
+}
+
diff --git a/nixos/laptop/hardware-configuration.nix b/nixos/laptop/hardware-configuration.nix
@@ -0,0 +1,32 @@
+# Do not modify this file! It was generated by ‘nixos-generate-config’
+# and may be overwritten by future invocations. Please make changes
+# to /etc/nixos/configuration.nix instead.
+{ config, lib, pkgs, modulesPath, ... }:
+
+{
+ imports = [ ];
+
+ boot.initrd.availableKernelModules = [ "ahci" ];
+ boot.initrd.kernelModules = [ ];
+ boot.kernelModules = [ "kvm-intel" ];
+ boot.extraModulePackages = [ ];
+
+ fileSystems."/" =
+ { device = "/dev/disk/by-uuid/1f48f06c-0b18-4873-bba3-d5fd27c1e61e";
+ fsType = "ext4";
+ };
+
+ fileSystems."/boot" =
+ { device = "/dev/disk/by-uuid/9acb548b-d7b0-45c6-bf2e-39476d46b8be";
+ fsType = "ext4";
+ };
+
+ fileSystems."/home" =
+ { device = "/dev/disk/by-uuid/682fecaa-c686-43c3-867e-0fa904205eb0";
+ fsType = "ext4";
+ };
+
+ swapDevices = [ ];
+
+ powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
+}