diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2f5dd2 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result \ No newline at end of file diff --git a/README.org b/README.org index bfbcbc1..144cb23 100644 --- a/README.org +++ b/README.org @@ -1,5 +1,24 @@ * Installation +It's from here: + +https://github.com/Misterio77/nix-starter-configs/tree/main/standard + +It was probably initialized with this command: + +#+begin_src bash +nix flake init -t github:misterio77/nix-starter-config#standard +#+end_src + +Fuck vagrant + +#+begin_src shell +nix build .#nixosConfigurations.vm.config.system.build.vm + +#+end_src + +From https://github.com/nix-community/vagrant-nixos-plugin + ** Installing home manager #+begin_src bash diff --git a/flake.lock b/flake.lock index 05ed3b7..9a8d0c9 100644 --- a/flake.lock +++ b/flake.lock @@ -7,32 +7,32 @@ ] }, "locked": { - "lastModified": 1685599623, - "narHash": "sha256-Tob4CMOVHue0D3RzguDBCtUmX5ji2PsdbQDbIOIKvsc=", + "lastModified": 1720042825, + "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", "owner": "nix-community", "repo": "home-manager", - "rev": "93db05480c0c0f30382d3e80779e8386dcb4f9dd", + "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.05", + "ref": "release-24.05", "repo": "home-manager", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1686431482, - "narHash": "sha256-oPVQ/0YP7yC2ztNsxvWLrV+f0NQ2QAwxbrZ+bgGydEM=", + "lastModified": 1722519197, + "narHash": "sha256-VEdJmVU2eLFtLqCjTYJd1J7+Go8idAcZoT11IewFiRg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "d3bb401dcfc5a46ce51cdfb5762e70cc75d082d2", + "rev": "05405724efa137a0b899cce5ab4dde463b4fd30b", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.05", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index a91d7d5..507d631 100644 --- a/flake.nix +++ b/flake.nix @@ -3,14 +3,14 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; # You can access packages and modules from different nixpkgs revs # at the same time. Here's an working example: nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # Also see the 'unstable-packages' overlay at 'overlays/default.nix'. # Home manager - home-manager.url = "github:nix-community/home-manager/release-23.05"; + home-manager.url = "github:nix-community/home-manager/release-24.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; # TODO: Add any other flake you might need @@ -67,6 +67,15 @@ ./nixos/configuration.nix ]; }; + vm = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [ + # > Our main nixos configuration file < + + ./nixos/configuration-vm.nix + ]; + }; + }; # Standalone home-manager configuration entrypoint diff --git a/home-manager/home.nix b/home-manager/home.nix index 3761ada..53a6793 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -55,7 +55,18 @@ # Add stuff for your user as you see fit: # programs.neovim.enable = true; - # home.packages = with pkgs; [ steam ]; + home.packages = with pkgs; [ + steam + emacs + pandoc + offlineimap #emailing + liberation_ttf #fonts + graphviz #graphing + (python3.withPackages (python-pkgs: [ + python-pkgs.graphviz + python-pkgs.pygments + ])) + ]; # Enable home-manager and git programs.home-manager.enable = true; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 45aae31..05db906 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -2,5 +2,6 @@ # These should be stuff you would like to share with others, not your personal configurations. { # List your module files here - # my-module = import ./my-module.nix; + # gpg-agent = import ./gpg-agent.nix; + # config.azos.gpg-agent.enable = true; } diff --git a/modules/home-manager/gpg-agent.conf b/modules/home-manager/gpg-agent.conf new file mode 100644 index 0000000..4223529 --- /dev/null +++ b/modules/home-manager/gpg-agent.conf @@ -0,0 +1,6 @@ +grab +pinentry-program /usr/bin/pinentry +default-cache-ttl 86400 +max-cache-ttl 86400 +enable-ssh-support + diff --git a/modules/home-manager/gpg-agent.nix b/modules/home-manager/gpg-agent.nix new file mode 100644 index 0000000..f66a9c0 --- /dev/null +++ b/modules/home-manager/gpg-agent.nix @@ -0,0 +1,14 @@ +#https://xeiaso.net/talks/asg-2023-nixos/ example +{ lib, config, pkgs, ... }: + +with lib; + +let cfg = config.azos.gpg-agent; +in { + cfg.enable = mkEnableOption "Enables AZOS GPG agent"; + + config = mkIf cfg.enable { + programs.gnupg.agent.enable = true; + home.file.".gnupg/gpg-agent.conf".source = ./gpg-agent.conf; + }; +} diff --git a/nixos/configuration-vm.nix b/nixos/configuration-vm.nix new file mode 100644 index 0000000..aa7c27b --- /dev/null +++ b/nixos/configuration-vm.nix @@ -0,0 +1,149 @@ +# This is your system's configuration file. +# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix) +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # You can import other NixOS modules here + + virtualisation.vmVariant = { + virtualisation.resolution = { + x = 1280; + y = 1024; + }; + virtualisation.diskImage = "/dev/null"; +virtualisation.qemu.options = [ + # Better display option + "-vga virtio" + "-display gtk,zoom-to-fit=false" + # Enable copy/paste + # https://www.kraxel.org/blog/2021/05/qemu-cut-paste/ + "-chardev qemu-vdagent,id=ch1,name=vdagent,clipboard=on" + "-device virtio-serial-pci" + "-device virtserialport,chardev=ch1,id=ch1,name=com.redhat.spice.0" + ]; +}; +imports = [ + # If you want to use modules your own flake exports (from modules/nixos): + # outputs.nixosModules.example + + # Or modules from other flakes (such as nixos-hardware): + # inputs.hardware.nixosModules.common-cpu-amd + # inputs.hardware.nixosModules.common-ssd + + # You can also split up your configuration and import pieces of it here: + # ./users.nix + + # Import your generated (nixos-generate-config) hardware configuration + # ./vm-hardware-configuration.nix + inputs.home-manager.nixosModules.home-manager + ]; + + nixpkgs.hostPlatform = "x86_64-linux"; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + + # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default + + # Or define it inline, for example: + # (final: prev: { + # hi = final.hello.overrideAttrs (oldAttrs: { + # patches = [ ./change-hello-to-hi.patch ]; + # }); + # }) + ]; + # Configure your nixpkgs instance + config = { + # Disable if you don't want unfree packages + allowUnfree = true; + }; + }; + + # This will add each flake input as a registry + # To make nix3 commands consistent with your flake + nix.registry = (lib.mapAttrs (_: flake: {inherit flake;})) ((lib.filterAttrs (_: lib.isType "flake")) inputs); + + # This will additionally add your inputs to the system's legacy channels + # Making legacy nix commands consistent as well, awesome! + nix.nixPath = ["/etc/nix/path"]; + environment.etc = + lib.mapAttrs' + (name: value: { + name = "nix/path/${name}"; + value.source = value.flake; + }) + config.nix.registry; + + nix.settings = { + # Enable flakes and new 'nix' command + experimental-features = "nix-command flakes"; + # Deduplicate and optimize nix store + auto-optimise-store = true; + }; + + # FIXME: Add the rest of your current configuration + + # TODO: Set your hostname + networking.hostName = "test-vm"; + + # TODO: This is just an example, be sure to use whatever bootloader you prefer + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + # TODO: Configure your system-wide user settings (groups, etc), add more users as needed. + # users.users = { + # # FIXME: Replace with your username + # aner = import ../home-manager/home.nix; + # }; + + home-manager = { + extraSpecialArgs = { inherit inputs outputs; }; + users = { + # Import your home-manager configuration + aner = import ../home-manager/home.nix; + }; + }; + + users.users = { + # FIXME: Replace with your username + aner = { + # TODO: You can set an initial password for your user. + # If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install. + # Be sure to change it (using passwd) after rebooting! + initialPassword = "password"; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + # TODO: Add your SSH public key(s) here, if you plan on using SSH to connect + ]; + # TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc) + extraGroups = ["wheel"]; + }; + }; + + + # This setups a SSH server. Very important if you're setting up a headless system. + # Feel free to remove if you don't need it. + services.openssh = { + enable = true; + settings = { + # Forbid root login through SSH. + PermitRootLogin = "no"; + # Use keys only. Remove if you want to SSH using password (not recommended) + PasswordAuthentication = true; + }; + }; + + # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion + system.stateVersion = "24.05"; +}