commit 813b42483152978ea0a8644c24523282226ca21a Author: Fishandchips321 Date: Thu Feb 26 15:17:43 2026 +0000 initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ebe51d3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = false +insert_final_newline = false \ No newline at end of file diff --git a/all-modules.nix b/all-modules.nix new file mode 100644 index 0000000..a92e2a0 --- /dev/null +++ b/all-modules.nix @@ -0,0 +1,5 @@ +{lib, ...}: + +{ + imports = lib.fileset.toList (lib.fileset.fileFilter (f: f.hasExt "nix") ./modules); +} \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..82d8ab7 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1771848320, + "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "2fc6539b481e1d2569f25f8799236694180c0993", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6f523a3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,16 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + }; + + outputs = { self, nixpkgs }: { + # hydraJobs = nixpkgs.lib.mapAttrs (_: value: value.config.system.build.toplevel) self.nixosConfigurations; + nixosConfigurations = { + vm = nixpkgs.lib.nixosSystem { + modules = [ + ./systems/vm/configuration.nix + ]; + }; + }; + }; +} diff --git a/makefile b/makefile new file mode 100644 index 0000000..a33f8a8 --- /dev/null +++ b/makefile @@ -0,0 +1,8 @@ +build: + nix-build '' -A vm -I nixpkgs=channel:nixos-25.11 -I nixos-config=./configuration.nix + +run-nographics: + QEMU_KERNEL_PARAMS=console=ttyS0 ./result/bin/run-nixos-vm -nographic; reset + +run: + ./result/bin/run-nixos-vm \ No newline at end of file diff --git a/modules/boot.nix b/modules/boot.nix new file mode 100644 index 0000000..814ff37 --- /dev/null +++ b/modules/boot.nix @@ -0,0 +1,7 @@ +{config, pkgs, ...}: + +{ + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/vda"; + boot.loader.grub.useOSProber = true; +} \ No newline at end of file diff --git a/modules/default-packages.nix b/modules/default-packages.nix new file mode 100644 index 0000000..94713da --- /dev/null +++ b/modules/default-packages.nix @@ -0,0 +1,5 @@ +{config, pkgs, ...}: + +{ + programs.vim.enable = true; +} \ No newline at end of file diff --git a/modules/git.nix b/modules/git.nix new file mode 100644 index 0000000..1a98194 --- /dev/null +++ b/modules/git.nix @@ -0,0 +1,15 @@ +{config, pkgs, lib, ...}: + + +let + cfg = config.modules.git; +in +{ + options = { + modules.git.enable = lib.mkEnableOption "Enable git"; + }; + + config = lib.mkIf cfg.enable { + programs.git.enable = true; + }; +} \ No newline at end of file diff --git a/modules/graphical.nix b/modules/graphical.nix new file mode 100644 index 0000000..4842d93 --- /dev/null +++ b/modules/graphical.nix @@ -0,0 +1,16 @@ +{config, pkgs, lib, ...}: + +let + cfg = config.modules.graphical; +in + +{ + options = { + modules.graphical.enable = lib.mkEnableOption "Enable the GUI"; + }; + + config = lib.mkIf cfg.enable { + programs.niri.enable = true; + services.displayManager.ly.enable = true; + }; +} \ No newline at end of file diff --git a/modules/networkManager.nix b/modules/networkManager.nix new file mode 100644 index 0000000..dca6ad0 --- /dev/null +++ b/modules/networkManager.nix @@ -0,0 +1,5 @@ +{config, pkgs, ...}: + +{ + networking.networkmanager.enable = true; +} \ No newline at end of file diff --git a/modules/terminal.nix b/modules/terminal.nix new file mode 100644 index 0000000..708280a --- /dev/null +++ b/modules/terminal.nix @@ -0,0 +1,16 @@ +{config, pkgs, lib, ...}: + +let + cfg = config.modules.terminal; +in +{ + options = { + modules.terminal.enable = lib.mkEnableOption "Enables alacritty"; + }; + + config = lib.mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + alacritty + ]; + }; +} \ No newline at end of file diff --git a/systems/vm/configuration.nix b/systems/vm/configuration.nix new file mode 100644 index 0000000..1d6d9e1 --- /dev/null +++ b/systems/vm/configuration.nix @@ -0,0 +1,20 @@ +{ config, pkgs, ...}: + +{ + imports = [ + ../../all-modules.nix + ./hardware-configuration.nix + ]; + + users.users.riley = { + isNormalUser = true; + extraGroups = ["wheel"]; + }; + + modules.graphical.enable = true; + modules.terminal.enable = true; + + console.keyMap = "uk"; + + system.stateVersion = "25.11"; +} \ No newline at end of file diff --git a/systems/vm/hardware-configuration.nix b/systems/vm/hardware-configuration.nix new file mode 100644 index 0000000..3b2f28b --- /dev/null +++ b/systems/vm/hardware-configuration.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, modulesPath, ...}: +{ + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = ["ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ]; + boot.initrd.kernelModules = []; + boot.extraModulePackages = []; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/ed56e12e-55cc-42e0-b94f-9a6d6bb2bdad"; + fsType = "ext4"; + }; + + swapDevices = []; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} \ No newline at end of file