diff --git a/README.md b/README.md new file mode 100644 index 0000000..c66e161 --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +# NixOS Configuration files. + +## TODO + +- do something with dotfiles installation from [ivabus/dotfiles](https://github.com/ivabus/dotfiles) +- install nixos on more machines +- write proper readme \ No newline at end of file diff --git a/common/base.nix b/common/base.nix new file mode 100644 index 0000000..45adc9d --- /dev/null +++ b/common/base.nix @@ -0,0 +1,29 @@ +{ config, pkgs, ... }: + +{ + + nix = { + package = pkgs.nixUnstable; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + environment.systemPackages = with pkgs; [ + neovim + wget + git + curl + ]; + + networking.networkmanager.enable = true; + networking.nameservers = [ "1.1.1.1" "1.0.0.1" "8.8.8.8" ]; + + i18n.defaultLocale = "ru_RU.UTF-8"; + console = { + font = "${pkgs.terminus_font}/share/consolefonts/ter-u16b.psf.gz"; + keyMap = "us"; + packages = with pkgs; [ terminus_font ]; + }; + +} \ No newline at end of file diff --git a/common/graphical.nix b/common/graphical.nix new file mode 100644 index 0000000..79de445 --- /dev/null +++ b/common/graphical.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + firefox + alacritty + ]; + + services.xserver.enable = true; + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + + services.pipewire = { + enable = true; + alsa.enable = true; + pulse.enable = true; + }; +} \ No newline at end of file diff --git a/common/laptop.nix b/common/laptop.nix new file mode 100644 index 0000000..1d8e827 --- /dev/null +++ b/common/laptop.nix @@ -0,0 +1,5 @@ +{ config, pkgs, ... }: + +{ + networking.wireless.iwd.enable = true; +} \ No newline at end of file diff --git a/common/user.nix b/common/user.nix new file mode 100644 index 0000000..9c5d758 --- /dev/null +++ b/common/user.nix @@ -0,0 +1,28 @@ +{ config, pkgs, ... }: + +{ + users.users.ivabus = { + isNormalUser = true; + extraGroups = [ "wheel" ]; + packages = with pkgs; [ + tree + cargo + rustc + neofetch + ]; + shell = pkgs.zsh; + }; + + programs.zsh = { + enable = true; + }; + + programs.gnupg.agent.enable = true; + programs.ssh.startAgent = true; + + programs.git = { + enable = true; + userName = "my_git_username"; + userEmail = "my_git_username@gmail.com"; + }; +} \ No newline at end of file diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..ddf643c --- /dev/null +++ b/flake.nix @@ -0,0 +1,48 @@ +{ + + description = "ivabus's NixOS Flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + + outputs = { self, nixpkgs, ... }@inputs: { + + nixosConfigurations."stella" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./common/base.nix + ./common/laptop.nix + ./common/user.nix + ./common/graphical.nix + ./machines/stella/configuration.nix + ./machines/stella/hardware.nix + ]; + }; + + /* These machines will be configured later. */ + /* + nixosConfigurations."celerrime" = nixpkgs.lib.nixosSystem { + system = "aarch64-linux"; + modules = [ + ./machines/celerrime/configuration.nix + ./user.nix + ./graphical.nix + ]; + }; + + nixosConfigurations."vetus" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./machines/vetus/configuration.nix + ./ + ]; + }; + */ + }; +} \ No newline at end of file diff --git a/machines/stella/about.md b/machines/stella/about.md new file mode 100644 index 0000000..0e6d316 --- /dev/null +++ b/machines/stella/about.md @@ -0,0 +1 @@ +Random Ryzen 3 3250U laptop \ No newline at end of file diff --git a/machines/stella/configuration.nix b/machines/stella/configuration.nix new file mode 100644 index 0000000..b673133 --- /dev/null +++ b/machines/stella/configuration.nix @@ -0,0 +1,36 @@ + +{ config, pkgs, ... }: + +{ + nix = { + package = pkgs.nixUnstable; + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "stella"; + time.timeZone = "Europe/Moscow"; + + services.xserver.videoDrivers=["amdgpu"]; + boot.initrd.kernelModules=["amdgpu"]; + + services.openssh = { + enable = true; + settings.PasswordAuthentication = false; + }; + + services.dbus.enable = true; + fonts.fonts = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + jetbrains-mono + ]; + + system.stateVersion = "23.05"; +} + diff --git a/machines/stella/hardware.nix b/machines/stella/hardware.nix new file mode 100644 index 0000000..5a6649d --- /dev/null +++ b/machines/stella/hardware.nix @@ -0,0 +1,30 @@ + +{ 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-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/e9d47776-8f25-490b-9ea3-ee80ab9d6110"; + fsType = "btrfs"; + }; + + boot.initrd.luks.devices."cryptroot".device = "/dev/disk/by-uuid/c2e3757b-b29c-4797-9535-084eb71351e9"; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/4F73-6FFF"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +}