This commit is contained in:
parent
e493646556
commit
4e8b840830
4 changed files with 88 additions and 55 deletions
55
README.md
55
README.md
|
@ -10,31 +10,6 @@ nixos-rebuild switch --flake flake_path_directory#hostname
|
|||
nix flake update --extra-experimental-features "nix-command flakes"
|
||||
```
|
||||
|
||||
## Configure VM
|
||||
|
||||
Configure VM
|
||||
```nix
|
||||
users.users.<user>.initialPassword = "<password>";
|
||||
virtualisation.vmVariant = {
|
||||
# following configuration is added only when building VM with build-vm
|
||||
virtualisation = {
|
||||
memorySize = <RAM in MiB>; # Use 8192MiB memory.
|
||||
cores = <CPU Core number>;
|
||||
# And more here https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/virtualisation/qemu-vm.nix
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
Build
|
||||
```bash
|
||||
nixos-rebuild build-vm --flake .#nixos-test
|
||||
```
|
||||
|
||||
Run
|
||||
```bash
|
||||
./result/bin/run-nixos-vm-vm
|
||||
```
|
||||
|
||||
## Show changements between revisions
|
||||
|
||||
|
||||
|
@ -72,36 +47,6 @@ error: cached failure of attribute 'nixosConfigurations.perso-desktop.config.sys
|
|||
sudo rm -fr /root/.cache/nix/
|
||||
```
|
||||
|
||||
## If package is marked as insecure
|
||||
|
||||
Example:
|
||||
|
||||
> error: Package 'nix-2.16.2' in /nix/store/nra828scc8qs92b9pxra5csqzffb6hpl-source/pkgs/tools/package-management/nix/default.nix:229 is marked as insecure, refusing to evaluate.
|
||||
>
|
||||
> Known issues:
|
||||
> - CVE-2024-27297
|
||||
|
||||
```bash
|
||||
nix path-info -r /run/current-system | grep nix-2.16.2
|
||||
```
|
||||
Result:
|
||||
> [...]
|
||||
>
|
||||
> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
|
||||
>
|
||||
> [...]
|
||||
|
||||
```bash
|
||||
nix-store -q --referrers /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
|
||||
```
|
||||
Result:
|
||||
> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
|
||||
>
|
||||
> /nix/store/72pfc05339izcwqhlbs8441brrdasas7-nix-2.16.2-dev
|
||||
>
|
||||
> /nix/store/ln2z5d5izn8icm3wx94ci13ad19lzjhr-nixd-1.2.3
|
||||
|
||||
nixd is not up to date and require nix 2.16.2
|
||||
|
||||
## To limit resources use during build
|
||||
|
||||
|
|
30
tips/debug_insecure_package.md
Normal file
30
tips/debug_insecure_package.md
Normal file
|
@ -0,0 +1,30 @@
|
|||
## If package is marked as insecure
|
||||
|
||||
Example:
|
||||
|
||||
> error: Package 'nix-2.16.2' in /nix/store/nra828scc8qs92b9pxra5csqzffb6hpl-source/pkgs/tools/package-management/nix/default.nix:229 is marked as insecure, refusing to evaluate.
|
||||
>
|
||||
> Known issues:
|
||||
> - CVE-2024-27297
|
||||
|
||||
```bash
|
||||
nix path-info -r /run/current-system | grep nix-2.16.2
|
||||
```
|
||||
Result:
|
||||
> [...]
|
||||
>
|
||||
> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
|
||||
>
|
||||
> [...]
|
||||
|
||||
```bash
|
||||
nix-store -q --referrers /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
|
||||
```
|
||||
Result:
|
||||
> /nix/store/g4ss2h40n3j37bq20x1qw5s7nl82lch5-nix-2.16.2
|
||||
>
|
||||
> /nix/store/72pfc05339izcwqhlbs8441brrdasas7-nix-2.16.2-dev
|
||||
>
|
||||
> /nix/store/ln2z5d5izn8icm3wx94ci13ad19lzjhr-nixd-1.2.3
|
||||
|
||||
nixd is not up to date and require nix 2.16.2
|
34
tips/how_to_test_pr.md
Normal file
34
tips/how_to_test_pr.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
# Example for ollama
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.modules.system.server.ollama;
|
||||
nvidiaEnabled = config.modules.system.hardware.nvidia.enable;
|
||||
nixpkgsPr = builtins.fetchTarball {
|
||||
url = "https://github.com/abysssol/nixpkgs/archive/ollama-driver-runpath.tar.gz";
|
||||
sha256 = "1ixfvdpi2v4r9yrkvqnfk9whs8lyjhrkdph47bcznh8ak9aipr8p";
|
||||
};
|
||||
in
|
||||
{
|
||||
disabledModules = [ "services/misc/ollama.nix" ];
|
||||
imports = [
|
||||
(import "${nixpkgsPr}/nixos/modules/services/misc/ollama.nix")
|
||||
];
|
||||
|
||||
options.modules.system.server.ollama = {
|
||||
enable = mkEnableOption ''
|
||||
Enable ollama with my custom configurations
|
||||
'';
|
||||
};
|
||||
config = mkIf cfg.enable {
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
|
||||
package = (import nixpkgsPr { inherit (pkgs) system; config.allowUnfree = true; }).ollama;
|
||||
|
||||
acceleration = if nvidiaEnabled then "cuda" else null;
|
||||
};
|
||||
};
|
||||
}
|
24
tips/test_on_vm.md
Normal file
24
tips/test_on_vm.md
Normal file
|
@ -0,0 +1,24 @@
|
|||
## Configure VM
|
||||
|
||||
Configure VM
|
||||
```nix
|
||||
users.users.<user>.initialPassword = "<password>";
|
||||
virtualisation.vmVariant = {
|
||||
# following configuration is added only when building VM with build-vm
|
||||
virtualisation = {
|
||||
memorySize = <RAM in MiB>; # Use 8192MiB memory.
|
||||
cores = <CPU Core number>;
|
||||
# And more here https://github.com/NixOS/nixpkgs/blob/nixos-unstable/nixos/modules/virtualisation/qemu-vm.nix
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
Build
|
||||
```bash
|
||||
nixos-rebuild build-vm --flake .#nixos-test
|
||||
```
|
||||
|
||||
Run
|
||||
```bash
|
||||
./result/bin/run-nixos-vm-vm
|
||||
```
|
Loading…
Reference in a new issue