From 7744ecfaacc668d75ac0d4d458d95e7d549a826f Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Thu, 10 Jun 2021 15:34:49 +0700 Subject: Set up NixOS --- nix/etc/nixos/awesome.nix | 39 +++++++++++++++ nix/etc/nixos/configuration.nix | 85 ++++++++++++++++++++++++++++++++ nix/etc/nixos/devel.nix | 23 +++++++++ nix/etc/nixos/games.nix | 19 +++++++ nix/etc/nixos/hardware-configuration.nix | 43 ++++++++++++++++ 5 files changed, 209 insertions(+) create mode 100644 nix/etc/nixos/awesome.nix create mode 100644 nix/etc/nixos/configuration.nix create mode 100644 nix/etc/nixos/devel.nix create mode 100644 nix/etc/nixos/games.nix create mode 100644 nix/etc/nixos/hardware-configuration.nix (limited to 'nix') diff --git a/nix/etc/nixos/awesome.nix b/nix/etc/nixos/awesome.nix new file mode 100644 index 0000000..25e639e --- /dev/null +++ b/nix/etc/nixos/awesome.nix @@ -0,0 +1,39 @@ +{ pkgs, ... }: + +{ + imports = [ ./redshift.nix ]; + + fonts.fonts = with pkgs; [ lmodern ]; + + services = { + autorandr.enable = true; + xserver = { + enable = true; + displayManager.startx.enable = true; + windowManager.awesome.enable = true; + + layout = "us"; + xkbOptions = "caps:ctrl_modifier,compose:menu"; + libinput.enable = true; # Enable touchpad support. + }; + }; + + i18n = { + defaultLocale = "en_US.UTF-8"; + inputMethod = { + enabled = "ibus"; + ibus.engines = with pkgs.ibus-engines; [ table table-others ]; + }; + }; + + environment.systemPackages = with pkgs; [ + gnome.adwaita-icon-theme qt5ct + gnome.networkmanagerapplet mate.mate-power-manager playerctl pulsemixer + rxvt_unicode-with-plugins urxvt_autocomplete_all_the_things urxvt_font_size + aerc amfora autocutsel firefox keynav newsboat ranger + arandr audacious gimp scrot vim_configurable + ]; + + programs.nm-applet.enable = true; + programs.slock.enable = true; +} diff --git a/nix/etc/nixos/configuration.nix b/nix/etc/nixos/configuration.nix new file mode 100644 index 0000000..7e6e108 --- /dev/null +++ b/nix/etc/nixos/configuration.nix @@ -0,0 +1,85 @@ +# Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running 'nixos-help'). + +{ config, pkgs, ... }: + +{ + imports = [ + ./hardware-configuration.nix + ./awesome.nix + ./devel.nix + ./games.nix + ]; + + # Use the systemd-boot EFI boot loader. + boot.loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + grub.useOSProber = true; + }; + + networking = { + hostName = "nix"; + networkmanager.enable = true; + + # 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. + useDHCP = false; + interfaces.enp1s0.useDHCP = true; + interfaces.wlp2s0.useDHCP = true; + + # Configure network proxy if necessary + # proxy.default = "http://user:password@proxy:port/"; + # proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Open ports in the firewall. + # firewall.allowedTCPPorts = [ ... ]; + # firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # firewall.enable = false; + }; + + # Set your time zone. + time.timeZone = "Asia/Ho_Chi_Minh"; + + # Select internationalisation properties. + # console = { + # font = "Lat2-Terminus16"; + # keyMap = "us"; + # }; + + users.users.sea = { + isNormalUser = true; + extraGroups = [ "networkmanager" "wheel" ]; + }; + + environment.systemPackages = with pkgs; [ + htop isync killall oathToolkit rsync stow w3m wget + ffmpeg mpv pavucontrol pqiv + ]; + + # List services that you want to enable: + services.printing.enable = true; + + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + jack.enable = true; + + # Use the example session manager (no others are packaged yet so this is + # enabled by default, no need to redefine it in your config for now) + # media-session.enable = 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 = "21.05"; # Did you read the comment? +} diff --git a/nix/etc/nixos/devel.nix b/nix/etc/nixos/devel.nix new file mode 100644 index 0000000..86c842c --- /dev/null +++ b/nix/etc/nixos/devel.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + exa fd git ripgrep + clojure guile leiningen python3 rakudo zig + texlive.combined.scheme-tetex + ]; + + programs.mtr.enable = true; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + services = { + # openssh.enable = true; + ipfs = { + enable = true; + dataDir = "/data/IPFS"; + }; + }; +} diff --git a/nix/etc/nixos/games.nix b/nix/etc/nixos/games.nix new file mode 100644 index 0000000..3a48dc4 --- /dev/null +++ b/nix/etc/nixos/games.nix @@ -0,0 +1,19 @@ +{ config, pkgs, ... }: + +{ + nixpkgs.config.allowUnfree = true; + + environment.systemPackages = with pkgs; [ + _20kly hedgewars globulation2 scorched3d teeworlds # strategy + astromenace chromium-bsu # scrolling + azimuth cdogs-sdl taisei # shmup + bastet moon-buggy n2048 # text + blackshades redeclipse warsow xonotic-glx # fps + blobwars openclonk sienna superTux # platformer + bonzomatic # edu + extremetuxracer gl117 gltron superTuxKart # vehicle + flare freedroidrpg hyperrogue # slash + frozen-bubble gnujump gtetrinet pinball xbill # coffeebreak + neverball orthorobot trackballs # puzzle + ]; +} diff --git a/nix/etc/nixos/hardware-configuration.nix b/nix/etc/nixos/hardware-configuration.nix new file mode 100644 index 0000000..9ac7c6c --- /dev/null +++ b/nix/etc/nixos/hardware-configuration.nix @@ -0,0 +1,43 @@ +# 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" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems = { + "/" = { + device = "/dev/disk/by-uuid/34058769-4280-4374-ad92-259554380a9e"; + fsType = "ext4"; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/8EB8-6EDD"; + fsType = "vfat"; + }; + + "/home" = { + device = "/dev/disk/by-uuid/69991f9d-8fec-4b32-8e3e-83d6a2c64257"; + fsType = "ext4"; + }; + + "/data" = { + device = "/dev/disk/by-uuid/02594f2b-d681-49fc-8f4a-0616d44c8987"; + fsType = "ext4"; + }; + }; + + swapDevices = [ + { device = "/dev/disk/by-uuid/6f45a147-3b44-4eb9-8ac3-2201e80cff5e"; } + ]; + + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; +} -- cgit 1.4.1