From e0b88992f574747085d0ec1da55f35819a61c17b Mon Sep 17 00:00:00 2001 From: CDaut Date: Fri, 23 Feb 2024 00:18:39 +0100 Subject: [PATCH] initial nix setum with Nina :3 --- configuration.nix | 95 +++++++++++++++++++++++++++++++++++ flake.nix | 21 ++++++++ git.nix | 7 +++ home.nix | 47 +++++++++++++++++ vm_hardware-configuration.nix | 31 ++++++++++++ vscode.nix | 11 ++++ 6 files changed, 212 insertions(+) create mode 100644 configuration.nix create mode 100644 flake.nix create mode 100644 git.nix create mode 100644 home.nix create mode 100644 vm_hardware-configuration.nix create mode 100644 vscode.nix diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..f05b84a --- /dev/null +++ b/configuration.nix @@ -0,0 +1,95 @@ +{ config, pkgs, ... }: + +{ + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; + + imports = + [ # Include the results of the hardware scan. + ./vm_hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/sda"; + boot.loader.grub.useOSProber = true; + + networking.hostName = "nixpad"; # Define your hostname. + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + time.timeZone = "Europe/Berlin"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "de_DE.UTF-8"; + LC_IDENTIFICATION = "de_DE.UTF-8"; + LC_MEASUREMENT = "de_DE.UTF-8"; + LC_MONETARY = "de_DE.UTF-8"; + LC_NAME = "de_DE.UTF-8"; + LC_NUMERIC = "de_DE.UTF-8"; + LC_PAPER = "de_DE.UTF-8"; + LC_TELEPHONE = "de_DE.UTF-8"; + LC_TIME = "de_DE.UTF-8"; + }; + + # Configure keymap in X11 + services.xserver = { + layout = "de"; + xkbVariant = ""; + enable = true; + + displayManager = { + defaultSession = "none+i3"; + }; + + windowManager.i3 = { + enable = true; + package = pkgs.i3-gaps; + extraPackages = with pkgs; [ + dmenu + ]; + }; + }; + + + # Configure console keymap + console.keyMap = "de"; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.clemens = { + isNormalUser = true; + description = "clemens"; + initialPassword = "123456"; + extraGroups = [ "networkmanager" "wheel" ]; + packages = with pkgs; []; + }; + + # home manager + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.clemens = import ./home.nix; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # systemwide packages + environment.systemPackages = with pkgs; [ + vim + wget + ]; + + # 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 = "24.05"; # Did you read the comment? +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..25b3a0b --- /dev/null +++ b/flake.nix @@ -0,0 +1,21 @@ +{ + description = "Flake to manage local systems"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + home-manager.url = "github:nix-community/home-manager"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + }; + + outputs = inputs@{ nixpkgs, home-manager, ... }: { + nixosConfigurations = { + laptop = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + home-manager.nixosModules.home-manager + ]; + }; + }; + }; +} diff --git a/git.nix b/git.nix new file mode 100644 index 0000000..344e202 --- /dev/null +++ b/git.nix @@ -0,0 +1,7 @@ +{pkgs, ...}: { + programs.git = { + enable = true; + userName = "CDaut"; + userEmail = "git@cdaut.de"; + }; +} \ No newline at end of file diff --git a/home.nix b/home.nix new file mode 100644 index 0000000..fab2602 --- /dev/null +++ b/home.nix @@ -0,0 +1,47 @@ +{ config, pkgs, ... }: +let + tex = (pkgs.texlive.combine { + inherit (pkgs.texlive) scheme-full; + }); +in +{ + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "clemens"; + home.homeDirectory = "/home/clemens"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "24.05"; # Please read the comment before changing. + + imports = [ + ./git.nix + ./vscode.nix + ]; + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + zsh + alacritty + polybar + firefox + tex + jetbrains.idea-ultimate + ]; + + # dotfiles + home.file = { + + }; + + # envars + home.sessionVariables = { + EDITOR = "vim"; + }; +} diff --git a/vm_hardware-configuration.nix b/vm_hardware-configuration.nix new file mode 100644 index 0000000..5981af9 --- /dev/null +++ b/vm_hardware-configuration.nix @@ -0,0 +1,31 @@ +# 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 = [ ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "ohci_pci" "ehci_pci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/1874c90c-9363-4f50-a82d-1883862123c8"; + fsType = "ext4"; + }; + + 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.enp0s3.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + virtualisation.virtualbox.guest.enable = true; + virtualisation.virtualbox.guest.x11 = true; +} diff --git a/vscode.nix b/vscode.nix new file mode 100644 index 0000000..41b34b2 --- /dev/null +++ b/vscode.nix @@ -0,0 +1,11 @@ +{pkgs, ...} : +{ + programs.vscode = { + enable = true; + package = pkgs.vscodium; + extensions = with pkgs.vscode-extensions; [ + bbenoist.nix + james-yu.latex-workshop + ]; + }; +} \ No newline at end of file