Nixpkgs/Reviewing changes: Difference between revisions

From NixOS Wiki
imported>Artturin
No edit summary
imported>Artturin
increase memory and disk size
Line 68: Line 68:
         ({ pkgs, ... }: {
         ({ pkgs, ... }: {
           disabledModules = [ "services/desktops/pipewire/pipewire.nix" ];
           disabledModules = [ "services/desktops/pipewire/pipewire.nix" ];
          imports = [
            "${inputs.pkgsReview}/nixos/modules/services/desktops/pipewire/pipewire.nix"


          imports = [ "${inputs.pkgsReview}/nixos/modules/services/desktops/pipewire/pipewire.nix" ];
            # For virtualisation settings
            "${inputs.nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix"
          ];


           services.pipewire.enable = true;
           services.pipewire.enable = true;
          # Documentation for these is in nixos/modules/virtualisation/qemu-vm.nix
          virtualisation = {
            memorySize = 1024 * 3;
            diskSize = 1024 * 3;
            cores = 4;
          };


           users.mutableUsers = false;
           users.mutableUsers = false;

Revision as of 17:55, 3 September 2021

1

Packages

Modules

Pre-flakes

You may use the rev instead of the branchname, the rev will get redownloaded when changed but the branch wont be redownloaded

disabledModules = [ "module.nix" ];

imports = let
  pkgsReview = builtins.fetchTarball {
    url = "https://github.com/USERNAME/nixpkgs/archive/BRANCHNAME.tar.gz";
  };
in [
  (import "${pkgsReview}/nixos/modules/module.nix")
];


for example

disabledModules = [ "config/swap.nix" "tasks/filesystems.nix" ];

imports = let
  pkgsReview = builtins.fetchTarball {
    url = "https://github.com/Artturin/nixpkgs/archive/add-swap-options.tar.gz";
  };
in [
  (import "${pkgsReview}/nixos/modules/config/swap.nix")
  (import "${pkgsReview}/nixos/modules/tasks/filesystems.nix")
];

  swapDevices = [
    { "device" = "/swapfile"; "options" = [ "nofail" "noatime" ]; "priority" =  0; "discardPolicy" = "once"; }
  ];


Flakes

Vm example

run with

$ nix run
{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
  inputs.pkgsReview.url = "github:Artturin/nixpkgs/pipewirejackldpath";
  #inputs.pkgsReview.url = "path:../nixgits/my-nixpkgs";

  outputs = inputs@{ self, nixpkgs, pkgsReview }: {

    nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = { inherit inputs; };
      modules = [
        ({ pkgs, ... }: {
          disabledModules = [ "services/desktops/pipewire/pipewire.nix" ];
          imports = [ 
            "${inputs.pkgsReview}/nixos/modules/services/desktops/pipewire/pipewire.nix"

            # For virtualisation settings
            "${inputs.nixpkgs}/nixos/modules/virtualisation/qemu-vm.nix"
          ];

          services.pipewire.enable = true;

          # Documentation for these is in nixos/modules/virtualisation/qemu-vm.nix
          virtualisation = {
            memorySize = 1024 * 3;
            diskSize = 1024 * 3;
            cores = 4;
          };

          users.mutableUsers = false;
          users.users.root = {
            password = "root";
          };
          users.users.user = {
            password = "user";
            isNormalUser = true;
            extraGroups = [ "wheel" ];
          };
        })
      ];
    };
    # So that we can just run 'nix run' instead of 
    # 'nix build ".#nixosConfigurations.vm.config.system.build.vm" && ./result/bin/run-nixos-vm'
    defaultPackage.x86_64-linux = self.nixosConfigurations.vm.config.system.build.vm;
    defaultApp.x86_64-linux = {
      type = "app";
      program = "${self.defaultPackage.x86_64-linux}/bin/run-nixos-vm";
    };
  };
}