From 2802cc319dbc6728958b9e103bc3e176ac4cc772 Mon Sep 17 00:00:00 2001 From: Benjamin Palko Date: Fri, 16 Aug 2024 09:22:35 -0400 Subject: [PATCH] flakify --- flake.lock | 48 ++++++++++++++++++++++++++++++++ flake.nix | 33 ++++++++++++++++++++++ nixos/hardware-configuration.nix | 41 +++++++++++++++++++++++++++ nixos/nixos.nix | 2 +- 4 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 nixos/hardware-configuration.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e12e181 --- /dev/null +++ b/flake.lock @@ -0,0 +1,48 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1723399884, + "narHash": "sha256-97wn0ihhGqfMb8WcUgzzkM/TuAxce2Gd20A8oiruju4=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "086f619dd991a4d355c07837448244029fc2d9ab", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1723637854, + "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..a5382c4 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { home-manager, nixpkgs, ... }@inputs: + let + system = "x86_64-linux"; + username = "benjamin"; + hostname = "nixos"; + in + { + # nixos config + nixosConfigurations."${hostname}" = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs; + inherit username; + inherit hostname; + }; + modules = [ + ./nixos/nixos.nix + home-manager.nixosModules.home-manager + { networking.hostName = "${hostname}"; } + ]; + }; + }; +} diff --git a/nixos/hardware-configuration.nix b/nixos/hardware-configuration.nix new file mode 100644 index 0000000..47dbd39 --- /dev/null +++ b/nixos/hardware-configuration.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" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/47f6ac24-4dbc-47d9-bc54-c64509be4e61"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/12CE-A600"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/0355621d-f9ea-485a-8954-d85cd485d475"; } + ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp7s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp6s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nixos/nixos.nix b/nixos/nixos.nix index 06df2bf..9d3df26 100644 --- a/nixos/nixos.nix +++ b/nixos/nixos.nix @@ -9,7 +9,7 @@ in { imports = [ # Generated - /etc/nixos/hardware-configuration.nix + ./hardware-configuration.nix # Custom ./system.nix ./network.nix