diff --git a/configuration.nix b/configuration.nix index 9a9342d..0b4308a 100644 --- a/configuration.nix +++ b/configuration.nix @@ -4,7 +4,6 @@ # Kernel configuration boot = { kernelPackages = pkgs.linuxPackages_latest; - # TODO Add resume_offset kernelParams = [ "zfs.zfs_arc_max=536870912" ]; kernelModules = [ "i915" "acpi_call" ]; extraModulePackages = with config.boot.kernelPackages; [ acpi_call ]; @@ -64,13 +63,17 @@ # Enable the TLP daemon services.tlp.enable = true; - # Add a swap file and resume from it - swapDevices = [ { device = "/swap"; size = 8192; } ]; - boot.resumeDevice = "/swap"; - # NixOS version system.stateVersion = "20.09"; + # Create coolneng user + users.users.coolneng = { + isNormalUser = true; + home = "/home/coolneng"; + extraGroups = [ "wheel" "video" "audio" ]; + shell = "/run/current-system/sw/bin/fish"; + }; + # Import other configuration modules imports = [ ./modules/software.nix @@ -78,6 +81,8 @@ ./modules/gui.nix ./modules/datasync.nix ./modules/audio.nix + ./modules/home.nix + ./modules/hardware-configuration.nix ]; } diff --git a/modules/audio.nix b/modules/audio.nix new file mode 100644 index 0000000..48411ca --- /dev/null +++ b/modules/audio.nix @@ -0,0 +1,15 @@ +{ config, lib, pkgs, ... }: + +{ + # Enable ALSA + sound.enable = true; + + # Configure PulseAudio with mopidy tweaks + hardware.pulseaudio = { + enable = true; + tcp = { + enable = true; + anonymousClients.allowedIpRanges = [ "127.0.0.1" ]; + }; + }; +} diff --git a/modules/datasync.nix b/modules/datasync.nix index 477a85d..36d874c 100644 --- a/modules/datasync.nix +++ b/modules/datasync.nix @@ -19,6 +19,7 @@ dataset = "syscea/root"; }; }; + "syscea/state/home" = { plan = "1d=>1h,1m=>1d,1y=>1m"; recursive = true; diff --git a/modules/gui.nix b/modules/gui.nix index bd6c684..1443753 100644 --- a/modules/gui.nix +++ b/modules/gui.nix @@ -2,11 +2,12 @@ { # Display manager + services.xserver.enable = true; services.xserver.displayManager = { defaultSession = "sway"; sddm = { enable = true; - autologin = { + autoLogin = { enable = true; user = "coolneng"; }; @@ -47,9 +48,13 @@ enable = true; temperature = { day = 6500; - night = 5500; + night = 5000; }; }; + location = { + latitude = 35.89; + longitude = -5.32; + }; # Bar programs.waybar.enable = true; diff --git a/modules/hardware-configuration.nix b/modules/hardware-configuration.nix new file mode 100644 index 0000000..add1167 --- /dev/null +++ b/modules/hardware-configuration.nix @@ -0,0 +1,46 @@ +# 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 = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "syscea/stateful/root"; + fsType = "zfs"; + }; + + fileSystems."/nix" = + { device = "syscea/ephemeral/nix"; + fsType = "zfs"; + }; + + fileSystems."/tmp" = + { device = "syscea/ephemeral/tmp"; + fsType = "zfs"; + }; + + fileSystems."/home" = + { device = "syscea/stateful/home"; + fsType = "zfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/4AED-6F54"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/29d26e6a-b421-41c3-9826-76e4da00e3bb"; } + ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} diff --git a/modules/home.nix b/modules/home.nix new file mode 100644 index 0000000..138f336 --- /dev/null +++ b/modules/home.nix @@ -0,0 +1,111 @@ +{ config, lib, pkgs, ... }: + +# Doom emacs overlay +let + +doom-emacs = pkgs.callPackage (builtins.fetchTarball { + url = https://github.com/vlaci/nix-doom-emacs/archive/master.tar.gz; +}) { + doomPrivateDir = ./doom.d; +}; + +in + +{ + # User packages + home.packages = [ + # Text editors + doom-emacs + pkgs.neovim + # Terminals + pkgs.tmux + pkgs.tmuxp + # Development + pkgs.git + pkgs.direnv + pkgs.lorri + ]; + + # Enable home manager + programs.home-manager.enable = true; + + # Terminal emulator + programs.kitty = { + enable = true; + font.name = "Go Mono 11"; + settings = { + repaint_delay = 30; + input_delay = 10; + enable_audio_bell = false; + foreground = "#c6c8d1"; + background = "#161821"; + color0 = "#161821"; + color8 = "#6b7089"; + color1 = "#e27878"; + color9 = "#e98989"; + color2 = "#b4be82"; + color10= "#c0ca8e"; + color3 = "#e2a478"; + color11= "#e9b189"; + color4 = "#84a0c6"; + color12= "#91acd1"; + color5 = "#a093c7"; + color13= "#ada0d3"; + color6 = "#89b8c2"; + color14= "#95c4ce"; + color7 = "#c6c8d1"; + color15= "#d2d4de"; + }; + }; + + # Shell + home.sessionVariables = { + # fff colors [0-9] + FFF_COL1 = 4; + FFF_COL2 = 8; + # fff favourites; + FFF_FAV1 = "$HOME/Documents/Uni"; + FFF_FAV2 = "$HOME/Documents/Papers"; + FFF_FAV3 = "$HOME/Documents/Books/Academic"; + FFF_FAV4 = "$HOME/Documents/Education"; + }; + + programs.fish = { + enable = true; + shellAbbrs = { + la = "ls -lA"; + f = "fff"; + vim = "nvim"; + }; + shellAliases = { + wlan = "iw dev wlp2s0 scan | grep SSID"; + bc = "bc -l"; + docker = "podman"; + docker-compose = "podman-compose"; + }; + plugins = [ + { + name = "colored-man"; + src = builtins.fetchGit { + name = "fish-colored-man"; + url = "https://github.com/decors/fish-colored-man"; + rev = "c1e9db7765c932587b795d6c8965e9cff2fd849a"; + }; + } + + { + name = "prompt-theme"; + src = builtins.fetchGit { + name = "fish-colored-man"; + url = "https://github.com/oh-my-fish/theme-nai"; + rev = "9616e644e95fe79eb59b8c9d77fe44b9f096db2f"; + }; + } + ]; + }; + + # Emacs startup + home.file.".emacs.d/init.el".text = '' + (load "default.el") + ''; +} diff --git a/modules/software.nix b/modules/software.nix index 6356393..4d8645e 100644 --- a/modules/software.nix +++ b/modules/software.nix @@ -12,9 +12,10 @@ firefox chromium # LaTeX - texlive.combind.scheme-full + texlive.combined.scheme-full pandoc - pandoc-citeproc + # Declarative user config + home-manager ]; # Fonts declaration @@ -24,7 +25,6 @@ siji cherry iosevka - emacs.all-the-icons-fonts ]; };