aboutsummaryrefslogtreecommitdiff
path: root/nixos
diff options
context:
space:
mode:
Diffstat (limited to 'nixos')
-rw-r--r--nixos/configurations/alpha.nix112
-rw-r--r--nixos/configurations/default.nix5
-rw-r--r--nixos/configurations/hardware/alpha.nix55
-rw-r--r--nixos/modules/cachix/caches/nix-community.nix12
-rw-r--r--nixos/modules/cachix/default.nix13
-rw-r--r--nixos/modules/default.nix5
-rw-r--r--nixos/modules/flake.nix12
-rw-r--r--nixos/modules/nix.nix34
8 files changed, 248 insertions, 0 deletions
diff --git a/nixos/configurations/alpha.nix b/nixos/configurations/alpha.nix
new file mode 100644
index 0000000..27e8ceb
--- /dev/null
+++ b/nixos/configurations/alpha.nix
@@ -0,0 +1,112 @@
+{ config, pkgs, lib, ...}:
+
+{
+ imports = [];
+
+ security.chromiumSuidSandbox.enable = true;
+
+ boot.kernelPackages = pkgs.linuxPackages_xanmod;
+ # GRUB bootloader
+ boot.loader.efi.canTouchEfiVariables = true;
+ boot.loader.grub = {
+ enable = true;
+ version = 2;
+
+ efiSupport = true;
+ configurationLimit = 10;
+ device = "nodev";
+ useOSProber = true;
+ # device = "/dev/disk/by-uuid/7905-2E41";
+ extraEntries = ''
+ menuentry "Reboot" {
+ reboot
+ }
+ menuentry "Shutdown" {
+ halt
+ }
+ '';
+ };
+
+ networking.networkmanager.enable = true;
+ networking.useDHCP = false;
+ networking.firewall.enable = true;
+
+ i18n.defaultLocale = "en_US.UTF-8";
+ i18n.inputMethod.enabled = "kime";
+
+ console.font = "Lat2-Terminus16";
+ console.keyMap = "us";
+
+ time.timeZone = "Asia/Seoul";
+
+ environment.systemPackages = with pkgs; [ ];
+
+ services.openssh.enable = true;
+
+ sound.enable = true;
+ hardware.pulseaudio = {
+ enable = true;
+ package = pkgs.pulseaudioFull;
+ };
+
+ hardware.bluetooth.enable = true;
+
+ services.greetd = {
+ enable = true;
+
+ settings.default_session.command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway";
+ };
+
+ programs = {
+ sway = {
+ enable = true;
+ wrapperFeatures.gtk = true;
+
+ extraPackages = with pkgs; [
+ autotiling
+ alacritty
+ swaylock
+ swayidle
+ swaybg
+ wayland-utils
+ wl-clipboard
+ grim
+ slurp
+ sway-contrib.grimshot
+ waybar
+ bemenu
+ qt5.qtwayland
+ xdg_utils
+ ];
+ };
+
+ zsh.enable = true;
+ zsh.enableCompletion = false;
+ };
+
+ hardware.opengl.enable = true;
+ hardware.opengl.driSupport32Bit = true;
+ hardware.opengl.extraPackages = with pkgs; [ vaapiVdpau libvdpau-va-gl ];
+
+ virtualisation.libvirtd.enable = true;
+
+ users.users = {
+ boopy = {
+ isNormalUser = true;
+ shell = pkgs.zsh;
+
+ extraGroups = [
+ "wheel"
+ "audio"
+ "networkmanager"
+ "libvirtd"
+ ];
+ };
+ };
+
+ # This value determines the NixOS release with which your system is to be
+ # compatible, in order to avoid breaking some software such as database
+ # servers. You should change this only after NixOS release notes say you
+ # should.
+ system.stateVersion = "22.05"; # Did you read the comment?
+}
diff --git a/nixos/configurations/default.nix b/nixos/configurations/default.nix
new file mode 100644
index 0000000..8b84279
--- /dev/null
+++ b/nixos/configurations/default.nix
@@ -0,0 +1,5 @@
+{ self, nixpkgs, ... } @ inputs:
+
+{
+ alpha = self.lib.mkSystem "alpha" nixpkgs;
+}
diff --git a/nixos/configurations/hardware/alpha.nix b/nixos/configurations/hardware/alpha.nix
new file mode 100644
index 0000000..e8d3e17
--- /dev/null
+++ b/nixos/configurations/hardware/alpha.nix
@@ -0,0 +1,55 @@
+{ config, lib, pkgs, ... }:
+
+let
+ espDev = "/dev/disk/by-uuid/7905-2E41";
+ btrfsDev = "/dev/disk/by-uuid/dc47a0a6-3c73-45c1-951c-40032e762180";
+ swapDev = "/dev/disk/by-uuid/4a74b247-99e9-42c7-9a86-75aea964bb85";
+ dataDev = "/dev/disk/by-uuid/fe7a00a8-0a3c-48de-9d7a-ed7cf172f501";
+
+ subvolume = name: {
+ device = btrfsDev;
+ fsType = "btrfs";
+ options = [ "subvol=${name}" "compress=zstd" "noatime" ];
+ };
+in
+{
+ boot.initrd.availableKernelModules = [ "xhci-pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
+ boot.initrd.kernelModules = [ ];
+ boot.kernelModules = [ "kvm-amd" ];
+ boot.extraModulePackages = [ ];
+
+ hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
+ hardware.enableRedistributableFirmware = true;
+
+ fileSystems."/" = subvolume "root";
+ fileSystems."/home" = subvolume "home";
+ fileSystems."/nix" = subvolume "nix";
+ fileSystems."/persist" = subvolume "persist";
+ fileSystems."/var/log" = {
+ device = btrfsDev;
+ fsType = "btrfs";
+ options = [ "subvol=log" "compress=zstd" "noatime" ];
+ neededForBoot = true;
+ };
+
+ fileSystems."/boot" = {
+ device = espDev;
+ fsType = "vfat";
+ };
+
+ fileSystems."/data" = {
+ device = dataDev;
+ fsType = "ext4";
+ };
+
+ fileSystems."/tmp" = {
+ fsType = "tmpfs";
+ device = "tmpfs";
+ options = [ "nosuid" "nodev" "relatime" "size=14G" ];
+ };
+
+ swapDevices = [{ device = swapDev; }];
+
+ nix.maxJobs = lib.mkDefault 4;
+ powerManagement.cpuFreqGovernor = lib.mkDefault "schedutil";
+}
diff --git a/nixos/modules/cachix/caches/nix-community.nix b/nixos/modules/cachix/caches/nix-community.nix
new file mode 100644
index 0000000..2b4c408
--- /dev/null
+++ b/nixos/modules/cachix/caches/nix-community.nix
@@ -0,0 +1,12 @@
+{ config, lib, ... }:
+
+{
+ nix = {
+ binaryCaches = [
+ "https://nix-community.cachix.org"
+ ];
+ binaryCachePublicKeys = [
+ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
+ ];
+ };
+}
diff --git a/nixos/modules/cachix/default.nix b/nixos/modules/cachix/default.nix
new file mode 100644
index 0000000..38ad575
--- /dev/null
+++ b/nixos/modules/cachix/default.nix
@@ -0,0 +1,13 @@
+{ config, pkgs, lib, ... }:
+let
+ folder = ./caches;
+ toImport = name: value: folder + ("/" + name);
+ filterCaches = key: value: value == "regular" && lib.hasSuffix ".nix" key;
+ imports = lib.mapAttrsToList toImport (lib.filterAttrs filterCaches (builtins.readDir folder));
+in
+{
+ inherit imports;
+ nix.binaryCaches = [ "https://cache.nixos.org/" ];
+
+ environment.systemPackages = [ pkgs.cachix ];
+}
diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix
new file mode 100644
index 0000000..f17f392
--- /dev/null
+++ b/nixos/modules/default.nix
@@ -0,0 +1,5 @@
+{
+ cachix = import ./cachix;
+ flake = import ./flake.nix;
+ nix = import ./nix.nix;
+}
diff --git a/nixos/modules/flake.nix b/nixos/modules/flake.nix
new file mode 100644
index 0000000..a88f9d0
--- /dev/null
+++ b/nixos/modules/flake.nix
@@ -0,0 +1,12 @@
+{ config, pkgs, lib, ... }:
+
+{
+ options.nix.flakes.enable = lib.mkEnableOption "nix flakes";
+
+ config = lib.mkIf config.nix.flakes.enable {
+ nix = {
+ package = pkgs.nixUnstable;
+ experimentalFeatures = "nix-command flakes";
+ };
+ };
+}
diff --git a/nixos/modules/nix.nix b/nixos/modules/nix.nix
new file mode 100644
index 0000000..04fafac
--- /dev/null
+++ b/nixos/modules/nix.nix
@@ -0,0 +1,34 @@
+{ config, lib, ... }:
+
+let
+ allowed = config.nix.allowedUnfree;
+in
+{
+ options.nix = {
+ experimentalFeatures = lib.mkOption {
+ type = lib.types.separatedString " ";
+ default = "";
+ description = ''
+ Enables experimental features
+ '';
+ };
+
+ allowedUnfree = lib.mkOption {
+ type = lib.types.listOf lib.types.string;
+ default = [ ];
+ description = ''
+ Allows for unfree packages by their name.
+ '';
+ };
+ };
+
+ config = lib.mkMerge [
+ (lib.mkIf (config.nix.experimentalFeatures != "") { nix.extraOptions = "experimental-features = ${config.nix.experimentalFeatures}"; })
+ (lib.mkIf (allowed != [ ]) { nixpkgs.config.allowUnfreePredicate = (pkg: __elem (lib.getName pkg) allowed); })
+ { nix.autoOptimiseStore = lib.mkDefault true; }
+ {
+ nix.gc.automatic = lib.mkDefault true;
+ nix.gc.options = lib.mkDefault "--delete-older-than 10d";
+ }
+ ];
+}