diff --git a/.gitignore b/.gitignore index 96dd39d..549b46f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.uasm result +*.qcow2 diff --git a/flake.nix b/flake.nix index e061171..0ba2601 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ { inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; - outputs = { self, nixpkgs }: + outputs = { self, nixpkgs }: let inherit (nixpkgs) lib; @@ -16,6 +16,19 @@ pkgs = nixpkgs.legacyPackages.${system}; in f system pkgs); in { + apps = forAllSystems ( + system: pkgs: { + default = { + type = "app"; + program = "${lib.getExe self.packages.${system}.default}"; + }; + vm = { + type = "app"; + program = "${self.nixosConfigurations.vm.config.system.build.vm}/bin/run-nixos-vm"; + }; + } + ); + devShells = forAllSystems (system: pkgs: { default = pkgs.mkShell { nativeBuildInputs = [ @@ -33,5 +46,64 @@ }; nixosModules.default = ./nix/module.nix; + + nixosConfigurations.vm = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + pkgs = import nixpkgs { + system = "x86_64-linux"; + overlays = [ + self.overlays.default + ]; + }; + + modules = [ + "${nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix" + self.nixosModules.default + ({ config, pkgs, ... }: { + system.stateVersion = config.system.nixos.release; + virtualisation.graphics = false; + users.extraUsers.root.password = "root"; + services.getty.autologinUser = "root"; + + environment.systemPackages = with pkgs; [ + netcat + ]; + + users.motd = '' + ======================= + + Welcome to the qotd vm! + + Try running: + + nc localhost 17 + + ======================= + ''; + + services.qotd = { + enable = true; + quotes = [ + '' + "rm -rf /" + + - felixalb on bekkalokk, 2026 (probably) + '' + '' + ( U I U A ) + 汎用配列指向プログラミング言語 + + - frero, 2025 + '' + '' + bwaaa :3 + + - oysteikt on gitea, 2024 + '' + ]; + }; + }) + ]; + }; }; }