From 1f872a4253ffd889e488dea47e60a2e6b8c83bb2 Mon Sep 17 00:00:00 2001 From: Ivan Dimitrov Date: Mon, 7 Aug 2023 11:19:48 +0300 Subject: [PATCH] moving to flake config --- .gitignore | 1 - flake.lock | 47 +++++++++++++++++++ flake.nix | 27 +++++++++++ hardware-configuration.nix | 38 +++++++++++++++ {cfg => home/cfg}/nvim/init.lua | 0 {cfg => home/cfg}/sway/config | 0 home.nix => home/laptop.nix | 2 +- .../laptop/configuration.nix | 7 +-- sys/laptop/default.nix | 11 +++++ 9 files changed, 125 insertions(+), 8 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hardware-configuration.nix rename {cfg => home/cfg}/nvim/init.lua (100%) rename {cfg => home/cfg}/sway/config (100%) rename home.nix => home/laptop.nix (99%) rename configuration.nix => sys/laptop/configuration.nix (95%) create mode 100644 sys/laptop/default.nix diff --git a/.gitignore b/.gitignore index 577b0a0..e69de29 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +0,0 @@ -hardware-configuration.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..a3f2ee7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,47 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1691312444, + "narHash": "sha256-J9e9dGwAPTX+UlAn8jehoyaEq6fwK+L+gunfx0cYT4E=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "903e06d734bcae48efb79b9afd51b406d2744179", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1691368598, + "narHash": "sha256-ia7li22keBBbj02tEdqjVeLtc7ZlSBuhUk+7XTUFr14=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5a8e9243812ba528000995b294292d3b5e120947", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-unstable", + "type": "indirect" + } + }, + "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..d8347e6 --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + inputs = { + nixpkgs.url = "nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager, ... }: { + nixosConfigurations = { + laptop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./sys/laptop + ]; + }; + }; + homeConfigurations = { + ivand = home-manager.lib.homeManagerConfiguration { + modules = [ ./home/laptop.nix ]; + pkgs = import nixpkgs { system = "x86_64-linux"; }; + }; + }; + }; +} + diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..e0e169e --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,38 @@ +# 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" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/sda1"; + fsType = "btrfs"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/D76B-0BB3"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # 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.enp2s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/cfg/nvim/init.lua b/home/cfg/nvim/init.lua similarity index 100% rename from cfg/nvim/init.lua rename to home/cfg/nvim/init.lua diff --git a/cfg/sway/config b/home/cfg/sway/config similarity index 100% rename from cfg/sway/config rename to home/cfg/sway/config diff --git a/home.nix b/home/laptop.nix similarity index 99% rename from home.nix rename to home/laptop.nix index 7ac7bd9..8665e6f 100644 --- a/home.nix +++ b/home/laptop.nix @@ -109,7 +109,7 @@ }; zsh = { enable = true; - enableSyntaxHighlighting = true; + syntaxHighlighting.enable = true; enableAutosuggestions = true; loginExtra = '' [ "$(tty)" = "/dev/tty1" ] && exec sway diff --git a/configuration.nix b/sys/laptop/configuration.nix similarity index 95% rename from configuration.nix rename to sys/laptop/configuration.nix index 890ec20..46cb96b 100644 --- a/configuration.nix +++ b/sys/laptop/configuration.nix @@ -2,11 +2,6 @@ , pkgs , ... }: { - imports = [ - ./hardware-configuration.nix - - ]; - system.stateVersion = "23.05"; nix = { @@ -54,7 +49,7 @@ time.timeZone = "Europe/Sofia"; - fonts.fonts = with pkgs; [ nerdfonts ]; + fonts.packages = with pkgs; [ nerdfonts ]; environment = { systemPackages = with pkgs; [ diff --git a/sys/laptop/default.nix b/sys/laptop/default.nix new file mode 100644 index 0000000..7f9699c --- /dev/null +++ b/sys/laptop/default.nix @@ -0,0 +1,11 @@ +{ config, pkgs, ... }: + +{ + imports = + [ + ./configuration.nix + ../../hardware-configuration.nix + ]; +} + +