diff --git a/nix/flake.lock b/nix/flake.lock new file mode 100644 index 0000000..c6fbe93 --- /dev/null +++ b/nix/flake.lock @@ -0,0 +1,82 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1609010567, + "narHash": "sha256-N6WslRAtrvCPCpQnxQqo+VlSivX/KylL9Xy/OZr0kMg=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "22f6736e628958f05222ddaadd7df7818fe8f59d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-20.09", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1610779893, + "narHash": "sha256-dAKlewu9L3C4ZCWgS1UVtk2gYJI42ZeUdcezfbXvSdw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1eff582e7ea6dcb208127ad369e231eaaf6fa378", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-20.09", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-master": { + "locked": { + "lastModified": 1610831355, + "narHash": "sha256-5MM+YvTkLyWEBxlKALvs6EmSE74wDUhVreO2fyxudDY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "feb775d1c87b52b122db203e21341794f2044f84", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1610219734, + "narHash": "sha256-hCsGe2nDz+SX4uO+lj0qPVcSGZdt52R9Yk5MOYs4djw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "257cbbcd3ab7bd96f5d24d50adc807de7c82e06d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-master": "nixpkgs-master", + "nixpkgs-unstable": "nixpkgs-unstable" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/flake.nix b/nix/flake.nix new file mode 100644 index 0000000..9e12260 --- /dev/null +++ b/nix/flake.nix @@ -0,0 +1,62 @@ +{ + inputs = { + home-manager = { + url = "github:nix-community/home-manager/release-20.09"; + inputs.nixpkgs.follows = "/nixpkgs"; + }; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.09"; + nixpkgs-master.url = "github:NixOS/nixpkgs"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = { self, home-manager, nixpkgs, nixpkgs-master, nixpkgs-unstable }: { + nixosConfigurations = let + defaultModules = [ + home-manager.nixosModules.home-manager + ./modules/g810-led.nix + # ./main/fonts.nix + # ./main/general.nix + # ./main/hardware.nix + # ./main/kernel.nix + # ./main/misc.nix + # ./main/networking.nix + # ./main/packages.nix + # ./main/printing.nix + # ./main/services.nix + # ./main/terminal.nix + + ({ config, lib, lib', ... }: { + config = { + _module.args = { + lib' = lib // import ./lib { inherit config lib; }; + master = lib'.pkgsImport nixpkgs-master; + unstable = lib'.pkgsImport nixpkgs-unstable; + }; + + nix.registry = { + nixpkgs.flake = nixpkgs; + nixpkgs-unstable.flake = nixpkgs-unstable; + }; + + nixpkgs.overlays = [ (import ./overlays) ]; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.dave.imports = [ ./home/default.nix ]; + }; + }; + }) + ]; + in { + hephaestus = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./machines/hephaestus/configuration.nix + ./machines/hephaestus/hardware.nix + ] ++ defaultModules; + }; + }; + }; +} + diff --git a/nix/home.nix b/nix/home/default.nix similarity index 99% rename from nix/home.nix rename to nix/home/default.nix index e893c86..935ccf0 100644 --- a/nix/home.nix +++ b/nix/home/default.nix @@ -1,7 +1,7 @@ { pkgs, ... }: { - nixpkgs.overlays = import ./overlays { inherit pkgs; }; + nixpkgs.overlays = import ../overlays { inherit pkgs; }; nixpkgs.config.allowUnfree = true; home = { diff --git a/nix/packages.nix b/nix/home/packages.nix similarity index 100% rename from nix/packages.nix rename to nix/home/packages.nix diff --git a/nix/machines/hephaestus/configuration.nix b/nix/machines/hephaestus/configuration.nix new file mode 100644 index 0000000..9234edd --- /dev/null +++ b/nix/machines/hephaestus/configuration.nix @@ -0,0 +1,88 @@ +{ config, pkgs, ... }: + +{ + imports = [ ./hardware.nix ]; + + nixpkgs.config.allowUnfree = true; + + nix = { + package = pkgs.nixFlakes; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.kernelPackages = pkgs.linuxPackages_latest; + + networking.hostName = "hephaestus"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Set your time zone. + time.timeZone = "America/Toronto"; + + # 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.enp34s0.useDHCP = true; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; + keyMap = "us"; + }; + + # Enable the GNOME 3 Desktop Environment. + services.xserver.enable = true; + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome3.enable = true; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound. + sound.enable = true; + + # Enable 32bit for steam + hardware.pulseaudio.enable = true; + hardware.opengl.driSupport32Bit = true; + hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ libva ]; + hardware.pulseaudio.support32Bit = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.dave = { + isNormalUser = true; + extraGroups = [ "wheel" "docker" ]; + shell = pkgs.zsh; + }; + + environment.systemPackages = with pkgs; [ gnome3.gnome-tweaks ]; + + virtualisation.docker.enable = true; + + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + + # Open ports in the firewall. + networking.firewall.enable = true; + + system.stateVersion = "unstable"; + system.autoUpgrade.enable = true; + + # systemd.services.g810-led = { + # description = "Set Logitech G810 Led Profile"; + # serviceConfig = { + # ExecStart = "${pkgs.g810-led}/bin/g810-led -p /etc/g610-led/profile"; + # Type = "oneshot"; + # }; + # wantedBy = [ "multi-user.target" ]; + # }; + +} + diff --git a/nix/machines/hephaestus/hardware.nix b/nix/machines/hephaestus/hardware.nix new file mode 100644 index 0000000..5f20a61 --- /dev/null +++ b/nix/machines/hephaestus/hardware.nix @@ -0,0 +1,41 @@ +# 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 = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/d3079c84-11b2-4c2b-bf9e-5a067854a21d"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/CEF0-328B"; + fsType = "vfat"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/39a775f9-e5b8-4029-875a-1df6d99cad5c"; } + ]; + + # high-resolution display + hardware.video.hidpi.enable = lib.mkDefault true; + + # Enable g810-led and set profile. + # hardware.g810-led.enable = true; + # hardware.g810-led.profile = builtins.toFile "g610-led-profile" '' + # a ff3000 # Set all keys to orange-red. + # c # Commit changes. + # ''; + + +} diff --git a/nix/nixos-rebuild b/nix/nixos-rebuild new file mode 100755 index 0000000..79b57a2 --- /dev/null +++ b/nix/nixos-rebuild @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +cd "$(dirname "$0")" +exec nixos-rebuild -I nixos-config=machines/$(hostname)/configuration.nix "$@"